@atlaskit/editor-common 60.0.0 → 61.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +89 -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/index.js +6 -0
  6. package/dist/cjs/extensions/types/field-definitions.js +7 -1
  7. package/dist/cjs/extensions/types/index.js +6 -0
  8. package/dist/cjs/extensions.js +6 -0
  9. package/dist/cjs/i18n/cs.js +1 -0
  10. package/dist/cjs/i18n/da.js +1 -0
  11. package/dist/cjs/i18n/de.js +1 -0
  12. package/dist/cjs/i18n/es.js +1 -0
  13. package/dist/cjs/i18n/fi.js +1 -0
  14. package/dist/cjs/i18n/fr.js +1 -0
  15. package/dist/cjs/i18n/hu.js +1 -0
  16. package/dist/cjs/i18n/it.js +1 -0
  17. package/dist/cjs/i18n/ja.js +1 -0
  18. package/dist/cjs/i18n/ko.js +1 -0
  19. package/dist/cjs/i18n/nb.js +1 -0
  20. package/dist/cjs/i18n/nl.js +1 -0
  21. package/dist/cjs/i18n/pl.js +1 -0
  22. package/dist/cjs/i18n/pt_BR.js +1 -0
  23. package/dist/cjs/i18n/ru.js +1 -0
  24. package/dist/cjs/i18n/sv.js +1 -0
  25. package/dist/cjs/i18n/th.js +1 -0
  26. package/dist/cjs/i18n/tr.js +1 -0
  27. package/dist/cjs/i18n/uk.js +1 -0
  28. package/dist/cjs/i18n/vi.js +1 -0
  29. package/dist/cjs/i18n/zh.js +1 -1
  30. package/dist/cjs/i18n/zh_TW.js +1 -0
  31. package/dist/cjs/index.js +12 -0
  32. package/dist/cjs/mention.js +23 -0
  33. package/dist/cjs/messages/codeBidiWarning.js +21 -0
  34. package/dist/cjs/messages/index.js +8 -0
  35. package/dist/cjs/styles/index.js +6 -0
  36. package/dist/cjs/styles/shared/panel.js +92 -37
  37. package/dist/cjs/styles/shared/table.js +2 -2
  38. package/dist/cjs/ufo/experience-store.js +160 -0
  39. package/dist/cjs/ufo/index.js +25 -0
  40. package/dist/cjs/ui/Messages/index.js +1 -3
  41. package/dist/cjs/utils/compareNodes.js +6 -0
  42. package/dist/cjs/utils/index.js +23 -1
  43. package/dist/cjs/utils/profiler/render-count.js +135 -0
  44. package/dist/cjs/utils/validator.js +46 -26
  45. package/dist/cjs/version.json +1 -1
  46. package/dist/es2019/card/cardOptions.js +1 -0
  47. package/dist/es2019/emoji.js +2 -0
  48. package/dist/es2019/extensions/index.js +1 -1
  49. package/dist/es2019/extensions/types/field-definitions.js +3 -0
  50. package/dist/es2019/extensions/types/index.js +1 -1
  51. package/dist/es2019/extensions.js +1 -1
  52. package/dist/es2019/i18n/cs.js +1 -0
  53. package/dist/es2019/i18n/da.js +1 -0
  54. package/dist/es2019/i18n/de.js +1 -0
  55. package/dist/es2019/i18n/es.js +1 -0
  56. package/dist/es2019/i18n/fi.js +1 -0
  57. package/dist/es2019/i18n/fr.js +1 -0
  58. package/dist/es2019/i18n/hu.js +1 -0
  59. package/dist/es2019/i18n/it.js +1 -0
  60. package/dist/es2019/i18n/ja.js +1 -0
  61. package/dist/es2019/i18n/ko.js +1 -0
  62. package/dist/es2019/i18n/nb.js +1 -0
  63. package/dist/es2019/i18n/nl.js +1 -0
  64. package/dist/es2019/i18n/pl.js +1 -0
  65. package/dist/es2019/i18n/pt_BR.js +1 -0
  66. package/dist/es2019/i18n/ru.js +1 -0
  67. package/dist/es2019/i18n/sv.js +1 -0
  68. package/dist/es2019/i18n/th.js +1 -0
  69. package/dist/es2019/i18n/tr.js +1 -0
  70. package/dist/es2019/i18n/uk.js +1 -0
  71. package/dist/es2019/i18n/vi.js +1 -0
  72. package/dist/es2019/i18n/zh.js +1 -1
  73. package/dist/es2019/i18n/zh_TW.js +1 -0
  74. package/dist/es2019/index.js +26 -8
  75. package/dist/es2019/mention.js +2 -0
  76. package/dist/es2019/messages/codeBidiWarning.js +12 -0
  77. package/dist/es2019/messages/index.js +1 -0
  78. package/dist/es2019/styles/index.js +4 -2
  79. package/dist/es2019/styles/shared/panel.js +104 -39
  80. package/dist/es2019/styles/shared/table.js +2 -1
  81. package/dist/es2019/ufo/experience-store.js +116 -0
  82. package/dist/es2019/ufo/index.js +1 -0
  83. package/dist/es2019/ui/Messages/index.js +1 -2
  84. package/dist/es2019/ui/index.js +8 -3
  85. package/dist/es2019/utils/compareNodes.js +6 -0
  86. package/dist/es2019/utils/index.js +3 -1
  87. package/dist/es2019/utils/profiler/render-count.js +107 -0
  88. package/dist/es2019/utils/validator.js +36 -13
  89. package/dist/es2019/version.json +1 -1
  90. package/dist/esm/card/cardOptions.js +1 -0
  91. package/dist/esm/emoji.js +2 -0
  92. package/dist/esm/extensions/index.js +1 -1
  93. package/dist/esm/extensions/types/field-definitions.js +3 -0
  94. package/dist/esm/extensions/types/index.js +1 -1
  95. package/dist/esm/extensions.js +1 -1
  96. package/dist/esm/i18n/cs.js +1 -0
  97. package/dist/esm/i18n/da.js +1 -0
  98. package/dist/esm/i18n/de.js +1 -0
  99. package/dist/esm/i18n/es.js +1 -0
  100. package/dist/esm/i18n/fi.js +1 -0
  101. package/dist/esm/i18n/fr.js +1 -0
  102. package/dist/esm/i18n/hu.js +1 -0
  103. package/dist/esm/i18n/it.js +1 -0
  104. package/dist/esm/i18n/ja.js +1 -0
  105. package/dist/esm/i18n/ko.js +1 -0
  106. package/dist/esm/i18n/nb.js +1 -0
  107. package/dist/esm/i18n/nl.js +1 -0
  108. package/dist/esm/i18n/pl.js +1 -0
  109. package/dist/esm/i18n/pt_BR.js +1 -0
  110. package/dist/esm/i18n/ru.js +1 -0
  111. package/dist/esm/i18n/sv.js +1 -0
  112. package/dist/esm/i18n/th.js +1 -0
  113. package/dist/esm/i18n/tr.js +1 -0
  114. package/dist/esm/i18n/uk.js +1 -0
  115. package/dist/esm/i18n/vi.js +1 -0
  116. package/dist/esm/i18n/zh.js +1 -1
  117. package/dist/esm/i18n/zh_TW.js +1 -0
  118. package/dist/esm/index.js +26 -8
  119. package/dist/esm/mention.js +2 -0
  120. package/dist/esm/messages/codeBidiWarning.js +12 -0
  121. package/dist/esm/messages/index.js +1 -0
  122. package/dist/esm/styles/index.js +4 -2
  123. package/dist/esm/styles/shared/panel.js +87 -38
  124. package/dist/esm/styles/shared/table.js +2 -2
  125. package/dist/esm/ufo/experience-store.js +144 -0
  126. package/dist/esm/ufo/index.js +1 -0
  127. package/dist/esm/ui/Messages/index.js +1 -2
  128. package/dist/esm/ui/index.js +8 -3
  129. package/dist/esm/utils/compareNodes.js +6 -0
  130. package/dist/esm/utils/index.js +3 -1
  131. package/dist/esm/utils/profiler/render-count.js +123 -0
  132. package/dist/esm/utils/validator.js +46 -26
  133. package/dist/esm/version.json +1 -1
  134. package/dist/types/card/cardOptions.d.ts +9 -0
  135. package/dist/types/card/index.d.ts +1 -9
  136. package/dist/types/collab/types.d.ts +5 -0
  137. package/dist/types/collab.d.ts +1 -1
  138. package/dist/types/emoji.d.ts +3 -0
  139. package/dist/types/extensions/index.d.ts +1 -1
  140. package/dist/types/extensions/types/extension-handler.d.ts +6 -2
  141. package/dist/types/extensions/types/extension-parameters.d.ts +1 -0
  142. package/dist/types/extensions/types/field-definitions.d.ts +2 -0
  143. package/dist/types/extensions/types/index.d.ts +1 -1
  144. package/dist/types/extensions.d.ts +1 -1
  145. package/dist/types/i18n/cs.d.ts +1 -0
  146. package/dist/types/i18n/da.d.ts +1 -0
  147. package/dist/types/i18n/de.d.ts +1 -0
  148. package/dist/types/i18n/es.d.ts +1 -0
  149. package/dist/types/i18n/fi.d.ts +1 -0
  150. package/dist/types/i18n/fr.d.ts +1 -0
  151. package/dist/types/i18n/hu.d.ts +1 -0
  152. package/dist/types/i18n/it.d.ts +1 -0
  153. package/dist/types/i18n/ja.d.ts +1 -0
  154. package/dist/types/i18n/ko.d.ts +1 -0
  155. package/dist/types/i18n/nb.d.ts +1 -0
  156. package/dist/types/i18n/nl.d.ts +1 -0
  157. package/dist/types/i18n/pl.d.ts +1 -0
  158. package/dist/types/i18n/pt_BR.d.ts +1 -0
  159. package/dist/types/i18n/ru.d.ts +1 -0
  160. package/dist/types/i18n/sv.d.ts +1 -0
  161. package/dist/types/i18n/th.d.ts +1 -0
  162. package/dist/types/i18n/tr.d.ts +1 -0
  163. package/dist/types/i18n/uk.d.ts +1 -0
  164. package/dist/types/i18n/vi.d.ts +1 -0
  165. package/dist/types/i18n/zh.d.ts +1 -0
  166. package/dist/types/i18n/zh_TW.d.ts +1 -0
  167. package/dist/types/index.d.ts +7 -3
  168. package/dist/types/mention.d.ts +2 -0
  169. package/dist/types/messages/codeBidiWarning.d.ts +11 -0
  170. package/dist/types/messages/index.d.ts +1 -0
  171. package/dist/types/provider-factory.d.ts +1 -0
  172. package/dist/types/styles/index.d.ts +1 -1
  173. package/dist/types/styles/shared/panel.d.ts +3 -1
  174. package/dist/types/ufo/experience-store.d.ts +33 -0
  175. package/dist/types/ufo/index.d.ts +1 -0
  176. package/dist/types/utils/index.d.ts +2 -0
  177. package/dist/types/utils/profiler/render-count.d.ts +50 -0
  178. package/emoji/package.json +7 -0
  179. package/mention/package.json +7 -0
  180. package/package.json +33 -21
  181. package/provider-helpers/package.json +7 -0
  182. package/types/package.json +7 -0
  183. package/ufo/package.json +7 -0
  184. package/ui/package.json +7 -0
  185. package/utils/package.json +7 -0
  186. package/dist/cjs/ui/Caption/index.test.js +0 -82
  187. package/dist/cjs/utils/performance/measure-tti.test.js +0 -183
  188. package/dist/es2019/ui/Caption/index.test.js +0 -73
  189. package/dist/es2019/utils/performance/measure-tti.test.js +0 -124
  190. package/dist/esm/ui/Caption/index.test.js +0 -73
  191. package/dist/esm/utils/performance/measure-tti.test.js +0 -174
