@atlaskit/adf-schema 25.4.0 → 25.5.1

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 (112) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/schema/jira-schema.js +4 -0
  3. package/dist/cjs/schema/marks/alignment.js +4 -0
  4. package/dist/cjs/schema/marks/annotation.js +8 -8
  5. package/dist/cjs/schema/marks/border.js +6 -0
  6. package/dist/cjs/schema/marks/breakout.js +5 -0
  7. package/dist/cjs/schema/marks/code.js +4 -0
  8. package/dist/cjs/schema/marks/data-consumer.js +17 -0
  9. package/dist/cjs/schema/marks/em.js +4 -0
  10. package/dist/cjs/schema/marks/fragment.js +6 -0
  11. package/dist/cjs/schema/marks/indentation.js +4 -0
  12. package/dist/cjs/schema/marks/link.js +4 -0
  13. package/dist/cjs/schema/marks/strike.js +4 -0
  14. package/dist/cjs/schema/marks/strong.js +4 -0
  15. package/dist/cjs/schema/marks/subsup.js +4 -0
  16. package/dist/cjs/schema/marks/text-color.js +4 -0
  17. package/dist/cjs/schema/marks/underline.js +4 -0
  18. package/dist/cjs/schema/nodes/bodied-extension.js +8 -0
  19. package/dist/cjs/schema/nodes/code-block.js +12 -0
  20. package/dist/cjs/schema/nodes/decision-item.js +4 -0
  21. package/dist/cjs/schema/nodes/decision-list.js +4 -0
  22. package/dist/cjs/schema/nodes/emoji.js +4 -0
  23. package/dist/cjs/schema/nodes/extension.js +8 -0
  24. package/dist/cjs/schema/nodes/inline-extension.js +8 -0
  25. package/dist/cjs/schema/nodes/media-inline.js +4 -0
  26. package/dist/cjs/schema/nodes/media.js +4 -0
  27. package/dist/cjs/schema/nodes/mention.js +7 -4
  28. package/dist/cjs/schema/nodes/panel.js +7 -4
  29. package/dist/cjs/schema/nodes/paragraph.js +0 -3
  30. package/dist/cjs/schema/nodes/status.js +4 -0
  31. package/dist/cjs/schema/nodes/tableNodes.js +23 -0
  32. package/dist/cjs/schema/nodes/task-item.js +4 -0
  33. package/dist/cjs/schema/nodes/task-list.js +4 -0
  34. package/dist/cjs/steps/analytics.js +3 -3
  35. package/dist/cjs/steps/link-meta-step.js +112 -0
  36. package/dist/cjs/steps/table/add-column.js +1 -1
  37. package/dist/cjs/steps/table/constants.js +4 -4
  38. package/dist/cjs/steps/table/utils/cells-at-column.js +48 -50
  39. package/dist/cjs/steps/table/utils/side-effects/rows.js +1 -1
  40. package/dist/cjs/steps/type-ahead.js +4 -4
  41. package/dist/cjs/steps.js +8 -1
  42. package/dist/cjs/version.json +1 -1
  43. package/dist/es2019/schema/jira-schema.js +5 -0
  44. package/dist/es2019/schema/marks/alignment.js +5 -0
  45. package/dist/es2019/schema/marks/annotation.js +6 -6
  46. package/dist/es2019/schema/marks/border.js +7 -0
  47. package/dist/es2019/schema/marks/breakout.js +5 -0
  48. package/dist/es2019/schema/marks/data-consumer.js +6 -0
  49. package/dist/es2019/schema/marks/fragment.js +7 -0
  50. package/dist/es2019/schema/marks/indentation.js +5 -0
  51. package/dist/es2019/schema/marks/link.js +5 -0
  52. package/dist/es2019/schema/marks/subsup.js +5 -0
  53. package/dist/es2019/schema/marks/text-color.js +5 -0
  54. package/dist/es2019/schema/nodes/bodied-extension.js +9 -0
  55. package/dist/es2019/schema/nodes/code-block.js +13 -0
  56. package/dist/es2019/schema/nodes/decision-item.js +5 -0
  57. package/dist/es2019/schema/nodes/extension.js +9 -0
  58. package/dist/es2019/schema/nodes/heading.js +0 -2
  59. package/dist/es2019/schema/nodes/inline-extension.js +9 -0
  60. package/dist/es2019/schema/nodes/layout-section.js +0 -3
  61. package/dist/es2019/schema/nodes/media-inline.js +5 -0
  62. package/dist/es2019/schema/nodes/media.js +5 -0
  63. package/dist/es2019/schema/nodes/mention.js +8 -3
  64. package/dist/es2019/schema/nodes/panel.js +8 -3
  65. package/dist/es2019/schema/nodes/paragraph.js +0 -3
  66. package/dist/es2019/schema/nodes/tableNodes.js +23 -0
  67. package/dist/es2019/schema/nodes/task-item.js +5 -0
  68. package/dist/es2019/schema/nodes/task-list.js +5 -0
  69. package/dist/es2019/steps/analytics.js +3 -3
  70. package/dist/es2019/steps/link-meta-step.js +71 -0
  71. package/dist/es2019/steps/table/constants.js +3 -3
  72. package/dist/es2019/steps/type-ahead.js +3 -3
  73. package/dist/es2019/steps.js +2 -1
  74. package/dist/es2019/version.json +1 -1
  75. package/dist/esm/schema/jira-schema.js +5 -0
  76. package/dist/esm/schema/marks/alignment.js +5 -0
  77. package/dist/esm/schema/marks/annotation.js +6 -6
  78. package/dist/esm/schema/marks/border.js +7 -0
  79. package/dist/esm/schema/marks/breakout.js +5 -0
  80. package/dist/esm/schema/marks/data-consumer.js +6 -0
  81. package/dist/esm/schema/marks/fragment.js +7 -0
  82. package/dist/esm/schema/marks/indentation.js +5 -0
  83. package/dist/esm/schema/marks/link.js +5 -0
  84. package/dist/esm/schema/marks/subsup.js +5 -0
  85. package/dist/esm/schema/marks/text-color.js +5 -0
  86. package/dist/esm/schema/nodes/bodied-extension.js +9 -0
  87. package/dist/esm/schema/nodes/code-block.js +13 -0
  88. package/dist/esm/schema/nodes/decision-item.js +5 -0
  89. package/dist/esm/schema/nodes/extension.js +9 -0
  90. package/dist/esm/schema/nodes/heading.js +0 -2
  91. package/dist/esm/schema/nodes/inline-extension.js +9 -0
  92. package/dist/esm/schema/nodes/layout-section.js +0 -3
  93. package/dist/esm/schema/nodes/media-inline.js +5 -0
  94. package/dist/esm/schema/nodes/media.js +5 -0
  95. package/dist/esm/schema/nodes/mention.js +8 -3
  96. package/dist/esm/schema/nodes/panel.js +8 -3
  97. package/dist/esm/schema/nodes/paragraph.js +0 -3
  98. package/dist/esm/schema/nodes/tableNodes.js +23 -0
  99. package/dist/esm/schema/nodes/task-item.js +5 -0
  100. package/dist/esm/schema/nodes/task-list.js +5 -0
  101. package/dist/esm/steps/analytics.js +3 -3
  102. package/dist/esm/steps/link-meta-step.js +103 -0
  103. package/dist/esm/steps/table/add-column.js +1 -1
  104. package/dist/esm/steps/table/constants.js +3 -3
  105. package/dist/esm/steps/table/utils/cells-at-column.js +48 -50
  106. package/dist/esm/steps/table/utils/side-effects/rows.js +1 -1
  107. package/dist/esm/steps/type-ahead.js +3 -3
  108. package/dist/esm/steps.js +2 -1
  109. package/dist/esm/version.json +1 -1
  110. package/dist/types/steps/link-meta-step.d.ts +51 -0
  111. package/dist/types/steps.d.ts +2 -0
  112. package/package.json +2 -2
