@atlaskit/editor-plugin-list 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.eslintrc.js +14 -0
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +1 -1
  4. package/dist/cjs/actions/conversions.js +153 -0
  5. package/dist/cjs/actions/indent-list-items-selected.js +125 -0
  6. package/dist/cjs/actions/indent-list.js +49 -0
  7. package/dist/cjs/actions/join-list-items-forward.js +59 -0
  8. package/dist/cjs/actions/join-list-items-scenarios/index.js +40 -0
  9. package/dist/cjs/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +88 -0
  10. package/dist/cjs/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +85 -0
  11. package/dist/cjs/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +79 -0
  12. package/dist/cjs/actions/join-list-items-scenarios/join-paragraph-with-list.js +45 -0
  13. package/dist/cjs/actions/join-list-items-scenarios/join-sibling-list-items.js +56 -0
  14. package/dist/cjs/actions/merge-lists.js +27 -0
  15. package/dist/cjs/actions/outdent-list-items-selected.js +291 -0
  16. package/dist/cjs/actions/wrap-and-join-lists.js +100 -0
  17. package/dist/cjs/commands/indent-list.js +71 -0
  18. package/dist/cjs/commands/index.js +350 -0
  19. package/dist/cjs/commands/isFirstChildOfParent.js +12 -0
  20. package/dist/cjs/commands/join-list-item-forward.js +61 -0
  21. package/dist/cjs/commands/listBackspace.js +284 -0
  22. package/dist/cjs/commands/outdent-list.js +70 -0
  23. package/dist/cjs/index.js +8 -1
  24. package/dist/cjs/messages.js +37 -0
  25. package/dist/cjs/plugin.js +133 -0
  26. package/dist/cjs/pm-plugins/input-rules/create-list-input-rule.js +63 -0
  27. package/dist/cjs/pm-plugins/input-rules/index.js +38 -0
  28. package/dist/cjs/pm-plugins/input-rules/wrapping-join-rule.js +60 -0
  29. package/dist/cjs/pm-plugins/keymap.js +27 -0
  30. package/dist/cjs/pm-plugins/main.js +166 -0
  31. package/dist/cjs/transforms.js +99 -0
  32. package/dist/cjs/types.js +4 -1
  33. package/dist/cjs/utils/analytics.js +22 -0
  34. package/dist/cjs/utils/find.js +68 -0
  35. package/dist/cjs/utils/indentation.js +22 -0
  36. package/dist/cjs/utils/mark.js +40 -0
  37. package/dist/cjs/utils/node.js +16 -0
  38. package/dist/cjs/utils/selection.js +95 -0
  39. package/dist/es2019/actions/conversions.js +160 -0
  40. package/dist/es2019/actions/indent-list-items-selected.js +124 -0
  41. package/dist/es2019/actions/indent-list.js +44 -0
  42. package/dist/es2019/actions/join-list-items-forward.js +54 -0
  43. package/dist/es2019/actions/join-list-items-scenarios/index.js +5 -0
  44. package/dist/es2019/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +74 -0
  45. package/dist/es2019/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +77 -0
  46. package/dist/es2019/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +71 -0
  47. package/dist/es2019/actions/join-list-items-scenarios/join-paragraph-with-list.js +37 -0
  48. package/dist/es2019/actions/join-list-items-scenarios/join-sibling-list-items.js +48 -0
  49. package/dist/es2019/actions/merge-lists.js +24 -0
  50. package/dist/es2019/actions/outdent-list-items-selected.js +295 -0
  51. package/dist/es2019/actions/wrap-and-join-lists.js +93 -0
  52. package/dist/es2019/commands/indent-list.js +62 -0
  53. package/dist/es2019/commands/index.js +326 -0
  54. package/dist/es2019/commands/isFirstChildOfParent.js +7 -0
  55. package/dist/es2019/commands/join-list-item-forward.js +53 -0
  56. package/dist/es2019/commands/listBackspace.js +276 -0
  57. package/dist/es2019/commands/outdent-list.js +60 -0
  58. package/dist/es2019/index.js +1 -1
  59. package/dist/es2019/messages.js +29 -0
  60. package/dist/es2019/plugin.js +121 -0
  61. package/dist/es2019/pm-plugins/input-rules/create-list-input-rule.js +56 -0
  62. package/dist/es2019/pm-plugins/input-rules/index.js +35 -0
  63. package/dist/es2019/pm-plugins/input-rules/wrapping-join-rule.js +55 -0
  64. package/dist/es2019/pm-plugins/keymap.js +19 -0
  65. package/dist/es2019/pm-plugins/main.js +156 -0
  66. package/dist/es2019/transforms.js +101 -0
  67. package/dist/es2019/types.js +1 -1
  68. package/dist/es2019/utils/analytics.js +12 -0
  69. package/dist/es2019/utils/find.js +61 -0
  70. package/dist/es2019/utils/indentation.js +15 -0
  71. package/dist/es2019/utils/mark.js +30 -0
  72. package/dist/es2019/utils/node.js +12 -0
  73. package/dist/es2019/utils/selection.js +96 -0
  74. package/dist/esm/actions/conversions.js +147 -0
  75. package/dist/esm/actions/indent-list-items-selected.js +117 -0
  76. package/dist/esm/actions/indent-list.js +43 -0
  77. package/dist/esm/actions/join-list-items-forward.js +52 -0
  78. package/dist/esm/actions/join-list-items-scenarios/index.js +5 -0
  79. package/dist/esm/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +81 -0
  80. package/dist/esm/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +78 -0
  81. package/dist/esm/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +72 -0
  82. package/dist/esm/actions/join-list-items-scenarios/join-paragraph-with-list.js +38 -0
  83. package/dist/esm/actions/join-list-items-scenarios/join-sibling-list-items.js +49 -0
  84. package/dist/esm/actions/merge-lists.js +21 -0
  85. package/dist/esm/actions/outdent-list-items-selected.js +283 -0
  86. package/dist/esm/actions/wrap-and-join-lists.js +94 -0
  87. package/dist/esm/commands/indent-list.js +63 -0
  88. package/dist/esm/commands/index.js +324 -0
  89. package/dist/esm/commands/isFirstChildOfParent.js +5 -0
  90. package/dist/esm/commands/join-list-item-forward.js +53 -0
  91. package/dist/esm/commands/listBackspace.js +275 -0
  92. package/dist/esm/commands/outdent-list.js +62 -0
  93. package/dist/esm/index.js +1 -1
  94. package/dist/esm/messages.js +29 -0
  95. package/dist/esm/plugin.js +126 -0
  96. package/dist/esm/pm-plugins/input-rules/create-list-input-rule.js +57 -0
  97. package/dist/esm/pm-plugins/input-rules/index.js +32 -0
  98. package/dist/esm/pm-plugins/input-rules/wrapping-join-rule.js +54 -0
  99. package/dist/esm/pm-plugins/keymap.js +19 -0
  100. package/dist/esm/pm-plugins/main.js +156 -0
  101. package/dist/esm/transforms.js +91 -0
  102. package/dist/esm/types.js +1 -1
  103. package/dist/esm/utils/analytics.js +12 -0
  104. package/dist/esm/utils/find.js +59 -0
  105. package/dist/esm/utils/indentation.js +15 -0
  106. package/dist/esm/utils/mark.js +33 -0
  107. package/dist/esm/utils/node.js +10 -0
  108. package/dist/esm/utils/selection.js +81 -0
  109. package/dist/types/actions/conversions.d.ts +6 -0
  110. package/dist/types/actions/indent-list-items-selected.d.ts +2 -0
  111. package/dist/types/actions/indent-list.d.ts +2 -0
  112. package/dist/types/actions/join-list-items-forward.d.ts +13 -0
  113. package/dist/types/actions/join-list-items-scenarios/index.d.ts +5 -0
  114. package/dist/types/actions/join-list-items-scenarios/join-list-item-with-paragraph.d.ts +9 -0
  115. package/dist/types/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.d.ts +9 -0
  116. package/dist/types/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.d.ts +9 -0
  117. package/dist/types/actions/join-list-items-scenarios/join-paragraph-with-list.d.ts +9 -0
  118. package/dist/types/actions/join-list-items-scenarios/join-sibling-list-items.d.ts +9 -0
  119. package/dist/types/actions/merge-lists.d.ts +7 -0
  120. package/dist/types/actions/outdent-list-items-selected.d.ts +3 -0
  121. package/dist/types/actions/wrap-and-join-lists.d.ts +17 -0
  122. package/dist/types/commands/indent-list.d.ts +6 -0
  123. package/dist/types/commands/index.d.ts +16 -0
  124. package/dist/types/commands/isFirstChildOfParent.d.ts +2 -0
  125. package/dist/types/commands/join-list-item-forward.d.ts +3 -0
  126. package/dist/types/commands/listBackspace.d.ts +10 -0
  127. package/dist/types/commands/outdent-list.d.ts +6 -0
  128. package/dist/types/index.d.ts +2 -1
  129. package/dist/types/messages.d.ts +27 -0
  130. package/dist/types/plugin.d.ts +2 -0
  131. package/dist/types/pm-plugins/input-rules/create-list-input-rule.d.ts +11 -0
  132. package/dist/types/pm-plugins/input-rules/index.d.ts +5 -0
  133. package/dist/types/pm-plugins/input-rules/wrapping-join-rule.d.ts +13 -0
  134. package/dist/types/pm-plugins/keymap.d.ts +5 -0
  135. package/dist/types/pm-plugins/main.d.ts +11 -0
  136. package/dist/types/transforms.d.ts +4 -0
  137. package/dist/types/types.d.ts +29 -2
  138. package/dist/types/utils/analytics.d.ts +5 -0
  139. package/dist/types/utils/find.d.ts +10 -0
  140. package/dist/types/utils/indentation.d.ts +2 -0
  141. package/dist/types/utils/mark.d.ts +8 -0
  142. package/dist/types/utils/node.d.ts +2 -0
  143. package/dist/types/utils/selection.d.ts +14 -0
  144. package/dist/types-ts4.5/actions/conversions.d.ts +6 -0
  145. package/dist/types-ts4.5/actions/indent-list-items-selected.d.ts +2 -0
  146. package/dist/types-ts4.5/actions/indent-list.d.ts +2 -0
  147. package/dist/types-ts4.5/actions/join-list-items-forward.d.ts +16 -0
  148. package/dist/types-ts4.5/actions/join-list-items-scenarios/index.d.ts +5 -0
  149. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-list-item-with-paragraph.d.ts +9 -0
  150. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.d.ts +9 -0
  151. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.d.ts +9 -0
  152. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-paragraph-with-list.d.ts +9 -0
  153. package/dist/types-ts4.5/actions/join-list-items-scenarios/join-sibling-list-items.d.ts +9 -0
  154. package/dist/types-ts4.5/actions/merge-lists.d.ts +7 -0
  155. package/dist/types-ts4.5/actions/outdent-list-items-selected.d.ts +3 -0
  156. package/dist/types-ts4.5/actions/wrap-and-join-lists.d.ts +17 -0
  157. package/dist/types-ts4.5/commands/indent-list.d.ts +6 -0
  158. package/dist/types-ts4.5/commands/index.d.ts +16 -0
  159. package/dist/types-ts4.5/commands/isFirstChildOfParent.d.ts +2 -0
  160. package/dist/types-ts4.5/commands/join-list-item-forward.d.ts +3 -0
  161. package/dist/types-ts4.5/commands/listBackspace.d.ts +13 -0
  162. package/dist/types-ts4.5/commands/outdent-list.d.ts +6 -0
  163. package/dist/types-ts4.5/index.d.ts +2 -1
  164. package/dist/types-ts4.5/messages.d.ts +27 -0
  165. package/dist/types-ts4.5/plugin.d.ts +2 -0
  166. package/dist/types-ts4.5/pm-plugins/input-rules/create-list-input-rule.d.ts +11 -0
  167. package/dist/types-ts4.5/pm-plugins/input-rules/index.d.ts +5 -0
  168. package/dist/types-ts4.5/pm-plugins/input-rules/wrapping-join-rule.d.ts +13 -0
  169. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +5 -0
  170. package/dist/types-ts4.5/pm-plugins/main.d.ts +11 -0
  171. package/dist/types-ts4.5/transforms.d.ts +4 -0
  172. package/dist/types-ts4.5/types.d.ts +29 -2
  173. package/dist/types-ts4.5/utils/analytics.d.ts +5 -0
  174. package/dist/types-ts4.5/utils/find.d.ts +10 -0
  175. package/dist/types-ts4.5/utils/indentation.d.ts +2 -0
  176. package/dist/types-ts4.5/utils/mark.d.ts +8 -0
  177. package/dist/types-ts4.5/utils/node.d.ts +2 -0
  178. package/dist/types-ts4.5/utils/selection.d.ts +14 -0
  179. package/package.json +8 -5
  180. package/report.api.md +61 -1
  181. package/tmp/api-report-tmp.d.ts +53 -0