@@ -1,7 +1,8 @@
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
- import { emojiSprite } from '@atlaskit/emoji';
4
+ import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
5
+ import { emojiImage, emojiSprite } from '@atlaskit/emoji';
5
6
  import * as colors from '@atlaskit/theme/colors';
6
7
  import { themed } from '@atlaskit/theme/components';
7
8
  import { borderRadius, gridSize } from '@atlaskit/theme/constants';
@@ -13,22 +14,67 @@ const lightPanelColor = {
13
14
  warning: colors.Y50,
14
15
  error: colors.R50
15
16
  };
16
- const darkPanelOpacity = 0.64;
17
- const darkPanelColor = {
18
- info: colors.B500,
19
- note: colors.P500,
20
- tip: colors.G500,
21
- success: colors.G500,
22
- warning: colors.Y500,
23
- error: colors.R500
24
- };
25
- const darkPanelBorderColor = {
26
- info: colors.B400,
27
- note: colors.P400,
28
- tip: colors.G400,
29
- success: colors.G400,
30
- warning: colors.Y400,
31
- 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'
32
78
  };
33
79
  const lightIconColor = {
34
80
  info: colors.B400,
@@ -45,15 +91,20 @@ const darkIconColor = {
45
91
  success: colors.G200,
46
92
  warning: colors.Y100,
47
93
  error: colors.R200
48
- };
49
- const darkTextColor = {
50
- info: colors.B75,
51
- note: colors.P75,
52
- tip: colors.G75,
53
- success: colors.G75,
54
- warning: colors.Y75,
55
- error: colors.R75
56
- };
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
+ }
57
108
  const prefix = 'ak-editor-panel';