@@ -12,57 +12,55 @@ import { getCellIndex, hasMergedColumns, isRootRow } from './table-map';
12
12
  export function cellsAtColumn(rect, col) {
13
13
  var map, tableStart, table, refColumn, row, index, pos, hasMergedCells, type, cell, cellInfo, skippedRows;
14
14
  return _regeneratorRuntime.wrap(function cellsAtColumn$(_context) {
15
- while (1) {
16
- switch (_context.prev = _context.next) {
17
- case 0:
18
- map = rect.map, tableStart = rect.tableStart, table = rect.table;
19
- refColumn = col > 0 ? -1 : 0;
20
- if (columnIsHeader(map, table, col + refColumn)) {
21
- refColumn = col === 0 || col === map.width ? null : 0;
22
- }
23
- row = 0;
24
- case 4:
25
- if (!(row < map.height)) {
26
- _context.next = 20;
27
- break;
28
- }
29
- index = getCellIndex(rect.map, row, col);
30
- pos = map.map[index]; // We only consider to has merged cell to the first cell in a rowspan.
31
- hasMergedCells = hasMergedColumns(rect.map, row, col) && isRootRow(rect.map, row, col); // If this position falls inside a col-spanning cell
32
- type = refColumn == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map.map[index + refColumn]).type;
33
- if (!hasMergedCells) {
34
- pos = map.positionAt(row, col, table);
35
- }
36
- cell = table.nodeAt(pos);
37
- cellInfo = {
38
- from: tableStart + pos,
39
- to: tableStart + pos,
40
- row: row,
41
- col: hasMergedCells ? map.colCount(pos) : col,
42
- type: type,
43
- hasMergedCells: hasMergedCells
44
- };
45
- if (cell) {
46
- cellInfo.attrs = cell.attrs;
47
- cellInfo.to = tableStart + pos + cell.nodeSize;
48
- }
49
-
50
- // We let the consumer to pass the rows that we want to skip
51
- _context.next = 15;
52
- return cellInfo;
53
- case 15:
54
- skippedRows = _context.sent;
55
- if (skippedRows && skippedRows > 0) {
56
- row += skippedRows;
57
- }
58
- case 17:
59
- row++;
60
- _context.next = 4;
15
+ while (1) switch (_context.prev = _context.next) {
16
+ case 0:
17
+ map = rect.map, tableStart = rect.tableStart, table = rect.table;
18
+ refColumn = col > 0 ? -1 : 0;
19
+ if (columnIsHeader(map, table, col + refColumn)) {
20
+ refColumn = col === 0 || col === map.width ? null : 0;
21
+ }
22
+ row = 0;
23
+ case 4:
24
+ if (!(row < map.height)) {
25
+ _context.next = 20;
61
26
  break;
62
- case 20:
63
- case "end":
64
- return _context.stop();
65
- }
27
+ }
28
+ index = getCellIndex(rect.map, row, col);
29
+ pos = map.map[index]; // We only consider to has merged cell to the first cell in a rowspan.
30
+ hasMergedCells = hasMergedColumns(rect.map, row, col) && isRootRow(rect.map, row, col); // If this position falls inside a col-spanning cell
31
+ type = refColumn == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map.map[index + refColumn]).type;
32
+ if (!hasMergedCells) {
33
+ pos = map.positionAt(row, col, table);
34
+ }
35
+ cell = table.nodeAt(pos);
36
+ cellInfo = {
37
+ from: tableStart + pos,
38
+ to: tableStart + pos,
39
+ row: row,
40
+ col: hasMergedCells ? map.colCount(pos) : col,
41
+ type: type,
42
+ hasMergedCells: hasMergedCells
43
+ };
44
+ if (cell) {
45
+ cellInfo.attrs = cell.attrs;
46
+ cellInfo.to = tableStart + pos + cell.nodeSize;
47
+ }
48
+
49
+ // We let the consumer to pass the rows that we want to skip
50
+ _context.next = 15;
51
+ return cellInfo;
52
+ case 15:
53
+ skippedRows = _context.sent;
54
+ if (skippedRows && skippedRows > 0) {
55
+ row += skippedRows;
56
+ }
57
+ case 17:
58
+ row++;
59
+ _context.next = 4;
60
+ break;
61
+ case 20:
62
+ case "end":
63
+ return _context.stop();
66
64
  }
67
65
  }, _marked);
