@atlaskit/editor-common 71.0.3 → 72.0.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/dist/cjs/analytics/types/enums.js +20 -1
  3. package/dist/cjs/i18n/index.js +13 -5
  4. package/dist/cjs/i18n/languages.js +42 -0
  5. package/dist/cjs/keymaps/index.js +56 -6
  6. package/dist/cjs/styles/index.js +8 -2
  7. package/dist/cjs/styles/shared/annotation.js +9 -14
  8. package/dist/cjs/styles/shared/block-marks.js +1 -1
  9. package/dist/cjs/styles/shared/blockquote.js +1 -3
  10. package/dist/cjs/styles/shared/code-block.js +13 -16
  11. package/dist/cjs/styles/shared/code-mark.js +2 -4
  12. package/dist/cjs/styles/shared/lists.js +55 -4
  13. package/dist/cjs/styles/shared/panel.js +29 -39
  14. package/dist/cjs/styles/shared/rule.js +2 -4
  15. package/dist/cjs/styles/shared/shadow.js +1 -1
  16. package/dist/cjs/styles/shared/table.js +24 -26
  17. package/dist/cjs/types/next-editor-plugin.js +5 -0
  18. package/dist/cjs/ui/Caption/index.js +2 -4
  19. package/dist/cjs/ui/DropList/index.js +5 -7
  20. package/dist/cjs/ui/Emoji/index.js +11 -2
  21. package/dist/cjs/ui/Expand/index.js +17 -19
  22. package/dist/cjs/ui/Messages/index.js +3 -5
  23. package/dist/cjs/ui/Popup/index.js +72 -2
  24. package/dist/cjs/ui/Popup/utils.js +13 -6
  25. package/dist/cjs/ui/UnsupportedBlock/index.js +3 -5
  26. package/dist/cjs/ui/UnsupportedInline/index.js +3 -5
  27. package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +138 -0
  28. package/dist/cjs/ui-color/ColorPalette/index.js +20 -2
  29. package/dist/cjs/ui-menu/DropdownMenu/index.js +12 -12
  30. package/dist/cjs/ui-menu/ToolbarButton/index.js +3 -1
  31. package/dist/cjs/utils/analytics.js +1 -38
  32. package/dist/cjs/utils/builder.js +44 -0
  33. package/dist/cjs/utils/compareNodes.js +86 -33
  34. package/dist/cjs/utils/index.js +47 -1
  35. package/dist/cjs/utils/list.js +47 -0
  36. package/dist/cjs/utils/plugin-state-factory.js +9 -9
  37. package/dist/cjs/utils/referentiality.js +281 -2
  38. package/dist/cjs/utils/track-unsupported-content.js +19 -20
  39. package/dist/cjs/utils/validate-using-spec.js +8 -2
  40. package/dist/cjs/version.json +1 -1
  41. package/dist/es2019/analytics/types/enums.js +20 -1
  42. package/dist/es2019/i18n/index.js +4 -3
  43. package/dist/es2019/i18n/languages.js +34 -0
  44. package/dist/es2019/keymaps/index.js +48 -2
  45. package/dist/es2019/styles/index.js +1 -1
  46. package/dist/es2019/styles/shared/annotation.js +9 -13
  47. package/dist/es2019/styles/shared/block-marks.js +8 -1
  48. package/dist/es2019/styles/shared/blockquote.js +1 -2
  49. package/dist/es2019/styles/shared/code-block.js +18 -18
  50. package/dist/es2019/styles/shared/code-mark.js +2 -3
  51. package/dist/es2019/styles/shared/lists.js +44 -2
  52. package/dist/es2019/styles/shared/panel.js +29 -37
  53. package/dist/es2019/styles/shared/rule.js +2 -3
  54. package/dist/es2019/styles/shared/shadow.js +20 -6
  55. package/dist/es2019/styles/shared/table.js +24 -26
  56. package/dist/es2019/types/next-editor-plugin.js +1 -0
  57. package/dist/es2019/ui/Caption/index.js +2 -3
  58. package/dist/es2019/ui/DropList/index.js +5 -6
  59. package/dist/es2019/ui/Emoji/index.js +11 -2
  60. package/dist/es2019/ui/Expand/index.js +17 -18
  61. package/dist/es2019/ui/Messages/index.js +3 -4
  62. package/dist/es2019/ui/Popup/index.js +68 -2
  63. package/dist/es2019/ui/Popup/utils.js +13 -6
  64. package/dist/es2019/ui/UnsupportedBlock/index.js +3 -4
  65. package/dist/es2019/ui/UnsupportedInline/index.js +3 -4
  66. package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +120 -0
  67. package/dist/es2019/ui-color/ColorPalette/index.js +29 -13
  68. package/dist/es2019/ui-menu/DropdownMenu/index.js +13 -12
  69. package/dist/es2019/ui-menu/ToolbarButton/index.js +3 -1
  70. package/dist/es2019/utils/analytics.js +0 -33
  71. package/dist/es2019/utils/builder.js +16 -0
  72. package/dist/es2019/utils/compareNodes.js +79 -28
  73. package/dist/es2019/utils/index.js +4 -2
  74. package/dist/es2019/utils/list.js +31 -0
  75. package/dist/es2019/utils/plugin-state-factory.js +9 -9
  76. package/dist/es2019/utils/referentiality.js +240 -0
  77. package/dist/es2019/utils/track-unsupported-content.js +20 -16
  78. package/dist/es2019/utils/validate-using-spec.js +8 -2
  79. package/dist/es2019/version.json +1 -1
  80. package/dist/esm/analytics/types/enums.js +20 -1
  81. package/dist/esm/i18n/index.js +4 -3
  82. package/dist/esm/i18n/languages.js +34 -0
  83. package/dist/esm/keymaps/index.js +49 -2
  84. package/dist/esm/styles/index.js +1 -1
  85. package/dist/esm/styles/shared/annotation.js +9 -13
  86. package/dist/esm/styles/shared/block-marks.js +1 -1
  87. package/dist/esm/styles/shared/blockquote.js +1 -2
  88. package/dist/esm/styles/shared/code-block.js +13 -15
  89. package/dist/esm/styles/shared/code-mark.js +2 -3
  90. package/dist/esm/styles/shared/lists.js +49 -2
  91. package/dist/esm/styles/shared/panel.js +29 -37
  92. package/dist/esm/styles/shared/rule.js +2 -3
  93. package/dist/esm/styles/shared/shadow.js +1 -2
  94. package/dist/esm/styles/shared/table.js +24 -26
  95. package/dist/esm/types/next-editor-plugin.js +1 -0
  96. package/dist/esm/ui/Caption/index.js +2 -3
  97. package/dist/esm/ui/DropList/index.js +5 -6
  98. package/dist/esm/ui/Emoji/index.js +11 -2
  99. package/dist/esm/ui/Expand/index.js +17 -18
  100. package/dist/esm/ui/Messages/index.js +3 -4
  101. package/dist/esm/ui/Popup/index.js +73 -2
  102. package/dist/esm/ui/Popup/utils.js +13 -6
  103. package/dist/esm/ui/UnsupportedBlock/index.js +2 -3
  104. package/dist/esm/ui/UnsupportedInline/index.js +2 -3
  105. package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +124 -0
  106. package/dist/esm/ui-color/ColorPalette/index.js +19 -3
  107. package/dist/esm/ui-menu/DropdownMenu/index.js +12 -11
  108. package/dist/esm/ui-menu/ToolbarButton/index.js +3 -1
  109. package/dist/esm/utils/analytics.js +0 -33
  110. package/dist/esm/utils/builder.js +30 -0
  111. package/dist/esm/utils/compareNodes.js +83 -32
  112. package/dist/esm/utils/index.js +4 -2
  113. package/dist/esm/utils/list.js +31 -0
  114. package/dist/esm/utils/plugin-state-factory.js +9 -9
  115. package/dist/esm/utils/referentiality.js +269 -0
  116. package/dist/esm/utils/track-unsupported-content.js +19 -20
  117. package/dist/esm/utils/validate-using-spec.js +8 -2
  118. package/dist/esm/version.json +1 -1
  119. package/dist/types/analytics/types/enums.d.ts +23 -4
  120. package/dist/types/collab/types.d.ts +1 -1
  121. package/dist/types/i18n/index.d.ts +4 -3
  122. package/dist/types/i18n/languages.d.ts +35 -0
  123. package/dist/types/keymaps/index.d.ts +1 -0
  124. package/dist/types/styles/index.d.ts +1 -1
  125. package/dist/types/styles/shared/lists.d.ts +3 -1
  126. package/dist/types/types/collab.d.ts +1 -1
  127. package/dist/types/types/copy-button.d.ts +4 -0
  128. package/dist/types/types/feature-flags.d.ts +30 -25
  129. package/dist/types/types/floating-toolbar.d.ts +26 -1
  130. package/dist/types/types/index.d.ts +2 -1
  131. package/dist/types/types/next-editor-plugin.d.ts +61 -0
  132. package/dist/types/ui/Emoji/index.d.ts +2 -0
  133. package/dist/types/ui/Popup/index.d.ts +19 -0
  134. package/dist/types/ui/Popup/utils.d.ts +3 -3
  135. package/dist/types/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +214 -0
  136. package/dist/types/ui-color/ColorPalette/index.d.ts +7 -0
  137. package/dist/types/ui-menu/DropdownMenu/types.d.ts +1 -0
  138. package/dist/types/ui-menu/ToolbarButton/index.d.ts +3 -1
  139. package/dist/types/utils/analytics.d.ts +1 -21
  140. package/dist/types/utils/builder.d.ts +8 -0
  141. package/dist/types/utils/compareNodes.d.ts +16 -0
  142. package/dist/types/utils/index.d.ts +3 -1
  143. package/dist/types/utils/list.d.ts +10 -0
  144. package/dist/types/utils/plugin-state-factory.d.ts +1 -1
  145. package/dist/types/utils/referentiality.d.ts +4 -0
  146. package/dist/types/utils/track-unsupported-content.d.ts +14 -2
  147. package/package.json +15 -12
  148. package/report.api.md +1 -1