58
109
  export const PanelSharedCssClassName = {
59
110
  prefix,
@@ -70,7 +121,7 @@ export const PanelSharedSelectors = {
70
121
  removeButton: `button[aria-label="Remove"]`,
71
122
  colorPalette: `[aria-label="Background color"]`,
72
123
  selectedColor: `[aria-label="The smell"]`,
73
- hideEmojiIcon: `[aria-label="Hide emoji"]`,
124
+ removeEmojiIcon: `[aria-label="Remove emoji"]`,
74
125
  emojiIcon: `[aria-label="editor-add-emoji"]`,
75
126
  selectedEmoji: `[aria-label=":grinning:"]`,
76
127
  title: `#editor-title`
@@ -90,7 +141,7 @@ const iconDynamicStyles = panelType => props => {
90
141
 
91
142
  export const getPanelTypeBackground = (panelType, props = {}) => {
92
143
  const light = lightPanelColor[panelType];
93
- const dark = hexToRgba(darkPanelColor[panelType], darkPanelOpacity);
144
+ const dark = darkPanelColors[panelType];
94
145
  const background = themed({
95
146
  light,
96
147
  dark
@@ -100,19 +151,12 @@ export const getPanelTypeBackground = (panelType, props = {}) => {
100
151
 
101
152
  const mainDynamicStyles = panelType => props => {
102
153
  const background = getPanelTypeBackground(panelType, props);
103
- const darkText = darkTextColor[panelType];
104
- const darkBorder = '1px solid ' + darkPanelBorderColor[panelType];
105
- const border = themed({
106
- light: 'none',
107
- dark: darkBorder
108
- })(props);
109
154
  const text = themed({
110
155
  light: 'inherit',
111
- dark: darkText
156
+ dark: darkPanelColors.TextColor
112
157
  })(props);
113
158
  return `
114
159
  background-color: ${background};
115
- border: ${border};
116
160
  color: ${text};
117
161
  `;
118
162
  };
@@ -124,19 +168,23 @@ export const panelSharedStyles = css`
124
168
  padding: ${gridSize()}px;
125
169
  min-width: ${akEditorTableCellMinWidth}px;
126
170
  display: flex;
171
+ position: relative;
127
172
  align-items: baseline;
128
173
  word-break: break-word;
129
174
 
130
175
  ${mainDynamicStyles(PanelType.INFO)}
131
176
 
132
177
  .${PanelSharedCssClassName.icon} {
133
- display: block;
134
178
  flex-shrink: 0;
135
179
  height: ${gridSize() * 3}px;
136
180
  width: ${gridSize() * 3}px;
137
181
  box-sizing: content-box;
138
182
  padding-right: ${gridSize()}px;
139
183
  text-align: center;
184
+ user-select: none;
185
+ -moz-user-select: none;
186
+ -webkit-user-select: none;
187
+ -ms-user-select: none;
140
188
  ${iconDynamicStyles(PanelType.INFO)}
141
189
 
142
190
  > span {
@@ -145,7 +193,18 @@ export const panelSharedStyles = css`
145
193
  }
146
194
 
147
195
  .${emojiSprite} {
148
- vertical-align: -2px;
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
+ }
149
208
  }
150
209
  }
151
210
 
@@ -198,5 +257,11 @@ export const panelSharedStyles = css`
198
257
  ${iconDynamicStyles(PanelType.SUCCESS)}
199
258
  }
200
259
  }
260
+
261
+ &[data-panel-type='${PanelType.CUSTOM}'] {
262
+ ${themed({
263
+ dark: getPanelBackgroundDarkModeColors
264
+ })};
265
+ }
201
266
  }
202
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';
@@ -4,7 +4,6 @@ import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
4
4
  import ErrorIcon from '@atlaskit/icon/glyph/error';
5
5
  import { G400, N200, R400 } from '@atlaskit/theme/colors';
6
6
  import { gridSize } from '@atlaskit/theme/constants';
7
- import { multiply } from '@atlaskit/theme/math';
8
7
  import { h200 } from '@atlaskit/theme/typography';
9
8
  const Message = styled.div`
10
9
  ${h200} font-weight: normal;
@@ -19,7 +18,7 @@ const Message = styled.div`
19
18
 
20
19
  return N200;
21
20
  }};
22
- margin-top: ${multiply(gridSize, 0.5)}px;
21
+ margin-top: ${gridSize() / 2}px;
23
22
  display: flex;
24
23
  justify-content: baseline;
25
24
  `;
@@ -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.0.0",
3
+ "version": "61.0.0",
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...',