@milkdown/preset-gfm 6.5.3 → 7.0.0-next.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 (156) hide show
  1. package/lib/composed/commands.d.ts +8 -0
  2. package/lib/composed/commands.d.ts.map +1 -0
  3. package/lib/composed/index.d.ts +6 -0
  4. package/lib/composed/index.d.ts.map +1 -0
  5. package/lib/composed/inputrules.d.ts +3 -0
  6. package/lib/composed/inputrules.d.ts.map +1 -0
  7. package/lib/composed/keymap.d.ts +3 -0
  8. package/lib/composed/keymap.d.ts.map +1 -0
  9. package/lib/composed/plugins.d.ts +3 -0
  10. package/lib/composed/plugins.d.ts.map +1 -0
  11. package/lib/composed/schema.d.ts +3 -0
  12. package/lib/composed/schema.d.ts.map +1 -0
  13. package/lib/index.d.ts +4 -34
  14. package/lib/index.d.ts.map +1 -1
  15. package/lib/index.es.js +633 -2328
  16. package/lib/index.es.js.map +1 -1
  17. package/lib/mark/index.d.ts +2 -0
  18. package/lib/mark/index.d.ts.map +1 -0
  19. package/lib/mark/strike-through.d.ts +4 -0
  20. package/lib/mark/strike-through.d.ts.map +1 -0
  21. package/lib/node/footnote/definition.d.ts +2 -0
  22. package/lib/node/footnote/definition.d.ts.map +1 -0
  23. package/lib/{footnote → node/footnote}/index.d.ts +0 -0
  24. package/lib/node/footnote/index.d.ts.map +1 -0
  25. package/lib/node/footnote/reference.d.ts +2 -0
  26. package/lib/node/footnote/reference.d.ts.map +1 -0
  27. package/lib/node/index.d.ts +4 -0
  28. package/lib/node/index.d.ts.map +1 -0
  29. package/lib/node/table/index.d.ts +32 -0
  30. package/lib/node/table/index.d.ts.map +1 -0
  31. package/lib/node/table/utils.d.ts +27 -0
  32. package/lib/node/table/utils.d.ts.map +1 -0
  33. package/lib/node/task-list-item.d.ts +2 -0
  34. package/lib/node/task-list-item.d.ts.map +1 -0
  35. package/lib/plugin/auto-insert-zero-space-plugin.d.ts +2 -0
  36. package/lib/plugin/auto-insert-zero-space-plugin.d.ts.map +1 -0
  37. package/lib/plugin/column-resizing-plugin.d.ts +2 -0
  38. package/lib/plugin/column-resizing-plugin.d.ts.map +1 -0
  39. package/lib/plugin/index.d.ts +5 -0
  40. package/lib/plugin/index.d.ts.map +1 -0
  41. package/lib/plugin/remark-gfm-plugin.d.ts +2 -0
  42. package/lib/plugin/remark-gfm-plugin.d.ts.map +1 -0
  43. package/lib/plugin/table-editing-plugin.d.ts +2 -0
  44. package/lib/plugin/table-editing-plugin.d.ts.map +1 -0
  45. package/package.json +18 -10
  46. package/src/composed/commands.ts +23 -0
  47. package/src/composed/index.ts +6 -0
  48. package/src/composed/inputrules.ts +7 -0
  49. package/src/composed/keymap.ts +9 -0
  50. package/src/composed/plugins.ts +10 -0
  51. package/src/composed/schema.ts +18 -0
  52. package/src/index.ts +5 -89
  53. package/src/mark/index.ts +2 -0
  54. package/src/mark/strike-through.ts +39 -0
  55. package/src/node/footnote/definition.ts +68 -0
  56. package/src/{footnote → node/footnote}/index.ts +0 -0
  57. package/src/node/footnote/reference.ts +58 -0
  58. package/src/node/index.ts +4 -0
  59. package/src/node/table/index.ts +283 -0
  60. package/src/node/table/utils.ts +489 -0
  61. package/src/node/task-list-item.ts +87 -0
  62. package/src/{table/plugin/auto-insert-zero-space.ts → plugin/auto-insert-zero-space-plugin.ts} +13 -15
  63. package/src/plugin/column-resizing-plugin.ts +4 -0
  64. package/src/plugin/index.ts +5 -0
  65. package/src/plugin/remark-gfm-plugin.ts +5 -0
  66. package/src/plugin/table-editing-plugin.ts +4 -0
  67. package/lib/footnote/definition.d.ts +0 -3
  68. package/lib/footnote/definition.d.ts.map +0 -1
  69. package/lib/footnote/index.d.ts.map +0 -1
  70. package/lib/footnote/reference.d.ts +0 -3
  71. package/lib/footnote/reference.d.ts.map +0 -1
  72. package/lib/footnote/utils.d.ts +0 -3
  73. package/lib/footnote/utils.d.ts.map +0 -1
  74. package/lib/strike-through.d.ts +0 -3
  75. package/lib/strike-through.d.ts.map +0 -1
  76. package/lib/supported-keys.d.ts +0 -28
  77. package/lib/supported-keys.d.ts.map +0 -1
  78. package/lib/table/command.d.ts +0 -4
  79. package/lib/table/command.d.ts.map +0 -1
  80. package/lib/table/index.d.ts +0 -10
  81. package/lib/table/index.d.ts.map +0 -1
  82. package/lib/table/nodes/index.d.ts +0 -12
  83. package/lib/table/nodes/index.d.ts.map +0 -1
  84. package/lib/table/operator-plugin/actions.d.ts +0 -20
  85. package/lib/table/operator-plugin/actions.d.ts.map +0 -1
  86. package/lib/table/operator-plugin/calc-pos.d.ts +0 -3
  87. package/lib/table/operator-plugin/calc-pos.d.ts.map +0 -1
  88. package/lib/table/operator-plugin/constant.d.ts +0 -6
  89. package/lib/table/operator-plugin/constant.d.ts.map +0 -1
  90. package/lib/table/operator-plugin/helper.d.ts +0 -7
  91. package/lib/table/operator-plugin/helper.d.ts.map +0 -1
  92. package/lib/table/operator-plugin/index.d.ts +0 -6
  93. package/lib/table/operator-plugin/index.d.ts.map +0 -1
  94. package/lib/table/operator-plugin/style.d.ts +0 -3
  95. package/lib/table/operator-plugin/style.d.ts.map +0 -1
  96. package/lib/table/operator-plugin/widget.d.ts +0 -8
  97. package/lib/table/operator-plugin/widget.d.ts.map +0 -1
  98. package/lib/table/plugin/auto-insert-zero-space.d.ts +0 -3
  99. package/lib/table/plugin/auto-insert-zero-space.d.ts.map +0 -1
  100. package/lib/table/plugin/cell-selection.d.ts +0 -40
  101. package/lib/table/plugin/cell-selection.d.ts.map +0 -1
  102. package/lib/table/plugin/column-resizing.d.ts +0 -18
  103. package/lib/table/plugin/column-resizing.d.ts.map +0 -1
  104. package/lib/table/plugin/commands.d.ts +0 -30
  105. package/lib/table/plugin/commands.d.ts.map +0 -1
  106. package/lib/table/plugin/copy-paste.d.ts +0 -14
  107. package/lib/table/plugin/copy-paste.d.ts.map +0 -1
  108. package/lib/table/plugin/fix-tables.d.ts +0 -7
  109. package/lib/table/plugin/fix-tables.d.ts.map +0 -1
  110. package/lib/table/plugin/index.d.ts +0 -4
  111. package/lib/table/plugin/index.d.ts.map +0 -1
  112. package/lib/table/plugin/schema.d.ts +0 -4
  113. package/lib/table/plugin/schema.d.ts.map +0 -1
  114. package/lib/table/plugin/table-editing.d.ts +0 -9
  115. package/lib/table/plugin/table-editing.d.ts.map +0 -1
  116. package/lib/table/plugin/table-map.d.ts +0 -44
  117. package/lib/table/plugin/table-map.d.ts.map +0 -1
  118. package/lib/table/plugin/table-view.d.ts +0 -15
  119. package/lib/table/plugin/table-view.d.ts.map +0 -1
  120. package/lib/table/plugin/types.d.ts +0 -15
  121. package/lib/table/plugin/types.d.ts.map +0 -1
  122. package/lib/table/plugin/util.d.ts +0 -16
  123. package/lib/table/plugin/util.d.ts.map +0 -1
  124. package/lib/table/utils.d.ts +0 -21
  125. package/lib/table/utils.d.ts.map +0 -1
  126. package/lib/task-list-item.d.ts +0 -9
  127. package/lib/task-list-item.d.ts.map +0 -1
  128. package/src/footnote/definition.ts +0 -187
  129. package/src/footnote/reference.ts +0 -178
  130. package/src/footnote/utils.ts +0 -4
  131. package/src/strike-through.ts +0 -43
  132. package/src/supported-keys.ts +0 -13
  133. package/src/table/command.ts +0 -20
  134. package/src/table/index.ts +0 -13
  135. package/src/table/nodes/index.ts +0 -189
  136. package/src/table/operator-plugin/actions.ts +0 -116
  137. package/src/table/operator-plugin/calc-pos.ts +0 -36
  138. package/src/table/operator-plugin/constant.ts +0 -7
  139. package/src/table/operator-plugin/helper.ts +0 -39
  140. package/src/table/operator-plugin/index.ts +0 -110
  141. package/src/table/operator-plugin/style.ts +0 -123
  142. package/src/table/operator-plugin/widget.ts +0 -57
  143. package/src/table/plugin/cell-selection.ts +0 -381
  144. package/src/table/plugin/column-resizing.ts +0 -288
  145. package/src/table/plugin/commands.ts +0 -594
  146. package/src/table/plugin/copy-paste.ts +0 -322
  147. package/src/table/plugin/fix-tables.ts +0 -132
  148. package/src/table/plugin/index.ts +0 -4
  149. package/src/table/plugin/schema.ts +0 -120
  150. package/src/table/plugin/table-editing.ts +0 -369
  151. package/src/table/plugin/table-map.ts +0 -345
  152. package/src/table/plugin/table-view.ts +0 -80
  153. package/src/table/plugin/types.ts +0 -16
  154. package/src/table/plugin/util.ts +0 -119
  155. package/src/table/utils.ts +0 -165
  156. package/src/task-list-item.ts +0 -159