@@ -0,0 +1,34 @@
1
+ /**
2
+ * NOTE:
3
+ *
4
+ * ED-16073:
5
+ * This was manually updated since the original `@atlaskit/i18n-tools` has been deprecated
6
+ */
7
+ export default {
8
+ zh: 'Chinese (Simplified)',
9
+ zh_TW: 'Chinese (Traditional)',
10
+ cs: 'Czech',
11
+ da: 'Danish',
12
+ nl: 'Dutch',
13
+ en: 'English',
14
+ en_GB: 'English (United Kingdom)',
15
+ fi: 'Finnish',
16
+ fr: 'French',
17
+ de: 'German',
18
+ hu: 'Hungarian',
19
+ it: 'Italian',
20
+ ja: 'Japanese',
21
+ ko: 'Korean',
22
+ nb: 'Norwegian Bokmål',
23
+ pl: 'Polish',
24
+ pt_BR: 'Portuguese (Brazil)',
25
+ pt_PT: 'Portuguese (Portugal)',
26
+ ru: 'Russian',
27
+ sk: 'Slovak',
28
+ es: 'Spanish',
29
+ sv: 'Swedish',
30
+ th: 'Thai',
31
+ tr: 'Turkish',
32
+ uk: 'Ukrainian',
33
+ vi: 'Vietnamese'
34
+ };
@@ -2,7 +2,6 @@
2
2
  import React, { Fragment } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { N400 } from '@atlaskit/theme/colors';
