@atlaskit/adf-schema 28.1.12 → 28.1.13

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 (209) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +1 -1
  3. package/src/__tests__/unit/json-schema/v1.ts +0 -55
  4. package/src/__tests__/unit/schema/create-schema.ts +0 -214
  5. package/src/__tests__/unit/schema/default-schema.ts +0 -192
  6. package/src/__tests__/unit/schema/marks/annotation.ts +0 -46
  7. package/src/__tests__/unit/schema/marks/border.ts +0 -76
  8. package/src/__tests__/unit/schema/marks/breakout.ts +0 -24
  9. package/src/__tests__/unit/schema/marks/code.ts +0 -44
  10. package/src/__tests__/unit/schema/marks/confluence-inline-comment.ts +0 -25
  11. package/src/__tests__/unit/schema/marks/data-consumer.ts +0 -52
  12. package/src/__tests__/unit/schema/marks/em.ts +0 -37
  13. package/src/__tests__/unit/schema/marks/link.ts +0 -188
  14. package/src/__tests__/unit/schema/marks/strike.ts +0 -37
  15. package/src/__tests__/unit/schema/marks/strong.ts +0 -43
  16. package/src/__tests__/unit/schema/marks/subsup.ts +0 -50
  17. package/src/__tests__/unit/schema/marks/text-color.ts +0 -61
  18. package/src/__tests__/unit/schema/marks/underline.ts +0 -36
  19. package/src/__tests__/unit/schema/nodes/_consts.ts +0 -964
  20. package/src/__tests__/unit/schema/nodes/block-card.ts +0 -184
  21. package/src/__tests__/unit/schema/nodes/blockquote.ts +0 -44
  22. package/src/__tests__/unit/schema/nodes/bodied-extension.ts +0 -101
  23. package/src/__tests__/unit/schema/nodes/code-block.ts +0 -221
  24. package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +0 -32
  25. package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +0 -35
  26. package/src/__tests__/unit/schema/nodes/date.ts +0 -51
  27. package/src/__tests__/unit/schema/nodes/decision-item.ts +0 -46
  28. package/src/__tests__/unit/schema/nodes/decision-list.ts +0 -52
  29. package/src/__tests__/unit/schema/nodes/embed-card.ts +0 -60
  30. package/src/__tests__/unit/schema/nodes/emoji.ts +0 -71
  31. package/src/__tests__/unit/schema/nodes/expand.ts +0 -51
  32. package/src/__tests__/unit/schema/nodes/extension.ts +0 -101
  33. package/src/__tests__/unit/schema/nodes/hard-break.ts +0 -24
  34. package/src/__tests__/unit/schema/nodes/heading.ts +0 -56
  35. package/src/__tests__/unit/schema/nodes/image.ts +0 -32
  36. package/src/__tests__/unit/schema/nodes/inline-card.ts +0 -106
  37. package/src/__tests__/unit/schema/nodes/inline-extension.ts +0 -79
  38. package/src/__tests__/unit/schema/nodes/layout-column.ts +0 -54
  39. package/src/__tests__/unit/schema/nodes/layout-section.ts +0 -95
  40. package/src/__tests__/unit/schema/nodes/list-item.ts +0 -49
  41. package/src/__tests__/unit/schema/nodes/media-group.ts +0 -67
  42. package/src/__tests__/unit/schema/nodes/media-single.ts +0 -171
  43. package/src/__tests__/unit/schema/nodes/media.ts +0 -384
  44. package/src/__tests__/unit/schema/nodes/mention.ts +0 -115
  45. package/src/__tests__/unit/schema/nodes/nestedExpand.ts +0 -72
  46. package/src/__tests__/unit/schema/nodes/ordered-list.ts +0 -49
  47. package/src/__tests__/unit/schema/nodes/panel.ts +0 -180
  48. package/src/__tests__/unit/schema/nodes/paragraph.ts +0 -25
  49. package/src/__tests__/unit/schema/nodes/placeholder.ts +0 -46
  50. package/src/__tests__/unit/schema/nodes/rule.ts +0 -24
  51. package/src/__tests__/unit/schema/nodes/status.ts +0 -120
  52. package/src/__tests__/unit/schema/nodes/tableNodes.ts +0 -555
  53. package/src/__tests__/unit/schema/nodes/task-item.ts +0 -39
  54. package/src/__tests__/unit/schema/nodes/task-list.ts +0 -45
  55. package/src/__tests__/unit/schema/nodes/unknown-block.ts +0 -42
  56. package/src/__tests__/unit/schema/nodes/unsupported-block.ts +0 -42
  57. package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +0 -38
  58. package/src/__tests__/unit/utils/colors.ts +0 -42
  59. package/src/__tests__/unit/utils/url.ts +0 -209
  60. package/src/schema/bitbucket-schema.ts +0 -43
  61. package/src/schema/confluence-schema.ts +0 -76
  62. package/src/schema/create-schema.ts +0 -337
  63. package/src/schema/default-schema.ts +0 -180
  64. package/src/schema/groups.ts +0 -30
  65. package/src/schema/inline-nodes.ts +0 -9
  66. package/src/schema/jira-schema.ts +0 -158
  67. package/src/schema/marks/__tests__/unit/annotation.ts +0 -18
  68. package/src/schema/marks/alignment.ts +0 -48
  69. package/src/schema/marks/annotation.ts +0 -107
  70. package/src/schema/marks/border.ts +0 -74
  71. package/src/schema/marks/breakout.ts +0 -42
  72. package/src/schema/marks/code.ts +0 -45
  73. package/src/schema/marks/confluence-inline-comment.ts +0 -32
  74. package/src/schema/marks/data-consumer.ts +0 -100
  75. package/src/schema/marks/em.ts +0 -19
  76. package/src/schema/marks/fragment.ts +0 -77
  77. package/src/schema/marks/indentation.ts +0 -47
  78. package/src/schema/marks/link.ts +0 -139
  79. package/src/schema/marks/strike.ts +0 -26
  80. package/src/schema/marks/strong.ts +0 -45
  81. package/src/schema/marks/subsup.ts +0 -53
  82. package/src/schema/marks/text-color.ts +0 -172
  83. package/src/schema/marks/type-ahead-query.ts +0 -22
  84. package/src/schema/marks/underline.ts +0 -24
  85. package/src/schema/marks/unsupported-mark.ts +0 -9
  86. package/src/schema/marks/unsupported-node-attributes.ts +0 -8
  87. package/src/schema/nodes/block-card.ts +0 -121
  88. package/src/schema/nodes/blockquote.ts +0 -25
  89. package/src/schema/nodes/bodied-extension.ts +0 -75
  90. package/src/schema/nodes/bullet-list.ts +0 -17
  91. package/src/schema/nodes/caption.ts +0 -51
  92. package/src/schema/nodes/code-block.ts +0 -176
  93. package/src/schema/nodes/confluence-jira-issue.ts +0 -43
  94. package/src/schema/nodes/confluence-unsupported-block.ts +0 -29
  95. package/src/schema/nodes/confluence-unsupported-inline.ts +0 -30
  96. package/src/schema/nodes/date.ts +0 -38
  97. package/src/schema/nodes/decision-item.ts +0 -50
  98. package/src/schema/nodes/decision-list.ts +0 -56
  99. package/src/schema/nodes/doc.ts +0 -30
  100. package/src/schema/nodes/embed-card.ts +0 -62
  101. package/src/schema/nodes/emoji.ts +0 -89
  102. package/src/schema/nodes/expand.ts +0 -101
  103. package/src/schema/nodes/extension.ts +0 -60
  104. package/src/schema/nodes/hard-break.ts +0 -21
  105. package/src/schema/nodes/heading.ts +0 -64
  106. package/src/schema/nodes/image.ts +0 -32
  107. package/src/schema/nodes/inline-card.ts +0 -70
  108. package/src/schema/nodes/inline-extension.ts +0 -57
  109. package/src/schema/nodes/layout-column.ts +0 -68
  110. package/src/schema/nodes/layout-section.ts +0 -93
  111. package/src/schema/nodes/list-item.ts +0 -13
  112. package/src/schema/nodes/media-group.ts +0 -44
  113. package/src/schema/nodes/media-inline.ts +0 -19
  114. package/src/schema/nodes/media-single.ts +0 -179
  115. package/src/schema/nodes/media.ts +0 -253
  116. package/src/schema/nodes/mention.ts +0 -86
  117. package/src/schema/nodes/nested-expand.ts +0 -77
  118. package/src/schema/nodes/ordered-list.ts +0 -62
  119. package/src/schema/nodes/panel.ts +0 -133
  120. package/src/schema/nodes/paragraph.ts +0 -79
  121. package/src/schema/nodes/placeholder.ts +0 -40
  122. package/src/schema/nodes/rule.ts +0 -17
  123. package/src/schema/nodes/status.ts +0 -58
  124. package/src/schema/nodes/tableNodes.ts +0 -478
  125. package/src/schema/nodes/task-item.ts +0 -51
  126. package/src/schema/nodes/task-list.ts +0 -61
  127. package/src/schema/nodes/text.ts +0 -19
  128. package/src/schema/nodes/types/block-content.ts +0 -51
  129. package/src/schema/nodes/types/extensions.ts +0 -36
  130. package/src/schema/nodes/types/inline-content.ts +0 -56
  131. package/src/schema/nodes/types/list.ts +0 -54
  132. package/src/schema/nodes/types/mark.ts +0 -16
  133. package/src/schema/nodes/types/non-nestable-block-content.ts +0 -39
  134. package/src/schema/nodes/types/rich-media-common.ts +0 -51
  135. package/src/schema/nodes/unknown-block.ts +0 -13
  136. package/src/schema/nodes/unsupported-block.ts +0 -28
  137. package/src/schema/nodes/unsupported-inline.ts +0 -27
  138. package/src/schema/unsupported.ts +0 -4
  139. package/src/steps/__tests__/unit/analytics.ts +0 -72
  140. package/src/steps/__tests__/unit/link-meta-step.ts +0 -64
  141. package/src/steps/__tests__/unit/override-document-step.ts +0 -174
  142. package/src/steps/__tests__/unit/set-attrs.ts +0 -71
  143. package/src/steps/analytics.ts +0 -189
  144. package/src/steps/link-meta-step.ts +0 -105
  145. package/src/steps/override-document-step.ts +0 -97
  146. package/src/steps/set-attrs.tsx +0 -74
  147. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-0.json +0 -15
  148. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-1.json +0 -15
  149. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-2.json +0 -15
  150. package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-3.json +0 -15
  151. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-0.json +0 -9
  152. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-1.json +0 -9
  153. package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-2.json +0 -9
  154. package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row-inverted.json +0 -98
  155. package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row.json +0 -71
  156. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0-inverted.json +0 -19
  157. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0.json +0 -19
  158. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1-inverted.json +0 -21
  159. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1.json +0 -21
  160. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2-inverted.json +0 -21
  161. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2.json +0 -21
  162. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3-inverted.json +0 -19
  163. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3.json +0 -19
  164. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0-inverted.json +0 -63
  165. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0.json +0 -21
  166. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1-inverted.json +0 -64
  167. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1.json +0 -22
  168. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2-inverted.json +0 -63
  169. package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2.json +0 -21
  170. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0-inverted.json +0 -19
  171. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0.json +0 -19
  172. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1-inverted.json +0 -19
  173. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1.json +0 -19
  174. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2-inverted.json +0 -19
  175. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2.json +0 -19
  176. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3-inverted.json +0 -19
  177. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3.json +0 -19
  178. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0-inverted.json +0 -52
  179. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0.json +0 -38
  180. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1-inverted.json +0 -52
  181. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1.json +0 -38
  182. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2-inverted.json +0 -25
  183. package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2.json +0 -11
  184. package/src/steps/table/__tests__/_utils.ts +0 -102
  185. package/src/steps/table/__tests__/add-column-merge-columns.ts +0 -509
  186. package/src/steps/table/__tests__/add-column-merge-rows.ts +0 -466
  187. package/src/steps/table/__tests__/add-column.ts +0 -638
  188. package/src/steps/table/add-column.ts +0 -443
  189. package/src/steps/table/constants.ts +0 -4
  190. package/src/steps/table/sort-column.ts +0 -57
  191. package/src/steps/table/types.ts +0 -48
  192. package/src/steps/table/utils/cell-step.ts +0 -239
  193. package/src/steps/table/utils/cells-at-column.ts +0 -75
  194. package/src/steps/table/utils/find-column.ts +0 -90
  195. package/src/steps/table/utils/get-table-rect-from-doc.ts +0 -37
  196. package/src/steps/table/utils/side-effects/rows.ts +0 -327
  197. package/src/steps/table/utils/side-effects/side-effects.ts +0 -90
  198. package/src/steps/table/utils/side-effects/table.ts +0 -112
  199. package/src/steps/table/utils/side-effects/types.ts +0 -34
  200. package/src/steps/table/utils/table-map.ts +0 -28
  201. package/src/steps/type-ahead.ts +0 -100
  202. package/src/steps.ts +0 -16
  203. package/src/utils/colors.ts +0 -171
  204. package/src/utils/confluence/emoji.ts +0 -99
  205. package/src/utils/extensions.ts +0 -32
  206. package/src/utils/parseDOM.ts +0 -2
  207. package/src/utils/url.ts +0 -173
  208. package/src/utils/uuid.ts +0 -19
  209. package/src/version.json +0 -6