@@ -0,0 +1,2 @@
1
+ export * from './strike-through';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mark/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export declare const strikethroughSchema: import("@milkdown/utils").$MarkSchema;
2
+ export declare const toggleStrikethroughCommand: import("@milkdown/utils").$Command<unknown>;
3
+ export declare const strikethroughKeymap: import("@milkdown/utils").$UserKeymap<"strikeThroughKeymap", "ToggleStrikethrough">;
4
+ //# sourceMappingURL=strike-through.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strike-through.d.ts","sourceRoot":"","sources":["../../src/mark/strike-through.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,uCAqB7B,CAAA;AAEH,eAAO,MAAM,0BAA0B,6CAAsF,CAAA;AAE7H,eAAO,MAAM,mBAAmB,qFAQ9B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const footnoteDefinitionSchema: import("@milkdown/utils").$NodeSchema<"footnote_definition">;
2
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/node/footnote/definition.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,wBAAwB,8DA4DlC,CAAA"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/footnote/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const footnoteReferenceSchema: import("@milkdown/utils").$NodeSchema<"footnote_reference">;
2
+ //# sourceMappingURL=reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/node/footnote/reference.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,6DAmDjC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './table';
2
+ export * from './footnote';
3
+ export * from './task-list-item';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,32 @@
1
+ export declare const tableSchema: import("@milkdown/utils").$NodeSchema<"table">;
2
+ export declare const tableRowSchema: import("@milkdown/utils").$NodeSchema<"table_row">;
3
+ export declare const tableCellSchema: import("@milkdown/utils").$NodeSchema<"table_cell">;
4
+ export declare const tableHeaderSchema: import("@milkdown/utils").$NodeSchema<"table_header">;
5
+ export declare const insertTableInputRule: import("@milkdown/utils").$InputRule;
6
+ export declare const goToPrevTableCellCommand: import("@milkdown/utils").$Command<unknown>;
7
+ export declare const goToNextTableCellCommand: import("@milkdown/utils").$Command<unknown>;
8
+ export declare const breakTableCommand: import("@milkdown/utils").$Command<unknown>;
9
+ export declare const insertTableCommand: import("@milkdown/utils").$Command<{
10
+ row?: number | undefined;
11
+ col?: number | undefined;
12
+ }>;
13
+ export declare const moveRowCommand: import("@milkdown/utils").$Command<{
14
+ from?: number | undefined;
15
+ to?: number | undefined;
16
+ }>;
17
+ export declare const moveColCommand: import("@milkdown/utils").$Command<{
18
+ from?: number | undefined;
19
+ to?: number | undefined;
20
+ }>;
21
+ export declare const selectRowCommand: import("@milkdown/utils").$Command<number>;
22
+ export declare const selectColCommand: import("@milkdown/utils").$Command<number>;
23
+ export declare const selectTableCommand: import("@milkdown/utils").$Command<unknown>;
24
+ export declare const deleteSelectedCellsCommand: import("@milkdown/utils").$Command<unknown>;
25
+ export declare const addColBeforeCommand: import("@milkdown/utils").$Command<unknown>;
26
+ export declare const addColAfterCommand: import("@milkdown/utils").$Command<unknown>;
27
+ export declare const addRowBeforeCommand: import("@milkdown/utils").$Command<unknown>;
28
+ export declare const addRowAfterCommand: import("@milkdown/utils").$Command<unknown>;
29
+ export declare const setAlignCommand: import("@milkdown/utils").$Command<"center" | "left" | "right">;
30
+ export declare const tableKeymap: import("@milkdown/utils").$UserKeymap<"tableKeymap", "NextCell" | "PrevCell" | "ExitTable">;
31
+ export * from './utils';
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/table/index.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,WAAW,gDAiCrB,CAAA;AAEH,eAAO,MAAM,cAAc,oDAwBxB,CAAA;AAEH,eAAO,MAAM,eAAe,qDAoBzB,CAAA;AAEH,eAAO,MAAM,iBAAiB,uDAqB3B,CAAA;AAEH,eAAO,MAAM,oBAAoB,sCAa/B,CAAA;AAEF,eAAO,MAAM,wBAAwB,6CAA8D,CAAA;AAEnG,eAAO,MAAM,wBAAwB,6CAA6D,CAAA;AAElG,eAAO,MAAM,iBAAiB,6CAY5B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;EAU7B,CAAA;AAEF,eAAO,MAAM,cAAc;;;EAKzB,CAAA;AAEF,eAAO,MAAM,cAAc;;;EAKzB,CAAA;AAEF,eAAO,MAAM,gBAAgB,4CAK3B,CAAA;AAEF,eAAO,MAAM,gBAAgB,4CAK3B,CAAA;AAEF,eAAO,MAAM,kBAAkB,6CAK7B,CAAA;AAEF,eAAO,MAAM,0BAA0B,6CAgBrC,CAAA;AAEF,eAAO,MAAM,mBAAmB,6CAAwD,CAAA;AAExF,eAAO,MAAM,kBAAkB,6CAAsD,CAAA;AAErF,eAAO,MAAM,mBAAmB,6CAQ9B,CAAA;AAEF,eAAO,MAAM,kBAAkB,6CAQ7B,CAAA;AAEF,eAAO,MAAM,eAAe,iEAAmI,CAAA;AAE/J,eAAO,MAAM,WAAW,6FAyBtB,CAAA;AAEF,cAAc,SAAS,CAAA"}
@@ -0,0 +1,27 @@
1
+ import type { ContentNodeWithPos } from '@milkdown/prose';
2
+ import type { Node } from '@milkdown/prose/model';
3
+ import type { Selection, Transaction } from '@milkdown/prose/state';
4
+ import type { TableRect } from '@milkdown/prose/tables';
5
+ export interface CellPos {
6
+ pos: number;
7
+ start: number;
8
+ node: Node;
9
+ }
10
+ export declare const createTable: (rowsCount?: number, colsCount?: number) => Node;
11
+ export declare const findTable: (selection: Selection) => ContentNodeWithPos | undefined;
12
+ export declare const getCellsInColumn: (columnIndex: number, selection: Selection) => CellPos[] | undefined;
13
+ export declare const getCellsInRow: (rowIndex: number, selection: Selection) => CellPos[] | undefined;
14
+ export declare const getAllCellsInTable: (selection: Selection) => {
15
+ pos: number;
16
+ start: number;
17
+ node: Node | null;
18
+ }[] | undefined;
19
+ export declare const selectTable: (tr: Transaction) => Transaction;
20
+ export declare function addRowWithAlignment(tr: Transaction, { map, tableStart, table }: TableRect, row: number): Transaction;
21
+ export declare const selectLine: (type: 'row' | 'col') => (index: number) => (tr: Transaction) => Transaction;
22
+ export declare const selectRow: (index: number) => (tr: Transaction) => Transaction;
23
+ export declare const selectCol: (index: number) => (tr: Transaction) => Transaction;
24
+ export declare const convertTableNodeToArrayOfRows: (tableNode: Node) => (Node | null)[][];
25
+ export declare function moveCol(tr: Transaction, origin: number, target: number, select?: boolean): Transaction;
26
+ export declare function moveRow(tr: Transaction, origin: number, target: number, select?: boolean): Transaction;
27
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/node/table/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAKvD,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,IAAI,CAAA;CACX;AAED,eAAO,MAAM,WAAW,8CAAmC,IAc1D,CAAA;AAED,eAAO,MAAM,SAAS,cAAe,SAAS,mCAC2B,CAAA;AAEzE,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,aAAa,SAAS,KAAG,OAAO,EAAE,GAAG,SAsBxF,CAAA;AAED,eAAO,MAAM,aAAa,aAAc,MAAM,aAAa,SAAS,KAAG,OAAO,EAAE,GAAG,SAsBlF,CAAA;AAED,eAAO,MAAM,kBAAkB,cAAe,SAAS;;;;eAiBtD,CAAA;AAED,eAAO,MAAM,WAAW,OAAQ,WAAW,gBAW1C,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,eAgBtG;AAED,eAAO,MAAM,UAAU,SAAU,KAAK,GAAG,KAAK,aAAa,MAAM,UAAU,WAAW,gBAuBrF,CAAA;AAED,eAAO,MAAM,SAAS,UAzBqC,MAAM,UAAU,WAAW,gBAyB5C,CAAA;AAC1C,eAAO,MAAM,SAAS,UA1BqC,MAAM,UAAU,WAAW,gBA0B5C,CAAA;AA2C1C,eAAO,MAAM,6BAA6B,cAAe,IAAI,sBAwB5D,CAAA;AAqLD,wBAAgB,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAO,eAuCrF;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAO,eAuCrF"}
@@ -0,0 +1,2 @@
1
+ export declare const extendListItemSchemaForTask: import("@milkdown/ctx").MilkdownPlugin;
2
+ //# sourceMappingURL=task-list-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-list-item.d.ts","sourceRoot":"","sources":["../../src/node/task-list-item.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,2BAA2B,wCAkFtC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const autoInsertZeroSpaceInTablePlugin: import("@milkdown/utils").$Prose;
2
+ //# sourceMappingURL=auto-insert-zero-space-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-insert-zero-space-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/auto-insert-zero-space-plugin.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gCAAgC,kCAuC3C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const columnResizingPlugin: import("@milkdown/utils").$Prose;
2
+ //# sourceMappingURL=column-resizing-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-resizing-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/column-resizing-plugin.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,kCAAmC,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './auto-insert-zero-space-plugin';
2
+ export * from './column-resizing-plugin';
3
+ export * from './table-editing-plugin';
4
+ export * from './remark-gfm-plugin';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AACA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const remarkGFMPlugin: import("@milkdown/utils").$Remark;
2
+ //# sourceMappingURL=remark-gfm-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-gfm-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-gfm-plugin.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,mCAA2B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const tableEditingPlugin: import("@milkdown/utils").$Prose;
2
+ //# sourceMappingURL=table-editing-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-editing-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/table-editing-plugin.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,kCAA+B,CAAA"}
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@milkdown/preset-gfm",
3
3
  "type": "module",
