@manuscripts/transform 2.1.1-LEAN-3092-9 → 2.1.1-LEAN-3336-21

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 (61) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/jats/importer/jats-body-dom-parser.js +74 -33
  3. package/dist/cjs/jats/importer/jats-body-transformations.js +0 -13
  4. package/dist/cjs/jats/importer/jats-parser-utils.js +0 -6
  5. package/dist/cjs/jats/jats-exporter.js +64 -32
  6. package/dist/cjs/mathjax/index.js +41 -0
  7. package/dist/cjs/mathjax/mathjax-packages.js +20 -0
  8. package/dist/cjs/mathjax/mathml-to-svg.js +70 -0
  9. package/dist/cjs/mathjax/tex-to-mathml.js +49 -0
  10. package/dist/cjs/mathjax/tex-to-svg.js +59 -0
  11. package/dist/cjs/schema/index.js +4 -5
  12. package/dist/cjs/schema/nodes/equation.js +14 -12
  13. package/dist/cjs/schema/nodes/equation_element.js +5 -4
  14. package/dist/cjs/schema/nodes/inline_equation.js +15 -13
  15. package/dist/cjs/schema/nodes/table.js +73 -30
  16. package/dist/cjs/schema/nodes/table_element.js +1 -1
  17. package/dist/cjs/transformer/builders.js +8 -1
  18. package/dist/cjs/transformer/decode.js +26 -7
  19. package/dist/cjs/transformer/encode.js +27 -6
  20. package/dist/cjs/transformer/node-types.js +1 -0
  21. package/dist/cjs/transformer/object-types.js +1 -0
  22. package/dist/es/index.js +1 -0
  23. package/dist/es/jats/importer/jats-body-dom-parser.js +75 -34
  24. package/dist/es/jats/importer/jats-body-transformations.js +0 -13
  25. package/dist/es/jats/importer/jats-parser-utils.js +0 -6
  26. package/dist/es/jats/jats-exporter.js +64 -32
  27. package/dist/es/mathjax/index.js +12 -0
  28. package/dist/es/mathjax/mathjax-packages.js +17 -0
  29. package/dist/es/mathjax/mathml-to-svg.js +66 -0
  30. package/dist/es/mathjax/tex-to-mathml.js +45 -0
  31. package/dist/es/mathjax/tex-to-svg.js +55 -0
  32. package/dist/es/schema/index.js +3 -4
  33. package/dist/es/schema/nodes/equation.js +14 -12
  34. package/dist/es/schema/nodes/equation_element.js +5 -4
  35. package/dist/es/schema/nodes/inline_equation.js +15 -13
  36. package/dist/es/schema/nodes/table.js +72 -29
  37. package/dist/es/schema/nodes/table_element.js +1 -1
  38. package/dist/es/transformer/builders.js +6 -0
  39. package/dist/es/transformer/decode.js +26 -7
  40. package/dist/es/transformer/encode.js +27 -6
  41. package/dist/es/transformer/node-types.js +1 -0
  42. package/dist/es/transformer/object-types.js +1 -0
  43. package/dist/types/index.d.ts +1 -0
  44. package/dist/types/jats/jats-exporter.d.ts +0 -1
  45. package/dist/types/mathjax/index.d.ts +3 -0
  46. package/dist/types/mathjax/mathjax-packages.d.ts +16 -0
  47. package/dist/types/mathjax/mathml-to-svg.d.ts +17 -0
  48. package/dist/types/mathjax/tex-to-mathml.d.ts +17 -0
  49. package/dist/types/mathjax/tex-to-svg.d.ts +17 -0
  50. package/dist/types/schema/index.d.ts +1 -1
  51. package/dist/types/schema/nodes/equation.d.ts +4 -3
  52. package/dist/types/schema/nodes/equation_element.d.ts +2 -1
  53. package/dist/types/schema/nodes/inline_equation.d.ts +3 -4
  54. package/dist/types/schema/nodes/table.d.ts +72 -10
  55. package/dist/types/schema/types.d.ts +1 -1
  56. package/dist/types/transformer/builders.d.ts +2 -1
  57. package/dist/types/transformer/decode.d.ts +1 -0
  58. package/package.json +7 -5
  59. package/dist/cjs/schema/nodes/table_row.js +0 -123
  60. package/dist/es/schema/nodes/table_row.js +0 -120
  61. package/dist/types/schema/nodes/table_row.d.ts +0 -41