5
- import { token } from '@atlaskit/tokens';
6
5
  import { browser } from '../utils';
7
6
  export const addAltText = makeKeyMapWithCommon('Add Alt Text', 'Mod-Alt-y');
8
7
  export const toggleBold = makeKeyMapWithCommon('Bold', 'Mod-b');
@@ -75,7 +74,7 @@ const arrowKeysMap = {
75
74
  };
76
75
  const tooltipShortcutStyle = css`
77
76
  border-radius: 2px;
78
- background-color: ${token('color.background.inverse.subtle', N400)};
77
+ background-color: ${`var(--ds-background-inverse-subtle, ${N400})`};
79
78
  padding: 0 2px;
80
79
 
81
80
  /* TODO: fix in develop: https://atlassian.slack.com/archives/CFG3PSQ9E/p1647395052443259?thread_ts=1647394572.556029&cid=CFG3PSQ9E */
@@ -144,6 +143,53 @@ export function findShortcutByKeymap(keymap) {
144
143
 
145
144
  return keymap.windows;
146
145
  }
146
+ export function getAriaKeyshortcuts(keymap) {
147
+ let keyShortcuts;
148
+
149
+ if (typeof keymap === 'string') {
150
+ keyShortcuts = keymap;
151
+ } else if (typeof keymap === 'object') {
152
+ keyShortcuts = keymap[browser.mac ? 'mac' : 'windows'];
153
+ }
154
+
155
+ if (keyShortcuts) {
156
+ return keyShortcuts.toLowerCase().split('-').map(modifier => {
157
+ switch (modifier) {
158
+ case 'cmd':
159
+ return 'Meta';
160
+
161
+ case 'ctrl':
162
+ return 'Control';
163
+
164
+ case 'alt':
165
+ return 'Alt';
166
+
167
+ case 'shift':
168
+ return 'Shift';
169
+
170
+ case 'enter':
171
+ return 'Enter';
172
+
173
+ case 'esc':
174
+ return 'Esc';
175
+
176
+ case 'tab':
177
+ return 'Tab';
178
+
179
+ case 'space':
180
+ return 'Space';
181
+
182
+ case 'backspace':
183
+ return 'Backspace';
184
+
185
+ default:
186
+ return modifier.split('').join(' ');
187
+ }
188
+ }).join('+');
189
+ } else {
190
+ return undefined;
191
+ }
192
+ }
147
193
  const ALL = [toggleOrderedList, toggleBulletList, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleBlockQuote, insertNewLine, insertRule, splitCodeBlock, splitListItem, redo, undo, find, escape, enter, shiftEnter];
148
194
  export function makeKeymap(description, windows, mac, common) {
149
195
  return {
@@ -9,7 +9,7 @@ export { ruleSharedStyles } from './shared/rule';
9
9
  export { whitespaceSharedStyles } from './shared/whitespace';
10
10
  export { paragraphSharedStyles } from './shared/paragraph';
11
11
  export { linkSharedStyle } from './shared/link';
12
- export { listsSharedStyles, listPaddingLeftMarkerSpace } from './shared/lists';
12
+ export { listsSharedStyles, listItemCounterPadding, getOrderedListInlineStyles } from './shared/lists';
13
13
  export { indentationSharedStyles } from './shared/indentation';
14
14
  export { blockMarksSharedStyles } from './shared/block-marks';
15
15
  export { codeMarkSharedStyles } from './shared/code-mark';
@@ -1,7 +1,6 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { N60A, Y300, Y75 } from '@atlaskit/theme/colors';
3
3
  import { themed } from '@atlaskit/theme/components';
4
- import { token } from '@atlaskit/tokens';
5
4
  export const annotationPrefix = 'ak-editor-annotation';
6
5
  export const AnnotationSharedClassNames = {
7
6
  focus: `${annotationPrefix}-focus`,
@@ -15,38 +14,35 @@ const Y200a = 'rgba(255, 196, 0, 0.82)';
15
14
  const DY75a = 'rgba(111, 92, 37, 0.5)';
16
15
  const DY200 = '#82641c';
17
16
  export const AnnotationSharedCSSByState = props => ({
18
- /* eslint-disable */
19
17
  focus: css`