package/report.api.md CHANGED
@@ -16,10 +16,28 @@
16
16
 
17
17
  ```ts
18
18
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
+ import type { Command } from '@atlaskit/editor-common/types';
20
+ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
21
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
22
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
19
23
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
20
24
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
25
+ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
21
26
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
22
27
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
28
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
29
+
30
+ // @public (undocumented)
31
+ export type FindRootParentListNode = ($pos: ResolvedPos) => ResolvedPos | null;
32
+
33
+ // @public (undocumented)
34
+ type IndentList = (inputMethod: InputMethod) => Command;
35
+
36
+ // @public (undocumented)
37
+ export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
38
+
39
+ // @public (undocumented)
40
+ type IsInsideListItem = (state: EditorState) => boolean;
23
41
 
24
42
  // @public (undocumented)
25
43
  export type ListPlugin = NextEditorPlugin<
@@ -30,12 +48,53 @@ export type ListPlugin = NextEditorPlugin<
30
48
  typeof featureFlagsPlugin,
31
49
  OptionalPlugin<typeof analyticsPlugin>,
32
50
  ];
51
+ actions: {
52
+ indentList: IndentList;
53
+ outdentList: OutdentList;
54
+ toggleOrderedList: ToggleOrderedList;
55
+ toggleBulletList: ToggleBulletList;
56
+ isInsideListItem: IsInsideListItem;
57
+ findRootParentListNode: FindRootParentListNode;
58
+ };
59
+ sharedState: ListState | undefined;
33
60
  }
34
61
  >;
35
62
 
63
+ // @public (undocumented)
64
+ export const listPlugin: ListPlugin;
65
+
36
66
  // @public (undocumented)
37
67
  export type ListPluginOptions = Pick<FeatureFlags, 'restartNumberedLists'>;
38
68
 
69
+ // @public (undocumented)
70
+ export interface ListState {
71
+ // (undocumented)
72
+ bulletListActive: boolean;
73
+ // (undocumented)
74
+ bulletListDisabled: boolean;
75
+ // (undocumented)
76
+ decorationSet: DecorationSet;
77
+ // (undocumented)
78
+ orderedListActive: boolean;
79
+ // (undocumented)
80
+ orderedListDisabled: boolean;
81
+ }
82
+
83
+ // @public (undocumented)
84
+ type OutdentList = (
85
+ inputMethod: InputMethod,
86
+ featureFlags: FeatureFlags,
87
+ ) => Command;
88
+
89
+ // @public (undocumented)
90
+ type ToggleBulletList = (view: EditorView, inputMethod: InputMethod) => boolean;
91
+
92
+ // @public (undocumented)
93
+ type ToggleOrderedList = (
94
+ view: EditorView,
95
+ inputMethod: InputMethod,
96
+ ) => boolean;
97
+
39
98
  // (No @packageDocumentation comment for this package)
40
99
  ```
