@atlaskit/editor-common 60.1.0 → 61.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 (221) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/card/package.json +7 -0
  3. package/dist/cjs/card/cardOptions.js +5 -0
  4. package/dist/cjs/emoji.js +23 -0
  5. package/dist/cjs/extensions/extension-fields-helpers.js +1 -1
  6. package/dist/cjs/extensions/index.js +46 -40
  7. package/dist/cjs/extensions/manifest-helpers.js +3 -1
  8. package/dist/cjs/extensions/module-helpers.js +3 -1
  9. package/dist/cjs/extensions/types/field-definitions.js +7 -1
  10. package/dist/cjs/extensions/types/index.js +14 -8
  11. package/dist/cjs/extensions.js +38 -32
  12. package/dist/cjs/i18n/cs.js +1 -0
  13. package/dist/cjs/i18n/da.js +1 -0
  14. package/dist/cjs/i18n/de.js +1 -0
  15. package/dist/cjs/i18n/es.js +1 -0
  16. package/dist/cjs/i18n/fi.js +1 -0
  17. package/dist/cjs/i18n/fr.js +1 -0
  18. package/dist/cjs/i18n/hu.js +1 -0
  19. package/dist/cjs/i18n/index.js +26 -26
  20. package/dist/cjs/i18n/it.js +1 -0
  21. package/dist/cjs/i18n/ja.js +1 -0
  22. package/dist/cjs/i18n/ko.js +1 -0
  23. package/dist/cjs/i18n/nb.js +1 -0
  24. package/dist/cjs/i18n/nl.js +1 -0
  25. package/dist/cjs/i18n/pl.js +1 -0
  26. package/dist/cjs/i18n/pt_BR.js +1 -0
  27. package/dist/cjs/i18n/ru.js +1 -0
  28. package/dist/cjs/i18n/sv.js +1 -0
  29. package/dist/cjs/i18n/th.js +1 -0
  30. package/dist/cjs/i18n/tr.js +1 -0
  31. package/dist/cjs/i18n/uk.js +1 -0
  32. package/dist/cjs/i18n/vi.js +1 -0
  33. package/dist/cjs/i18n/zh.js +1 -1
  34. package/dist/cjs/i18n/zh_TW.js +1 -0
  35. package/dist/cjs/in-product.js +14 -14
  36. package/dist/cjs/index.js +314 -302
  37. package/dist/cjs/mention.js +23 -0
  38. package/dist/cjs/messages/codeBidiWarning.js +21 -0
  39. package/dist/cjs/messages/index.js +8 -0
  40. package/dist/cjs/provider-factory/context.js +1 -1
  41. package/dist/cjs/provider-factory.js +6 -6
  42. package/dist/cjs/provider-helpers/promise-helpers.js +1 -1
  43. package/dist/cjs/styles/index.js +86 -80
  44. package/dist/cjs/styles/shared/annotation.js +1 -1
  45. package/dist/cjs/styles/shared/block-marks.js +1 -1
  46. package/dist/cjs/styles/shared/media-single.js +1 -1
  47. package/dist/cjs/styles/shared/panel.js +90 -37
  48. package/dist/cjs/styles/shared/table.js +3 -3
  49. package/dist/cjs/type-ahead/index.js +1 -1
  50. package/dist/cjs/types/annotation/emitter.js +1 -1
  51. package/dist/cjs/ufo/experience-store.js +160 -0
  52. package/dist/cjs/ufo/index.js +25 -0
  53. package/dist/cjs/ui/BaseTheme/index.js +2 -2
  54. package/dist/cjs/ui/Expand/index.js +1 -1
  55. package/dist/cjs/ui/MediaSingle/grid.js +2 -2
  56. package/dist/cjs/ui/MediaSingle/index.js +2 -1
  57. package/dist/cjs/ui/MediaSingle/styled.js +1 -1
  58. package/dist/cjs/ui/Messages/index.js +1 -1
  59. package/dist/cjs/ui/Popup/index.js +1 -1
  60. package/dist/cjs/ui/Popup/utils.js +5 -5
  61. package/dist/cjs/ui/WidthProvider/index.js +2 -2
  62. package/dist/cjs/ui/index.js +72 -72
  63. package/dist/cjs/utils/analytics.js +6 -5
  64. package/dist/cjs/utils/breakout.js +1 -1
  65. package/dist/cjs/utils/compareNodes.js +6 -0
  66. package/dist/cjs/utils/date.js +1 -1
  67. package/dist/cjs/utils/index.js +129 -107
  68. package/dist/cjs/utils/performance/measure-tti.js +2 -2
  69. package/dist/cjs/utils/performance/measure.js +1 -1
  70. package/dist/cjs/utils/profiler/render-count.js +135 -0
  71. package/dist/cjs/utils/table.js +1 -1
  72. package/dist/cjs/utils/validate-using-spec.js +1 -1
  73. package/dist/cjs/utils/validator.js +47 -27
  74. package/dist/cjs/version.json +1 -1
  75. package/dist/es2019/card/cardOptions.js +1 -0
  76. package/dist/es2019/emoji.js +2 -0
  77. package/dist/es2019/extensions/index.js +1 -1
  78. package/dist/es2019/extensions/types/field-definitions.js +3 -0
  79. package/dist/es2019/extensions/types/index.js +1 -1
  80. package/dist/es2019/extensions.js +1 -1
  81. package/dist/es2019/i18n/cs.js +1 -0
  82. package/dist/es2019/i18n/da.js +1 -0
  83. package/dist/es2019/i18n/de.js +1 -0
  84. package/dist/es2019/i18n/es.js +1 -0
  85. package/dist/es2019/i18n/fi.js +1 -0
  86. package/dist/es2019/i18n/fr.js +1 -0
  87. package/dist/es2019/i18n/hu.js +1 -0
  88. package/dist/es2019/i18n/it.js +1 -0
  89. package/dist/es2019/i18n/ja.js +1 -0
  90. package/dist/es2019/i18n/ko.js +1 -0
  91. package/dist/es2019/i18n/nb.js +1 -0
  92. package/dist/es2019/i18n/nl.js +1 -0
  93. package/dist/es2019/i18n/pl.js +1 -0
  94. package/dist/es2019/i18n/pt_BR.js +1 -0
  95. package/dist/es2019/i18n/ru.js +1 -0
  96. package/dist/es2019/i18n/sv.js +1 -0
  97. package/dist/es2019/i18n/th.js +1 -0
  98. package/dist/es2019/i18n/tr.js +1 -0
  99. package/dist/es2019/i18n/uk.js +1 -0
  100. package/dist/es2019/i18n/vi.js +1 -0
  101. package/dist/es2019/i18n/zh.js +1 -1
  102. package/dist/es2019/i18n/zh_TW.js +1 -0
  103. package/dist/es2019/index.js +26 -8
  104. package/dist/es2019/mention.js +2 -0
  105. package/dist/es2019/messages/codeBidiWarning.js +12 -0
  106. package/dist/es2019/messages/index.js +1 -0
  107. package/dist/es2019/styles/index.js +4 -2
  108. package/dist/es2019/styles/shared/block-marks.js +1 -2
  109. package/dist/es2019/styles/shared/media-single.js +10 -0
  110. package/dist/es2019/styles/shared/panel.js +99 -45
  111. package/dist/es2019/styles/shared/table.js +2 -1
  112. package/dist/es2019/ufo/experience-store.js +116 -0
  113. package/dist/es2019/ufo/index.js +1 -0
  114. package/dist/es2019/ui/index.js +8 -3
  115. package/dist/es2019/utils/compareNodes.js +6 -0
  116. package/dist/es2019/utils/index.js +3 -1
  117. package/dist/es2019/utils/profiler/render-count.js +107 -0
  118. package/dist/es2019/utils/validator.js +36 -13
  119. package/dist/es2019/version.json +1 -1
  120. package/dist/esm/card/cardOptions.js +1 -0
  121. package/dist/esm/emoji.js +2 -0
  122. package/dist/esm/extensions/index.js +1 -1
  123. package/dist/esm/extensions/types/field-definitions.js +3 -0
  124. package/dist/esm/extensions/types/index.js +1 -1
  125. package/dist/esm/extensions.js +1 -1
  126. package/dist/esm/i18n/cs.js +1 -0
  127. package/dist/esm/i18n/da.js +1 -0
  128. package/dist/esm/i18n/de.js +1 -0
  129. package/dist/esm/i18n/es.js +1 -0
  130. package/dist/esm/i18n/fi.js +1 -0
  131. package/dist/esm/i18n/fr.js +1 -0
  132. package/dist/esm/i18n/hu.js +1 -0
  133. package/dist/esm/i18n/it.js +1 -0
  134. package/dist/esm/i18n/ja.js +1 -0
  135. package/dist/esm/i18n/ko.js +1 -0
  136. package/dist/esm/i18n/nb.js +1 -0
  137. package/dist/esm/i18n/nl.js +1 -0
  138. package/dist/esm/i18n/pl.js +1 -0
  139. package/dist/esm/i18n/pt_BR.js +1 -0
  140. package/dist/esm/i18n/ru.js +1 -0
  141. package/dist/esm/i18n/sv.js +1 -0
  142. package/dist/esm/i18n/th.js +1 -0
  143. package/dist/esm/i18n/tr.js +1 -0
  144. package/dist/esm/i18n/uk.js +1 -0
  145. package/dist/esm/i18n/vi.js +1 -0
  146. package/dist/esm/i18n/zh.js +1 -1
  147. package/dist/esm/i18n/zh_TW.js +1 -0
  148. package/dist/esm/index.js +26 -8
  149. package/dist/esm/mention.js +2 -0
  150. package/dist/esm/messages/codeBidiWarning.js +12 -0
  151. package/dist/esm/messages/index.js +1 -0
  152. package/dist/esm/styles/index.js +4 -2
  153. package/dist/esm/styles/shared/block-marks.js +1 -1
  154. package/dist/esm/styles/shared/media-single.js +1 -1
  155. package/dist/esm/styles/shared/panel.js +84 -37
  156. package/dist/esm/styles/shared/table.js +2 -2
  157. package/dist/esm/ufo/experience-store.js +144 -0
  158. package/dist/esm/ufo/index.js +1 -0
  159. package/dist/esm/ui/index.js +8 -3
  160. package/dist/esm/utils/compareNodes.js +6 -0
  161. package/dist/esm/utils/index.js +3 -1
  162. package/dist/esm/utils/profiler/render-count.js +123 -0
  163. package/dist/esm/utils/validator.js +46 -26
  164. package/dist/esm/version.json +1 -1
  165. package/dist/types/card/cardOptions.d.ts +9 -0
  166. package/dist/types/card/index.d.ts +1 -9
  167. package/dist/types/collab.d.ts +1 -1
  168. package/dist/types/emoji.d.ts +3 -0
  169. package/dist/types/extensions/index.d.ts +1 -1
  170. package/dist/types/extensions/types/extension-handler.d.ts +6 -2
  171. package/dist/types/extensions/types/extension-parameters.d.ts +1 -0
  172. package/dist/types/extensions/types/field-definitions.d.ts +2 -0
  173. package/dist/types/extensions/types/index.d.ts +1 -1
  174. package/dist/types/extensions.d.ts +1 -1
  175. package/dist/types/i18n/cs.d.ts +1 -0
  176. package/dist/types/i18n/da.d.ts +1 -0
  177. package/dist/types/i18n/de.d.ts +1 -0
  178. package/dist/types/i18n/es.d.ts +1 -0
  179. package/dist/types/i18n/fi.d.ts +1 -0
  180. package/dist/types/i18n/fr.d.ts +1 -0
  181. package/dist/types/i18n/hu.d.ts +1 -0
  182. package/dist/types/i18n/it.d.ts +1 -0
  183. package/dist/types/i18n/ja.d.ts +1 -0
  184. package/dist/types/i18n/ko.d.ts +1 -0
  185. package/dist/types/i18n/nb.d.ts +1 -0
  186. package/dist/types/i18n/nl.d.ts +1 -0
  187. package/dist/types/i18n/pl.d.ts +1 -0
  188. package/dist/types/i18n/pt_BR.d.ts +1 -0
  189. package/dist/types/i18n/ru.d.ts +1 -0
  190. package/dist/types/i18n/sv.d.ts +1 -0
  191. package/dist/types/i18n/th.d.ts +1 -0
  192. package/dist/types/i18n/tr.d.ts +1 -0
  193. package/dist/types/i18n/uk.d.ts +1 -0
  194. package/dist/types/i18n/vi.d.ts +1 -0
  195. package/dist/types/i18n/zh.d.ts +1 -0
  196. package/dist/types/i18n/zh_TW.d.ts +1 -0
  197. package/dist/types/index.d.ts +7 -3
  198. package/dist/types/mention.d.ts +2 -0
  199. package/dist/types/messages/codeBidiWarning.d.ts +11 -0
  200. package/dist/types/messages/index.d.ts +1 -0
  201. package/dist/types/provider-factory.d.ts +1 -0
  202. package/dist/types/styles/index.d.ts +1 -1
  203. package/dist/types/styles/shared/panel.d.ts +2 -0
  204. package/dist/types/ufo/experience-store.d.ts +33 -0
  205. package/dist/types/ufo/index.d.ts +1 -0
  206. package/dist/types/utils/index.d.ts +2 -0
  207. package/dist/types/utils/profiler/render-count.d.ts +50 -0
  208. package/emoji/package.json +7 -0
  209. package/mention/package.json +7 -0
  210. package/package.json +29 -17
  211. package/provider-helpers/package.json +7 -0
  212. package/types/package.json +7 -0
  213. package/ufo/package.json +7 -0
  214. package/ui/package.json +7 -0
  215. package/utils/package.json +7 -0
  216. package/dist/cjs/ui/Caption/index.test.js +0 -82
  217. package/dist/cjs/utils/performance/measure-tti.test.js +0 -183
  218. package/dist/es2019/ui/Caption/index.test.js +0 -73
  219. package/dist/es2019/utils/performance/measure-tti.test.js +0 -124
  220. package/dist/esm/ui/Caption/index.test.js +0 -73
  221. package/dist/esm/utils/performance/measure-tti.test.js +0 -174
