@atlaskit/editor-core 188.8.0 → 188.9.2

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 (290) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/composable-editor/editor-internal.js +2 -2
  3. package/dist/cjs/create-editor/ReactEditorView.js +796 -8
  4. package/dist/cjs/labs/next/presets/default.js +2 -2
  5. package/dist/cjs/labs/next/presets/universal.js +7 -4
  6. package/dist/cjs/plugins/index.js +0 -28
  7. package/dist/cjs/plugins/insert-block/index.js +4 -6
  8. package/dist/cjs/plugins/tasks-and-decisions/index.js +4 -3
  9. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  10. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -13
  11. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +15 -7
  12. package/dist/cjs/version-wrapper.js +1 -1
  13. package/dist/es2019/composable-editor/editor-internal.js +1 -1
  14. package/dist/es2019/create-editor/ReactEditorView.js +753 -2
  15. package/dist/es2019/labs/next/presets/default.js +1 -1
  16. package/dist/es2019/labs/next/presets/universal.js +4 -1
  17. package/dist/es2019/plugins/index.js +0 -4
  18. package/dist/es2019/plugins/insert-block/index.js +4 -6
  19. package/dist/es2019/plugins/tasks-and-decisions/index.js +4 -3
  20. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  21. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +43 -10
  22. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +13 -6
  23. package/dist/es2019/version-wrapper.js +1 -1
  24. package/dist/esm/composable-editor/editor-internal.js +1 -1
  25. package/dist/esm/create-editor/ReactEditorView.js +797 -8
  26. package/dist/esm/labs/next/presets/default.js +1 -1
  27. package/dist/esm/labs/next/presets/universal.js +4 -1
  28. package/dist/esm/plugins/index.js +0 -4
  29. package/dist/esm/plugins/insert-block/index.js +4 -6
  30. package/dist/esm/plugins/tasks-and-decisions/index.js +4 -3
  31. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  32. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -12
  33. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +14 -7
  34. package/dist/esm/version-wrapper.js +1 -1
  35. package/dist/types/create-editor/ReactEditorView.d.ts +119 -5
  36. package/dist/types/labs/next/presets/default.d.ts +43 -43
  37. package/dist/types/plugins/index.d.ts +0 -4
  38. package/dist/types/plugins/insert-block/types.d.ts +3 -1
  39. package/dist/types/plugins/tasks-and-decisions/index.d.ts +2 -5
  40. package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
  41. package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
  42. package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
  43. package/dist/types/plugins/tasks-and-decisions/types.d.ts +6 -1
  44. package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
  45. package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +119 -5
  46. package/dist/types-ts4.5/labs/next/presets/default.d.ts +43 -43
  47. package/dist/types-ts4.5/plugins/index.d.ts +0 -4
  48. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
  49. package/dist/types-ts4.5/plugins/tasks-and-decisions/index.d.ts +2 -5
  50. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
  51. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
  52. package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
  53. package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +8 -1
  54. package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
  55. package/package.json +7 -7
  56. package/dist/cjs/create-editor/ReactEditorViewInternal.js +0 -812
  57. package/dist/cjs/create-editor/ReactEditorViewNext.js +0 -15
  58. package/dist/cjs/plugins/save-on-enter/index.js +0 -70
  59. package/dist/cjs/plugins/scroll-into-view/index.js +0 -55
  60. package/dist/cjs/plugins/status/actions.js +0 -158
  61. package/dist/cjs/plugins/status/analytics.js +0 -31
  62. package/dist/cjs/plugins/status/index.js +0 -143
  63. package/dist/cjs/plugins/status/keymap.js +0 -22
  64. package/dist/cjs/plugins/status/nodeviews/status.js +0 -58
  65. package/dist/cjs/plugins/status/plugin-key.js +0 -9
  66. package/dist/cjs/plugins/status/plugin.js +0 -133
  67. package/dist/cjs/plugins/status/types.js +0 -5
  68. package/dist/cjs/plugins/status/ui/statusPicker.js +0 -314
  69. package/dist/cjs/plugins/status/utils.js +0 -22
  70. package/dist/cjs/plugins/type-ahead/api.js +0 -215
  71. package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -205
  72. package/dist/cjs/plugins/type-ahead/commands/update-list-items.js +0 -23
  73. package/dist/cjs/plugins/type-ahead/commands/update-query.js +0 -27
  74. package/dist/cjs/plugins/type-ahead/commands/update-selected-index.js +0 -27
  75. package/dist/cjs/plugins/type-ahead/constants.js +0 -15
  76. package/dist/cjs/plugins/type-ahead/index.js +0 -14
  77. package/dist/cjs/plugins/type-ahead/insert-utils.js +0 -107
  78. package/dist/cjs/plugins/type-ahead/messages.js +0 -79
  79. package/dist/cjs/plugins/type-ahead/plugin.js +0 -382
  80. package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +0 -16
  81. package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +0 -148
  82. package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +0 -36
  83. package/dist/cjs/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -22
  84. package/dist/cjs/plugins/type-ahead/pm-plugins/key.js +0 -8
  85. package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +0 -110
  86. package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +0 -158
  87. package/dist/cjs/plugins/type-ahead/pm-plugins/utils.js +0 -18
  88. package/dist/cjs/plugins/type-ahead/stats-modifier.js +0 -42
  89. package/dist/cjs/plugins/type-ahead/transforms/close-type-ahead.js +0 -13
  90. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -75
  91. package/dist/cjs/plugins/type-ahead/transforms/set-selection-before-query.js +0 -18
  92. package/dist/cjs/plugins/type-ahead/types.js +0 -5
  93. package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +0 -120
  94. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +0 -400
  95. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +0 -285
  96. package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +0 -179
  97. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +0 -230
  98. package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -127
  99. package/dist/cjs/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -109
  100. package/dist/cjs/plugins/type-ahead/ui/hooks/use-load-items.js +0 -50
  101. package/dist/cjs/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -41
  102. package/dist/cjs/plugins/type-ahead/utils.js +0 -130
  103. package/dist/es2019/create-editor/ReactEditorViewInternal.js +0 -753
  104. package/dist/es2019/create-editor/ReactEditorViewNext.js +0 -7
  105. package/dist/es2019/plugins/save-on-enter/index.js +0 -63
  106. package/dist/es2019/plugins/scroll-into-view/index.js +0 -44
  107. package/dist/es2019/plugins/status/actions.js +0 -144
  108. package/dist/es2019/plugins/status/analytics.js +0 -18
  109. package/dist/es2019/plugins/status/index.js +0 -135
  110. package/dist/es2019/plugins/status/keymap.js +0 -13
  111. package/dist/es2019/plugins/status/nodeviews/status.js +0 -60
  112. package/dist/es2019/plugins/status/plugin-key.js +0 -3
  113. package/dist/es2019/plugins/status/plugin.js +0 -113
  114. package/dist/es2019/plugins/status/types.js +0 -1
  115. package/dist/es2019/plugins/status/ui/statusPicker.js +0 -293
  116. package/dist/es2019/plugins/status/utils.js +0 -12
  117. package/dist/es2019/plugins/type-ahead/api.js +0 -205
  118. package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -204
  119. package/dist/es2019/plugins/type-ahead/commands/update-list-items.js +0 -17
  120. package/dist/es2019/plugins/type-ahead/commands/update-query.js +0 -21
  121. package/dist/es2019/plugins/type-ahead/commands/update-selected-index.js +0 -21
  122. package/dist/es2019/plugins/type-ahead/constants.js +0 -9
  123. package/dist/es2019/plugins/type-ahead/index.js +0 -3
  124. package/dist/es2019/plugins/type-ahead/insert-utils.js +0 -106
  125. package/dist/es2019/plugins/type-ahead/messages.js +0 -73
  126. package/dist/es2019/plugins/type-ahead/plugin.js +0 -381
  127. package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +0 -10
  128. package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +0 -148
  129. package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
  130. package/dist/es2019/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
  131. package/dist/es2019/plugins/type-ahead/pm-plugins/key.js +0 -2
  132. package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +0 -106
  133. package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +0 -160
  134. package/dist/es2019/plugins/type-ahead/pm-plugins/utils.js +0 -12
  135. package/dist/es2019/plugins/type-ahead/stats-modifier.js +0 -33
  136. package/dist/es2019/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
  137. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -71
  138. package/dist/es2019/plugins/type-ahead/transforms/set-selection-before-query.js +0 -10
  139. package/dist/es2019/plugins/type-ahead/types.js +0 -1
  140. package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +0 -88
  141. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +0 -393
  142. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +0 -273
  143. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +0 -214
  144. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +0 -233
  145. package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -109
  146. package/dist/es2019/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -112
  147. package/dist/es2019/plugins/type-ahead/ui/hooks/use-load-items.js +0 -41
  148. package/dist/es2019/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -38
  149. package/dist/es2019/plugins/type-ahead/utils.js +0 -126
  150. package/dist/esm/create-editor/ReactEditorViewInternal.js +0 -806
  151. package/dist/esm/create-editor/ReactEditorViewNext.js +0 -7
  152. package/dist/esm/plugins/save-on-enter/index.js +0 -63
  153. package/dist/esm/plugins/scroll-into-view/index.js +0 -50
  154. package/dist/esm/plugins/status/actions.js +0 -151
  155. package/dist/esm/plugins/status/analytics.js +0 -24
  156. package/dist/esm/plugins/status/index.js +0 -136
  157. package/dist/esm/plugins/status/keymap.js +0 -15
  158. package/dist/esm/plugins/status/nodeviews/status.js +0 -51
  159. package/dist/esm/plugins/status/plugin-key.js +0 -3
  160. package/dist/esm/plugins/status/plugin.js +0 -115
  161. package/dist/esm/plugins/status/types.js +0 -1
  162. package/dist/esm/plugins/status/ui/statusPicker.js +0 -308
  163. package/dist/esm/plugins/status/utils.js +0 -16
  164. package/dist/esm/plugins/type-ahead/api.js +0 -209
  165. package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -198
  166. package/dist/esm/plugins/type-ahead/commands/update-list-items.js +0 -17
  167. package/dist/esm/plugins/type-ahead/commands/update-query.js +0 -21
  168. package/dist/esm/plugins/type-ahead/commands/update-selected-index.js +0 -21
  169. package/dist/esm/plugins/type-ahead/constants.js +0 -9
  170. package/dist/esm/plugins/type-ahead/index.js +0 -3
  171. package/dist/esm/plugins/type-ahead/insert-utils.js +0 -101
  172. package/dist/esm/plugins/type-ahead/messages.js +0 -73
  173. package/dist/esm/plugins/type-ahead/plugin.js +0 -374
  174. package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +0 -10
  175. package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +0 -141
  176. package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
  177. package/dist/esm/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
  178. package/dist/esm/plugins/type-ahead/pm-plugins/key.js +0 -2
  179. package/dist/esm/plugins/type-ahead/pm-plugins/main.js +0 -104
  180. package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +0 -151
  181. package/dist/esm/plugins/type-ahead/pm-plugins/utils.js +0 -12
  182. package/dist/esm/plugins/type-ahead/stats-modifier.js +0 -35
  183. package/dist/esm/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
  184. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -69
  185. package/dist/esm/plugins/type-ahead/transforms/set-selection-before-query.js +0 -12
  186. package/dist/esm/plugins/type-ahead/types.js +0 -1
  187. package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +0 -115
  188. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +0 -390
  189. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +0 -276
  190. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +0 -169
  191. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +0 -220
  192. package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -117
  193. package/dist/esm/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -103
  194. package/dist/esm/plugins/type-ahead/ui/hooks/use-load-items.js +0 -43
  195. package/dist/esm/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -35
  196. package/dist/esm/plugins/type-ahead/utils.js +0 -124
  197. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -119
  198. package/dist/types/create-editor/ReactEditorViewNext.d.ts +0 -8
  199. package/dist/types/plugins/save-on-enter/index.d.ts +0 -10
  200. package/dist/types/plugins/scroll-into-view/index.d.ts +0 -14
  201. package/dist/types/plugins/status/actions.d.ts +0 -16
  202. package/dist/types/plugins/status/analytics.d.ts +0 -4
  203. package/dist/types/plugins/status/index.d.ts +0 -15
  204. package/dist/types/plugins/status/keymap.d.ts +0 -3
  205. package/dist/types/plugins/status/nodeviews/status.d.ts +0 -25
  206. package/dist/types/plugins/status/plugin-key.d.ts +0 -4
  207. package/dist/types/plugins/status/plugin.d.ts +0 -7
  208. package/dist/types/plugins/status/types.d.ts +0 -18
  209. package/dist/types/plugins/status/ui/statusPicker.d.ts +0 -63
  210. package/dist/types/plugins/status/utils.d.ts +0 -5
  211. package/dist/types/plugins/type-ahead/api.d.ts +0 -61
  212. package/dist/types/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
  213. package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
  214. package/dist/types/plugins/type-ahead/commands/update-query.d.ts +0 -2
  215. package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
  216. package/dist/types/plugins/type-ahead/constants.d.ts +0 -8
  217. package/dist/types/plugins/type-ahead/index.d.ts +0 -4
  218. package/dist/types/plugins/type-ahead/insert-utils.d.ts +0 -18
  219. package/dist/types/plugins/type-ahead/messages.d.ts +0 -72
  220. package/dist/types/plugins/type-ahead/plugin.d.ts +0 -10
  221. package/dist/types/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
  222. package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
  223. package/dist/types/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
  224. package/dist/types/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
  225. package/dist/types/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
  226. package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
  227. package/dist/types/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
  228. package/dist/types/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
  229. package/dist/types/plugins/type-ahead/stats-modifier.d.ts +0 -20
  230. package/dist/types/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
  231. package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
  232. package/dist/types/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
  233. package/dist/types/plugins/type-ahead/types.d.ts +0 -109
  234. package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
  235. package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
  236. package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
  237. package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
  238. package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
  239. package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
  240. package/dist/types/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -3
  241. package/dist/types/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
  242. package/dist/types/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
  243. package/dist/types/plugins/type-ahead/utils.d.ts +0 -27
  244. package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -119
  245. package/dist/types-ts4.5/create-editor/ReactEditorViewNext.d.ts +0 -8
  246. package/dist/types-ts4.5/plugins/save-on-enter/index.d.ts +0 -10
  247. package/dist/types-ts4.5/plugins/scroll-into-view/index.d.ts +0 -14
  248. package/dist/types-ts4.5/plugins/status/actions.d.ts +0 -16
  249. package/dist/types-ts4.5/plugins/status/analytics.d.ts +0 -4
  250. package/dist/types-ts4.5/plugins/status/index.d.ts +0 -17
  251. package/dist/types-ts4.5/plugins/status/keymap.d.ts +0 -3
  252. package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +0 -25
  253. package/dist/types-ts4.5/plugins/status/plugin-key.d.ts +0 -4
  254. package/dist/types-ts4.5/plugins/status/plugin.d.ts +0 -7
  255. package/dist/types-ts4.5/plugins/status/types.d.ts +0 -18
  256. package/dist/types-ts4.5/plugins/status/ui/statusPicker.d.ts +0 -63
  257. package/dist/types-ts4.5/plugins/status/utils.d.ts +0 -5
  258. package/dist/types-ts4.5/plugins/type-ahead/api.d.ts +0 -61
  259. package/dist/types-ts4.5/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
  260. package/dist/types-ts4.5/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
  261. package/dist/types-ts4.5/plugins/type-ahead/commands/update-query.d.ts +0 -2
  262. package/dist/types-ts4.5/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
  263. package/dist/types-ts4.5/plugins/type-ahead/constants.d.ts +0 -8
  264. package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +0 -4
  265. package/dist/types-ts4.5/plugins/type-ahead/insert-utils.d.ts +0 -18
  266. package/dist/types-ts4.5/plugins/type-ahead/messages.d.ts +0 -72
  267. package/dist/types-ts4.5/plugins/type-ahead/plugin.d.ts +0 -10
  268. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
  269. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
  270. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
  271. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
  272. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
  273. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
  274. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
  275. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
  276. package/dist/types-ts4.5/plugins/type-ahead/stats-modifier.d.ts +0 -20
  277. package/dist/types-ts4.5/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
  278. package/dist/types-ts4.5/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
  279. package/dist/types-ts4.5/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
  280. package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +0 -111
  281. package/dist/types-ts4.5/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
  282. package/dist/types-ts4.5/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
  283. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
  284. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
  285. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
  286. package/dist/types-ts4.5/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
  287. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -7
  288. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
  289. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
  290. package/dist/types-ts4.5/plugins/type-ahead/utils.d.ts +0 -27
