@atlaskit/adf-schema 19.2.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 (430) hide show
  1. package/CHANGELOG.md +1524 -0
  2. package/LICENSE +13 -0
  3. package/build/tsconfig.json +17 -0
  4. package/dist/cjs/index.js +1089 -0
  5. package/dist/cjs/schema/bitbucket-schema.js +14 -0
  6. package/dist/cjs/schema/confluence-schema.js +21 -0
  7. package/dist/cjs/schema/create-schema.js +354 -0
  8. package/dist/cjs/schema/default-schema.js +52 -0
  9. package/dist/cjs/schema/groups.js +35 -0
  10. package/dist/cjs/schema/index.js +755 -0
  11. package/dist/cjs/schema/inline-nodes.js +20 -0
  12. package/dist/cjs/schema/jira-schema.js +118 -0
  13. package/dist/cjs/schema/marks/alignment.js +39 -0
  14. package/dist/cjs/schema/marks/annotation.js +96 -0
  15. package/dist/cjs/schema/marks/breakout.js +32 -0
  16. package/dist/cjs/schema/marks/code.js +46 -0
  17. package/dist/cjs/schema/marks/confluence-inline-comment.js +30 -0
  18. package/dist/cjs/schema/marks/data-consumer.js +71 -0
  19. package/dist/cjs/schema/marks/em.js +25 -0
  20. package/dist/cjs/schema/marks/indentation.js +32 -0
  21. package/dist/cjs/schema/marks/index.js +189 -0
  22. package/dist/cjs/schema/marks/link.js +128 -0
  23. package/dist/cjs/schema/marks/strike.js +29 -0
  24. package/dist/cjs/schema/marks/strong.js +37 -0
  25. package/dist/cjs/schema/marks/subsup.js +61 -0
  26. package/dist/cjs/schema/marks/text-color.js +93 -0
  27. package/dist/cjs/schema/marks/type-ahead-query.js +31 -0
  28. package/dist/cjs/schema/marks/underline.js +25 -0
  29. package/dist/cjs/schema/marks/unsupported-mark.js +15 -0
  30. package/dist/cjs/schema/marks/unsupported-node-attributes.js +16 -0
  31. package/dist/cjs/schema/nodes/block-card.js +56 -0
  32. package/dist/cjs/schema/nodes/blockquote.js +23 -0
  33. package/dist/cjs/schema/nodes/bodied-extension.js +66 -0
  34. package/dist/cjs/schema/nodes/bullet-list.js +29 -0
  35. package/dist/cjs/schema/nodes/caption.js +27 -0
  36. package/dist/cjs/schema/nodes/code-block.js +160 -0
  37. package/dist/cjs/schema/nodes/confluence-jira-issue.js +54 -0
  38. package/dist/cjs/schema/nodes/confluence-unsupported-block.js +33 -0
  39. package/dist/cjs/schema/nodes/confluence-unsupported-inline.js +34 -0
  40. package/dist/cjs/schema/nodes/date.js +36 -0
  41. package/dist/cjs/schema/nodes/decision-item.js +45 -0
  42. package/dist/cjs/schema/nodes/decision-list.js +45 -0
  43. package/dist/cjs/schema/nodes/doc.js +15 -0
  44. package/dist/cjs/schema/nodes/embed-card.js +62 -0
  45. package/dist/cjs/schema/nodes/emoji.js +73 -0
  46. package/dist/cjs/schema/nodes/expand.js +86 -0
  47. package/dist/cjs/schema/nodes/extension.js +59 -0
  48. package/dist/cjs/schema/nodes/hard-break.js +22 -0
  49. package/dist/cjs/schema/nodes/heading.js +69 -0
  50. package/dist/cjs/schema/nodes/image.js +40 -0
  51. package/dist/cjs/schema/nodes/index.js +539 -0
  52. package/dist/cjs/schema/nodes/inline-card.js +64 -0
  53. package/dist/cjs/schema/nodes/inline-extension.js +54 -0
  54. package/dist/cjs/schema/nodes/layout-column.js +53 -0
  55. package/dist/cjs/schema/nodes/layout-section.js +61 -0
  56. package/dist/cjs/schema/nodes/list-item.js +25 -0
  57. package/dist/cjs/schema/nodes/media-group.js +29 -0
  58. package/dist/cjs/schema/nodes/media-inline.js +11 -0
  59. package/dist/cjs/schema/nodes/media-single.js +101 -0
  60. package/dist/cjs/schema/nodes/media.js +196 -0
  61. package/dist/cjs/schema/nodes/mention.js +90 -0
  62. package/dist/cjs/schema/nodes/nested-expand.js +64 -0
  63. package/dist/cjs/schema/nodes/ordered-list.js +29 -0
  64. package/dist/cjs/schema/nodes/panel.js +85 -0
  65. package/dist/cjs/schema/nodes/paragraph.js +45 -0
  66. package/dist/cjs/schema/nodes/placeholder.js +39 -0
  67. package/dist/cjs/schema/nodes/rule.js +21 -0
  68. package/dist/cjs/schema/nodes/status.js +56 -0
  69. package/dist/cjs/schema/nodes/tableNodes.js +276 -0
  70. package/dist/cjs/schema/nodes/task-item.js +46 -0
  71. package/dist/cjs/schema/nodes/task-list.js +45 -0
  72. package/dist/cjs/schema/nodes/text.js +17 -0
  73. package/dist/cjs/schema/nodes/types/block-content.js +5 -0
  74. package/dist/cjs/schema/nodes/types/extensions.js +5 -0
  75. package/dist/cjs/schema/nodes/types/inline-content.js +5 -0
  76. package/dist/cjs/schema/nodes/types/mark.js +5 -0
  77. package/dist/cjs/schema/nodes/types/non-nestable-block-content.js +5 -0
  78. package/dist/cjs/schema/nodes/types/rich-media-common.js +5 -0
  79. package/dist/cjs/schema/nodes/unknown-block.js +21 -0
  80. package/dist/cjs/schema/nodes/unsupported-block.js +33 -0
  81. package/dist/cjs/schema/nodes/unsupported-inline.js +32 -0
  82. package/dist/cjs/schema/unsupported.js +8 -0
  83. package/dist/cjs/steps/analytics.js +183 -0
  84. package/dist/cjs/steps/set-attrs.js +106 -0
  85. package/dist/cjs/steps/table/add-column.js +453 -0
  86. package/dist/cjs/steps/table/constants.js +13 -0
  87. package/dist/cjs/steps/table/sort-column.js +87 -0
  88. package/dist/cjs/steps/table/types.js +5 -0
  89. package/dist/cjs/steps/table/utils/cell-step.js +233 -0
  90. package/dist/cjs/steps/table/utils/cells-at-column.js +94 -0
  91. package/dist/cjs/steps/table/utils/find-column.js +94 -0
  92. package/dist/cjs/steps/table/utils/get-table-rect-from-doc.js +38 -0
  93. package/dist/cjs/steps/table/utils/side-effects/rows.js +370 -0
  94. package/dist/cjs/steps/table/utils/side-effects/side-effects.js +106 -0
  95. package/dist/cjs/steps/table/utils/side-effects/table.js +126 -0
  96. package/dist/cjs/steps/table/utils/side-effects/types.js +5 -0
  97. package/dist/cjs/steps/table/utils/table-map.js +36 -0
  98. package/dist/cjs/steps/type-ahead.js +134 -0
  99. package/dist/cjs/steps.js +59 -0
  100. package/dist/cjs/utils/colors.js +234 -0
  101. package/dist/cjs/utils/confluence/emoji.js +97 -0
  102. package/dist/cjs/utils/extensions.js +39 -0
  103. package/dist/cjs/utils/index.js +373 -0
  104. package/dist/cjs/utils/parseDOM.js +12 -0
  105. package/dist/cjs/utils/url.js +38 -0
  106. package/dist/cjs/utils/uuid.js +28 -0
  107. package/dist/cjs/version.json +5 -0
  108. package/dist/es2019/index.js +2 -0
  109. package/dist/es2019/schema/bitbucket-schema.js +5 -0
  110. package/dist/es2019/schema/confluence-schema.js +11 -0
  111. package/dist/es2019/schema/create-schema.js +325 -0
  112. package/dist/es2019/schema/default-schema.js +35 -0
  113. package/dist/es2019/schema/groups.js +23 -0
  114. package/dist/es2019/schema/index.js +9 -0
  115. package/dist/es2019/schema/inline-nodes.js +3 -0
  116. package/dist/es2019/schema/jira-schema.js +88 -0
  117. package/dist/es2019/schema/marks/alignment.js +32 -0
  118. package/dist/es2019/schema/marks/annotation.js +80 -0
  119. package/dist/es2019/schema/marks/breakout.js +29 -0
  120. package/dist/es2019/schema/marks/code.js +43 -0
  121. package/dist/es2019/schema/marks/confluence-inline-comment.js +24 -0
  122. package/dist/es2019/schema/marks/data-consumer.js +61 -0
  123. package/dist/es2019/schema/marks/em.js +22 -0
  124. package/dist/es2019/schema/marks/indentation.js +27 -0
  125. package/dist/es2019/schema/marks/index.js +17 -0
  126. package/dist/es2019/schema/marks/link.js +105 -0
  127. package/dist/es2019/schema/marks/strike.js +24 -0
  128. package/dist/es2019/schema/marks/strong.js +40 -0
  129. package/dist/es2019/schema/marks/subsup.js +51 -0
  130. package/dist/es2019/schema/marks/text-color.js +67 -0
  131. package/dist/es2019/schema/marks/type-ahead-query.js +23 -0
  132. package/dist/es2019/schema/marks/underline.js +20 -0
  133. package/dist/es2019/schema/marks/unsupported-mark.js +9 -0
  134. package/dist/es2019/schema/marks/unsupported-node-attributes.js +10 -0
  135. package/dist/es2019/schema/nodes/block-card.js +50 -0
  136. package/dist/es2019/schema/nodes/blockquote.js +17 -0
  137. package/dist/es2019/schema/nodes/bodied-extension.js +58 -0
  138. package/dist/es2019/schema/nodes/bullet-list.js +23 -0
  139. package/dist/es2019/schema/nodes/caption.js +21 -0
  140. package/dist/es2019/schema/nodes/code-block.js +143 -0
  141. package/dist/es2019/schema/nodes/confluence-jira-issue.js +49 -0
  142. package/dist/es2019/schema/nodes/confluence-unsupported-block.js +30 -0
  143. package/dist/es2019/schema/nodes/confluence-unsupported-inline.js +31 -0
  144. package/dist/es2019/schema/nodes/date.js +28 -0
  145. package/dist/es2019/schema/nodes/decision-item.js +37 -0
  146. package/dist/es2019/schema/nodes/decision-list.js +41 -0
  147. package/dist/es2019/schema/nodes/doc.js +7 -0
  148. package/dist/es2019/schema/nodes/embed-card.js +55 -0
  149. package/dist/es2019/schema/nodes/emoji.js +67 -0
  150. package/dist/es2019/schema/nodes/expand.js +73 -0
  151. package/dist/es2019/schema/nodes/extension.js +51 -0
  152. package/dist/es2019/schema/nodes/hard-break.js +16 -0
  153. package/dist/es2019/schema/nodes/heading.js +63 -0
  154. package/dist/es2019/schema/nodes/image.js +37 -0
  155. package/dist/es2019/schema/nodes/index.js +44 -0
  156. package/dist/es2019/schema/nodes/inline-card.js +58 -0
  157. package/dist/es2019/schema/nodes/inline-extension.js +46 -0
  158. package/dist/es2019/schema/nodes/layout-column.js +49 -0
  159. package/dist/es2019/schema/nodes/layout-section.js +56 -0
  160. package/dist/es2019/schema/nodes/list-item.js +20 -0
  161. package/dist/es2019/schema/nodes/media-group.js +23 -0
  162. package/dist/es2019/schema/nodes/media-inline.js +2 -0
  163. package/dist/es2019/schema/nodes/media-single.js +77 -0
  164. package/dist/es2019/schema/nodes/media.js +165 -0
  165. package/dist/es2019/schema/nodes/mention.js +81 -0
  166. package/dist/es2019/schema/nodes/nested-expand.js +58 -0
  167. package/dist/es2019/schema/nodes/ordered-list.js +23 -0
  168. package/dist/es2019/schema/nodes/panel.js +79 -0
  169. package/dist/es2019/schema/nodes/paragraph.js +39 -0
  170. package/dist/es2019/schema/nodes/placeholder.js +33 -0
  171. package/dist/es2019/schema/nodes/rule.js +15 -0
  172. package/dist/es2019/schema/nodes/status.js +54 -0
  173. package/dist/es2019/schema/nodes/tableNodes.js +222 -0
  174. package/dist/es2019/schema/nodes/task-item.js +38 -0
  175. package/dist/es2019/schema/nodes/task-list.js +37 -0
  176. package/dist/es2019/schema/nodes/text.js +7 -0
  177. package/dist/es2019/schema/nodes/types/block-content.js +1 -0
  178. package/dist/es2019/schema/nodes/types/extensions.js +1 -0
  179. package/dist/es2019/schema/nodes/types/inline-content.js +1 -0
  180. package/dist/es2019/schema/nodes/types/mark.js +1 -0
  181. package/dist/es2019/schema/nodes/types/non-nestable-block-content.js +1 -0
  182. package/dist/es2019/schema/nodes/types/rich-media-common.js +1 -0
  183. package/dist/es2019/schema/nodes/unknown-block.js +16 -0
  184. package/dist/es2019/schema/nodes/unsupported-block.js +26 -0
  185. package/dist/es2019/schema/nodes/unsupported-inline.js +25 -0
  186. package/dist/es2019/schema/unsupported.js +1 -0
  187. package/dist/es2019/steps/analytics.js +122 -0
  188. package/dist/es2019/steps/set-attrs.js +57 -0
  189. package/dist/es2019/steps/table/add-column.js +349 -0
  190. package/dist/es2019/steps/table/constants.js +6 -0
  191. package/dist/es2019/steps/table/sort-column.js +41 -0
  192. package/dist/es2019/steps/table/types.js +1 -0
  193. package/dist/es2019/steps/table/utils/cell-step.js +204 -0
  194. package/dist/es2019/steps/table/utils/cells-at-column.js +57 -0
  195. package/dist/es2019/steps/table/utils/find-column.js +86 -0
  196. package/dist/es2019/steps/table/utils/get-table-rect-from-doc.js +30 -0
  197. package/dist/es2019/steps/table/utils/side-effects/rows.js +297 -0
  198. package/dist/es2019/steps/table/utils/side-effects/side-effects.js +81 -0
  199. package/dist/es2019/steps/table/utils/side-effects/table.js +99 -0
  200. package/dist/es2019/steps/table/utils/side-effects/types.js +1 -0
  201. package/dist/es2019/steps/table/utils/table-map.js +19 -0
  202. package/dist/es2019/steps/type-ahead.js +85 -0
  203. package/dist/es2019/steps.js +6 -0
  204. package/dist/es2019/utils/colors.js +148 -0
  205. package/dist/es2019/utils/confluence/emoji.js +83 -0
  206. package/dist/es2019/utils/extensions.js +26 -0
  207. package/dist/es2019/utils/index.js +4 -0
  208. package/dist/es2019/utils/parseDOM.js +1 -0
  209. package/dist/es2019/utils/url.js +19 -0
  210. package/dist/es2019/utils/uuid.js +18 -0
  211. package/dist/es2019/version.json +5 -0
  212. package/dist/esm/index.js +2 -0
  213. package/dist/esm/schema/bitbucket-schema.js +5 -0
  214. package/dist/esm/schema/confluence-schema.js +11 -0
  215. package/dist/esm/schema/create-schema.js +338 -0
  216. package/dist/esm/schema/default-schema.js +36 -0
  217. package/dist/esm/schema/groups.js +23 -0
  218. package/dist/esm/schema/index.js +9 -0
  219. package/dist/esm/schema/inline-nodes.js +5 -0
  220. package/dist/esm/schema/jira-schema.js +88 -0
  221. package/dist/esm/schema/marks/alignment.js +30 -0
  222. package/dist/esm/schema/marks/annotation.js +82 -0
  223. package/dist/esm/schema/marks/breakout.js +25 -0
  224. package/dist/esm/schema/marks/code.js +41 -0
  225. package/dist/esm/schema/marks/confluence-inline-comment.js +22 -0
  226. package/dist/esm/schema/marks/data-consumer.js +63 -0
  227. package/dist/esm/schema/marks/em.js +20 -0
  228. package/dist/esm/schema/marks/indentation.js +23 -0
  229. package/dist/esm/schema/marks/index.js +17 -0
  230. package/dist/esm/schema/marks/link.js +113 -0
  231. package/dist/esm/schema/marks/strike.js +24 -0
  232. package/dist/esm/schema/marks/strong.js +32 -0
  233. package/dist/esm/schema/marks/subsup.js +53 -0
  234. package/dist/esm/schema/marks/text-color.js +78 -0
  235. package/dist/esm/schema/marks/type-ahead-query.js +21 -0
  236. package/dist/esm/schema/marks/underline.js +20 -0
  237. package/dist/esm/schema/marks/unsupported-mark.js +8 -0
  238. package/dist/esm/schema/marks/unsupported-node-attributes.js +9 -0
  239. package/dist/esm/schema/nodes/block-card.js +48 -0
  240. package/dist/esm/schema/nodes/blockquote.js +15 -0
  241. package/dist/esm/schema/nodes/bodied-extension.js +58 -0
  242. package/dist/esm/schema/nodes/bullet-list.js +21 -0
  243. package/dist/esm/schema/nodes/caption.js +19 -0
  244. package/dist/esm/schema/nodes/code-block.js +149 -0
  245. package/dist/esm/schema/nodes/confluence-jira-issue.js +47 -0
  246. package/dist/esm/schema/nodes/confluence-unsupported-block.js +26 -0
  247. package/dist/esm/schema/nodes/confluence-unsupported-inline.js +27 -0
  248. package/dist/esm/schema/nodes/date.js +28 -0
  249. package/dist/esm/schema/nodes/decision-item.js +36 -0
  250. package/dist/esm/schema/nodes/decision-list.js +39 -0
  251. package/dist/esm/schema/nodes/doc.js +7 -0
  252. package/dist/esm/schema/nodes/embed-card.js +54 -0
  253. package/dist/esm/schema/nodes/emoji.js +68 -0
  254. package/dist/esm/schema/nodes/expand.js +75 -0
  255. package/dist/esm/schema/nodes/extension.js +51 -0
  256. package/dist/esm/schema/nodes/hard-break.js +14 -0
  257. package/dist/esm/schema/nodes/heading.js +61 -0
  258. package/dist/esm/schema/nodes/image.js +33 -0
  259. package/dist/esm/schema/nodes/index.js +44 -0
  260. package/dist/esm/schema/nodes/inline-card.js +56 -0
  261. package/dist/esm/schema/nodes/inline-extension.js +46 -0
  262. package/dist/esm/schema/nodes/layout-column.js +45 -0
  263. package/dist/esm/schema/nodes/layout-section.js +52 -0
  264. package/dist/esm/schema/nodes/list-item.js +18 -0
  265. package/dist/esm/schema/nodes/media-group.js +21 -0
  266. package/dist/esm/schema/nodes/media-inline.js +2 -0
  267. package/dist/esm/schema/nodes/media-single.js +84 -0
  268. package/dist/esm/schema/nodes/media.js +174 -0
  269. package/dist/esm/schema/nodes/mention.js +80 -0
  270. package/dist/esm/schema/nodes/nested-expand.js +56 -0
  271. package/dist/esm/schema/nodes/ordered-list.js +21 -0
  272. package/dist/esm/schema/nodes/panel.js +76 -0
  273. package/dist/esm/schema/nodes/paragraph.js +37 -0
  274. package/dist/esm/schema/nodes/placeholder.js +31 -0
  275. package/dist/esm/schema/nodes/rule.js +13 -0
  276. package/dist/esm/schema/nodes/status.js +51 -0
  277. package/dist/esm/schema/nodes/tableNodes.js +238 -0
  278. package/dist/esm/schema/nodes/task-item.js +37 -0
  279. package/dist/esm/schema/nodes/task-list.js +35 -0
  280. package/dist/esm/schema/nodes/text.js +9 -0
  281. package/dist/esm/schema/nodes/types/block-content.js +1 -0
  282. package/dist/esm/schema/nodes/types/extensions.js +1 -0
  283. package/dist/esm/schema/nodes/types/inline-content.js +1 -0
  284. package/dist/esm/schema/nodes/types/mark.js +1 -0
  285. package/dist/esm/schema/nodes/types/non-nestable-block-content.js +1 -0
  286. package/dist/esm/schema/nodes/types/rich-media-common.js +1 -0
  287. package/dist/esm/schema/nodes/unknown-block.js +14 -0
  288. package/dist/esm/schema/nodes/unsupported-block.js +26 -0
  289. package/dist/esm/schema/nodes/unsupported-inline.js +25 -0
  290. package/dist/esm/schema/unsupported.js +1 -0
  291. package/dist/esm/steps/analytics.js +166 -0
  292. package/dist/esm/steps/set-attrs.js +89 -0
  293. package/dist/esm/steps/table/add-column.js +431 -0
  294. package/dist/esm/steps/table/constants.js +6 -0
  295. package/dist/esm/steps/table/sort-column.js +69 -0
  296. package/dist/esm/steps/table/types.js +1 -0
  297. package/dist/esm/steps/table/utils/cell-step.js +216 -0
  298. package/dist/esm/steps/table/utils/cells-at-column.js +84 -0
  299. package/dist/esm/steps/table/utils/find-column.js +87 -0
  300. package/dist/esm/steps/table/utils/get-table-rect-from-doc.js +30 -0
  301. package/dist/esm/steps/table/utils/side-effects/rows.js +360 -0
  302. package/dist/esm/steps/table/utils/side-effects/side-effects.js +93 -0
  303. package/dist/esm/steps/table/utils/side-effects/table.js +113 -0
  304. package/dist/esm/steps/table/utils/side-effects/types.js +1 -0
  305. package/dist/esm/steps/table/utils/table-map.js +19 -0
  306. package/dist/esm/steps/type-ahead.js +117 -0
  307. package/dist/esm/steps.js +6 -0
  308. package/dist/esm/utils/colors.js +160 -0
  309. package/dist/esm/utils/confluence/emoji.js +85 -0
  310. package/dist/esm/utils/extensions.js +27 -0
  311. package/dist/esm/utils/index.js +4 -0
  312. package/dist/esm/utils/parseDOM.js +3 -0
  313. package/dist/esm/utils/url.js +21 -0
  314. package/dist/esm/utils/uuid.js +18 -0
  315. package/dist/esm/version.json +5 -0
  316. package/dist/json-schema/v1/full.json +2536 -0
  317. package/dist/json-schema/v1/stage-0.json +2737 -0
  318. package/dist/types/index.d.ts +4 -0
  319. package/dist/types/schema/bitbucket-schema.d.ts +2 -0
  320. package/dist/types/schema/confluence-schema.d.ts +3 -0
  321. package/dist/types/schema/create-schema.d.ts +31 -0
  322. package/dist/types/schema/default-schema.d.ts +7 -0
  323. package/dist/types/schema/groups.d.ts +6 -0
  324. package/dist/types/schema/index.d.ts +11 -0
  325. package/dist/types/schema/inline-nodes.d.ts +1 -0
  326. package/dist/types/schema/jira-schema.d.ts +26 -0
  327. package/dist/types/schema/marks/alignment.d.ts +16 -0
  328. package/dist/types/schema/marks/annotation.d.ts +32 -0
  329. package/dist/types/schema/marks/breakout.d.ts +12 -0
  330. package/dist/types/schema/marks/code.d.ts +8 -0
  331. package/dist/types/schema/marks/confluence-inline-comment.d.ts +12 -0
  332. package/dist/types/schema/marks/data-consumer.d.ts +41 -0
  333. package/dist/types/schema/marks/em.d.ts +8 -0
  334. package/dist/types/schema/marks/indentation.d.ts +16 -0
  335. package/dist/types/schema/marks/index.d.ts +30 -0
  336. package/dist/types/schema/marks/link.d.ts +32 -0
  337. package/dist/types/schema/marks/strike.d.ts +8 -0
  338. package/dist/types/schema/marks/strong.d.ts +8 -0
  339. package/dist/types/schema/marks/subsup.d.ts +15 -0
  340. package/dist/types/schema/marks/text-color.d.ts +21 -0
  341. package/dist/types/schema/marks/type-ahead-query.d.ts +2 -0
  342. package/dist/types/schema/marks/underline.d.ts +8 -0
  343. package/dist/types/schema/marks/unsupported-mark.d.ts +2 -0
  344. package/dist/types/schema/marks/unsupported-node-attributes.d.ts +2 -0
  345. package/dist/types/schema/nodes/block-card.d.ts +19 -0
  346. package/dist/types/schema/nodes/blockquote.d.ts +14 -0
  347. package/dist/types/schema/nodes/bodied-extension.d.ts +27 -0
  348. package/dist/types/schema/nodes/bullet-list.d.ts +14 -0
  349. package/dist/types/schema/nodes/caption.d.ts +21 -0
  350. package/dist/types/schema/nodes/code-block.d.ts +31 -0
  351. package/dist/types/schema/nodes/confluence-jira-issue.d.ts +2 -0
  352. package/dist/types/schema/nodes/confluence-unsupported-block.d.ts +2 -0
  353. package/dist/types/schema/nodes/confluence-unsupported-inline.d.ts +2 -0
  354. package/dist/types/schema/nodes/date.d.ts +14 -0
  355. package/dist/types/schema/nodes/decision-item.d.ts +17 -0
  356. package/dist/types/schema/nodes/decision-list.d.ts +18 -0
  357. package/dist/types/schema/nodes/doc.d.ts +18 -0
  358. package/dist/types/schema/nodes/embed-card.d.ts +15 -0
  359. package/dist/types/schema/nodes/emoji.d.ts +14 -0
  360. package/dist/types/schema/nodes/expand.d.ts +33 -0
  361. package/dist/types/schema/nodes/extension.d.ts +21 -0
  362. package/dist/types/schema/nodes/hard-break.d.ts +11 -0
  363. package/dist/types/schema/nodes/heading.d.ts +36 -0
  364. package/dist/types/schema/nodes/image.d.ts +2 -0
  365. package/dist/types/schema/nodes/index.d.ts +93 -0
  366. package/dist/types/schema/nodes/inline-card.d.ts +19 -0
  367. package/dist/types/schema/nodes/inline-extension.d.ts +21 -0
  368. package/dist/types/schema/nodes/layout-column.d.ts +21 -0
  369. package/dist/types/schema/nodes/layout-section.d.ts +44 -0
  370. package/dist/types/schema/nodes/list-item.d.ts +20 -0
  371. package/dist/types/schema/nodes/media-group.d.ts +14 -0
  372. package/dist/types/schema/nodes/media-inline.d.ts +16 -0
  373. package/dist/types/schema/nodes/media-single.d.ts +59 -0
  374. package/dist/types/schema/nodes/media.d.ts +60 -0
  375. package/dist/types/schema/nodes/mention.d.ts +26 -0
  376. package/dist/types/schema/nodes/nested-expand.d.ts +27 -0
  377. package/dist/types/schema/nodes/ordered-list.d.ts +20 -0
  378. package/dist/types/schema/nodes/panel.d.ts +46 -0
  379. package/dist/types/schema/nodes/paragraph.d.ts +37 -0
  380. package/dist/types/schema/nodes/placeholder.d.ts +11 -0
  381. package/dist/types/schema/nodes/rule.d.ts +8 -0
  382. package/dist/types/schema/nodes/status.d.ts +20 -0
  383. package/dist/types/schema/nodes/tableNodes.d.ts +111 -0
  384. package/dist/types/schema/nodes/task-item.d.ts +17 -0
  385. package/dist/types/schema/nodes/task-list.d.ts +21 -0
  386. package/dist/types/schema/nodes/text.d.ts +15 -0
  387. package/dist/types/schema/nodes/types/block-content.d.ts +22 -0
  388. package/dist/types/schema/nodes/types/extensions.d.ts +34 -0
  389. package/dist/types/schema/nodes/types/inline-content.d.ts +32 -0
  390. package/dist/types/schema/nodes/types/mark.d.ts +15 -0
  391. package/dist/types/schema/nodes/types/non-nestable-block-content.d.ts +20 -0
  392. package/dist/types/schema/nodes/types/rich-media-common.d.ts +9 -0
  393. package/dist/types/schema/nodes/unknown-block.d.ts +3 -0
  394. package/dist/types/schema/nodes/unsupported-block.d.ts +2 -0
  395. package/dist/types/schema/nodes/unsupported-inline.d.ts +2 -0
  396. package/dist/types/schema/unsupported.d.ts +1 -0
  397. package/dist/types/steps/analytics.d.ts +59 -0
  398. package/dist/types/steps/set-attrs.d.ts +23 -0
  399. package/dist/types/steps/table/add-column.d.ts +88 -0
  400. package/dist/types/steps/table/constants.d.ts +4 -0
  401. package/dist/types/steps/table/sort-column.d.ts +18 -0
  402. package/dist/types/steps/table/types.d.ts +39 -0
  403. package/dist/types/steps/table/utils/cell-step.d.ts +47 -0
  404. package/dist/types/steps/table/utils/cells-at-column.d.ts +20 -0
  405. package/dist/types/steps/table/utils/find-column.d.ts +8 -0
  406. package/dist/types/steps/table/utils/get-table-rect-from-doc.d.ts +8 -0
  407. package/dist/types/steps/table/utils/side-effects/rows.d.ts +25 -0
  408. package/dist/types/steps/table/utils/side-effects/side-effects.d.ts +15 -0
  409. package/dist/types/steps/table/utils/side-effects/table.d.ts +16 -0
  410. package/dist/types/steps/table/utils/side-effects/types.d.ts +33 -0
  411. package/dist/types/steps/table/utils/table-map.d.ts +6 -0
  412. package/dist/types/steps/type-ahead.d.ts +35 -0
  413. package/dist/types/steps.d.ts +8 -0
  414. package/dist/types/utils/colors.d.ts +71 -0
  415. package/dist/types/utils/confluence/emoji.d.ts +50 -0
  416. package/dist/types/utils/extensions.d.ts +3 -0
  417. package/dist/types/utils/index.d.ts +6 -0
  418. package/dist/types/utils/parseDOM.d.ts +1 -0
  419. package/dist/types/utils/url.d.ts +15 -0
  420. package/dist/types/utils/uuid.d.ts +5 -0
  421. package/document-fixtures/unsupported-content.json +526 -0
  422. package/json-schema/v1/full.json +2536 -0
  423. package/json-schema/v1/stage-0.json +2737 -0
  424. package/package.json +63 -0
  425. package/steps/package.json +7 -0
  426. package/test-helpers/html-helpers.ts +40 -0
  427. package/test-helpers/matches.ts +8 -0
  428. package/test-helpers/schema-builder.ts +329 -0
  429. package/test-helpers/schema.ts +79 -0
  430. package/tsconfig.json +18 -0
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toJSON = exports.mention = exports.USER_TYPES = void 0;
7
+ var USER_TYPES;
8
+ exports.USER_TYPES = USER_TYPES;
9
+
10
+ (function (USER_TYPES) {
11
+ USER_TYPES["DEFAULT"] = "DEFAULT";
12
+ USER_TYPES["SPECIAL"] = "SPECIAL";
13
+ USER_TYPES["APP"] = "APP";
14
+ })(USER_TYPES || (exports.USER_TYPES = USER_TYPES = {}));
15
+
16
+ var mention = {
17
+ inline: true,
18
+ group: 'inline',
19
+ selectable: true,
20
+ attrs: {
21
+ id: {
22
+ default: ''
23
+ },
24
+ text: {
25
+ default: ''
26
+ },
27
+ accessLevel: {
28
+ default: ''
29
+ },
30
+ userType: {
31
+ default: null
32
+ }
33
+ },
34
+ parseDOM: [{
35
+ tag: 'span[data-mention-id]',
36
+ getAttrs: function getAttrs(domNode) {
37
+ var dom = domNode;
38
+ var attrs = {
39
+ id: dom.getAttribute('data-mention-id') || mention.attrs.id.default,
40
+ text: dom.textContent || mention.attrs.text.default,
41
+ accessLevel: dom.getAttribute('data-access-level') || mention.attrs.accessLevel.default
42
+ };
43
+ var userType = dom.getAttribute('data-user-type');
44
+
45
+ if (USER_TYPES[userType]) {
46
+ attrs.userType = userType;
47
+ }
48
+
49
+ return attrs;
50
+ }
51
+ }],
52
+ toDOM: function toDOM(node) {
53
+ var _node$attrs = node.attrs,
54
+ id = _node$attrs.id,
55
+ accessLevel = _node$attrs.accessLevel,
56
+ text = _node$attrs.text,
57
+ userType = _node$attrs.userType;
58
+ var attrs = {
59
+ 'data-mention-id': id,
60
+ 'data-access-level': accessLevel,
61
+ contenteditable: 'false'
62
+ };
63
+
64
+ if (userType) {
65
+ attrs['data-user-type'] = userType;
66
+ }
67
+
68
+ return ['span', attrs, text];
69
+ }
70
+ };
71
+ exports.mention = mention;
72
+
73
+ var isOptional = function isOptional(key) {
74
+ return ['userType'].indexOf(key) > -1;
75
+ };
76
+
77
+ var toJSON = function toJSON(node) {
78
+ return {
79
+ attrs: Object.keys(node.attrs).reduce(function (obj, key) {
80
+ if (isOptional(key) && !node.attrs[key]) {
81
+ return obj;
82
+ }
83
+
84
+ obj[key] = node.attrs[key];
85
+ return obj;
86
+ }, {})
87
+ };
88
+ };
89
+
90
+ exports.toJSON = toJSON;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.nestedExpand = void 0;
7
+
8
+ /**
9
+ * @name nestedExpand_content
10
+ * @minItems 1
11
+ * @allowUnsupportedBlock true
12
+ */
13
+
14
+ /**
15
+ * @name nestedExpand_node
16
+ */
17
+
18
+ /**
19
+ * @name nestedExpand_with_no_marks_node
20
+ */
21
+ var nestedExpand = {
22
+ inline: false,
23
+ marks: 'link unsupportedMark unsupportedNodeAttribute',
24
+ content: '(paragraph | heading | mediaSingle | mediaGroup | unsupportedBlock)+',
25
+ isolating: true,
26
+ selectable: true,
27
+ attrs: {
28
+ title: {
29
+ default: ''
30
+ },
31
+ __expanded: {
32
+ default: true
33
+ }
34
+ },
35
+ parseDOM: [{
36
+ context: 'nestedExpand//',
37
+ tag: '[data-node-type="nestedExpand"]',
38
+ skip: true
39
+ }, {
40
+ tag: '[data-node-type="nestedExpand"] button',
41
+ ignore: true
42
+ }, {
43
+ tag: '[data-node-type="expand"] button',
44
+ ignore: true
45
+ }, {
46
+ tag: 'div[data-node-type="nestedExpand"]',
47
+ getAttrs: function getAttrs(domNode) {
48
+ var dom = domNode;
49
+ return {
50
+ title: dom.getAttribute('data-title'),
51
+ __expanded: true
52
+ };
53
+ }
54
+ }],
55
+ toDOM: function toDOM(node) {
56
+ var attrs = {
57
+ 'data-node-type': 'nestedExpand',
58
+ 'data-title': node.attrs.title,
59
+ 'data-expanded': node.attrs.__expanded
60
+ };
61
+ return ['div', attrs, 0];
62
+ }
63
+ };
64
+ exports.nestedExpand = nestedExpand;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.orderedList = exports.orderedListSelector = void 0;
7
+ // eslint-disable-next-line import/no-cycle
8
+
9
+ /**
10
+ * @name orderedList_node
11
+ */
12
+ var orderedListSelector = '.ak-ol';
13
+ exports.orderedListSelector = orderedListSelector;
14
+ var orderedList = {
15
+ group: 'block',
16
+ content: 'listItem+',
17
+ marks: 'unsupportedMark unsupportedNodeAttribute',
18
+ selectable: false,
19
+ parseDOM: [{
20
+ tag: 'ol'
21
+ }],
22
+ toDOM: function toDOM() {
23
+ var attrs = {
24
+ class: orderedListSelector.substr(1)
25
+ };
26
+ return ['ol', attrs, 0];
27
+ }
28
+ };
29
+ exports.orderedList = orderedList;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.panel = exports.customPanel = exports.PanelType = void 0;
7
+ var PanelType;
8
+ exports.PanelType = PanelType;
9
+
10
+ (function (PanelType) {
11
+ PanelType["INFO"] = "info";
12
+ PanelType["NOTE"] = "note";
13
+ PanelType["TIP"] = "tip";
14
+ PanelType["WARNING"] = "warning";
15
+ PanelType["ERROR"] = "error";
16
+ PanelType["SUCCESS"] = "success";
17
+ PanelType["CUSTOM"] = "custom";
18
+ })(PanelType || (exports.PanelType = PanelType = {}));
19
+
20
+ //TODO: ED-10445 rename to panel and merge with the other panel node spec, after emoji panels moved to full schema
21
+ var customPanel = {
22
+ group: 'block',
23
+ content: '(paragraph | heading | bulletList | orderedList | blockCard | unsupportedBlock)+',
24
+ marks: 'unsupportedMark unsupportedNodeAttribute',
25
+ attrs: {
26
+ panelType: {
27
+ default: 'info'
28
+ },
29
+ panelIcon: {
30
+ default: null
31
+ },
32
+ panelColor: {
33
+ default: null
34
+ }
35
+ },
36
+ parseDOM: [{
37
+ tag: 'div[data-panel-type]',
38
+ getAttrs: function getAttrs(dom) {
39
+ return {
40
+ panelType: dom.getAttribute('data-panel-type'),
41
+ panelIcon: dom.getAttribute('data-panel-icon'),
42
+ panelColor: dom.getAttribute('data-panel-color')
43
+ };
44
+ }
45
+ }],
46
+ toDOM: function toDOM(node) {
47
+ var _node$attrs = node.attrs,
48
+ panelType = _node$attrs.panelType,
49
+ panelIcon = _node$attrs.panelIcon,
50
+ panelColor = _node$attrs.panelColor;
51
+ var attrs = {
52
+ 'data-panel-type': panelType,
53
+ 'data-panel-icon': panelIcon,
54
+ 'data-panel-color': panelColor
55
+ };
56
+ return ['div', attrs, ['div', {}, 0]];
57
+ }
58
+ };
59
+ exports.customPanel = customPanel;
60
+ var panel = {
61
+ group: 'block',
62
+ content: '(paragraph | heading | bulletList | orderedList | blockCard | unsupportedBlock)+',
63
+ marks: 'unsupportedMark unsupportedNodeAttribute',
64
+ attrs: {
65
+ panelType: {
66
+ default: 'info'
67
+ }
68
+ },
69
+ parseDOM: [{
70
+ tag: 'div[data-panel-type]',
71
+ getAttrs: function getAttrs(dom) {
72
+ return {
73
+ panelType: dom.getAttribute('data-panel-type')
74
+ };
75
+ }
76
+ }],
77
+ toDOM: function toDOM(node) {
78
+ var panelType = node.attrs.panelType;
79
+ var attrs = {
80
+ 'data-panel-type': panelType
81
+ };
82
+ return ['div', attrs, ['div', {}, 0]];
83
+ }
84
+ };
85
+ exports.panel = panel;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.paragraph = void 0;
7
+
8
+ /**
9
+ * @name paragraph_node
10
+ */
11
+
12
+ /**
13
+ * @name paragraph_with_no_marks_node
14
+ */
15
+
16
+ /**
17
+ * NOTE: Need this because TS is too smart and inline everything.
18
+ * So we need to give them separate identity.
19
+ * Probably there's a way to solve it but that will need time and exploration.
20
+ * // http://bit.ly/2raXFX5
21
+ * type T1 = X | Y
22
+ * type T2 = A | T1 | B // T2 = A | X | Y | B
23
+ */
24
+
25
+ /**
26
+ * @name paragraph_with_alignment_node
27
+ */
28
+
29
+ /**
30
+ * @name paragraph_with_indentation_node
31
+ */
32
+ var pDOM = ['p', 0];
33
+ var paragraph = {
34
+ selectable: false,
35
+ content: 'inline*',
36
+ group: 'block',
37
+ marks: 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer',
38
+ parseDOM: [{
39
+ tag: 'p'
40
+ }],
41
+ toDOM: function toDOM() {
42
+ return pDOM;
43
+ }
44
+ };
45
+ exports.paragraph = paragraph;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.placeholder = void 0;
7
+
8
+ /**
9
+ * @name placeholder_node
10
+ */
11
+ var placeholder = {
12
+ inline: true,
13
+ group: 'inline',
14
+ selectable: false,
15
+ marks: '',
16
+ attrs: {
17
+ text: {
18
+ default: ''
19
+ }
20
+ },
21
+ parseDOM: [{
22
+ tag: 'span[data-placeholder]',
23
+ getAttrs: function getAttrs(dom) {
24
+ return {
25
+ text: dom.getAttribute('data-placeholder') || placeholder.attrs.text.default
26
+ };
27
+ }
28
+ }],
29
+ toDOM: function toDOM(node) {
30
+ var text = node.attrs.text;
31
+ var attrs = {
32
+ 'data-placeholder': text,
33
+ // Needs to be edtiable for mobile to not close keyboard
34
+ contenteditable: 'true'
35
+ };
36
+ return ['span', attrs, text];
37
+ }
38
+ };
39
+ exports.placeholder = placeholder;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.rule = void 0;
7
+
8
+ /**
9
+ * @name rule_node
10
+ */
11
+ var hrDOM = ['hr'];
12
+ var rule = {
13
+ group: 'block',
14
+ parseDOM: [{
15
+ tag: 'hr'
16
+ }],
17
+ toDOM: function toDOM() {
18
+ return hrDOM;
19
+ }
20
+ };
21
+ exports.rule = rule;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.status = void 0;
7
+
8
+ var _uuid = require("../../utils/uuid");
9
+
10
+ var status = {
11
+ inline: true,
12
+ group: 'inline',
13
+ selectable: true,
14
+ attrs: {
15
+ text: {
16
+ default: ''
17
+ },
18
+ color: {
19
+ default: ''
20
+ },
21
+ localId: {
22
+ default: _uuid.uuid.generate()
23
+ },
24
+ style: {
25
+ default: ''
26
+ }
27
+ },
28
+ parseDOM: [{
29
+ tag: 'span[data-node-type="status"]',
30
+ getAttrs: function getAttrs(domNode) {
31
+ var dom = domNode;
32
+ return {
33
+ text: dom.textContent.replace(/\n/, '').trim(),
34
+ color: dom.getAttribute('data-color'),
35
+ localId: _uuid.uuid.generate(),
36
+ style: dom.getAttribute('data-style')
37
+ };
38
+ }
39
+ }],
40
+ toDOM: function toDOM(node) {
41
+ var _node$attrs = node.attrs,
42
+ text = _node$attrs.text,
43
+ color = _node$attrs.color,
44
+ localId = _node$attrs.localId,
45
+ style = _node$attrs.style;
46
+ var attrs = {
47
+ 'data-node-type': 'status',
48
+ 'data-color': color,
49
+ 'data-local-id': localId,
50
+ 'data-style': style,
51
+ contenteditable: 'false'
52
+ };
53
+ return ['span', attrs, text];
54
+ }
55
+ };
56
+ exports.status = status;
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.toJSONTableHeader = exports.tableHeader = exports.toJSONTableCell = exports.tableCell = exports.tableRow = exports.tableToJSON = exports.table = exports.tableBackgroundColorNames = exports.tableBackgroundBorderColor = exports.tableBackgroundColorPalette = exports.getCellDomAttrs = exports.getCellAttrs = exports.tableCellContentDomSelector = exports.tableCellContentWrapperSelector = exports.tableHeaderSelector = exports.tableCellSelector = exports.tablePrefixSelector = void 0;
9
+
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+
12
+ var _colors = require("../../utils/colors");
13
+
14
+ var _uuid = require("../../utils/uuid");
15
+
16
+ var tablePrefixSelector = 'pm-table';
17
+ exports.tablePrefixSelector = tablePrefixSelector;
18
+ var tableCellSelector = "".concat(tablePrefixSelector, "-cell-content-wrap");
19
+ exports.tableCellSelector = tableCellSelector;
20
+ var tableHeaderSelector = "".concat(tablePrefixSelector, "-header-content-wrap");
21
+ exports.tableHeaderSelector = tableHeaderSelector;
22
+ var tableCellContentWrapperSelector = "".concat(tablePrefixSelector, "-cell-nodeview-wrapper");
23
+ exports.tableCellContentWrapperSelector = tableCellContentWrapperSelector;
24
+ var tableCellContentDomSelector = "".concat(tablePrefixSelector, "-cell-nodeview-content-dom");
25
+ exports.tableCellContentDomSelector = tableCellContentDomSelector;
26
+
27
+ var DEFAULT_TABLE_HEADER_CELL_BACKGROUND = _colors.N20.toLocaleLowerCase();
28
+
29
+ var getCellAttrs = function getCellAttrs(dom) {
30
+ var defaultValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31
+ var widthAttr = dom.getAttribute('data-colwidth');
32
+ var width = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(',').map(function (str) {
33
+ return Number(str);
34
+ }) : null;
35
+ var colspan = Number(dom.getAttribute('colspan') || 1);
36
+ var backgroundColor = dom.style.backgroundColor;
37
+
38
+ if (backgroundColor && (0, _colors.isRgb)(backgroundColor)) {
39
+ var result = (0, _colors.rgbToHex)(backgroundColor);
40
+
41
+ if (result !== null) {
42
+ backgroundColor = result;
43
+ }
44
+ }
45
+
46
+ return {
47
+ colspan: colspan,
48
+ rowspan: Number(dom.getAttribute('rowspan') || 1),
49
+ colwidth: width && width.length === colspan ? width : null,
50
+ background: backgroundColor && backgroundColor !== defaultValues['background'] ? backgroundColor : null
51
+ };
52
+ };
53
+
54
+ exports.getCellAttrs = getCellAttrs;
55
+
56
+ /**
57
+ * gets cell dom attributes based on node attributes
58
+ * @returns CellDomAttrs
59
+ */
60
+ var getCellDomAttrs = function getCellDomAttrs(node) {
61
+ var attrs = {};
62
+ var nodeType = node.type.name;
63
+
64
+ if (node.attrs.colspan !== 1) {
65
+ attrs.colspan = node.attrs.colspan;
66
+ }
67
+
68
+ if (node.attrs.rowspan !== 1) {
69
+ attrs.rowspan = node.attrs.rowspan;
70
+ }
71
+
72
+ if (node.attrs.colwidth) {
73
+ attrs['data-colwidth'] = node.attrs.colwidth.join(',');
74
+ }
75
+
76
+ if (node.attrs.background) {
77
+ var background = node.attrs.background; // to ensure that we don't overwrite product's style:
78
+ // - it clears background color for <th> if its set to gray
79
+ // - it clears background color for <td> if its set to white
80
+
81
+ var ignored = nodeType === 'tableHeader' && background === tableBackgroundColorNames.get('light gray') || nodeType === 'tableCell' && background === tableBackgroundColorNames.get('white');
82
+
83
+ if (ignored) {
84
+ attrs.style = '';
85
+ } else {
86
+ var color = (0, _colors.isRgb)(background) ? (0, _colors.rgbToHex)(background) : background;
87
+ attrs.style = "".concat(attrs.style || '', "background-color: ").concat(color, ";");
88
+ attrs.colorname = tableBackgroundColorPalette.get(color);
89
+ }
90
+ }
91
+
92
+ if (nodeType === 'tableHeader') {
93
+ attrs.class = tableHeaderSelector;
94
+ } else {
95
+ attrs.class = tableCellSelector;
96
+ }
97
+
98
+ return attrs;
99
+ };
100
+
101
+ exports.getCellDomAttrs = getCellDomAttrs;
102
+ var tableBackgroundColorPalette = new Map();
103
+ exports.tableBackgroundColorPalette = tableBackgroundColorPalette;
104
+
105
+ var tableBackgroundBorderColor = (0, _colors.hexToRgba)(_colors.N800, 0.12) || _colors.N0;
106
+
107
+ exports.tableBackgroundBorderColor = tableBackgroundBorderColor;
108
+ var tableBackgroundColorNames = new Map();
109
+ exports.tableBackgroundColorNames = tableBackgroundColorNames;
110
+ [[_colors.N0, 'White'], [_colors.B50, 'Light blue'], [_colors.T50, 'Light teal'], [_colors.G50, 'Light green'], [_colors.Y50, 'Light yellow'], [_colors.R50, 'Light red'], [_colors.P50, 'Light purple'], [_colors.N20, 'Light gray'], [_colors.B75, 'Blue'], [_colors.T75, 'Teal'], [_colors.G75, 'Green'], [_colors.Y75, 'Yellow'], [_colors.R75, 'Red'], [_colors.P75, 'Purple'], [_colors.N60, 'Gray'], [_colors.B100, 'Dark blue'], [_colors.T100, 'Dark teal'], [_colors.G200, 'Dark green'], [_colors.Y200, 'Dark yellow'], [_colors.R100, 'Dark red'], [_colors.P100, 'Dark purple']].forEach(function (_ref) {
111
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
112
+ colorValue = _ref2[0],
113
+ colorName = _ref2[1];
114
+
115
+ tableBackgroundColorPalette.set(colorValue.toLowerCase(), colorName);
116
+ tableBackgroundColorNames.set(colorName.toLowerCase(), colorValue.toLowerCase());
117
+ });
118
+
119
+ // TODO: Fix any, potential issue. ED-5048
120
+ var createTableSpec = function createTableSpec() {
121
+ var attrs = {
122
+ isNumberColumnEnabled: {
123
+ default: false
124
+ },
125
+ layout: {
126
+ default: 'default'
127
+ },
128
+ __autoSize: {
129
+ default: false
130
+ },
131
+ localId: {
132
+ default: ''
133
+ }
134
+ };
135
+ var tableNodeSpec = {
136
+ content: 'tableRow+',
137
+ attrs: attrs,
138
+ marks: 'unsupportedMark unsupportedNodeAttribute',
139
+ tableRole: 'table',
140
+ isolating: true,
141
+ selectable: false,
142
+ group: 'block',
143
+ parseDOM: [{
144
+ tag: 'table',
145
+ getAttrs: function getAttrs(node) {
146
+ var _dom$parentElement;
147
+
148
+ var dom = node;
149
+ var breakoutWrapper = (_dom$parentElement = dom.parentElement) === null || _dom$parentElement === void 0 ? void 0 : _dom$parentElement.parentElement;
150
+ return {
151
+ isNumberColumnEnabled: dom.getAttribute('data-number-column') === 'true' ? true : false,
152
+ layout: // copying from editor
153
+ dom.getAttribute('data-layout') || ( // copying from renderer
154
+ breakoutWrapper === null || breakoutWrapper === void 0 ? void 0 : breakoutWrapper.getAttribute('data-layout')) || 'default',
155
+ __autoSize: dom.getAttribute('data-autosize') === 'true' ? true : false,
156
+ localId: dom.getAttribute('data-table-local-id') || _uuid.uuid.generate()
157
+ };
158
+ }
159
+ }],
160
+ toDOM: function toDOM(node) {
161
+ var attrs = {
162
+ 'data-number-column': node.attrs.isNumberColumnEnabled,
163
+ 'data-layout': node.attrs.layout,
164
+ 'data-autosize': node.attrs.__autoSize,
165
+ 'data-table-local-id': node.attrs.localId
166
+ };
167
+ return ['table', attrs, ['tbody', 0]];
168
+ }
169
+ };
170
+ return tableNodeSpec;
171
+ };
172
+
173
+ var table = createTableSpec();
174
+ exports.table = table;
175
+
176
+ var shouldIncludeAttribute = function shouldIncludeAttribute(key, value) {
177
+ return !key.startsWith('__') && (key !== 'localId' || !!value);
178
+ };
179
+
180
+ var tableToJSON = function tableToJSON(node) {
181
+ return {
182
+ attrs: Object.keys(node.attrs).filter(function (key) {
183
+ return shouldIncludeAttribute(key, node.attrs[key]);
184
+ }).reduce(function (obj, key) {
185
+ obj[key] = node.attrs[key];
186
+ return obj;
187
+ }, {})
188
+ };
189
+ };
190
+
191
+ exports.tableToJSON = tableToJSON;
192
+ var tableRow = {
193
+ selectable: false,
194
+ content: '(tableCell | tableHeader)+',
195
+ marks: 'unsupportedMark unsupportedNodeAttribute',
196
+ tableRole: 'row',
197
+ parseDOM: [{
198
+ tag: 'tr'
199
+ }],
200
+ toDOM: function toDOM() {
201
+ return ['tr', 0];
202
+ }
203
+ };
204
+ exports.tableRow = tableRow;
205
+ var cellAttrs = {
206
+ colspan: {
207
+ default: 1
208
+ },
209
+ rowspan: {
210
+ default: 1
211
+ },
212
+ colwidth: {
213
+ default: null
214
+ },
215
+ background: {
216
+ default: null
217
+ }
218
+ };
219
+ var tableCell = {
220
+ selectable: false,
221
+ content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
222
+ attrs: cellAttrs,
223
+ tableRole: 'cell',
224
+ marks: 'link alignment dataConsumer unsupportedMark unsupportedNodeAttribute',
225
+ isolating: true,
226
+ parseDOM: [// Ignore number cell copied from renderer
227
+ {
228
+ tag: '.ak-renderer-table-number-column',
229
+ ignore: true
230
+ }, {
231
+ tag: 'td',
232
+ getAttrs: function getAttrs(dom) {
233
+ return getCellAttrs(dom);
234
+ }
235
+ }],
236
+ toDOM: function toDOM(node) {
237
+ return ['td', getCellDomAttrs(node), 0];
238
+ }
239
+ };
240
+ exports.tableCell = tableCell;
241
+
242
+ var toJSONTableCell = function toJSONTableCell(node) {
243
+ return {
244
+ attrs: Object.keys(node.attrs).reduce(function (obj, key) {
245
+ if (cellAttrs[key].default !== node.attrs[key]) {
246
+ obj[key] = node.attrs[key];
247
+ }
248
+
249
+ return obj;
250
+ }, {})
251
+ };
252
+ };
253
+
254
+ exports.toJSONTableCell = toJSONTableCell;
255
+ var tableHeader = {
256
+ selectable: false,
257
+ content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand)+',
258
+ attrs: cellAttrs,
259
+ tableRole: 'header_cell',
260
+ isolating: true,
261
+ marks: 'link alignment dataConsumer unsupportedMark unsupportedNodeAttribute',
262
+ parseDOM: [{
263
+ tag: 'th',
264
+ getAttrs: function getAttrs(dom) {
265
+ return getCellAttrs(dom, {
266
+ background: DEFAULT_TABLE_HEADER_CELL_BACKGROUND
267
+ });
268
+ }
269
+ }],
270
+ toDOM: function toDOM(node) {
271
+ return ['th', getCellDomAttrs(node), 0];
272
+ }
273
+ };
274
+ exports.tableHeader = tableHeader;
275
+ var toJSONTableHeader = toJSONTableCell;
276
+ exports.toJSONTableHeader = toJSONTableHeader;