68
66
  }
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
5
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
10
  import { hasMergedColumns } from '../table-map';
@@ -8,11 +8,11 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
8
8
  import { Slice } from 'prosemirror-model';
9
9
  import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror-transform';
10
10
  export var insertTypeAheadStepType = 'atlaskit-insert-type-ahead';
11
- export var InsertTypeAheadStages;
12
- (function (InsertTypeAheadStages) {
11
+ export var InsertTypeAheadStages = /*#__PURE__*/function (InsertTypeAheadStages) {
13
12
  InsertTypeAheadStages["DELETING_RAW_QUERY"] = "DELETING_RAW_QUERY";
14
13
  InsertTypeAheadStages["INSERTING_ITEM"] = "INSERTING_ITEM";
15
- })(InsertTypeAheadStages || (InsertTypeAheadStages = {}));
14
+ return InsertTypeAheadStages;
15
+ }({});
16
16
  export var InsertTypeAheadStep = /*#__PURE__*/function (_Step) {
17
17
  _inherits(InsertTypeAheadStep, _Step);
18
18
  var _super = _createSuper(InsertTypeAheadStep);
package/dist/esm/steps.js CHANGED
@@ -3,4 +3,5 @@ export { TableSortStep } from './steps/table/sort-column';
3
3
  export { InsertTypeAheadStages, InsertTypeAheadStep } from './steps/type-ahead';
4
4
  export { AddColumnStep } from './steps/table/add-column';
5
5
  export { SetAttrsStep } from './steps/set-attrs';
6
- export { AnalyticsStep } from './steps/analytics';
6
+ export { AnalyticsStep } from './steps/analytics';
7
+ export { LinkMetaStep } from './steps/link-meta-step';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "25.4.0",
3
+ "version": "25.5.1",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,51 @@
1
+ import { Node as PMNode, Schema } from 'prosemirror-model';
2
+ import { ReplaceStep, Step, StepMap, StepResult, Mappable } from 'prosemirror-transform';
3
+ export declare const stepType = "editor-linking-meta";
4
+ export declare const invertStepType = "editor-linking-meta-invert";
5
+ export declare type LinkStepMetadata = {
6
+ /**
7
+ * Editor action performed
8
+ */
9
+ action?: string;
10
+ /**
11
+ * Editor input method that triggered the transaction
12
+ */
13
+ inputMethod?: string;
14
+ /**
15
+ * The applicable card action for this step
16
+ * if is RESOLVE then the undo/redo steps should be considered "updates" of a link
17
+ */
18
+ cardAction?: 'RESOLVE';
19
+ /**
20
+ * Source UI that tiggered this step, if available/applicable
21
+ */
22
+ sourceEvent?: unknown;
23
+ };
24
+ /**
25
+ * Custom Prosemirror Step to attach metadata about user interactions with links
26
+ * Using a Step means that it will work with prosemirror-history and we get utilise when
27
+ * firing events on history change
28
+ */
29
+ export declare class LinkMetaStep extends Step {
30
+ private pos;
31
+ private metadata;
32
+ private isInverted;
33
+ constructor(pos: number | null, metadata: LinkStepMetadata, isInverted?: boolean);
34
+ getMetadata(): LinkStepMetadata;
35
+ /**
36
+ * Generate new undo/redo analytics event when step is inverted
37
+ */
38
+ invert(): LinkMetaStep;
39
+ apply(doc: PMNode): StepResult<any>;
40
+ map(mapping: Mappable): LinkMetaStep;
41
+ getMap(): StepMap;
42
+ merge(): null;
43
+ toJSON(): {
44
+ stepType: string;
45
+ from: number;
46
+ to: number;
47
+ };
48
+ static fromJSON<S extends Schema = any>(_: S, __: {
49
+ [key: string]: any;
50
+ }): ReplaceStep<any>;
51
+ }
@@ -6,3 +6,5 @@ export { SetAttrsStep } from './steps/set-attrs';
6
6
  export { AnalyticsStep } from './steps/analytics';
7
7
  export type { TableColumnOrdering } from './steps/table/types';
8
8
  export type { AnalyticsInvertStep, AnalyticsWithChannel, AnalyticsPayload, } from './steps/analytics';
9
+ export { LinkMetaStep } from './steps/link-meta-step';
10
+ export type { LinkStepMetadata } from './steps/link-meta-step';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "25.4.0",
3
+ "version": "25.5.1",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@atlaskit/codemod-utils": "^4.1.0",
43
- "@atlaskit/editor-palette": "1.2.0",
43
+ "@atlaskit/editor-palette": "1.3.0",
44
44
  "@atlaskit/editor-tables": "^2.2.0",
45
45
  "@atlaskit/tokens": "^1.2.1",
46
46
  "@babel/runtime": "^7.0.0",