@@ -1,110 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createPlugin = createPlugin;
7
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
- var _view = require("@atlaskit/editor-prosemirror/view");
9
- var _steps = require("@atlaskit/adf-schema/steps");
10
- var _constants = require("../constants");
11
- var _actions = require("./actions");
12
- var _key = require("./key");
13
- var _utils = require("@atlaskit/editor-common/utils");
14
- var _reducer = require("./reducer");
15
- var _decorations = require("./decorations");
16
- var _utils2 = require("./utils");
17
- var hasValidTypeAheadStep = function hasValidTypeAheadStep(tr) {
18
- var steps = tr.steps.filter(function (step) {
19
- return step instanceof _steps.InsertTypeAheadStep;
20
- });
21
-
22
- // There are some cases, like collab rebase, where the steps are re-applied
23
- // We should not re open the type-ahead for those cases
24
- if (steps.length === 1) {
25
- return steps[0];
26
- }
27
- return null;
28
- };
29
- function createPlugin(_ref) {
30
- var reactDispatch = _ref.reactDispatch,
31
- popupMountRef = _ref.popupMountRef,
32
- createAnalyticsEvent = _ref.createAnalyticsEvent,
33
- typeAheadHandlers = _ref.typeAheadHandlers,
34
- getIntl = _ref.getIntl;
35
- var intl = getIntl();
36
- var _factoryDecorations = (0, _decorations.factoryDecorations)({
37
- intl: intl,
38
- popupMountRef: popupMountRef,
39
- createAnalyticsEvent: createAnalyticsEvent
40
- }),
41
- createDecorations = _factoryDecorations.createDecorations,
42
- removeDecorations = _factoryDecorations.removeDecorations;
43
- var reducer = (0, _reducer.createReducer)({
44
- createDecorations: createDecorations,
45
- removeDecorations: removeDecorations,
46
- typeAheadHandlers: typeAheadHandlers,
47
- popupMountRef: popupMountRef
48
- });
49
- return new _safePlugin.SafePlugin({
50
- key: _key.pluginKey,
51
- state: {
52
- init: function init() {
53
- return {
54
- typeAheadHandlers: typeAheadHandlers,
55
- query: '',
56
- decorationSet: _view.DecorationSet.empty,
57
- decorationElement: null,
58
- items: [],
59
- selectedIndex: -1,
60
- stats: null,
61
- inputMethod: null
62
- };
63
- },
64
- apply: function apply(tr, currentPluginState, oldEditorState, state) {
65
- var customStep = hasValidTypeAheadStep(tr);
66
- var nextPluginState = reducer(tr, currentPluginState, customStep);
67
- if (currentPluginState !== nextPluginState) {
68
- reactDispatch(_key.pluginKey, nextPluginState);
69
- }
70
- return nextPluginState;
71
- }
72
- },
73
- appendTransaction: function appendTransaction(transactions, _oldState, newState) {
74
- var insertItemCallback = (0, _utils2.isInsertionTransaction)(transactions, _actions.ACTIONS.INSERT_RAW_QUERY);
75
- if (insertItemCallback) {
76
- var tr = insertItemCallback(newState);
77
- if (tr) {
78
- return tr;
79
- }
80
- }
81
- },
82
- view: function view() {
83
- return {
84
- update: function update(editorView) {}
85
- };
86
- },
87
- props: {
88
- decorations: function decorations(state) {
89
- var _pluginKey$getState;
90
- return (_pluginKey$getState = _key.pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet;
91
- },
92
- handleDOMEvents: {
93
- compositionend: function compositionend(view, event) {
94
- return false;
95
- },
96
- click: function click(view, event) {
97
- var target = event.target;
98
- // ProseMirror view listen to any click event inside of it
99
- // When this event is coming from the typeahead
100
- // we should tell to ProseMirror to sit down and relax
101
- // cuz we know what we are doing (I hope)
102
- if (target instanceof HTMLElement && (0, _utils.closest)(target, "[data-type-ahead=".concat(_constants.TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, "]"))) {
103
- return true;
104
- }
105
- return false;
106
- }
107
- }
108
- }
109
- });
110
- }
@@ -1,158 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createReducer = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _view = require("@atlaskit/editor-prosemirror/view");
10
- var _steps = require("@atlaskit/adf-schema/steps");
11
- var _actions = require("./actions");
12
- var _key = require("./key");
13
- var _analytics = require("@atlaskit/editor-common/analytics");
14
- var _utils = require("../utils");
15
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
- var shouldForceOpen = function shouldForceOpen(step) {
18
- if (!(step instanceof _steps.InsertTypeAheadStep)) {
19
- return false;
20
- }
21
- var isDeletionRawQueryOperation = step.isInsertionStep() && step.stage === _steps.InsertTypeAheadStages.DELETING_RAW_QUERY;
22
- var isUndoingInsertionItem = step.isUndoingStep() && step.stage === _steps.InsertTypeAheadStages.INSERTING_ITEM;
23
- return isDeletionRawQueryOperation || isUndoingInsertionItem;
24
- };
25
- var shouldForceClose = function shouldForceClose(step) {
26
- if (!(step instanceof _steps.InsertTypeAheadStep)) {
27
- return false;
28
- }
29
- var isInsertingItem = step.isInsertionStep() && step.stage === _steps.InsertTypeAheadStages.INSERTING_ITEM;
30
- var isUndoingDeletionRawQuery = step.isUndoingStep() && step.stage === _steps.InsertTypeAheadStages.DELETING_RAW_QUERY;
31
- return isInsertingItem || isUndoingDeletionRawQuery;
32
- };
33
- var createFindHandler = function createFindHandler(typeAheadHandlers) {
34
- return function (step) {
35
- if (!(step instanceof _steps.InsertTypeAheadStep)) {
36
- return null;
37
- }
38
- var handler = typeAheadHandlers.find(function (h) {
39
- return h.trigger === step.trigger;
40
- });
41
- return handler || null;
42
- };
43
- };
44
- var createReducer = exports.createReducer = function createReducer(_ref) {
45
- var typeAheadHandlers = _ref.typeAheadHandlers,
46
- removeDecorations = _ref.removeDecorations,
47
- createDecorations = _ref.createDecorations;
48
- var findHandler = createFindHandler(typeAheadHandlers);
49
- var openMenu = function openMenu(currentPluginState, _ref2) {
50
- var tr = _ref2.tr,
51
- triggerHandler = _ref2.triggerHandler,
52
- inputMethod = _ref2.inputMethod,
53
- reopenQuery = _ref2.reopenQuery,
54
- selectedIndex = _ref2.selectedIndex;
55
- removeDecorations(currentPluginState.decorationSet);
56
- var _createDecorations = createDecorations(tr, {
57
- triggerHandler: triggerHandler,
58
- inputMethod: inputMethod,
59
- reopenQuery: reopenQuery
60
- }),
61
- decorationSet = _createDecorations.decorationSet,
62
- decorationElement = _createDecorations.decorationElement,
63
- stats = _createDecorations.stats;
64
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
65
- stats: stats,
66
- decorationSet: decorationSet,
67
- triggerHandler: triggerHandler,
68
- decorationElement: decorationElement,
69
- inputMethod: inputMethod,
70
- selectedIndex: typeof selectedIndex === 'number' ? selectedIndex : -1,
71
- items: [],
72
- query: reopenQuery || ''
73
- });
74
- };
75
- var closeMenu = function closeMenu(currentPluginState) {
76
- removeDecorations(currentPluginState.decorationSet);
77
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
78
- inputMethod: null,
79
- query: '',
80
- decorationElement: null,
81
- decorationSet: _view.DecorationSet.empty,
82
- stats: null,
83
- triggerHandler: undefined,
84
- items: []
85
- });
86
- };
87
- return function (tr, currentPluginState, typeAheadStepOverride) {
88
- var meta = tr.getMeta(_key.pluginKey) || {};
89
-
90
- // This code below controls when we should force
91
- // the menu to open or close during undo/redo operations
92
- var overrideHandler = findHandler(typeAheadStepOverride);
93
- if (typeAheadStepOverride && overrideHandler && shouldForceOpen(typeAheadStepOverride)) {
94
- return openMenu(currentPluginState, {
95
- tr: tr,
96
- triggerHandler: overrideHandler,
97
- inputMethod: _analytics.INPUT_METHOD.KEYBOARD,
98
- reopenQuery: typeAheadStepOverride.query,
99
- selectedIndex: typeAheadStepOverride.selectedIndex
100
- });
101
- } else if (shouldForceClose(typeAheadStepOverride)) {
102
- return closeMenu(currentPluginState);
103
- }
104
- var _ref3 = meta || {},
105
- action = _ref3.action,
106
- params = _ref3.params;
107
- var shouldOpenMenu = action === _actions.ACTIONS.OPEN_TYPEAHEAD_AT_CURSOR && (0, _utils.isTypeAheadHandler)(params === null || params === void 0 ? void 0 : params.triggerHandler);
108
- var selectionChanged = tr.selectionSet && (tr.isGeneric || Boolean(tr.getMeta('pointer')));
109
- var shouldCloseMenu = [_actions.ACTIONS.CLOSE_TYPE_AHEAD, _actions.ACTIONS.INSERT_ITEM].includes(action) || selectionChanged;
110
- var shouldUpdateQuery = action === _actions.ACTIONS.CHANGE_QUERY;
111
- var shouldUpdateListItems = action === _actions.ACTIONS.UPDATE_LIST_ITEMS;
112
- var shouldUpdateSelectedIndex = action === _actions.ACTIONS.UPDATE_SELECTED_INDEX;
113
- if (shouldOpenMenu) {
114
- return openMenu(currentPluginState, {
115
- tr: tr,
116
- triggerHandler: params.triggerHandler,
117
- inputMethod: params.inputMethod
118
- });
119
- } else if (shouldCloseMenu) {
120
- return closeMenu(currentPluginState);
121
- } else if (shouldUpdateQuery) {
122
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
123
- query: params.query
124
- });
125
- } else if (shouldUpdateListItems) {
126
- var items = params.items;
127
- var selectedIndex = currentPluginState.selectedIndex;
128
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
129
- items: items,
130
- selectedIndex: Math.max(selectedIndex >= items.length ? items.length - 1 : selectedIndex, -1)
131
- });
132
- } else if (shouldUpdateSelectedIndex) {
133
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
134
- selectedIndex: params.selectedIndex
135
- });
136
- }
137
- if (tr.docChanged) {
138
- var decorationSet = currentPluginState.decorationSet;
139
- var onRemove = function onRemove() {
140
- // Make sure we are unmounting the component
141
- // from the react tree when this decoration is removed
142
- removeDecorations(currentPluginState.decorationSet);
143
- };
144
- var mappedDecorationSet = decorationSet.map(tr.mapping, tr.doc, {
145
- onRemove: onRemove
146
- });
147
-
148
- // return same pluginState if decorationSet did not change
149
- if (mappedDecorationSet === currentPluginState.decorationSet) {
150
- return currentPluginState;
151
- }
152
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
153
- decorationSet: mappedDecorationSet
154
- });
155
- }
156
- return currentPluginState;
157
- };
158
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isInsertionTransaction = void 0;
7
- var _key = require("./key");
8
- var isInsertionTransaction = exports.isInsertionTransaction = function isInsertionTransaction(transactions, action) {
9
- var _tr$getMeta2;
10
- var tr = transactions.find(function (tr) {
11
- var _tr$getMeta;
12
- return ((_tr$getMeta = tr.getMeta(_key.pluginKey)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.action) === action;
13
- });
14
- if (!tr) {
15
- return null;
16
- }
17
- return (_tr$getMeta2 = tr.getMeta(_key.pluginKey)) === null || _tr$getMeta2 === void 0 ? void 0 : _tr$getMeta2.params;
18
- };
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.StatsModifier = void 0;
8
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var StatsModifier = exports.StatsModifier = /*#__PURE__*/(0, _createClass2.default)(function StatsModifier() {
12
- var _this = this;
13
- (0, _classCallCheck2.default)(this, StatsModifier);
14
- (0, _defineProperty2.default)(this, "startedAt", 0);
15
- (0, _defineProperty2.default)(this, "endedAt", 0);
16
- (0, _defineProperty2.default)(this, "keyCount", {
17
- arrowUp: 0,
18
- arrowDown: 0
19
- });
20
- (0, _defineProperty2.default)(this, "increaseArrowUp", function () {
21
- _this.keyCount.arrowUp += 1;
22
- });
23
- (0, _defineProperty2.default)(this, "increaseArrowDown", function () {
24
- _this.keyCount.arrowDown += 1;
25
- });
26
- (0, _defineProperty2.default)(this, "serialize", function () {
27
- var _this$keyCount, _this$keyCount2;
28
- return {
29
- startedAt: _this.startedAt,
30
- endedAt: performance.now(),
31
- keyCount: {
32
- arrowUp: ((_this$keyCount = _this.keyCount) === null || _this$keyCount === void 0 ? void 0 : _this$keyCount.arrowUp) || 0,
33
- arrowDown: ((_this$keyCount2 = _this.keyCount) === null || _this$keyCount2 === void 0 ? void 0 : _this$keyCount2.arrowDown) || 0
34
- }
35
- };
36
- });
37
- this.startedAt = performance.now();
38
- this.keyCount = {
39
- arrowUp: 0,
40
- arrowDown: 0
41
- };
42
- });
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.closeTypeAhead = void 0;
7
- var _key = require("../pm-plugins/key");
8
- var _actions = require("../pm-plugins/actions");
9
- var closeTypeAhead = exports.closeTypeAhead = function closeTypeAhead(tr) {
10
- return tr.setMeta(_key.pluginKey, {
11
- action: _actions.ACTIONS.CLOSE_TYPE_AHEAD
12
- });
13
- };
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.openTypeAheadAtCursor = exports.openTypeAhead = void 0;
7
- var _state = require("@atlaskit/editor-prosemirror/state");
8
- var _selection = require("@atlaskit/editor-common/selection");
9
- var _key = require("../pm-plugins/key");
10
- var _actions = require("../pm-plugins/actions");
11
- var openTypeAhead = exports.openTypeAhead = function openTypeAhead(props) {
12
- return function (tr) {
13
- var triggerHandler = props.triggerHandler,
14
- inputMethod = props.inputMethod,
15
- query = props.query;
16
- tr.setMeta(_key.pluginKey, {
17
- action: _actions.ACTIONS.OPEN_TYPEAHEAD_AT_CURSOR,
18
- params: {
19
- triggerHandler: triggerHandler,
20
- inputMethod: inputMethod,
21
- query: query
22
- }
23
- });
24
- };
25
- };
26
- var openTypeAheadAtCursor = exports.openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
27
- var triggerHandler = _ref.triggerHandler,
28
- inputMethod = _ref.inputMethod,
29
- query = _ref.query;
30
- return function (_ref2) {
31
- var tr = _ref2.tr;
32
- openTypeAhead({
33
- triggerHandler: triggerHandler,
34
- inputMethod: inputMethod,
35
- query: query
36
- })(tr);
37
- var selection = tr.selection;
38
- if (!(selection instanceof _state.TextSelection || selection instanceof _selection.GapCursorSelection)) {
39
- return tr;
40
- }
41
- if (selection instanceof _selection.GapCursorSelection) {
42
- // Create space for the typeahead menu in gap cursor
43
- tr.insertText(' ');
44
- // delete 1 pos before wherever selection is now - that will delete the empty space
45
- tr.delete(tr.selection.from - 1, tr.selection.from);
46
- } else {
47
- var _selection$$head, _selection$$head$pare, _selection$$head$pare2;
48
- if (!selection.$cursor) {
49
- tr.deleteSelection();
50
- return tr;
51
- }
52
-
53
- // Search & Destroy placeholder
54
- var cursorPos = selection.$cursor.pos;
55
- var nodeAtCursor = tr.doc.nodeAt(cursorPos);
56
- var isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
57
- if (nodeAtCursor && isPlaceholderAtCursorPosition) {
58
- tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
59
- }
60
-
61
- // ME-2375 remove the superfluous '@' inserted before decoration
62
- // by composition (https://github.com/ProseMirror/prosemirror/issues/903)
63
- //
64
- // Update:
65
- // Now also handles any use case with superfluous typeahead triggers (ie. '@', ':', '/')
66
- // being inserted due to composition by checking if we have the trigger
67
- // directly before the typeahead. This should not happen unless it has
68
- // been eroneously added because we require whitespace/newline for typeahead.
69
- if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head = _selection$$head.parent) !== null && _selection$$head !== void 0 && _selection$$head.textContent) && (_selection$$head$pare = (_selection$$head$pare2 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.call(_selection$$head$pare2, triggerHandler.trigger)) {
70
- tr.delete(cursorPos - 1, cursorPos);
71
- }
72
- }
73
- return tr;
74
- };
75
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setSelectionBeforeQuery = void 0;
7
- var _state = require("@atlaskit/editor-prosemirror/state");
8
- var setSelectionBeforeQuery = exports.setSelectionBeforeQuery = function setSelectionBeforeQuery(rawText) {
9
- return function (tr) {
10
- var currentPosition = tr.selection.$from.pos;
11
- var positionBeforeRawText = Math.max(currentPosition - rawText.length, 0);
12
- var resolvedPositionBeforeText = tr.doc.resolve(positionBeforeRawText);
13
- var nextSelection = _state.TextSelection.findFrom(resolvedPositionBeforeText, -1, true);
14
- if (nextSelection) {
15
- tr.setSelection(nextSelection);
16
- }
17
- };
18
- };
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,120 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.AssistiveText = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _debounce = _interopRequireDefault(require("lodash/debounce"));
16
- var _react = _interopRequireDefault(require("react"));
17
- var _react2 = require("@emotion/react");
18
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
19
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
20
- var statusDebounceMillis = 1400;
21
- var assitiveTextStyles = (0, _react2.css)({
22
- border: 0,
23
- clip: 'rect(0 0 0 0)',
24
- height: '1px',
25
- marginbottom: '-1px',
26
- marginright: '-1px',
27
- overflow: 'hidden',
28
- padding: 0,
29
- position: 'absolute',
30
- whitespace: 'nowrap',
31
- width: '1px'
32
- });
33
- var AssistveTextComponent = /*#__PURE__*/function (_React$Component) {
34
- (0, _inherits2.default)(AssistveTextComponent, _React$Component);
35
- var _super = _createSuper(AssistveTextComponent);
36
- function AssistveTextComponent() {
37
- var _this;
38
- (0, _classCallCheck2.default)(this, AssistveTextComponent);
39
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
40
- args[_key] = arguments[_key];
41
- }
42
- _this = _super.call.apply(_super, [this].concat(args));
43
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
44
- bump: false,
45
- //when the same text needs to be read again, Hence it needs to be toggled between __status--A and __status--B
46
- debounced: false,
47
- silenced: false
48
- });
49
- return _this;
50
- }
51
- (0, _createClass2.default)(AssistveTextComponent, [{
52
- key: "componentWillMount",
53
- value: function componentWillMount() {
54
- var _this2 = this;
55
- this.debounceStatusUpdate = (0, _debounce.default)(function () {
56
- if (!_this2.state.debounced) {
57
- var shouldSilence = !_this2.props.isInFocus;
58
- _this2.setState(function (_ref) {
59
- var bump = _ref.bump;
60
- return {
61
- bump: !bump,
62
- debounced: true,
63
- silenced: shouldSilence
64
- };
65
- });
66
- }
67
- }, statusDebounceMillis);
68
- }
69
- }, {
70
- key: "componentWillUnmount",
71
- value: function componentWillUnmount() {
72
- this.debounceStatusUpdate.cancel();
73
- }
74
- }, {
75
- key: "componentWillReceiveProps",
76
- value: function componentWillReceiveProps() {
77
- this.setState(function (_ref2) {
78
- var bump = _ref2.bump;
79
- return {
80
- bump: !bump,
81
- debounced: false
82
- };
83
- });
84
- }
85
- }, {
86
- key: "render",
87
- value: function render() {
88
- var _this$props = this.props,
89
- assistiveText = _this$props.assistiveText,
90
- id = _this$props.id;
91
- var _this$state = this.state,
92
- bump = _this$state.bump,
93
- debounced = _this$state.debounced,
94
- silenced = _this$state.silenced;
95
- this.debounceStatusUpdate();
96
- return (0, _react2.jsx)("div", {
97
- css: assitiveTextStyles
98
- }, (0, _react2.jsx)("div", {
99
- id: id + '__status--A',
100
- role: "status",
101
- "aria-atomic": "true",
102
- "aria-live": "polite"
103
- }, "".concat(!silenced && debounced && bump ? assistiveText : '')), (0, _react2.jsx)("div", {
104
- id: id + '__status--B',
105
- role: "status",
106
- "aria-atomic": "true",
107
- "aria-live": "polite"
108
- }, "".concat(!silenced && debounced && !bump ? assistiveText : '')));
109
- }
110
- }]);
111
- return AssistveTextComponent;
112
- }(_react.default.Component);
113
- (0, _defineProperty2.default)(AssistveTextComponent, "defaultProps", {
114
- statusDebounceMillis: 1400,
115
- debounce: true,
116
- assistiveText: '',
117
- isInFocus: false,
118
- id: ''
119
- });
120
- var AssistiveText = exports.AssistiveText = AssistveTextComponent;