4
- "version": "6.5.3",
4
+ "version": "7.0.0-next.0",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Saul-Mirone/milkdown.git",
9
+ "directory": "packages/preset-gfm"
10
+ },
6
11
  "keywords": [
7
12
  "milkdown",
8
13
  "milkdown plugin",
@@ -17,21 +22,24 @@
17
22
  "src"
18
23
  ],
19
24
  "peerDependencies": {
20
- "@milkdown/core": "^6.0.1",
21
- "@milkdown/preset-commonmark": "^6.0.1",
22
- "@milkdown/prose": "^6.0.1"
25
+ "@milkdown/core": "^7.0.0-next.0",
26
+ "@milkdown/ctx": "^7.0.0-next.0",
27
+ "@milkdown/preset-commonmark": "^7.0.0-next.0",
28
+ "@milkdown/prose": "^7.0.0-next.0",
29
+ "@milkdown/transformer": "^7.0.0-next.0"
23
30
  },
24
31
  "dependencies": {
25
32
  "remark-gfm": "^3.0.0",
26
33
  "tslib": "^2.4.0",
27
- "@milkdown/exception": "6.5.3",
28
- "@milkdown/utils": "6.5.3"
34
+ "@milkdown/exception": "7.0.0-next.0",
35
+ "@milkdown/utils": "7.0.0-next.0"
29
36
  },