20
18
  // Background is not coming through in confluence, suspecting to be caused by some specific combination of
21
19
  // emotion and token look up
22
20
 
23
21
  background: ${themed({
24
- light: Y75,
25
- dark: DY75
22
+ light: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
23
+ dark: `var(--ds-background-accent-yellow-subtler, ${DY75})`
26
24
  })(props)};
27
25
  border-bottom: 2px solid
28
26
  ${themed({
29
- light: token('color.border.accent.yellow', Y300),
30
- dark: token('color.border.accent.yellow', DY300)
27
+ light: `var(--ds-border-accent-yellow, ${Y300})`,
28
+ dark: `var(--ds-border-accent-yellow, ${DY300})`
31
29
  })(props)};
32
30
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4147
33
- box-shadow: ${token('elevation.shadow.overlay', `1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`)};
31
+ box-shadow: ${`var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`};
34
32
  cursor: pointer;
35
33
  `,
36
34
  blur: css`
37
35
  background: ${themed({
38
- light: Y75a,
39
- dark: DY75a
36
+ light: `var(--ds-background-accent-yellow-subtlest, ${Y75a})`,
37
+ dark: `var(--ds-background-accent-yellow-subtlest, ${DY75a})`
40
38
  })(props)};
41
39
  border-bottom: 2px solid
42
40
  ${themed({
43
- light: token('color.border.accent.yellow', Y200a),
44
- dark: token('color.border.accent.yellow', DY200)
41
+ light: `var(--ds-border-accent-yellow, ${Y200a})`,
42
+ dark: `var(--ds-border-accent-yellow, ${DY200})`
45
43
  })(props)};
46
44
  cursor: pointer;
47
45
  `
48
- /* eslint-enable */
49
-
50
46
  });
51
47
  export const annotationSharedStyles = props => css`