@@ -1,171 +0,0 @@
1
- import * as namedColors from 'css-color-names'; // eslint-disable-line import/extensions
2
-
3
- /**
4
- * We're avoding importing these colors from @atlaskit/theme since we
5
- * do not want to have react as a dependency of this package.
6
- * TODO: Refactor this once tokenization by Core team is ready
7
- * https://product-fabric.atlassian.net/browse/CS-908
8
- */
9
-
10
- export const R50 = '#FFEBE6';
11
- export const R75 = '#FFBDAD';
12
- export const R100 = '#FF8F73';
13
- export const R300 = '#FF5630';
14
- export const R400 = '#DE350B';
15
- export const R500 = '#BF2600';
16
-
17
- export const Y50 = '#FFFAE6';
18
- export const Y75 = '#FFF0B3';
19
- export const Y200 = '#FFC400';
20
- export const Y400 = '#FF991F';
21
- export const Y500 = '#FF8B00';
22
-
23
- export const G50 = '#E3FCEF';
24
- export const G75 = '#ABF5D1';
25
- export const G200 = '#57D9A3';
26
- export const G300 = '#36B37E';
27
- export const G400 = '#00875A';
28
- export const G500 = '#006644';
29
-
30
- export const B50 = '#DEEBFF';
31
- export const B75 = '#B3D4FF';
32
- export const B100 = '#4C9AFF';
33
- export const B400 = '#0052CC';
34
- export const B500 = '#0747A6';
35
-
36
- export const N0 = '#FFFFFF';
37
- export const N20 = '#F4F5F7';
38
- export const N30 = '#EBECF0';
39
- export const N40 = '#DFE1E6';
40
- export const N50 = '#C1C7D0';
41
- export const N60 = '#B3BAC5';
42
- export const N80 = '#97A0AF';
43
- export const N90 = '#8993A4';
44
- export const N200 = '#6B778C';
45
- export const N300 = '#5E6C84';
46
- export const N300A = '#091E4224';
47
- export const N500 = '#42526E';
48
- export const N600 = '#758195';
49
- export const N800 = '#172B4D';
50
- export const N1000 = '#172B4D';
51
-
52
- export const P50 = '#EAE6FF';
53
- export const P75 = '#C0B6F2';
54
- export const P100 = '#998DD9';
55
- export const P300 = '#6554C0';
56
- export const P400 = '#5243AA';
57
- export const P500 = '#403294';
58
-
59
- export const T50 = '#E6FCFF';
60
- export const T75 = '#B3F5FF';
61
- export const T100 = '#79E2F2';
62
- export const T300 = '#00B8D9';
63
- export const T500 = '#008DA6';
64
-
65
- /**
66
- * @return String with HEX-coded color.
67
- */
68
- export function normalizeHexColor(
69
- color: string | null,
70
- defaultColor?: string,
71
- ): string | null {
72
- if (!color) {
73
- return null;
74
- }
75
-
76
- // Normalize to hex
77
- color = color.trim().toLowerCase();
78
- if (isHex(color)) {
79
- // Normalize 3-hex to 6-hex colours
80
- if (color.length === 4) {
81
- color = color
82
- .split('')
83
- .map((c) => (c === '#' ? '#' : `${c}${c}`))
84
- .join('');
85
- }
86
- } else if (isRgb(color)) {
87
- return rgbToHex(color);
88
- } else {
89
- // http://dev.w3.org/csswg/css-color/#named-colors
90
- if (color === 'default') {
91
- return null;
92
- } else if (namedColors.default && (namedColors as any).default[color]) {
93
- color = (namedColors as any).default[color];
94
- } else if (namedColors && namedColors[color]) {
95
- color = namedColors[color];
96
- } else {
97
- return null;
98
- }
99
- }
100
-
101
- if (color === defaultColor) {
102
- return null;
103
- }
104
-
105
- return color;
106
- }
107
-
108
- /**
109
- * Converts hex color format to rgb.
110
- * Works well with full hex color format and shortcut as well.
111
- *
112
- * @param hex - hex color string (#xxx, or #xxxxxx)
113
- */
114
- export function hexToRgb(color: string): string | null {
115
- if (!isHex(color)) {
116
- return null;
117
- }
118
-
119
- let colorBits = color.substring(1).split('');
120
- if (colorBits.length === 3) {
121
- colorBits = [
122
- colorBits[0],
123
- colorBits[0],
124
- colorBits[1],
125
- colorBits[1],
126
- colorBits[2],
127
- colorBits[2],
128
- ];
129
- }
130
-
131
- const rgb = Number(`0x${colorBits.join('')}`);
132
- // eslint-disable-next-line no-bitwise
133
- return `rgb(${(rgb >> 16) & 255},${(rgb >> 8) & 255},${rgb & 255})`;
134
- }
135
-
136
- /**
137
- * Converts hex color format to rgba.
138
- *
139
- * @param hex - hex color string (#xxx, or #xxxxxx)
140
- */
141
- export function hexToRgba(rawColor: string, alpha: number): string | null {
142
- let color = normalizeHexColor(rawColor);
143
- if (!color) {
144
- return null;
145
- }
146
- const hex2rgb = (color: string) =>
147
- color.match(/[a-z0-9]{2}/gi)!.map((hex) => parseInt(hex, 16));
148
- return `rgba(${hex2rgb(color).concat(alpha).join(',')})`;
149
- }
150
-
151
- export function rgbToHex(value: string): string | null {
152
- const matches = value.match(/(0?\.?\d{1,3})%?\b/g);
153
-
154
- if (matches && matches.length >= 3) {
155
- const [red, green, blue] = matches.map(Number);
156
- return (
157
- '#' +
158
- (blue | (green << 8) | (red << 16) | (1 << 24)).toString(16).slice(1) // eslint-disable-line no-bitwise
159
- );
160
- }
161
-
162
- return null;
163
- }
164
-
165
- export function isRgb(color: string): boolean {
166
- return /rgba?\(/.test(color);
167
- }
168
-
169
- export function isHex(color: string): boolean {
170
- return /^#([A-Fa-f0-9]{3}){1,2}$/.test(color);
171
- }
@@ -1,99 +0,0 @@
1
- // Default emoji id for Confluence glyphs that has no match to Fabric Emoji
2
- const DEFAULT_EMOJI_ID = '2b50';
3
-
4
- // Default ac:name for emoticons as a fallback is `blue-star`
5
- const DEFAULT_EMOJI_ACNAME = 'blue-star';
6
-
7
- // ac:hipchat-emoticon prefix when converting to Emoji ID
8
- const HC_EMOTICON_PREFIX = 'atlassian-';
9
-
10
- /**
11
- * Confluence glyphs ac:name of <ac:emoticon /> map to new emojis
12
- * {
13
- * [ac:name] : ['emoji-id', 'emoji-shortName', 'emoji-fallback']
14
- * ...
15
- * }
16
- * Glyphs that do not map to Fabric Emoji
17
- * will be mapped to Emoji Id '2b50' (:star:) with preserving ac:name as shortName attribute;
18
- */
19
- const acNameToEmojiMap = {
20
- smile: ['1f642', ':slight_smile:', '\uD83D\uDE42'],
21
- sad: ['1f641', ':slight_frown:', '\uD83D\uDE41'],
22
- cheeky: ['1f61b', ':stuck_out_tongue:', '\uD83D\uDE1B'],
23
- laugh: ['1f600', ':grinning:', '\uD83D\uDE00'],
24
- wink: ['1f609', ':wink:', '\uD83D\uDE09'],
25
- information: ['2139', ':information_source:', '\u2139'],
26
- tick: ['2705', ':white_check_mark:', '\u2705'],
27
- cross: ['274c', ':x:', '\u274C'],
28
- warning: ['26a0', ':warning:', '\u26A0'],
29
- plus: ['2795', ':heavy_plus_sign:', '\u2795'],
30
- minus: ['2796', ':heavy_minus_sign:', '\u2796'],
31
- question: ['2753', ':question:', '\u003F'],
32
- 'thumbs-up': ['1f44d', ':thumbsup:', '\uD83D\uDC4D'],
33
- 'thumbs-down': ['1f44e', ':thumbsdown:', '\uD83D\uDC4E'],
34
- 'light-on': ['1f4a1', ':bulb:', '\uD83D\uDCA1'],
35
- 'yellow-star': ['2b50', ':star:', '\uD83D\uDC9B'],
36
- 'light-off': ['1f6ab', ':no_entry_sign:', '\uD83D\uDEAB'],
37
- 'red-star': ['2764', ':heart:', '\u2764\uFE0F'],
38
- 'green-star': ['1f49a', ':green_heart:', '\uD83D\uDC9A'],
39
- 'blue-star': ['1f499', ':blue_heart:', '\uD83D\uDC99'],
40
- heart: ['2764', ':heart:', '\u2764\uFE0F'],
41
- 'broken-heart': ['1f494', ':broken_heart:', '\uD83D\uDC94'],
42
- };
43
-
44
- export type NameToEmoji = keyof typeof acNameToEmojiMap;
45
-
46
- export function acNameToEmoji(acName: NameToEmoji) {
47
- const emojiData = acNameToEmojiMap[acName];
48
- return emojiData
49
- ? {
50
- id: emojiData[0],
51
- shortName: emojiData[1],
52
- text: emojiData[2],
53
- }
54
- : {
55
- id: DEFAULT_EMOJI_ID,
56
- shortName: `:${acName}:`,
57
- text: '',
58
- };
59
- }
60
-
61
- export function emojiIdToAcName(emojiId: string) {
62
- const filterEmojis = (acName: keyof typeof acNameToEmojiMap) =>
63
- acNameToEmojiMap[acName] ? acNameToEmojiMap[acName][0] === emojiId : false;
64
- return (
65
- Object.keys(acNameToEmojiMap) as Array<keyof typeof acNameToEmoji>
66
- ).filter(filterEmojis)[0];
67
- }
68
-
69
- export function acShortcutToEmoji(hipchatEmoticonShortName: string) {
70
- return {
71
- id: `${HC_EMOTICON_PREFIX}${hipchatEmoticonShortName}`,
72
- shortName: `:${hipchatEmoticonShortName}:`,
73
- text: '',
74
- };
75
- }
76
-
77
- function getAcNameFromShortName(shortName: string) {
78
- return shortName.slice(
79
- shortName[0] === ':' ? 1 : 0,
80
- shortName[shortName.length - 1] === ':' ? -1 : shortName.length,
81
- );
82
- }
83
-
84
- export function getEmojiAcName({
85
- id,
86
- shortName,
87
- }: {
88
- id: string;
89
- shortName: string;
90
- }) {
91
- if (DEFAULT_EMOJI_ID === id) {
92
- const possibleName = getAcNameFromShortName(shortName);
93
- if (possibleName in acNameToEmojiMap) {
94
- return possibleName;
95
- }
96
- }
97
-
98
- return emojiIdToAcName(id) || DEFAULT_EMOJI_ACNAME;
99
- }
@@ -1,32 +0,0 @@
1
- import { ExtensionAttributes, Layout } from '../schema/nodes/types/extensions';
2
-
3
- export const isValidLayout = (name: string | null): name is Layout => {
4
- return !!name && ['default', 'wide', 'full-width'].includes(name);
5
- };
6
-
7
- export const getExtensionAttrs = (
8
- dom: HTMLElement,
9
- isInline: boolean = false,
10
- ): ExtensionAttributes | false => {
11
- const extensionType = dom.getAttribute('data-extension-type');
12
- const extensionKey = dom.getAttribute('data-extension-key');
13
-
14
- if (!extensionType || !extensionKey) {
15
- return false;
16
- }
17
-
18
- const attrs: ExtensionAttributes = {
19
- extensionType,
20
- extensionKey,
21
- text: dom.getAttribute('data-text') || undefined,
22
- parameters: JSON.parse(dom.getAttribute('data-parameters') || '{}'),
23
- localId: dom.getAttribute('data-local-id') || undefined,
24
- };
25
-
26
- if (!isInline) {
27
- const rawLayout = dom.getAttribute('data-layout');
28
- attrs.layout = isValidLayout(rawLayout) ? rawLayout : 'default';
29
- }
30
-
31
- return attrs;
32
- };
@@ -1,2 +0,0 @@
1
- export const isDOMElement = (maybeNode: unknown): maybeNode is Element =>
2
- maybeNode instanceof Node && maybeNode.nodeType === Node.ELEMENT_NODE;
package/src/utils/url.ts DELETED
@@ -1,173 +0,0 @@
1
- /**
2
- * This file has been partially duplicated in packages/linking-platform/linking-common/src/url.ts
3
- * Any changes made here should be mirrored there.
4
- * Ticket for dedeplication: https://product-fabric.atlassian.net/browse/EDM-7138
5
- * Ticket for fixing linkification of filename-like urls: https://product-fabric.atlassian.net/browse/EDM-7190
6
- */
7
- import LinkifyIt from 'linkify-it';
8
-
9
- const whitelistedURLPatterns = [
10
- /^https?:\/\//im,
11
- /^ftps?:\/\//im,
12
- /^gopher:\/\//im,
13
- /^integrity:\/\//im,
14
- /^file:\/\//im,
15
- /^smb:\/\//im,
16
- /^dynamicsnav:\/\//im,
17
- /^jamfselfservice:\/\//im,
18
- /^\//im,
19
- /^mailto:/im,
20
- /^skype:/im,
21
- /^callto:/im,
22
- /^facetime:/im,
23
- /^git:/im,
24
- /^irc6?:/im,
25
- /^news:/im,
26
- /^nntp:/im,
27
- /^feed:/im,
28
- /^cvs:/im,
29
- /^svn:/im,
30
- /^mvn:/im,
31
- /^ssh:/im,
32
- /^scp:\/\//im,
33
- /^sftp:\/\//im,
34
- /^itms:/im,
35
- // This is not a valid notes link, but we support this pattern for backwards compatibility
36
- /^notes:/im,
37
- /^notes:\/\//im,
38
- /^hipchat:\/\//im,
39
- // This is not a valid sourcetree link, but we support this pattern for backwards compatibility
40
- /^sourcetree:/im,
41
- /^sourcetree:\/\//im,
42
- /^urn:/im,
43
- /^tel:/im,
44
- /^xmpp:/im,
45
- /^telnet:/im,
46
- /^vnc:/im,
47
- /^rdp:/im,
48
- /^whatsapp:/im,
49
- /^slack:/im,
50
- /^sips?:/im,
51
- /^magnet:/im,
52
- /^#/im,
53
- ];
54
-
55
- /**
56
- * Please notify the Editor Mobile team (Slack: #help-mobilekit) if the logic for this changes.
57
- */
58
- export const isSafeUrl = (url: string): boolean => {
59
- const urlTrimmed = url.trim();
60
- if (urlTrimmed.length === 0) {
61
- return true;
62
- }
63
- return whitelistedURLPatterns.some((p) => p.test(urlTrimmed));
64
- };
65
-
66
- export interface Match {
67
- schema: any;
68
- index: number;
69
- lastIndex: number;
70
- raw: string;
71
- text: string;
72
- url: string;
73
- length?: number;
74
- input?: string;
75
- }
76
-
77
- export const linkify = LinkifyIt();
78
- linkify.add('sourcetree:', 'http:');
79
- linkify.add('jamfselfservice:', 'http:');
80
-
81
- const urlWithoutSpacesValidator: LinkifyIt.Rule = {
82
- validate: /[^\s]+/,
83
- };
84
-
85
- // `tel:` URI spec is https://datatracker.ietf.org/doc/html/rfc3966
86
- // We're not validating the phone number or separators - but if there's a space it definitely isn't a valid `tel:` URI
87
- linkify.add('tel:', urlWithoutSpacesValidator);
88
-
89
- // https://datatracker.ietf.org/doc/html/rfc8089
90
- linkify.add('file:', urlWithoutSpacesValidator);
91
-
92
- linkify.add('notes:', 'http:');
93
-
94
- const tlds =
95
- 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split(
96
- '|',
97
- );
98
- const tlds2Char =
99
- 'a[cdefgilmnoqrtuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrtuvwxyz]|n[acefgilopruz]|om|p[aefghkmnrtw]|qa|r[eosuw]|s[abcdegijklmnrtuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
100
- tlds.push(tlds2Char);
101
- linkify.tlds(tlds, false);
102
-
103
- // linkify-it mishandles closing braces on long urls, so we preference using our own regex first:
104
- // https://product-fabric.atlassian.net/browse/ED-13669
105
- export const LINK_REGEXP =
106
- /(https?|ftp|jamfselfservice|gopher|dynamicsnav|integrity|file|smb):\/\/[^\s]+/;
107
-
108
- /** Attempt to find a link match using a regex string defining a URL */
109
- export const linkifyMatch = (text: string): Match[] => {
110
- if (!LINK_REGEXP.test(text)) {
111
- return [];
112
- }
113
-
114
- const matches: Match[] = [];
115
- let startpos = 0;
116
- let substr;
117
-
118
- while ((substr = text.substr(startpos))) {
119
- const link = (substr.match(LINK_REGEXP) || [''])[0];
120
- if (link) {
121
- const index = substr.search(LINK_REGEXP);
122
- const start = index >= 0 ? index + startpos : index;
123
- const end = start + link.length;
124
- matches.push({
125
- index: start,
126
- lastIndex: end,
127
- raw: link,
128
- url: link,
129
- text: link,
130
- schema: '',
131
- });
132
- startpos += end;
133
- } else {
134
- break;
135
- }
136
- }
137
-
138
- return matches;
139
- };
140
-
141
- /**
142
- * Attempt to find a link match. Tries to use our regex search first.
143
- * If this doesn't match (e.g. no protocol), try using linkify-it library.
144
- * Returns null if url string empty or no string given, or if no match found.
145
- */
146
- export function getLinkMatch(str?: string): Match | null {
147
- if (!str) {
148
- return null;
149
- }
150
- // linkify-it mishandles closing braces on long urls, so we preference using our own regex first:
151
- // https://product-fabric.atlassian.net/browse/ED-13669
152
- let match: null | Match[] = linkifyMatch(str);
153
- if (!match.length) {
154
- match = linkify.match(str);
155
- }
156
- return match && match[0];
157
- }
158
-
159
- /**
160
- * Adds protocol to url if needed.
161
- * Returns empty string if no url given or if no link match found.
162
- */
163
- export function normalizeUrl(url?: string) {
164
- const match = getLinkMatch(url);
165
- return (match && match.url) || '';
166
- }
167
-
168
- /**
169
- * checks if root relative link
170
- */
171
- export function isRootRelative(url: string) {
172
- return url.startsWith('/');
173
- }
package/src/utils/uuid.ts DELETED
@@ -1,19 +0,0 @@
1
- /* eslint-disable no-bitwise */
2
- export const generateUuid = () =>
3
- 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
4
- const r = (Math.random() * 16) | 0;
5
- return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
6
- });
7
- /* eslint-enable no-bitwise */
8
-
9
- let staticValue: string | false = false;
10
-
11
- export const uuid = {
12
- setStatic(value: string | false) {
13
- staticValue = value;
14
- },
15
-
16
- generate() {
17
- return staticValue || generateUuid();
18
- },
19
- };
package/src/version.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "name": "@atlaskit/adf-schema",
3
- "version": "999.9.9",
4
- "NOTE: THIS FILE": "IS ONLY USED IN DEVELOPMENT",
5
- "BEFORE PUBLISH": "IT IS REGENERATED WITH ACTUAL VERSION INFO"
6
- }