30
37
  "devDependencies": {
31
- "@milkdown/core": "6.5.3",
32
- "@milkdown/design-system": "6.5.3",
33
- "@milkdown/preset-commonmark": "6.5.3",
34
- "@milkdown/prose": "6.5.3"
38
+ "@milkdown/core": "7.0.0-next.0",
39
+ "@milkdown/ctx": "7.0.0-next.0",
40
+ "@milkdown/preset-commonmark": "7.0.0-next.0",
41
+ "@milkdown/prose": "7.0.0-next.0",
42
+ "@milkdown/transformer": "7.0.0-next.0"
35
43
  },
36
44
  "nx": {
37
45
  "targets": {
@@ -0,0 +1,23 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import { toggleStrikethroughCommand } from '../mark'
3
+ import { addColAfterCommand, addColBeforeCommand, addRowAfterCommand, addRowBeforeCommand, breakTableCommand, deleteSelectedCellsCommand, goToNextTableCellCommand, goToPrevTableCellCommand, insertTableCommand, moveColCommand, moveRowCommand, selectColCommand, selectRowCommand, selectTableCommand, setAlignCommand } from '../node'
4
+
5
+ export const commands = [
6
+ goToNextTableCellCommand,
7
+ goToPrevTableCellCommand,
8
+ breakTableCommand,
9
+ insertTableCommand,
10
+ moveRowCommand,
11
+ moveColCommand,
12
+ selectRowCommand,
13
+ selectColCommand,
14
+ selectTableCommand,
15
+ deleteSelectedCellsCommand,
16
+ addRowBeforeCommand,
17
+ addRowAfterCommand,
18
+ addColBeforeCommand,
19
+ addColAfterCommand,
20
+ setAlignCommand,
21
+
22
+ toggleStrikethroughCommand,
23
+ ]
@@ -0,0 +1,6 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ export * from './keymap'
3
+ export * from './inputrules'
4
+ export * from './plugins'
5
+ export * from './schema'
6
+ export * from './commands'
@@ -0,0 +1,7 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import type { MilkdownPlugin } from '@milkdown/ctx'
3
+ import { insertTableInputRule } from '../node'
4
+
5
+ export const inputrules: MilkdownPlugin[] = [
6
+ insertTableInputRule,
7
+ ]
@@ -0,0 +1,9 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import type { MilkdownPlugin } from '@milkdown/ctx'
3
+ import { strikethroughKeymap } from '../mark'
4
+ import { tableKeymap } from '../node'
5
+
6
+ export const keymap: MilkdownPlugin[] = [
7
+ strikethroughKeymap,
8
+ tableKeymap,
9
+ ].flat()
@@ -0,0 +1,10 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import type { MilkdownPlugin } from '@milkdown/ctx'
3
+ import { autoInsertZeroSpaceInTablePlugin, columnResizingPlugin, remarkGFMPlugin, tableEditingPlugin } from '../plugin'
4
+
5
+ export const plugins: MilkdownPlugin[] = [
6
+ autoInsertZeroSpaceInTablePlugin,
7
+ columnResizingPlugin,
8
+ tableEditingPlugin,
9
+ remarkGFMPlugin,
10
+ ]
@@ -0,0 +1,18 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import type { MilkdownPlugin } from '@milkdown/ctx'
3
+ import { strikethroughSchema } from '../mark'
4
+ import { extendListItemSchemaForTask, footnoteDefinitionSchema, footnoteReferenceSchema, tableCellSchema, tableHeaderSchema, tableRowSchema, tableSchema } from '../node'
5
+
6
+ export const schema: MilkdownPlugin[] = [
7
+ extendListItemSchemaForTask,
8
+
9
+ tableSchema,
10
+ tableRowSchema,
11
+ tableHeaderSchema,
12
+ tableCellSchema,
13
+
14
+ footnoteDefinitionSchema,
15
+ footnoteReferenceSchema,
16
+
17
+ strikethroughSchema,
18
+ ].flat()
package/src/index.ts CHANGED
@@ -1,93 +1,9 @@
1
1
  /* Copyright 2021, Milkdown by Mirone. */
2
- import { commonmark, commands as commonmarkCommands } from '@milkdown/preset-commonmark'
3
- import { $remark, AtomList } from '@milkdown/utils'
4
- import remarkGFM from 'remark-gfm'
5
2
 
6
- import { footnoteReference } from './footnote'
7
- import { footnoteDefinition } from './footnote/definition'
8
- import { ToggleStrikeThrough, strikeThrough } from './strike-through'
9
- import { table } from './table'
10
- import {
11
- LiftTaskListItem,
12
- SinkTaskListItem,
13
- SplitTaskListItem,
14
- TurnIntoTaskList,
15
- taskListItem,
16
- } from './task-list-item'
3
+ import { commands, inputrules, keymap, plugins, schema } from './composed'
17
4
 
18
- export * from './footnote'
19
- export * from './strike-through'
20
- export { SupportedKeys } from './supported-keys'
21
- export {
22
- BreakTable,
23
- // command
24
- createTable,
25
- InsertTable,
26
- NextCell,
27
- PrevCell,
28
- // gather
29
- table,
30
- } from './table'
31
- export * from './task-list-item'
32
- export {
33
- blockquote,
34
- bulletList,
35
- codeFence,
36
- codeInline,
37
- commonmark,
38
- // gather
39
- commonmarkNodes,
40
- commonmarkPlugins,
41
- // node
42
- doc,
43
- em,
44
- HardbreakFilterPluginKey as hardbreak,
45
- heading,
46
- hr,
47
- image,
48
- // command
49
- InsertHardbreak,
50
- InsertHr,
51
- InsertImage,
52
- LiftListItem,
53
- link,
54
- listItem,
55
- ModifyImage,
56
- ModifyLink,
57
- orderedList,
58
- paragraph,
59
- SinkListItem,
60
- SplitListItem,
61
- strong,
62
- text,
63
- ToggleBold,
64
- ToggleInlineCode,
65
- ToggleItalic,
66
- ToggleLink,
67
- TurnIntoCodeFence,
68
- TurnIntoHeading,
69
- TurnIntoText,
70
- WrapInBlockquote,
71
- WrapInBulletList,
72
- WrapInOrderedList,
73
- } from '@milkdown/preset-commonmark'
5
+ export * from './node'
6
+ export * from './mark'
7
+ export * from './composed'
74
8
 
75
- export const gfm = AtomList.create([
76
- ...commonmark,
77
- $remark(() => remarkGFM),
78
- table(),
79
- strikeThrough(),
80
- taskListItem(),
81
- footnoteReference(),
82
- footnoteDefinition(),
83
- ])
84
-
85
- export const commands = {
86
- ...commonmarkCommands,
87
- ToggleStrikeThrough,
88
- TurnIntoTaskList,
89
- SinkTaskListItem,
90
- LiftTaskListItem,
91
- SplitTaskListItem,
92
- } as const
93
- export type Commands = typeof commands
9
+ export const gfm = [schema, inputrules, keymap, plugins, commands].flat()
@@ -0,0 +1,2 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ export * from './strike-through'
@@ -0,0 +1,39 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import { commandsCtx } from '@milkdown/core'
3
+ import { toggleMark } from '@milkdown/prose/commands'
4
+ import { $command, $markSchema, $useKeymap } from '@milkdown/utils'
5
+
6
+ export const strikethroughSchema = $markSchema('strike_through', () => ({
7
+ inclusive: false,
8
+ parseDOM: [
9
+ { tag: 'del' },
10
+ { style: 'text-decoration', getAttrs: value => (value === 'line-through') as false },
11
+ ],
12
+ toDOM: () => ['del'],
13
+ parseMarkdown: {
14
+ match: node => node.type === 'delete',
15
+ runner: (state, node, markType) => {
16
+ state.openMark(markType)
17
+ state.next(node.children)
18
+ state.closeMark(markType)
19
+ },
20
+ },
21
+ toMarkdown: {
22
+ match: mark => mark.type.name === 'strike_through',
23
+ runner: (state, mark) => {
24
+ state.withMark(mark, 'delete')
25
+ },
26
+ },
27
+ }))
28
+
29
+ export const toggleStrikethroughCommand = $command('ToggleStrikeThrough', () => () => toggleMark(strikethroughSchema.type()))
30
+
31
+ export const strikethroughKeymap = $useKeymap('strikeThroughKeymap', {
32
+ ToggleStrikethrough: {
33
+ shortcuts: 'Mod-Alt-x',
34
+ command: (ctx) => {
35
+ const commands = ctx.get(commandsCtx)
36
+ return () => commands.call(toggleStrikethroughCommand.key)
37
+ },
38
+ },
39
+ })
@@ -0,0 +1,68 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+
3
+ import { expectDomTypeError } from '@milkdown/exception'
4
+ import { $nodeSchema } from '@milkdown/utils'
5
+
6
+ const id = 'footnote_definition'
7
+ const markdownId = 'footnoteDefinition'
8
+ export const footnoteDefinitionSchema = $nodeSchema('footnote_definition', () => ({
9
+ group: 'block',
10
+ content: 'block+',
11
+ defining: true,
12
+ attrs: {
13
+ label: {
14
+ default: '',
15
+ },
16
+ },
17
+ parseDOM: [
18
+ {
19
+ tag: `dl[data-type="${id}"]`,
20
+ getAttrs: (dom) => {
21
+ if (!(dom instanceof HTMLElement))
22
+ throw expectDomTypeError(dom)
23
+
24
+ return {
25
+ label: dom.dataset.label,
26
+ }
27
+ },
28
+ contentElement: 'dd',
29
+ },
30
+ ],
31
+ toDOM: (node) => {
32
+ const label = node.attrs.label
33
+
34
+ return [
35
+ 'dl',
36
+ {
37
+ // TODO: add a prosemirror plugin to sync label on change
38
+ 'data-label': label,
39
+ 'data-type': id,
40
+ },
41
+ ['dt', label],
42
+ ['dd', 0],
43
+ ]
44
+ },
45
+ parseMarkdown: {
46
+ match: ({ type }) => type === markdownId,
47
+ runner: (state, node, type) => {
48
+ state
49
+ .openNode(type, {
50
+ label: node.label as string,
51
+ })
52
+ .next(node.children)
53
+ .closeNode()
54
+ },
55
+ },
56
+ toMarkdown: {
57
+ match: node => node.type.name === id,
58
+ runner: (state, node) => {
59
+ state
60
+ .openNode(markdownId, undefined, {
61
+ label: node.attrs.label,
62
+ identifier: node.attrs.label,
63
+ })
64
+ .next(node.content)
65
+ .closeNode()
66
+ },
67
+ },
68
+ }))
File without changes
@@ -0,0 +1,58 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+
3
+ import { expectDomTypeError } from '@milkdown/exception'
4
+ import { $nodeSchema } from '@milkdown/utils'
5
+
6
+ const id = 'footnote_reference'
7
+ export const footnoteReferenceSchema = $nodeSchema('footnote_reference', () => ({
8
+ group: 'inline',
9
+ inline: true,
10
+ atom: true,
11
+ attrs: {
12
+ label: {
13
+ default: '',
14
+ },
15
+ },
16
+ parseDOM: [
17
+ {
18
+ tag: `sup[data-type="${id}"]`,
19
+ getAttrs: (dom) => {
20
+ if (!(dom instanceof HTMLElement))
21
+ throw expectDomTypeError(dom)
22
+
23
+ return {
24
+ label: dom.dataset.label,
25
+ }
26
+ },
27
+ },
28
+ ],
29
+ toDOM: (node) => {
30
+ const label = node.attrs.label
31
+ return [
32
+ 'sup',
33
+ {
34
+ // TODO: add a prosemirror plugin to sync label on change
35
+ 'data-label': label,
36
+ 'data-type': id,
37
+ },
38
+ label,
39
+ ]
40
+ },
41
+ parseMarkdown: {
42
+ match: ({ type }) => type === 'footnoteReference',
43
+ runner: (state, node, type) => {
44
+ state.addNode(type, {
45
+ label: node.label as string,
46
+ })
47
+ },
48
+ },
49
+ toMarkdown: {
50
+ match: node => node.type.name === id,
51
+ runner: (state, node) => {
52
+ state.addNode('footnoteReference', undefined, undefined, {
53
+ label: node.attrs.label,
54
+ identifier: node.attrs.label,
55
+ })
56
+ },
57
+ },
58
+ }))
@@ -0,0 +1,4 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ export * from './table'
3
+ export * from './footnote'
4
+ export * from './task-list-item'