41
100
 
@@ -47,7 +106,8 @@ export type ListPluginOptions = Pick<FeatureFlags, 'restartNumberedLists'>;
47
106
 
48
107
  ```json
49
108
  {
50
- "react": "^16.8.0"
109
+ "react": "^16.8.0",
110
+ "react-intl-next": "npm:react-intl@^5.18.1"
51
111
  }
52
112
  ```
53
113
 
@@ -5,10 +5,28 @@
5
5
  ```ts
6
6
 
7
7
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
+ import type { Command } from '@atlaskit/editor-common/types';
9
+ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
10
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
11
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
12
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
9
13
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
14
+ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
10
15
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
11
16
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
17
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
18
+
19
+ // @public (undocumented)
20
+ export type FindRootParentListNode = ($pos: ResolvedPos) => ResolvedPos | null;
21
+
22
+ // @public (undocumented)
23
+ type IndentList = (inputMethod: InputMethod) => Command;
24
+
25
+ // @public (undocumented)
26
+ export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
27
+
28
+ // @public (undocumented)
29
+ type IsInsideListItem = (state: EditorState) => boolean;
12
30
 
13
31
  // @public (undocumented)
14
32
  export type ListPlugin = NextEditorPlugin<'list', {
@@ -17,11 +35,46 @@ export type ListPlugin = NextEditorPlugin<'list', {
17
35
  typeof featureFlagsPlugin,
18
36
  OptionalPlugin<typeof analyticsPlugin>
19
37
  ];
38
+ actions: {
39
+ indentList: IndentList;
40
+ outdentList: OutdentList;
41
+ toggleOrderedList: ToggleOrderedList;
42
+ toggleBulletList: ToggleBulletList;
43
+ isInsideListItem: IsInsideListItem;
44
+ findRootParentListNode: FindRootParentListNode;
45
+ };
46
+ sharedState: ListState | undefined;
20
47
  }>;
21
48
 
49
+ // @public (undocumented)
50
+ export const listPlugin: ListPlugin;
51
+
22
52
  // @public (undocumented)
23
53
  export type ListPluginOptions = Pick<FeatureFlags, 'restartNumberedLists'>;
24
54
 
55
+ // @public (undocumented)
56
+ export interface ListState {
57
+ // (undocumented)
58
+ bulletListActive: boolean;
59
+ // (undocumented)
60
+ bulletListDisabled: boolean;
61
+ // (undocumented)
62
+ decorationSet: DecorationSet;
63
+ // (undocumented)
64
+ orderedListActive: boolean;
65
+ // (undocumented)
66
+ orderedListDisabled: boolean;
67
+ }
68
+
69
+ // @public (undocumented)
70
+ type OutdentList = (inputMethod: InputMethod, featureFlags: FeatureFlags) => Command;
71
+
72
+ // @public (undocumented)
73
+ type ToggleBulletList = (view: EditorView, inputMethod: InputMethod) => boolean;
74
+
75
+ // @public (undocumented)
76
+ type ToggleOrderedList = (view: EditorView, inputMethod: InputMethod) => boolean;
77
+
25
78
  // (No @packageDocumentation comment for this package)
26
79
 
27
80
  ```