52
48
  .ProseMirror {
@@ -6,7 +6,14 @@ export const blockMarksSharedStyles = css`
6
6
  */
7
7
  *:not(.fabric-editor-block-mark) >,
8
8
  /* For nested block marks apart from those with indentation mark */
9
- *:not(.fabric-editor-block-mark) > div.fabric-editor-block-mark:first-of-type:not(.fabric-editor-indentation-mark),
9
+ *:not(.fabric-editor-block-mark) >
10
+ div.fabric-editor-block-mark:first-of-type
11
+ /* Do not remove the margin top for nodes inside indentation marks */
12
+ :not(.fabric-editor-indentation-mark)
13
+ /* Do not remove the margin top for nodes inside alignment marks */
14
+ :not(.fabric-editor-alignment),
15
+ // If first element inside a block node has alignment mark, then remove the margin-top
16
+ .fabric-editor-alignment:first-of-type:first-child,
10
17
  // If first document element has indentation mark remove margin-top
11
18
  .ProseMirror .fabric-editor-indentation-mark:first-of-type:first-child {
12
19
  p,
@@ -1,13 +1,12 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { akEditorBlockquoteBorderColor, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
3
3
  import { gridSize } from '@atlaskit/theme/constants';
4
- import { token } from '@atlaskit/tokens';
5
4
  export const blockquoteSharedStyles = css`
6
5
  & blockquote {
7
6
  box-sizing: border-box;
8
7
  padding-left: ${gridSize() * 2}px;
9
8
  border-left: 2px solid
10
- ${token('color.border', akEditorBlockquoteBorderColor)};
9
+ ${`var(--ds-border, ${akEditorBlockquoteBorderColor})`};
11
10
  margin: ${blockNodesVerticalMargin} 0 0 0;
12
11
  margin-right: 0;
13
12
 
@@ -3,7 +3,6 @@ import { akEditorCodeFontFamily, akEditorLineHeight, akEditorTableCellMinWidth,
3
3
  import { DN20, DN400, DN50, DN800, N20, N30, N400, N800 } from '@atlaskit/theme/colors';
4
4
  import { themed } from '@atlaskit/theme/components';
5
5
  import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
6
- import { token } from '@atlaskit/tokens';
7
6
  export const CodeBlockSharedCssClassName = {
8
7
  CODEBLOCK_CONTAINER: 'code-block',
9
8
  CODEBLOCK_START: 'code-block--start',
@@ -16,7 +15,7 @@ export const CodeBlockSharedCssClassName = {
16
15
  export const codeBlockSharedStyles = props => css`
17
16
  .${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER} {
18
17
  position: relative;
19
- background-color: ${token('elevation.surface.raised', 'transparent')};
18
+ background-color: ${"var(--ds-surface-raised, transparent)"};
20
19
  border-radius: ${borderRadius()}px;
21
20
  margin: ${blockNodesVerticalMargin} 0 0 0;
22
21
  font-family: ${akEditorCodeFontFamily};
@@ -46,8 +45,8 @@ export const codeBlockSharedStyles = props => css`
46
45
 
47
46
  .${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER} {
48
47
  background-color: ${themed({
49
- light: token('color.background.neutral', N20),
50
- dark: token('color.background.neutral', DN50)
48
+ light: `var(--ds-background-neutral, ${N20})`,
49
+ dark: `var(--ds-background-neutral, ${DN50})`
51
50
  })(props)};
52
51
  display: flex;
53
52
  border-radius: ${borderRadius()}px;
@@ -56,19 +55,20 @@ export const codeBlockSharedStyles = props => css`
56
55
  overflow-x: auto;
57
56
 
58
57
  background-image: ${overflowShadow({
59
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4118
60
58
  background: themed({
61
- light: token('color.background.neutral', N20),
62
- dark: token('color.background.neutral', DN50)
59
+ light: `var(--ds-background-neutral, ${N20})`,
60
+ dark: `var(--ds-background-neutral, ${DN50})`
63
61
  })(props),
64
- width: '8px'
62
+ leftCoverWidth: `${gridSize() * 3}px`
65
63
  })};
66
64
 
67
65
  background-repeat: no-repeat;
68
- background-attachment: local, local, local, local, scroll, scroll;
69
- background-size: 8px 100%, 8px 100%, 8px 100%, 8px 100%, 8px 100%,
70
- 8px 100%;
71
- background-position: 0 0, 0 0, 100% 0, 100% 0, 100% 0, 0 0;
66
+ background-attachment: local, local, local, local, scroll, scroll, scroll,
67
+ scroll;
68
+ background-size: ${gridSize() * 3}px 100%, ${gridSize() * 3}px 100%,
69
+ ${gridSize()}px 100%, ${gridSize()}px 100%, ${gridSize()}px 100%,
70
+ 1px 100%, ${gridSize()}px 100%, 1px 100%;
71
+ background-position: 0 0, 0 0, 100% 0, 100% 0, 100% 0, 100% 0, 0 0, 0 0;
72
72
 
73
73
  /* Be careful if refactoring this; it is needed to keep arrow key navigation in Firefox consistent with other browsers. */
74
74
  overflow-y: hidden;
@@ -78,8 +78,8 @@ export const codeBlockSharedStyles = props => css`
78
78
  flex-shrink: 0;
79
79
  text-align: right;
80
80
  background-color: ${themed({
81
- light: token('color.background.neutral', N30),
82
- dark: token('color.background.neutral', DN20)
81
+ light: `var(--ds-background-neutral, ${N30})`,
82
+ dark: `var(--ds-background-neutral, ${DN20})`
83
83
  })(props)};
84
84
  padding: ${gridSize()}px;
85
85
  position: relative;
@@ -94,8 +94,8 @@ export const codeBlockSharedStyles = props => css`
94
94
  content: counter(line);
95
95
  counter-increment: line;
96
96
  color: ${themed({
97
- light: token('color.text.subtlest', N400),
98
- dark: token('color.text.subtlest', DN400)
97
+ light: `var(--ds-text-subtlest, ${N400})`,
98
+ dark: `var(--ds-text-subtlest, ${DN400})`
99
99
  })(props)};
100
100
  font-size: ${relativeFontSizeToBase16(fontSize())};
101
101
  line-height: 1.5rem;
@@ -112,8 +112,8 @@ export const codeBlockSharedStyles = props => css`
112
112
  tab-size: 4;
113
113
  cursor: text;
114
114
  color: ${themed({
115
- light: token('color.text', N800),
116
- dark: token('color.text', DN800)
115
+ light: `var(--ds-text, ${N800})`,
116
+ dark: `var(--ds-text, ${DN800})`
117
117
  })(props)};
118
118
  border-radius: ${borderRadius()}px;
119
119
  margin: ${gridSize()}px;
@@ -2,14 +2,13 @@ import { css } from '@emotion/react';
2
2
  import { getCodeStyles } from '@atlaskit/code/inline';
3
3
  import { DN70, N30A } from '@atlaskit/theme/colors';
4
4
  import { getTheme, themed } from '@atlaskit/theme/components';
5
- import { token } from '@atlaskit/tokens';
6
5
  export const codeMarkSharedStyles = props => {
7
6
  const theme = getTheme(props);
8
7
  return css`
9
8
  .code {
10
9
  --ds--code--bg-color: ${themed({
11
- light: token('color.background.neutral', N30A),
12
- dark: token('color.background.neutral', DN70)
10
+ light: `var(--ds-background-neutral, ${N30A})`,
11
+ dark: `var(--ds-background-neutral, ${DN70})`
13
12
  })(props)};
14
13
  ${getCodeStyles(theme)}
15
14
  }
@@ -1,14 +1,56 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { bulletListSelector, orderedListSelector } from '@atlaskit/adf-schema';
3
3
  import browser from '../../utils/browser';
4
- export const listPaddingLeftMarkerSpace = 24;
4
+ export const listItemCounterPadding = 24;
5
+ var CSS_VAR_NAMES;
6
+
7
+ (function (CSS_VAR_NAMES) {
8
+ CSS_VAR_NAMES["ITEM_COUNTER_PADDING"] = "--ed--list--item-counter--padding";
9
+ })(CSS_VAR_NAMES || (CSS_VAR_NAMES = {}));
10
+
11
+ const getItemCounterLeftPadding = itemCounterDigitsSize => {
12
+ // Previous padding-left was approximately 24px. We approximate that
13
+ // same value using "ch" units (which represent the width of a "0" digit
14
+ // character). We use "ch" so that this computed padding can now grow if
15
+ // the font-size ever enlarges.
16
+ let paddingLeft = `2.385ch`;
17
+
18
+ if (itemCounterDigitsSize >= 3) {
19
+ // When there are 3 or more digits, we use a combination of "ch" units and
20
+ // pixel values so that while the computed padding grows if font-size ever
21
+ // enlarges, it doesn't over-scale with each digit (because of the fixed pixel
22
+ // portion of the computed value). This way, very large item counters will not
23
+ // become overly left-padded.
24
+ const fixedBasePx = 2;
25
+ paddingLeft = `calc(${itemCounterDigitsSize + 1}ch - ${fixedBasePx}px)`;
26
+ }
27
+
28
+ return paddingLeft;
29
+ };
30
+
31
+ const stringifyStyle = style => Object.entries(style).reduce((str, [key, value]) => `${str}${key}:${value};`, ``);
32
+
33
+ export function getOrderedListInlineStyles(itemCounterDigitsSize, styleFormat) {
34
+ const style = {
35
+ [CSS_VAR_NAMES.ITEM_COUNTER_PADDING]: getItemCounterLeftPadding(itemCounterDigitsSize)
36
+ };
37
+
38
+ if (styleFormat === 'string') {
39
+ return stringifyStyle(style);
40
+ }
41
+
42
+ return style;
43
+ }
5
44
  export const listsSharedStyles = css`
6
45
  /* =============== INDENTATION SPACING ========= */
7
46
 
8
47
  ul,
9
48
  ol {
10
49
  box-sizing: border-box;
11
- padding-left: ${listPaddingLeftMarkerSpace}px;
50
+ padding-left: var(
51
+ ${CSS_VAR_NAMES.ITEM_COUNTER_PADDING},
52
+ ${listItemCounterPadding}px
53
+ );
12
54
 
13
55
  /*
14
56
  Firefox does not handle empty block element inside li tag.
@@ -1,24 +1,14 @@
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
1
2
  import { css } from '@emotion/react';
2
3
  import { PanelType } from '@atlaskit/adf-schema';
4
+ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
3
5
  import { akEditorTableCellMinWidth, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
4
6
  import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
5
7
  import { emojiImage, emojiSprite } from '@atlaskit/emoji';
6
8
  import * as colors from '@atlaskit/theme/colors';
7
9
  import { themed } from '@atlaskit/theme/components';
8
10
  import { borderRadius, gridSize } from '@atlaskit/theme/constants';
9
- import { token } from '@atlaskit/tokens';
10
- const tokenPanelColor = {
11
- info: 'color.background.information',
12
- note: 'color.background.discovery',
13
- tip: 'color.background.success',
14
- success: 'color.background.success',
15
- warning: 'color.background.warning',
16
- error: 'color.background.danger'
17
- };
18
- const lightPanelColor = {
19
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4066
20
-
21
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
11
+ const lightPanelColors = {
22
12
  info: colors.B50,
23
13
  note: colors.P50,
24
14
  tip: colors.G50,
@@ -88,36 +78,42 @@ export const darkPanelColors = {
88
78
  LightGray: '#5A6977',
89
79
  TextColor: '#D9DDE3'
90
80
  };
91
- /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
92
-
93
81
  const lightIconColor = {
94
- info: token('color.icon.information', colors.B400),
95
- note: token('color.icon.discovery', colors.P400),
96
- tip: token('color.icon.success', colors.G400),
97
- success: token('color.icon.success', colors.G400),
98
- warning: token('color.icon.warning', colors.Y400),
99
- error: token('color.icon.danger', colors.R400)
82
+ info: `var(--ds-icon-information, ${colors.B400})`,
83
+ note: `var(--ds-icon-discovery, ${colors.P400})`,
84
+ tip: `var(--ds-icon-success, ${colors.G400})`,
85
+ success: `var(--ds-icon-success, ${colors.G400})`,
86
+ warning: `var(--ds-icon-warning, ${colors.Y400})`,
87
+ error: `var(--ds-icon-danger, ${colors.R400})`
100
88
  };
101
89
  const darkIconColor = {
102
- info: token('color.icon.information', colors.B100),
103
- note: token('color.icon.discovery', colors.P100),
104
- tip: token('color.icon.success', colors.G200),
105
- success: token('color.icon.success', colors.G200),
106
- warning: token('color.icon.warning', colors.Y100),
107
- error: token('color.icon.danger', colors.R200)
90
+ info: `var(--ds-icon-information, ${colors.B100})`,
91
+ note: `var(--ds-icon-discovery, ${colors.P100})`,
92
+ tip: `var(--ds-icon-success, ${colors.G200})`,
93
+ success: `var(--ds-icon-success, ${colors.G200})`,
94
+ warning: `var(--ds-icon-warning, ${colors.Y100})`,
95
+ error: `var(--ds-icon-danger, ${colors.R200})`
96
+ };
97
+ const tokenDarkPanelColors = {
98
+ info: `var(--ds-background-information, ${darkPanelColors['info']})`,
99
+ note: `var(--ds-background-discovery, ${darkPanelColors['note']})`,
100
+ tip: `var(--ds-background-success, ${darkPanelColors['tip']})`,
101
+ success: `var(--ds-background-success, ${darkPanelColors['success']})`,
102
+ warning: `var(--ds-background-warning, ${darkPanelColors['warning']})`,
103
+ error: `var(--ds-background-danger, ${darkPanelColors['error']})`
108
104
  }; // New custom icons are a little smaller than predefined icons.
109
105
  // To fix alignment issues with custom icons, vertical alignment is updated.
110
106
 
111
107
  const panelEmojiSpriteVerticalAlignment = -(gridSize() * 3 - akEditorCustomIconSize) / 2;
112
108
  const panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1; // TODO: https://product-fabric.atlassian.net/browse/DSP-4066
113
109
 
114
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
110
+ const panelDarkModeColors = [[colors.B50, darkPanelColors.B1200S], [colors.B75, darkPanelColors.B900], [colors.B100, darkPanelColors.B800S], [colors.N0, darkPanelColors.LightGray], [colors.N20, darkPanelColors.Gray], [colors.N60, darkPanelColors.DarkGray], [colors.T50, darkPanelColors.T1200S], [colors.T75, darkPanelColors.T900], [colors.T100, darkPanelColors.T900S], [colors.G50, darkPanelColors.G1200S], [colors.G75, darkPanelColors.G900], [colors.G200, darkPanelColors.G900S], [colors.Y50, darkPanelColors.Y1200S], [colors.Y75, darkPanelColors.Y900], [colors.Y200, darkPanelColors.Y800S], [colors.R50, darkPanelColors.R1200S], [colors.R75, darkPanelColors.R900], [colors.R100, darkPanelColors.R800S], [colors.P50, darkPanelColors.P1200S], [colors.P75, darkPanelColors.P900], [colors.P100, darkPanelColors.P800S]]; // used for custom panels
115
111
 
116
- const panelDarkModeColors = [[colors.B50, darkPanelColors.B1200S], [colors.B75, darkPanelColors.B900], [colors.B100, darkPanelColors.B800S], [colors.N0, darkPanelColors.LightGray], [colors.N20, darkPanelColors.Gray], [colors.N60, darkPanelColors.DarkGray], [colors.T50, darkPanelColors.T1200S], [colors.T75, darkPanelColors.T900], [colors.T100, darkPanelColors.T900S], [colors.G50, darkPanelColors.G1200S], [colors.G75, darkPanelColors.G900], [colors.G200, darkPanelColors.G900S], [colors.Y50, darkPanelColors.Y1200S], [colors.Y75, darkPanelColors.Y900], [colors.Y200, darkPanelColors.Y800S], [colors.R50, darkPanelColors.R1200S], [colors.R75, darkPanelColors.R900], [colors.R100, darkPanelColors.R800S], [colors.P50, darkPanelColors.P1200S], [colors.P75, darkPanelColors.P900], [colors.P100, darkPanelColors.P800S]];
117
112
  export const getPanelDarkColor = panelColor => {
118
113
  const colorObject = panelDarkModeColors.find(color => color[0] === panelColor || color[1] === panelColor);
119
114
  return colorObject ? colorObject[1] : darkPanelColors.B1200S;
120
- };
115
+ }; // used for custom panels
116
+
121
117
  export const getPanelBackgroundDarkModeColors = panelDarkModeColors.map(([colorName, colorValue]) => getPanelDarkModeCSS(colorName, colorValue)).join('\n');
122
118
  export function getPanelDarkModeCSS(colorName, colorValue) {
123
119
  return `
@@ -171,7 +167,7 @@ const iconDynamicStyles = panelType => props => {
171
167
 
172
168
 
173
169
  export const getPanelTypeBackgroundNoTokens = (panelType, props = {}) => {
174
- const light = lightPanelColor[panelType];
170
+ const light = lightPanelColors[panelType];
175
171
  const dark = darkPanelColors[panelType];
176
172
  const background = themed({
177
173
  light,
@@ -180,13 +176,9 @@ export const getPanelTypeBackgroundNoTokens = (panelType, props = {}) => {
180
176
  return background || 'none';
181
177
  };
182
178
  export const getPanelTypeBackground = (panelType, props = {}) => {
183
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4066
184
-
185
- /* eslint-disable @atlaskit/design-system/no-unsafe-design-token-usage */
186
- const light = token(tokenPanelColor[panelType], lightPanelColor[panelType]);
187
- const dark = token(tokenPanelColor[panelType], darkPanelColors[panelType]);
188
- /* eslint-disable @atlaskit/design-system/no-unsafe-design-token-usage */
179
+ const light = hexToEditorBackgroundPaletteColor(lightPanelColors[panelType]); // hexToEditorBackgroundPaletteColor has a light mode as a fallback color - for legacy dark mode we define the tokens locally
189
180
 
181
+ const dark = tokenDarkPanelColors[panelType];
190
182
  const background = themed({
191
183
  light,
192
184
  dark
@@ -2,10 +2,9 @@ import { css } from '@emotion/react';
2
2
  import { akEditorLineHeight } from '@atlaskit/editor-shared-styles';
3
3
  import { DN50, N30A } from '@atlaskit/theme/colors';
4
4
  import { themed } from '@atlaskit/theme/components';
5
- import { token } from '@atlaskit/tokens';
6
5
  const divider = themed({
7
- light: token('color.border', N30A),
8
- dark: token('color.border', DN50)
6
+ light: `var(--ds-border, ${N30A})`,
7
+ dark: `var(--ds-border, ${DN50})`
9
8
  }); // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
10
9
 
11
10
  export const ruleSharedStyles = props => css`
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4116
3
2
  import { css } from '@emotion/react';
4
3
  import { akEditorShadowZIndex } from '@atlaskit/editor-shared-styles';
5
4
  import { N40A } from '@atlaskit/theme/colors';
@@ -41,7 +40,16 @@ const shadowSharedStyle = css`
41
40
  }
42
41
 
43
42
  & .${shadowClassNames.LEFT_SHADOW}::before {
44
- background: linear-gradient(to left, rgba(99, 114, 130, 0) 0, ${N40A} 100%);
43
+ background: linear-gradient(
44
+ to left,
45
+ transparent 0,
46
+ ${`var(--ds-shadow-overflow-spread, ${N40A})`} 100%
47
+ ),
48
+ linear-gradient(
49
+ to right,
50
+ ${"var(--ds-shadow-overflow-perimeter, transparent)"} 0px,
51
+ transparent 1px
52
+ );
45
53
  top: 0px;
46
54
  left: 0;
47
55
  display: block;
@@ -49,14 +57,20 @@ const shadowSharedStyle = css`
49
57
 
50
58
  & .${shadowClassNames.RIGHT_SHADOW}::after {
51
59
  background: linear-gradient(
52
- to right,
53
- rgba(99, 114, 130, 0) 0,
54
- ${N40A} 100%
55
- );
60
+ to right,
61
+ transparent 0,
62
+ ${`var(--ds-shadow-overflow-spread, ${N40A})`} 100%
63
+ ),
64
+ linear-gradient(
65
+ to left,
66
+ ${"var(--ds-shadow-overflow-perimeter, transparent)"} 0px,
67
+ transparent 1px
68
+ );
56
69
  left: calc(100% - ${shadowWidth}px);
57
70
  top: 0px;
58
71
  display: block;
59
72
  }
73
+
60
74
  & .${shadowObserverClassNames.SENTINEL_LEFT} {
61
75
  height: 100%;
62
76
  width: 0px;