@@ -1,5 +1,5 @@
1
1
  import { css } from 'styled-components';
2
- import { hexToRgba, PanelType } from '@atlaskit/adf-schema';
2
+ import { PanelType } from '@atlaskit/adf-schema';
3
3
  import { akEditorTableCellMinWidth, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
4
4
  import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
5
5
  import { emojiImage, emojiSprite } from '@atlaskit/emoji';
@@ -14,22 +14,67 @@ const lightPanelColor = {
14
14
  warning: colors.Y50,
15
15
  error: colors.R50
16
16
  };
17
- const darkPanelOpacity = 0.64;
18
- const darkPanelColor = {
19
- info: colors.B500,
20
- note: colors.P500,
21
- tip: colors.G500,
22
- success: colors.G500,
23
- warning: colors.Y500,
24
- error: colors.R500
25
- };
26
- const darkPanelBorderColor = {
27
- info: colors.B400,
28
- note: colors.P400,
29
- tip: colors.G400,
30
- success: colors.G400,
31
- warning: colors.Y400,
32
- error: colors.R400
17
+ const darkPanelColors = {
18
+ // standard panels
19
+ info: '#0C294F',
20
+ error: `#441C13`,
21
+ warning: `#413001`,
22
+ tip: `#052E21`,
23
+ success: `#052E21`,
24
+ note: `#282249`,
25
+ // Reds
26
+ R900: '#601D16',
27
+ // Red Saturated
28
+ R100S: `#FFEFEB`,
29
+ R300S: `#FFB5A3`,
30
+ R500S: `#FF6B47`,
31
+ R800S: `#C4320E`,
32
+ R1200S: `#441C13`,
33
+ // Yellows
34
+ Y900: '#533F04',
35
+ // Yellow Saturated
36
+ Y100S: `#FFF3D1`,
37
+ Y300S: `#FFDC7A`,
38
+ Y500S: `#FFC933`,
39
+ Y800S: `#D8A003`,
40
+ Y1200S: `#413001`,
41
+ // Greens
42
+ G900: '#164B35',
43
+ // Green Saturated
44
+ G100S: `#E3FCF0`,
45
+ G300S: `#95EEC5`,
46
+ G400S: `#60DCA8`,
47
+ G900S: `#086848`,
48
+ G1200S: `#052E21`,
49
+ // Blues
50
+ B900: '#09326C',
51
+ // Saturated Blues
52
+ B100S: '#E5F0FF',
53
+ B300S: '#A3C9FF',
54
+ B500S: '#4794FF',
55
+ B800S: '#0055CC',
56
+ B1200S: '#0C294F',
57
+ // Purples
58
+ P900: `#352C63`,
59
+ // Purple Saturated
60
+ P100S: `#EEEBFF`,
61
+ P300S: `#CCC3FE`,
62
+ P500S: `#A292F7`,
63
+ P800S: `#5E49CA`,
64
+ P1200S: `#282249`,
65
+ // Teals
66
+ T900: '#1D474C',
67
+ // Teal Saturated
68
+ T100S: `#DBFAFF`,
69
+ T300S: `#78EBFC`,
70
+ T400S: `#3AD6EE`,
71
+ T900S: `#056270`,
72
+ T1200S: `#0B3037`,
73
+ // Dark Mode Alpha
74
+ DNA20A: 'rgba(150, 176, 210, 0.53)',
75
+ DNA40A: 'rgba(134, 156, 180, 0.29)',
76
+ DNA80A: '#161A1D',
77
+ TextColor: '#D9DDE3'
33
78
  };
34
79
  const lightIconColor = {
35
80
  info: colors.B400,
@@ -46,16 +91,20 @@ const darkIconColor = {
46
91
  success: colors.G200,
47
92
  warning: colors.Y100,
48
93
  error: colors.R200
49
- };
50
- const darkTextColor = {
51
- info: colors.B75,
52
- note: colors.P75,
53
- tip: colors.G75,
54
- success: colors.G75,
55
- warning: colors.Y75,
56
- error: colors.R75
57
- };
58
- const verticalAlignment = -((gridSize() * 3 - akEditorCustomIconSize) / 2);
94
+ }; // New custom icons are a little smaller than predefined icons.
95
+ // To fix alignment issues with custom icons, vertical alignment is updated.
96
+
97
+ const panelEmojiSpriteVerticalAlignment = -(gridSize() * 3 - akEditorCustomIconSize) / 2;
98
+ const panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1;
99
+ export const getPanelBackgroundDarkModeColors = [[colors.B50, darkPanelColors.B1200S], [colors.B75, darkPanelColors.B900], [colors.B100, darkPanelColors.B800S], [colors.N0, darkPanelColors.DNA80A], [colors.N20, darkPanelColors.DNA40A], [colors.N60, darkPanelColors.DNA20A], [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]].map(([colorName, colorValue]) => getPanelDarkModeCSS(colorName, colorValue)).join('\n');
100
+ export function getPanelDarkModeCSS(colorName, colorValue) {
101
+ return `
102
+ &[data-panel-color="${colorName}"] {
103
+ background-color: ${colorValue} !important; // !important to override default style color
104
+ color: ${darkPanelColors.TextColor};
105
+ }
106
+ `;
107
+ }
59
108
  const prefix = 'ak-editor-panel';
60
109
  export const PanelSharedCssClassName = {
61
110
  prefix,
@@ -92,7 +141,7 @@ const iconDynamicStyles = panelType => props => {
92
141
 
93
142
  export const getPanelTypeBackground = (panelType, props = {}) => {
94
143
  const light = lightPanelColor[panelType];
95
- const dark = hexToRgba(darkPanelColor[panelType], darkPanelOpacity);
144
+ const dark = darkPanelColors[panelType];
96
145
  const background = themed({
97
146
  light,
98
147
  dark
@@ -102,19 +151,12 @@ export const getPanelTypeBackground = (panelType, props = {}) => {
102
151
 
103
152
  const mainDynamicStyles = panelType => props => {
104
153
  const background = getPanelTypeBackground(panelType, props);
105
- const darkText = darkTextColor[panelType];
106
- const darkBorder = '1px solid ' + darkPanelBorderColor[panelType];
107
- const border = themed({
108
- light: 'none',
109
- dark: darkBorder
110
- })(props);
111
154
  const text = themed({
112
155
  light: 'inherit',
113
- dark: darkText
156
+ dark: darkPanelColors.TextColor
114
157
  })(props);
115
158
  return `
116
159
  background-color: ${background};
117
- border: ${border};
118
160
  color: ${text};
119
161
  `;
120
162
  };
@@ -126,19 +168,23 @@ export const panelSharedStyles = css`
126
168
  padding: ${gridSize()}px;
127
169
  min-width: ${akEditorTableCellMinWidth}px;
128
170
  display: flex;
171
+ position: relative;
129
172
  align-items: baseline;
130
173
  word-break: break-word;
131
174
 
132
175
  ${mainDynamicStyles(PanelType.INFO)}
133
176
 
134
177
  .${PanelSharedCssClassName.icon} {
135
- display: block;
136
178
  flex-shrink: 0;
137
179
  height: ${gridSize() * 3}px;
138
180
  width: ${gridSize() * 3}px;
139
181
  box-sizing: content-box;
140
182
  padding-right: ${gridSize()}px;
141
183
  text-align: center;
184
+ user-select: none;
185
+ -moz-user-select: none;
186
+ -webkit-user-select: none;
187
+ -ms-user-select: none;
142
188
  ${iconDynamicStyles(PanelType.INFO)}
143
189
 
144
190
  > span {
@@ -146,8 +192,19 @@ export const panelSharedStyles = css`
146
192
  display: inline;
147
193
  }
148
194
 
149
- .${emojiSprite}, .${emojiImage} {
150
- vertical-align: ${verticalAlignment}px;
195
+ .${emojiSprite} {
196
+ vertical-align: ${panelEmojiSpriteVerticalAlignment}px;
197
+ }
198
+
199
+ .${emojiImage} {
200
+ vertical-align: ${panelEmojiImageVerticalAlignment}px;
201
+
202
+ // Vertical align only works for inline-block elements in Firefox
203
+ @-moz-document url-prefix() {
204
+ img {
205
+ display: inline-block;
206
+ }
207
+ }
151
208
  }
152
209
  }
153
210
 
@@ -202,12 +259,9 @@ export const panelSharedStyles = css`
202
259
  }
203
260
 
204
261
  &[data-panel-type='${PanelType.CUSTOM}'] {
205
- .${PanelSharedCssClassName.icon} {
206
- user-select: none;
207
- -moz-user-select: none;
208
- -webkit-user-select: none;
209
- -ms-user-select: none;
210
- }
262
+ ${themed({
263
+ dark: getPanelBackgroundDarkModeColors
264
+ })};
211
265
  }
212
266
  }
213
267
  `;
@@ -40,6 +40,7 @@ const tableSharedStyle = css`
40
40
  }
41
41
  .${TableSharedCssClassName.TABLE_CONTAINER}[data-number-column='true'] {
42
42
  padding-left: ${akEditorTableNumberColumnWidth - 1}px;
43
+ clear: both;
43
44
  }
44
45
  /* avoid applying styles to nested tables (possible via extensions) */
45
46
  .${TableSharedCssClassName.TABLE_CONTAINER} > table,
@@ -88,7 +89,7 @@ const tableSharedStyle = css`
88
89
  border-bottom-width: 0;
89
90
  padding: ${tableCellPadding}px;
90
91
  /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */
91
- ${browser.gecko || browser.ie ? 'background-clip: padding-box;' : ''}
92
+ ${browser.gecko || browser.ie || browser.mac && browser.chrome ? 'background-clip: padding-box;' : ''}
92
93
 
93
94
  ${themed({
94
95
  dark: getTableCellBackgroundDarkModeColors
@@ -0,0 +1,116 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { ExperiencePerformanceTypes, ExperienceTypes, UFOExperience } from '@atlaskit/ufo';
3
+ export const experienceConfig = {
4
+ type: ExperienceTypes.Operation,
5
+ performanceType: ExperiencePerformanceTypes.Custom,
6
+ platform: {
7
+ component: 'editor'
8
+ }
9
+ };
10
+ export let EditorExperience;
11
+
12
+ (function (EditorExperience) {
13
+ EditorExperience["loadEditor"] = "load";
14
+ EditorExperience["typing"] = "type";
15
+ EditorExperience["interaction"] = "interact";
16
+ EditorExperience["editSession"] = "editSession";
17
+ })(EditorExperience || (EditorExperience = {}));
18
+
19
+ export const RELIABILITY_INTERVAL = 30000;
20
+ export class ExperienceStore {
21
+ constructor() {
22
+ this.experiences = new Map();
23
+
24
+ for (const experienceId of Object.values(EditorExperience)) {
25
+ const experience = new UFOExperience(experienceId, experienceConfig);
26
+ this.experiences.set(experienceId, experience);
27
+ }
28
+ }
29
+
30
+ static getInstance(view, options = {}) {
31
+ if (!this.stores.get(view) || options !== null && options !== void 0 && options.forceNewInstance) {
32
+ const store = new ExperienceStore();
33
+ this.stores.set(view, store);
34
+ }
35
+
36
+ return this.stores.get(view);
37
+ }
38
+
39
+ get(experienceId) {
40
+ return this.experiences.get(experienceId);
41
+ }
42
+
43
+ getActive(experienceId) {
44
+ const experience = this.experiences.get(experienceId);
45
+
46
+ if (!(experience !== null && experience !== void 0 && experience.state.final)) {
47
+ return experience;
48
+ }
49
+ }
50
+
51
+ getAll() {
52
+ return Array.from(this.experiences.values());
53
+ }
54
+
55
+ start(experienceId, startTime) {
56
+ var _this$get;
57
+
58
+ (_this$get = this.get(experienceId)) === null || _this$get === void 0 ? void 0 : _this$get.start(startTime);
59
+ }
60
+
61
+ addMetadata(experienceId, metadata) {
62
+ var _this$get2;
63
+
64
+ (_this$get2 = this.get(experienceId)) === null || _this$get2 === void 0 ? void 0 : _this$get2.addMetadata(metadata);
65
+ }
66
+
67
+ mark(experienceId, mark, value) {
68
+ var _this$get3;
69
+
70
+ (_this$get3 = this.get(experienceId)) === null || _this$get3 === void 0 ? void 0 : _this$get3.mark(mark, value);
71
+ }
72
+
73
+ success(experienceId, metadata) {
74
+ var _this$getActive;
75
+
76
+ return (_this$getActive = this.getActive(experienceId)) === null || _this$getActive === void 0 ? void 0 : _this$getActive.success({
77
+ metadata
78
+ });
79
+ }
80
+
81
+ fail(experienceId, metadata) {
82
+ var _this$getActive2;
83
+
84
+ (_this$getActive2 = this.getActive(experienceId)) === null || _this$getActive2 === void 0 ? void 0 : _this$getActive2.failure({
85
+ metadata
86
+ });
87
+ }
88
+
89
+ abort(experienceId, metadata) {
90
+ // We add this wait in here because when React catches an error it unmounts the component
91
+ // before the error boundary's componentDidCatch is called
92
+ // In this case we want to fail the experience, but without this wait, abort is called first
93
+ setTimeout(() => {
94
+ var _this$getActive3;
95
+
96
+ (_this$getActive3 = this.getActive(experienceId)) === null || _this$getActive3 === void 0 ? void 0 : _this$getActive3.abort({
97
+ metadata
98
+ });
99
+ }, 0);
100
+ }
101
+
102
+ abortAll(metadata) {
103
+ this.experiences.forEach(experience => {
104
+ this.abort(experience.id, metadata);
105
+ });
106
+ }
107
+
108
+ failAll(metadata) {
109
+ this.experiences.forEach(experience => {
110
+ this.fail(experience.id, metadata);
111
+ });
112
+ }
113
+
114
+ }
115
+
116
+ _defineProperty(ExperienceStore, "stores", new WeakMap());
@@ -0,0 +1 @@
1
+ export { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from './experience-store';
@@ -1,10 +1,15 @@
1
- export { default as Emoji } from './Emoji';
1
+ // TODO: ED-13875 Remove Emoji & EmojiProps exports once root entry point for editor-common has been removed
2
+ export { default as Emoji } from './Emoji'; //exported from ./src/emoji.ts
3
+
4
+ //exported from ./src/emoji.ts
2
5
  export { default as Caption } from './Caption';
3
6
  export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, shouldAddDefaultWrappedWidth } from './MediaSingle';
4
7
  export { MediaSingleDimensionHelper } from './MediaSingle/styled';
5
8
  export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid } from './MediaSingle/grid';
6
- export { MediaLink } from './MediaSingle/link';
7
- export { default as Mention } from './Mention';
9
+ export { MediaLink } from './MediaSingle/link'; // TODO: ED-13875 Remove Mention export once root entry point for editor-common has been removed
10
+
11
+ export { default as Mention } from './Mention'; //exported from ./src/mention.ts
12
+
8
13
  export { default as Popup, findOverflowScrollParent } from './Popup';
9
14
  export { default as UnsupportedBlock } from './UnsupportedBlock';
10
15
  export { default as UnsupportedInline } from './UnsupportedInline';
@@ -128,6 +128,12 @@ function compareValue(valueA, valueB) {
128
128
  return 0;
129
129
  }
130
130
 
131
+ if (typeof valueA === 'string' && typeof valueB === 'string') {
132
+ return valueA.localeCompare(valueB, window.navigator.language, {
133
+ caseFirst: 'upper'
134
+ });
135
+ }
136
+
131
137
  return valueA > valueB ? 1 : -1;
132
138
  }
133
139
  /**
@@ -21,4 +21,6 @@ export { compose } from './compose';
21
21
  export { ZERO_WIDTH_SPACE } from './whitespace';
22
22
  export { shouldForceTracking } from './should-force-tracking';
23
23
  export { getModeFromTheme } from './getModeFromTheme';
24
- export { sniffUserBrowserExtensions } from './browser-extensions';
24
+ export { sniffUserBrowserExtensions } from './browser-extensions';
25
+ export { RenderCountProfiler } from './profiler/render-count';
26
+ export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
@@ -0,0 +1,107 @@
1
+ export const PROFILER_KEY = '__editorRenderCountProfiler';
2
+ export class RenderCountProfiler {
3
+ /**
4
+ * The singleton/cached instance of RenderCountProfiler that will be shared
5
+ * betweenRenderCountProfiler.getInstance() calls
6
+ */
7
+ constructor({
8
+ store
9
+ }) {
10
+ this.store = store;
11
+ }
12
+ /**
13
+ * Returns the singleton/cached instance of RenderCountProfiler that
14
+ * currently exists. If it hasn't been instantiated yet, the singleton
15
+ * instance will be created using the given params. Returns the latest
16
+ * singleton/instance.
17
+ */
18
+
19
+
20
+ static getInstance(params) {
21
+ if (!RenderCountProfiler.instance) {
22
+ RenderCountProfiler.instance = new RenderCountProfiler({
23
+ store: params.store
24
+ });
25
+ }
26
+
27
+ return RenderCountProfiler.instance;
28
+ }
29
+
30
+ getData(profilerKey) {
31
+ var _this$store;
32
+
33
+ return (_this$store = this.store) === null || _this$store === void 0 ? void 0 : _this$store[profilerKey];
34
+ }
35
+
36
+ enable() {
37
+ this.store[PROFILER_KEY] = { ...this.store[PROFILER_KEY],
38
+ enabled: true
39
+ };
40
+ }
41
+
42
+ remove() {
43
+ delete this.store[PROFILER_KEY];
44
+ }
45
+
46
+ isEnabled() {
47
+ var _this$store2, _this$store2$PROFILER;
48
+
49
+ return Boolean((_this$store2 = this.store) === null || _this$store2 === void 0 ? void 0 : (_this$store2$PROFILER = _this$store2[PROFILER_KEY]) === null || _this$store2$PROFILER === void 0 ? void 0 : _this$store2$PROFILER.enabled);
50
+ }
51
+
52
+ setRenderCount({
53
+ componentId,
54
+ renderCount,
55
+ instanceId
56
+ }) {
57
+ const profilerData = this.store[PROFILER_KEY];
58
+ const instance = {
59
+ count: renderCount
60
+ };
61
+ const existingComponents = profilerData === null || profilerData === void 0 ? void 0 : profilerData.components;
62
+ const existingInstances = existingComponents === null || existingComponents === void 0 ? void 0 : existingComponents[componentId];
63
+ const updatedComponent = { ...existingInstances,
64
+ [instanceId]: instance
65
+ };
66
+ this.store[PROFILER_KEY] = { ...profilerData,
67
+ components: { ...existingComponents,
68
+ [componentId]: updatedComponent
69
+ }
70
+ };
71
+ }
72
+
73
+ getInstanceRenderCounters({
74
+ componentId
75
+ }) {
76
+ var _this$store$PROFILER_, _this$store3, _this$store3$PROFILER, _this$store3$PROFILER2;
77
+
78
+ const component = (_this$store$PROFILER_ = (_this$store3 = this.store) === null || _this$store3 === void 0 ? void 0 : (_this$store3$PROFILER = _this$store3[PROFILER_KEY]) === null || _this$store3$PROFILER === void 0 ? void 0 : (_this$store3$PROFILER2 = _this$store3$PROFILER.components) === null || _this$store3$PROFILER2 === void 0 ? void 0 : _this$store3$PROFILER2[componentId]) !== null && _this$store$PROFILER_ !== void 0 ? _this$store$PROFILER_ : {};
79
+ const counters = [];
80
+
81
+ for (let instanceId in component) {
82
+ const counter = {
83
+ instanceId,
84
+ count: component[instanceId].count
85
+ };
86
+ counters.push(counter);
87
+ }
88
+
89
+ return counters;
90
+ }
91
+
92
+ getRenderCount({
93
+ componentId
94
+ }) {
95
+ var _this$store$PROFILER_2, _this$store4, _this$store4$PROFILER, _this$store4$PROFILER2;
96
+
97
+ const component = (_this$store$PROFILER_2 = (_this$store4 = this.store) === null || _this$store4 === void 0 ? void 0 : (_this$store4$PROFILER = _this$store4[PROFILER_KEY]) === null || _this$store4$PROFILER === void 0 ? void 0 : (_this$store4$PROFILER2 = _this$store4$PROFILER.components) === null || _this$store4$PROFILER2 === void 0 ? void 0 : _this$store4$PROFILER2[componentId]) !== null && _this$store$PROFILER_2 !== void 0 ? _this$store$PROFILER_2 : {};
98
+ let total = 0;
99
+
100
+ for (let instanceId in component) {
101
+ total += component[instanceId].count;
102
+ }
103
+
104
+ return total;
105
+ }
106
+
107
+ }
@@ -8,7 +8,7 @@ export const ADFStages = {
8
8
  * It's important that this order follows the marks rank defined here:
9
9
  * https://product-fabric.atlassian.net/wiki/spaces/E/pages/11174043/Document+structure#Documentstructure-Rank
10
10
  */
11
- export const markOrder = ['link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'confluenceInlineComment', 'annotation', 'dataConsumer'];
11
+ export const markOrder = ['fragment', 'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'confluenceInlineComment', 'annotation', 'dataConsumer'];
12
12
  export const isSubSupType = type => {
13
13
  return type === 'sub' || type === 'sup';
14
14
  };
@@ -332,7 +332,7 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
332
332
 
333
333
  case 'caption':
334
334
  {
335
- if (content && adfStage === 'stage0') {
335
+ if (content) {
336
336
  return {
337
337
  type,
338
338
  content
@@ -342,6 +342,31 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
342
342
  break;
343
343
  }
344
344
 
345
+ case 'mediaInline':
346
+ {
347
+ let mediaId = '';
348
+ let mediaCollection = [];
349
+
350
+ if (attrs) {
351
+ const {
352
+ id,
353
+ collection
354
+ } = attrs;
355
+ mediaId = id;
356
+ mediaCollection = collection;
357
+ }
358
+
359
+ if (mediaId && mediaCollection && adfStage === 'stage0') {
360
+ return {
361
+ type,
362
+ attrs,
363
+ marks
364
+ };
365
+ }
366
+
367
+ break;
368
+ }
369
+
345
370
  case 'media':
346
371
  {
347
372
  let mediaId = '';
@@ -606,20 +631,10 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
606
631
  {
607
632
  if (attrs && content) {
608
633
  const {
609
- panelType,
610
- panelIcon,
611
- panelColor
634
+ panelType
612
635
  } = attrs;
613
636
 
614
637
  if (Object.values(PanelType).includes(panelType)) {
615
- // TODO: ED-10445 remove stage0 check
616
- let attrs = adfStage === 'stage0' ? {
617
- panelType,
618
- panelIcon,
619
- panelColor
620
- } : {
621
- panelType
622
- };
623
638
  return {
624
639
  type,
625
640
  attrs,
@@ -956,6 +971,14 @@ export const getValidMark = (mark, adfStage = 'final') => {
956
971
  attrs
957
972
  };
958
973
  }
974
+
975
+ case 'fragment':
976
+ {
977
+ return {
978
+ type,
979
+ attrs
980
+ };
981
+ }
959
982
  }
960
983
  }
961
984
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "60.1.0",
3
+ "version": "61.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Emoji } from './ui/Emoji';
2
+ export { EmojiSharedCssClassName } from './styles/shared/emoji';
@@ -1,4 +1,4 @@
1
- export { isFieldset, isTabGroup, isExpand, isDateRange } from './types';
1
+ export { isFieldset, isTabGroup, isTabField, isExpand, isDateRange } from './types';
2
2
  export { getExtensionKeyAndNodeKey, resolveImport } from './manifest-helpers';
3
3
  export { default as DefaultExtensionProvider } from './default-extension-provider';
4
4
  export { createAutoConverterRunner, getExtensionAutoConvertersFromProvider, getQuickInsertItemsFromModule, getContextualToolbarItemsFromModule, buildMenuItem } from './module-helpers';
@@ -8,6 +8,9 @@ export var isFieldset = function isFieldset(field) {
8
8
  export var isTabGroup = function isTabGroup(field) {
9
9
  return field.type === 'tab-group';
10
10
  };
11
+ export var isTabField = function isTabField(field) {
12
+ return 'type' in field && field.type === 'tab';
13
+ };
11
14
  export var isExpand = function isExpand(field) {
12
15
  return field.type === 'expand';
13
16
  };
@@ -1 +1 @@
1
- export { isFieldset, isTabGroup, isExpand, isDateRange } from './field-definitions';
1
+ export { isFieldset, isTabGroup, isTabField, isExpand, isDateRange } from './field-definitions';
@@ -1 +1 @@
1
- export { DefaultExtensionProvider, combineExtensionProviders, createAutoConverterRunner, getExtensionAutoConvertersFromProvider, getExtensionKeyAndNodeKey, getExtensionModuleNode, getQuickInsertItemsFromModule, getNodeRenderer, getExtensionModuleNodePrivateProps, getContextualToolbarItemsFromModule, resolveImport, getCustomFieldResolver, getFieldSerializer, getFieldDeserializer, isFieldset, isTabGroup, isExpand, isDateRange, getUserFieldContextProvider, buildMenuItem } from './extensions/index';
1
+ export { DefaultExtensionProvider, combineExtensionProviders, createAutoConverterRunner, getExtensionAutoConvertersFromProvider, getExtensionKeyAndNodeKey, getExtensionModuleNode, getQuickInsertItemsFromModule, getNodeRenderer, getExtensionModuleNodePrivateProps, getContextualToolbarItemsFromModule, resolveImport, getCustomFieldResolver, getFieldSerializer, getFieldDeserializer, isFieldset, isTabGroup, isTabField, isExpand, isDateRange, getUserFieldContextProvider, buildMenuItem } from './extensions/index';
@@ -6,6 +6,7 @@
6
6
  */
7
7
  // Czech
8
8
  export default {
9
+ 'fabric.editor.codeBidiWarningLabel': 'Obousměrné znaky mění pořadí vykreslování textu. Může to být použito k zakrytí škodlivého kódu.',
9
10
  'fabric.editor.captionPlaceholder': 'Přidejte popisek',
10
11
  'fabric.editor.collapseNode': 'Sbalit obsah',
11
12
  'fabric.editor.expandDefaultTitle': 'Klikněte sem pro rozbalení...',
@@ -6,6 +6,7 @@
6
6
  */
7
7
  // Danish
8
8
  export default {
9
+ 'fabric.editor.codeBidiWarningLabel': 'Tegn med tovejsfunktionalitet ændrer rækkefølgen, som teksten er gengivet i. Dette kan udnyttes til at skjule skadelig kode.',
9
10
  'fabric.editor.captionPlaceholder': 'Tilføj en billedtekst',
10
11
  'fabric.editor.collapseNode': 'skjul indhold',
11
12
  'fabric.editor.expandDefaultTitle': 'Klik her for at udvide...',
@@ -6,6 +6,7 @@
6
6
  */
7
7
  // German
8
8
  export default {
9
+ 'fabric.editor.codeBidiWarningLabel': 'Bidirektionale Zeichen ändern die Reihenfolge, in der Text gerendert wird. Dies könnte verwendet werden, um bösartigen Code zu verbergen.',
9
10
  'fabric.editor.captionPlaceholder': 'Eine Bildunterschrift hinzufügen',
10
11
  'fabric.editor.collapseNode': 'Inhaltsanzeige reduzieren',
11
12
  'fabric.editor.expandDefaultTitle': 'Klicken Sie hier, um zu erweitern …',
@@ -6,6 +6,7 @@
6
6
  */
7
7
  // Spanish
8
8
  export default {
9
+ 'fabric.editor.codeBidiWarningLabel': 'Los caracteres bidireccionales cambian el orden de renderización del texto. Esto podría utilizarse para ocultar código malicioso.',
9
10
  'fabric.editor.captionPlaceholder': 'Añadir un subtítulo',
10
11
  'fabric.editor.collapseNode': 'contraer contenido',
11
12
  'fabric.editor.expandDefaultTitle': 'Haz clic aquí para ampliar...',
@@ -6,6 +6,7 @@
6
6
  */
7
7
  // Finnish
8
8
  export default {
9
+ 'fabric.editor.codeBidiWarningLabel': 'Kaksisuuntaiset merkit muuttavat tekstin renderöintijärjestystä. Tätä voidaan hyödyntää haitallisen koodin peittämisessä.',
9
10
  'fabric.editor.captionPlaceholder': 'Lisää kuvateksti',
10
11
  'fabric.editor.collapseNode': 'piilota sisältö',
11
12
  'fabric.editor.expandDefaultTitle': 'Klikkaa tähän laajentaaksesi...',