@@ -13,19 +13,77 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { tableNodes as createTableNodes, } from 'prosemirror-tables';
17
+ const tableOptions = {
18
+ cellContent: 'inline*',
19
+ cellAttributes: {
20
+ placeholder: {
21
+ default: 'Data',
22
+ getFromDOM(dom) {
23
+ return dom.getAttribute('data-placeholder-text') || '';
24
+ },
25
+ setDOMAttr(value, attrs) {
26
+ if (value) {
27
+ attrs['data-placeholder-text'] = value;
28
+ }
29
+ },
30
+ },
31
+ valign: {
32
+ default: null,
33
+ getFromDOM(dom) {
34
+ return dom.getAttribute('valign');
35
+ },
36
+ setDOMAttr(value, attrs) {
37
+ if (value) {
38
+ attrs['valign'] = value;
39
+ }
40
+ },
41
+ },
42
+ align: {
43
+ default: null,
44
+ getFromDOM(dom) {
45
+ return dom.getAttribute('align');
46
+ },
47
+ setDOMAttr(value, attrs) {
48
+ if (value) {
49
+ attrs['align'] = value;
50
+ }
51
+ },
52
+ },
53
+ scope: {
54
+ default: null,
55
+ getFromDOM(dom) {
56
+ return dom.getAttribute('scope');
57
+ },
58
+ setDOMAttr(value, attrs) {
59
+ if (value) {
60
+ attrs['scope'] = value;
61
+ }
62
+ },
63
+ },
64
+ style: {
65
+ default: null,
66
+ getFromDOM(dom) {
67
+ return dom.getAttribute('style');
68
+ },
69
+ setDOMAttr(value, attrs) {
70
+ if (value) {
71
+ attrs['style'] = value;
72
+ }
73
+ },
74
+ },
75
+ },
76
+ };
77
+ const tableNodes = createTableNodes(tableOptions);
16
78
  export const table = {
17
- content: 'table_colgroup? table_body',
18
- tableRole: 'table',
19
- isolating: true,
20
- group: 'block',
21
- selectable: false,
22
79
  attrs: {
23
80
  id: { default: '' },
24
- headerRows: { default: 1 },
25
- footerRows: { default: 1 },
26
81
  dataTracked: { default: null },
27
- comments: { default: null },
28
82
  },
83
+ content: 'table_row+',
84
+ tableRole: 'table',
85
+ isolating: true,
86
+ group: 'block',
29
87
  parseDOM: [
30
88
  {
31
89
  tag: 'table',
@@ -33,35 +91,20 @@ export const table = {
33
91
  const dom = p;
34
92
  return {
35
93
  id: dom.getAttribute('id'),
36
- headerRows: dom.dataset && dom.dataset['header-rows'],
37
- footerRows: dom.dataset && dom.dataset['footer-rows'],
38
94
  };
39
95
  },
40
96
  },
41
97
  ],
42
- toDOM: (node) => {
43
- const tableNode = node;
98
+ toDOM(node) {
44
99
  return [
45
100
  'table',
46
101
  {
47
- id: tableNode.attrs.id,
48
- 'data-header-rows': String(node.attrs.headerRows),
49
- 'data-footer-rows': String(node.attrs.footerRows),
102
+ id: node.attrs.id,
50
103
  },
51
- 0,
104
+ ['tbody', 0],
52
105
  ];
53
106
  },
54
107
  };
55
- export const tableBody = {
56
- content: 'table_row+',
57
- group: 'block',
58
- tableRole: 'table',
59
- parseDOM: [
60
- {
61
- tag: 'tbody',
62
- },
63
- ],
64
- toDOM() {
65
- return ['tbody', 0];
66
- },
67
- };
108
+ export const tableRow = Object.assign(Object.assign({}, tableNodes.table_row), { attrs: Object.assign(Object.assign({}, tableNodes.table_row.attrs), { dataTracked: { default: null } }) });
109
+ export const tableCell = Object.assign(Object.assign({}, tableNodes.table_cell), { attrs: Object.assign(Object.assign({}, tableNodes.table_cell.attrs), { dataTracked: { default: null } }) });
110
+ export const tableHeader = Object.assign(Object.assign({}, tableNodes.table_header), { attrs: Object.assign(Object.assign({}, tableNodes.table_header.attrs), { dataTracked: { default: null } }) });
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const tableElement = {
17
- content: '(table | placeholder) table_element_footer? figcaption? (listing | placeholder)',
17
+ content: 'table_colgroup? (table | placeholder) table_element_footer? figcaption? (listing | placeholder)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  paragraphStyle: { default: '' },
@@ -95,6 +95,12 @@ export const buildNote = (target, source, contents = '') => ({
95
95
  source,
96
96
  contents,
97
97
  });
98
+ export const buildInlineMathFragment = (containingObject, TeXRepresentation) => ({
99
+ _id: generateID(ObjectTypes.InlineMathFragment),
100
+ objectType: ObjectTypes.InlineMathFragment,
101
+ containingObject: containingObject || undefined,
102
+ TeXRepresentation,
103
+ });
98
104
  export const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
99
105
  _id: generateID(ObjectTypes.Footnote),
100
106
  objectType: ObjectTypes.Footnote,
@@ -272,8 +272,9 @@ export class Decoder {
272
272
  const model = data;
273
273
  return schema.nodes.equation.createChecked({
274
274
  id: model._id,
275
- contents: model.contents,
276
- format: model.format,
275
+ MathMLStringRepresentation: model.MathMLStringRepresentation,
276
+ SVGStringRepresentation: model.SVGStringRepresentation,
277
+ TeXRepresentation: model.TeXRepresentation,
277
278
  });
278
279
  },
279
280
  [ObjectTypes.EquationElement]: (data) => {
@@ -292,10 +293,12 @@ export class Decoder {
292
293
  else {
293
294
  throw new MissingElement(model.containedObjectID);
294
295
  }
296
+ const figcaption = this.getFigcaption(model);
295
297
  return schema.nodes.equation_element.createChecked({
296
298
  id: model._id,
297
- label: model.label,
298
- }, [equation]);
299
+ suppressCaption: Boolean(model.suppressCaption),
300
+ suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
301
+ }, [equation, figcaption]);
299
302
  },
300
303
  [ObjectTypes.FootnotesElement]: (data) => {
301
304
  const foonotesElementModel = data;
@@ -557,13 +560,19 @@ export class Decoder {
557
560
  [ObjectTypes.TableElement]: (data) => {
558
561
  const model = data;
559
562
  const table = this.createTable(model);
563
+ const tableColGroup = this.createTableColGroup(model);
560
564
  const tableElementFooter = this.createTableElementFooter(model);
561
565
  const figcaption = this.getFigcaption(model);
562
566
  const comments = this.createCommentNodes(model);
563
567
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
564
- const content = tableElementFooter
565
- ? [table, tableElementFooter, figcaption]
566
- : [table, figcaption];
568
+ const content = [table];
569
+ if (tableColGroup) {
570
+ content.unshift(tableColGroup);
571
+ }
572
+ if (tableElementFooter) {
573
+ content.push(tableElementFooter);
574
+ }
575
+ content.push(figcaption);
567
576
  if (model.listingID) {
568
577
  const listing = this.createListing(model.listingID);
569
578
  content.push(listing);
@@ -777,6 +786,16 @@ export class Decoder {
777
786
  }
778
787
  return table;
779
788
  }
789
+ createTableColGroup(model) {
790
+ const tableId = model.containedObjectID;
791
+ const tableModel = this.getModel(tableId);
792
+ if (!tableModel || !tableModel.contents.includes('<colgroup>')) {
793
+ return undefined;
794
+ }
795
+ return this.parseContents(tableModel.contents, undefined, [], {
796
+ topNode: schema.nodes.table_colgroup.create(),
797
+ });
798
+ }
780
799
  createTableElementFooter(model) {
781
800
  const tableElementFooterID = model.tableElementFooterID;
782
801
  if (!tableElementFooterID) {
@@ -54,6 +54,12 @@ const listContents = (node) => {
54
54
  }
55
55
  return serializeToXML(output);
56
56
  };
57
+ const svgDefs = (svg) => {
58
+ const template = document.createElement('template');
59
+ template.innerHTML = svg.trim();
60
+ const defs = template.content.querySelector('defs');
61
+ return defs ? serializeToXML(defs) : undefined;
62
+ };
57
63
  const tableRowDisplayStyle = (tagName, parent) => {
58
64
  switch (tagName) {
59
65
  case 'thead':
@@ -101,8 +107,9 @@ function buildTableColGroup(cols) {
101
107
  }
102
108
  const tableContents = (node, parent) => {
103
109
  const input = serializer.serializeNode(node);
110
+ const parentInput = serializer.serializeNode(parent);
104
111
  const output = document.createElement('table');
105
- const colgroup = buildTableColGroup(Array.from(input.querySelectorAll('col')));
112
+ const colgroup = buildTableColGroup(Array.from(parentInput.querySelectorAll('col')));
106
113
  if (colgroup) {
107
114
  output.appendChild(colgroup);
108
115
  }
@@ -339,13 +346,20 @@ const encoders = {
339
346
  : false,
340
347
  }),
341
348
  equation: (node) => ({
342
- contents: node.attrs.contents,
343
- format: node.attrs.format,
349
+ MathMLStringRepresentation: node.attrs.MathMLStringRepresentation || undefined,
350
+ TeXRepresentation: node.attrs.TeXRepresentation,
351
+ SVGStringRepresentation: node.attrs.SVGStringRepresentation,
344
352
  }),
345
353
  equation_element: (node) => ({
346
354
  containedObjectID: attributeOfNodeType(node, 'equation', 'id'),
347
- elementType: 'div',
348
- label: node.attrs.label,
355
+ caption: inlineContentOfChildNodeType(node, node.type.schema.nodes.figcaption, node.type.schema.nodes.caption),
356
+ title: inlineContentOfChildNodeType(node, node.type.schema.nodes.figcaption, node.type.schema.nodes.caption_title, false),
357
+ elementType: 'p',
358
+ suppressCaption: Boolean(node.attrs.suppressCaption) || undefined,
359
+ suppressTitle: node.attrs.suppressTitle === undefined ||
360
+ node.attrs.suppressTitle === true
361
+ ? undefined
362
+ : false,
349
363
  }),
350
364
  figure: (node) => ({
351
365
  contentType: node.attrs.contentType || undefined,
@@ -392,6 +406,12 @@ const encoders = {
392
406
  .map((childNode) => childNode.attrs.id)
393
407
  .filter((id) => id),
394
408
  }),
409
+ inline_equation: (node, parent) => ({
410
+ containingObject: parent.attrs.id,
411
+ TeXRepresentation: node.attrs.TeXRepresentation,
412
+ SVGRepresentation: node.attrs.SVGRepresentation,
413
+ SVGGlyphs: svgDefs(node.attrs.SVGRepresentation),
414
+ }),
395
415
  keyword: (node, parent) => ({
396
416
  containedGroup: parent.attrs.id,
397
417
  name: keywordContents(node),
@@ -564,7 +584,8 @@ export const encode = (node) => {
564
584
  if (placeholderTypes.includes(child.type)) {
565
585
  return;
566
586
  }
567
- if (parent.type === schema.nodes.paragraph) {
587
+ if (parent.type === schema.nodes.paragraph &&
588
+ child.type !== schema.nodes.inline_equation) {
568
589
  return;
569
590
  }
570
591
  const { model, markers } = modelFromNode(child, parent, path, priority);
@@ -36,6 +36,7 @@ export const nodeTypesMap = new Map([
36
36
  [schema.nodes.footnotes_section, ObjectTypes.Section],
37
37
  [schema.nodes.graphical_abstract_section, ObjectTypes.Section],
38
38
  [schema.nodes.highlight_marker, ObjectTypes.HighlightMarker],
39
+ [schema.nodes.inline_equation, ObjectTypes.InlineMathFragment],
39
40
  [schema.nodes.keyword, ObjectTypes.Keyword],
40
41
  [schema.nodes.keywords_element, ObjectTypes.KeywordsElement],
41
42
  [schema.nodes.keywords, ObjectTypes.Section],
@@ -35,6 +35,7 @@ export const manuscriptObjects = [
35
35
  ObjectTypes.CommentAnnotation,
36
36
  ObjectTypes.Contributor,
37
37
  ObjectTypes.Footnote,
38
+ ObjectTypes.InlineMathFragment,
38
39
  ObjectTypes.Section,
39
40
  ].concat(elementObjects);
40
41
  export const isManuscriptModel = (model) => {
@@ -1,6 +1,7 @@
1
1
  export * from './lib/section-group-type';
2
2
  export * from './lib/table-cell-styles';
3
3
  export * from './lib/utils';
4
+ export * from './mathjax';
4
5
  export * from './schema';
5
6
  export * from './transformer';
6
7
  export * from './jats';
@@ -82,7 +82,6 @@ export declare class JATSExporter {
82
82
  protected buildBody: (fragment: ManuscriptFragment) => HTMLBodyElement;
83
83
  protected buildBack: (body: HTMLElement) => HTMLElement;
84
84
  protected createSerializer: () => void;
85
- private createEquation;
86
85
  protected serializeFragment: (fragment: ManuscriptFragment) => HTMLElement | DocumentFragment;
87
86
  protected serializeNode: (node: ManuscriptNode) => Node;
88
87
  private validateContributor;
@@ -0,0 +1,3 @@
1
+ export declare const convertMathMLToSVG: (mathml: string, display: boolean) => Promise<string | null>;
2
+ export declare const convertTeXToMathML: (tex: string, display: boolean) => Promise<string | null>;
3
+ export declare const convertTeXToSVG: (tex: string, display: boolean) => Promise<string | null>;
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare const packages: string[];
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import 'mathjax-full/js/util/entities/all';
17
+ export declare const convertMathMLToSVG: (mathml: string, display: boolean) => string | null;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import 'mathjax-full/js/util/entities/all';
17
+ export declare const convertTeXToMathML: (tex: string, display: boolean) => string | null;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import 'mathjax-full/js/util/entities/all';
17
+ export declare const convertTeXToSVG: (tex: string, display: boolean) => string | null;
@@ -40,6 +40,7 @@ export * from './nodes/footnotes_section';
40
40
  export * from './nodes/graphical_abstract_section';
41
41
  export * from './nodes/hard_break';
42
42
  export * from './nodes/highlight_marker';
43
+ export * from './nodes/inline_equation';
43
44
  export * from './nodes/inline_footnote';
44
45
  export * from './nodes/keyword';
45
46
  export * from './nodes/keywords_element';
@@ -59,7 +60,6 @@ export * from './nodes/section_title';
59
60
  export * from './nodes/table';
60
61
  export * from './nodes/table_col';
61
62
  export * from './nodes/table_element';
62
- export * from './nodes/table_row';
63
63
  export * from './nodes/text';
64
64
  export * from './nodes/toc_element';
65
65
  export * from './nodes/toc_section';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2023 Atypon Systems LLC
2
+ * © 2019 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -17,8 +17,9 @@ import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
18
  interface Attrs {
19
19
  id: string;
20
- format: string;
21
- contents: string;
20
+ MathMLStringRepresentation: string;
21
+ SVGStringRepresentation: string;
22
+ TeXRepresentation: string;
22
23
  }
23
24
  export interface EquationNode extends ManuscriptNode {
24
25
  attrs: Attrs;
@@ -18,7 +18,8 @@ import { ManuscriptNode } from '../types';
18
18
  import { CommentNode } from './comment';
19
19
  interface Attrs {
20
20
  id: string;
21
- label: string;
21
+ suppressCaption: boolean;
22
+ suppressTitle?: boolean;
22
23
  comments?: CommentNode[];
23
24
  }
24
25
  export interface EquationElementNode extends ManuscriptNode {
@@ -15,12 +15,11 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
- import { CommentNode } from './comment';
19
18
  interface Attrs {
20
19
  id: string;
21
- contents: string;
22
- format: string;
23
- comments?: CommentNode[];
20
+ MathMLRepresentation: string;
21
+ SVGRepresentation: string;
22
+ TeXRepresentation: string;
24
23
  }
25
24
  export interface InlineEquationNode extends ManuscriptNode {
26
25
  attrs: Attrs;
@@ -13,15 +13,77 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ManuscriptNode, TableNodeSpec } from '../types';
17
- import { CommentNode } from './comment';
18
- export interface TableNode extends ManuscriptNode {
16
+ import { NodeSpec } from 'prosemirror-model';
17
+ export declare const table: NodeSpec;
18
+ export declare const tableRow: {
19
19
  attrs: {
20
- id: string;
21
- headerRows: number;
22
- footerRows: number;
23
- comments?: CommentNode[];
20
+ dataTracked: {
21
+ default: null;
22
+ };
24
23
  };
25
- }
26
- export declare const table: TableNodeSpec;
27
- export declare const tableBody: TableNodeSpec;
24
+ content?: string | undefined;
25
+ marks?: string | undefined;
26
+ group?: string | undefined;
27
+ inline?: boolean | undefined;
28
+ atom?: boolean | undefined;
29
+ selectable?: boolean | undefined;
30
+ draggable?: boolean | undefined;
31
+ code?: boolean | undefined;
32
+ whitespace?: "pre" | "normal" | undefined;
33
+ definingAsContext?: boolean | undefined;
34
+ definingForContent?: boolean | undefined;
35
+ defining?: boolean | undefined;
36
+ isolating?: boolean | undefined;
37
+ toDOM?: ((node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec) | undefined;
38
+ parseDOM?: readonly import("prosemirror-model").ParseRule[] | undefined;
39
+ toDebugString?: ((node: import("prosemirror-model").Node) => string) | undefined;
40
+ leafText?: ((node: import("prosemirror-model").Node) => string) | undefined;
41
+ };
42
+ export declare const tableCell: {
43
+ attrs: {
44
+ dataTracked: {
45
+ default: null;
46
+ };
47
+ };
48
+ content?: string | undefined;
49
+ marks?: string | undefined;
50
+ group?: string | undefined;
51
+ inline?: boolean | undefined;
52
+ atom?: boolean | undefined;
53
+ selectable?: boolean | undefined;
54
+ draggable?: boolean | undefined;
55
+ code?: boolean | undefined;
56
+ whitespace?: "pre" | "normal" | undefined;
57
+ definingAsContext?: boolean | undefined;
58
+ definingForContent?: boolean | undefined;
59
+ defining?: boolean | undefined;
60
+ isolating?: boolean | undefined;
61
+ toDOM?: ((node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec) | undefined;
62
+ parseDOM?: readonly import("prosemirror-model").ParseRule[] | undefined;
63
+ toDebugString?: ((node: import("prosemirror-model").Node) => string) | undefined;
64
+ leafText?: ((node: import("prosemirror-model").Node) => string) | undefined;
65
+ };
66
+ export declare const tableHeader: {
67
+ attrs: {
68
+ dataTracked: {
69
+ default: null;
70
+ };
71
+ };
72
+ content?: string | undefined;
73
+ marks?: string | undefined;
74
+ group?: string | undefined;
75
+ inline?: boolean | undefined;
76
+ atom?: boolean | undefined;
77
+ selectable?: boolean | undefined;
78
+ draggable?: boolean | undefined;
79
+ code?: boolean | undefined;
80
+ whitespace?: "pre" | "normal" | undefined;
81
+ definingAsContext?: boolean | undefined;
82
+ definingForContent?: boolean | undefined;
83
+ defining?: boolean | undefined;
84
+ isolating?: boolean | undefined;
85
+ toDOM?: ((node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec) | undefined;
86
+ parseDOM?: readonly import("prosemirror-model").ParseRule[] | undefined;
87
+ toDebugString?: ((node: import("prosemirror-model").Node) => string) | undefined;
88
+ leafText?: ((node: import("prosemirror-model").Node) => string) | undefined;
89
+ };
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
17
17
  import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
18
18
  import { EditorView, NodeView } from 'prosemirror-view';
19
19
  export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
20
- export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement';
20
+ export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'table_header';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Affiliation, Attribution, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
16
+ import { Affiliation, Attribution, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, InlineMathFragment, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
17
17
  import { FootnotesOrderIndexList } from './footnotes-order';
18
18
  import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
19
19
  export type Build<T> = Pick<T, Exclude<keyof T, keyof ManuscriptModel>> & {
@@ -44,6 +44,7 @@ export declare const buildAffiliation: (institution: string, priority?: number)
44
44
  export declare const buildSupplementaryMaterial: (title: string, href: string) => Build<Supplement>;
45
45
  export declare const buildComment: (target: string, contents?: string, selector?: CommentSelector, contributions?: Contribution[], annotationColor?: string) => Build<CommentAnnotation>;
46
46
  export declare const buildNote: (target: string, source: 'EMAIL' | 'EDITOR' | 'DASHBOARD', contents?: string) => Build<ManuscriptNote>;
47
+ export declare const buildInlineMathFragment: (containingObject: string, TeXRepresentation: string) => Build<InlineMathFragment>;
47
48
  export declare const buildFootnote: (containingObject: string, contents: string, kind?: 'footnote' | 'endnote') => Build<Footnote>;
48
49
  export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList) => Build<FootnotesOrder>;
49
50
  export declare const buildCorresp: (contents: string) => Build<Corresponding>;
@@ -43,6 +43,7 @@ export declare class Decoder {
43
43
  private getManuscriptID;
44
44
  private getFigcaption;
45
45
  private createTable;
46
+ private createTableColGroup;
46
47
  private createTableElementFooter;
47
48
  private createListing;
48
49
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/transform",
3
3
  "description": "ProseMirror transformer for Manuscripts applications",
4
- "version": "2.1.1-LEAN-3092-9",
4
+ "version": "2.1.1-LEAN-3336-21",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -29,12 +29,14 @@
29
29
  "version": "yarn build"
30
30
  },
31
31
  "dependencies": {
32
- "@manuscripts/json-schema": "2.2.3-LEAN-3092-1",
33
- "@manuscripts/library": "1.3.2-LEAN-3092-3",
32
+ "@manuscripts/json-schema": "^2.2.2",
33
+ "@manuscripts/library": "1.3.2",
34
34
  "debug": "^4.3.4",
35
35
  "jszip": "^3.10.1",
36
+ "mathjax-full": "^3.2.2",
36
37
  "mime": "^3.0.0",
37
- "prosemirror-model": "^1.18.3",
38
+ "prosemirror-model": "^1.8.1",
39
+ "prosemirror-tables": "^1.3.5",
38
40
  "uuid": "^9.0.0",
39
41
  "w3c-xmlserializer": "^4.0.0"
40
42
  },
@@ -63,9 +65,9 @@
63
65
  "eslint-plugin-mdx": "^2.0.5",
64
66
  "eslint-plugin-prettier": "^4.2.1",
65
67
  "eslint-plugin-promise": "^6.1.1",
66
- "eslint-plugin-simple-import-sort": "^8.0.0",
67
68
  "eslint-plugin-react": "^7.31.11",
68
69
  "eslint-plugin-react-hooks": "^4.6.0",
70
+ "eslint-plugin-simple-import-sort": "^8.0.0",
69
71
  "husky": "^8.0.2",
70
72
  "jest": "^29.3.1",
71
73
  "jest-environment-jsdom": "^29.3.1",