@tinacms/mdx 0.0.0-8434fe2-20241004062927 → 0.0.0-8eeb2df-20241010045955

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.
@@ -38861,12 +38861,6 @@ var blockElement = (content3, field, imageCallback) => {
38861
38861
  type: "paragraph",
38862
38862
  children: eat2(content3.children, field, imageCallback)
38863
38863
  };
38864
- case "mermaid":
38865
- return {
38866
- type: "code",
38867
- lang: "mermaid",
38868
- value: content3.value
38869
- };
38870
38864
  case "code_block":
38871
38865
  return {
38872
38866
  type: "code",
@@ -38875,11 +38869,11 @@ var blockElement = (content3, field, imageCallback) => {
38875
38869
  };
38876
38870
  case "mdxJsxFlowElement":
38877
38871
  if (content3.name === "table") {
38878
- const table = content3.props;
38872
+ const table2 = content3.props;
38879
38873
  return {
38880
38874
  type: "table",
38881
- align: table.align,
38882
- children: table.tableRows.map((tableRow) => {
38875
+ align: table2.align,
38876
+ children: table2.tableRows.map((tableRow) => {
38883
38877
  const tr2 = {
38884
38878
  type: "tableRow",
38885
38879
  children: tableRow.tableCells.map(({ value }) => {
@@ -38975,6 +38969,27 @@ var blockElement = (content3, field, imageCallback) => {
38975
38969
  }
38976
38970
  ]
38977
38971
  };
38972
+ case "table":
38973
+ const table = content3.props;
38974
+ return {
38975
+ type: "table",
38976
+ align: table?.align,
38977
+ children: content3.children.map((tableRow) => {
38978
+ return {
38979
+ type: "tableRow",
38980
+ children: tableRow.children.map((tableCell) => {
38981
+ return {
38982
+ type: "tableCell",
38983
+ children: eat2(
38984
+ tableCell.children?.at(0)?.children || [],
38985
+ field,
38986
+ imageCallback
38987
+ )
38988
+ };
38989
+ })
38990
+ };
38991
+ })
38992
+ };
38978
38993
  default:
38979
38994
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
38980
38995
  }
@@ -39194,7 +39209,6 @@ function stringifyProps2(element2, parentField, flatten2, imageCallback) {
39194
39209
  if (field.list) {
39195
39210
  throw new Error(`Rich-text list is not supported`);
39196
39211
  } else {
39197
- console.log("RICH-TEXT StringifyProps", value);
39198
39212
  const joiner = flatten2 ? " " : "\n";
39199
39213
  let val = "";
39200
39214
  assertShape2(
@@ -39546,11 +39560,11 @@ var blockElement2 = (content3, field, imageCallback) => {
39546
39560
  };
39547
39561
  case "mdxJsxFlowElement":
39548
39562
  if (content3.name === "table") {
39549
- const table = content3.props;
39563
+ const table2 = content3.props;
39550
39564
  return {
39551
39565
  type: "table",
39552
- align: table.align,
39553
- children: table.tableRows.map((tableRow) => {
39566
+ align: table2.align,
39567
+ children: table2.tableRows.map((tableRow) => {
39554
39568
  const tr2 = {
39555
39569
  type: "tableRow",
39556
39570
  children: tableRow.tableCells.map(({ value }) => {
@@ -39617,6 +39631,27 @@ var blockElement2 = (content3, field, imageCallback) => {
39617
39631
  }
39618
39632
  ]
39619
39633
  };
39634
+ case "table":
39635
+ const table = content3.props;
39636
+ return {
39637
+ type: "table",
39638
+ align: table?.align,
39639
+ children: content3.children.map((tableRow) => {
39640
+ return {
39641
+ type: "tableRow",
39642
+ children: tableRow.children.map((tableCell) => {
39643
+ return {
39644
+ type: "tableCell",
39645
+ children: eat3(
39646
+ tableCell.children?.at(0)?.children || [],
39647
+ field,
39648
+ imageCallback
39649
+ )
39650
+ };
39651
+ })
39652
+ };
39653
+ })
39654
+ };
39620
39655
  default:
39621
39656
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
39622
39657
  }
@@ -42050,32 +42085,29 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42050
42085
  switch (content4.type) {
42051
42086
  case "table": {
42052
42087
  return {
42053
- type: "mdxJsxFlowElement",
42054
- children: [{ type: "text", text: "" }],
42055
- name: "table",
42056
- props: {
42057
- align: content4.align?.filter((item) => !!item),
42058
- tableRows: content4.children.map((child) => {
42059
- return {
42060
- tableCells: child.children.map((child2) => {
42061
- return {
42062
- value: {
42063
- type: "root",
42064
- children: [
42065
- {
42066
- type: "p",
42067
- children: (0, import_lodash.default)(
42068
- child2.children.map(
42069
- (child3) => phrasingContent(child3)
42070
- )
42071
- )
42072
- }
42073
- ]
42088
+ type: "table",
42089
+ children: content4.children.map((tableRow) => {
42090
+ return {
42091
+ type: "tr",
42092
+ children: tableRow.children.map((tableCell) => {
42093
+ return {
42094
+ type: "td",
42095
+ children: [
42096
+ {
42097
+ type: "p",
42098
+ children: (0, import_lodash.default)(
42099
+ tableCell.children.map(
42100
+ (child) => phrasingContent(child)
42101
+ )
42102
+ )
42074
42103
  }
42075
- };
42076
- })
42077
- };
42078
- })
42104
+ ]
42105
+ };
42106
+ })
42107
+ };
42108
+ }),
42109
+ props: {
42110
+ align: content4.align?.filter((item) => !!item)
42079
42111
  }
42080
42112
  };
42081
42113
  }
@@ -42094,7 +42126,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42094
42126
  case "heading":
42095
42127
  return heading2(content4);
42096
42128
  case "code":
42097
- return parseCode(content4);
42129
+ return code3(content4);
42098
42130
  case "paragraph":
42099
42131
  return paragraph2(content4);
42100
42132
  case "mdxJsxFlowElement":
@@ -42241,19 +42273,6 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42241
42273
  );
42242
42274
  }
42243
42275
  };
42244
- const parseCode = (content4) => {
42245
- if (content4.lang === "mermaid") {
42246
- return mermaid(content4);
42247
- }
42248
- return code3(content4);
42249
- };
42250
- const mermaid = (content4) => {
42251
- return {
42252
- type: "mermaid",
42253
- value: content4.value,
42254
- children: [{ type: "text", text: "" }]
42255
- };
42256
- };
42257
42276
  const code3 = (content4) => {
42258
42277
  const extra = {};
42259
42278
  if (content4.lang)
package/dist/index.js CHANGED
@@ -40750,12 +40750,6 @@ var blockElement = (content3, field, imageCallback) => {
40750
40750
  type: "paragraph",
40751
40751
  children: eat2(content3.children, field, imageCallback)
40752
40752
  };
40753
- case "mermaid":
40754
- return {
40755
- type: "code",
40756
- lang: "mermaid",
40757
- value: content3.value
40758
- };
40759
40753
  case "code_block":
40760
40754
  return {
40761
40755
  type: "code",
@@ -40764,11 +40758,11 @@ var blockElement = (content3, field, imageCallback) => {
40764
40758
  };
40765
40759
  case "mdxJsxFlowElement":
40766
40760
  if (content3.name === "table") {
40767
- const table = content3.props;
40761
+ const table2 = content3.props;
40768
40762
  return {
40769
40763
  type: "table",
40770
- align: table.align,
40771
- children: table.tableRows.map((tableRow) => {
40764
+ align: table2.align,
40765
+ children: table2.tableRows.map((tableRow) => {
40772
40766
  const tr2 = {
40773
40767
  type: "tableRow",
40774
40768
  children: tableRow.tableCells.map(({ value }) => {
@@ -40865,6 +40859,28 @@ var blockElement = (content3, field, imageCallback) => {
40865
40859
  }
40866
40860
  ]
40867
40861
  };
40862
+ case "table":
40863
+ const table = content3.props;
40864
+ return {
40865
+ type: "table",
40866
+ align: table == null ? void 0 : table.align,
40867
+ children: content3.children.map((tableRow) => {
40868
+ return {
40869
+ type: "tableRow",
40870
+ children: tableRow.children.map((tableCell) => {
40871
+ var _a3, _b;
40872
+ return {
40873
+ type: "tableCell",
40874
+ children: eat2(
40875
+ ((_b = (_a3 = tableCell.children) == null ? void 0 : _a3.at(0)) == null ? void 0 : _b.children) || [],
40876
+ field,
40877
+ imageCallback
40878
+ )
40879
+ };
40880
+ })
40881
+ };
40882
+ })
40883
+ };
40868
40884
  default:
40869
40885
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
40870
40886
  }
@@ -41087,7 +41103,6 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
41087
41103
  if (field.list) {
41088
41104
  throw new Error(`Rich-text list is not supported`);
41089
41105
  } else {
41090
- console.log("RICH-TEXT StringifyProps", value);
41091
41106
  const joiner = flatten2 ? " " : "\n";
41092
41107
  let val = "";
41093
41108
  assertShape2(
@@ -41441,11 +41456,11 @@ var blockElement2 = (content3, field, imageCallback) => {
41441
41456
  };
41442
41457
  case "mdxJsxFlowElement":
41443
41458
  if (content3.name === "table") {
41444
- const table = content3.props;
41459
+ const table2 = content3.props;
41445
41460
  return {
41446
41461
  type: "table",
41447
- align: table.align,
41448
- children: table.tableRows.map((tableRow) => {
41462
+ align: table2.align,
41463
+ children: table2.tableRows.map((tableRow) => {
41449
41464
  const tr2 = {
41450
41465
  type: "tableRow",
41451
41466
  children: tableRow.tableCells.map(({ value }) => {
@@ -41513,6 +41528,28 @@ var blockElement2 = (content3, field, imageCallback) => {
41513
41528
  }
41514
41529
  ]
41515
41530
  };
41531
+ case "table":
41532
+ const table = content3.props;
41533
+ return {
41534
+ type: "table",
41535
+ align: table == null ? void 0 : table.align,
41536
+ children: content3.children.map((tableRow) => {
41537
+ return {
41538
+ type: "tableRow",
41539
+ children: tableRow.children.map((tableCell) => {
41540
+ var _a3, _b;
41541
+ return {
41542
+ type: "tableCell",
41543
+ children: eat3(
41544
+ ((_b = (_a3 = tableCell.children) == null ? void 0 : _a3.at(0)) == null ? void 0 : _b.children) || [],
41545
+ field,
41546
+ imageCallback
41547
+ )
41548
+ };
41549
+ })
41550
+ };
41551
+ })
41552
+ };
41516
41553
  default:
41517
41554
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
41518
41555
  }
@@ -43953,32 +43990,29 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43953
43990
  switch (content4.type) {
43954
43991
  case "table": {
43955
43992
  return {
43956
- type: "mdxJsxFlowElement",
43957
- children: [{ type: "text", text: "" }],
43958
- name: "table",
43959
- props: {
43960
- align: (_a3 = content4.align) == null ? void 0 : _a3.filter((item) => !!item),
43961
- tableRows: content4.children.map((child) => {
43962
- return {
43963
- tableCells: child.children.map((child2) => {
43964
- return {
43965
- value: {
43966
- type: "root",
43967
- children: [
43968
- {
43969
- type: "p",
43970
- children: (0, import_lodash.default)(
43971
- child2.children.map(
43972
- (child3) => phrasingContent(child3)
43973
- )
43974
- )
43975
- }
43976
- ]
43993
+ type: "table",
43994
+ children: content4.children.map((tableRow) => {
43995
+ return {
43996
+ type: "tr",
43997
+ children: tableRow.children.map((tableCell) => {
43998
+ return {
43999
+ type: "td",
44000
+ children: [
44001
+ {
44002
+ type: "p",
44003
+ children: (0, import_lodash.default)(
44004
+ tableCell.children.map(
44005
+ (child) => phrasingContent(child)
44006
+ )
44007
+ )
43977
44008
  }
43978
- };
43979
- })
43980
- };
43981
- })
44009
+ ]
44010
+ };
44011
+ })
44012
+ };
44013
+ }),
44014
+ props: {
44015
+ align: (_a3 = content4.align) == null ? void 0 : _a3.filter((item) => !!item)
43982
44016
  }
43983
44017
  };
43984
44018
  }
@@ -43997,7 +44031,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43997
44031
  case "heading":
43998
44032
  return heading2(content4);
43999
44033
  case "code":
44000
- return parseCode(content4);
44034
+ return code3(content4);
44001
44035
  case "paragraph":
44002
44036
  return paragraph2(content4);
44003
44037
  case "mdxJsxFlowElement":
@@ -44144,19 +44178,6 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44144
44178
  );
44145
44179
  }
44146
44180
  };
44147
- const parseCode = (content4) => {
44148
- if (content4.lang === "mermaid") {
44149
- return mermaid(content4);
44150
- }
44151
- return code3(content4);
44152
- };
44153
- const mermaid = (content4) => {
44154
- return {
44155
- type: "mermaid",
44156
- value: content4.value,
44157
- children: [{ type: "text", text: "" }]
44158
- };
44159
- };
44160
44181
  const code3 = (content4) => {
44161
44182
  const extra = {};
44162
44183
  if (content4.lang)
package/dist/index.mjs CHANGED
@@ -40733,12 +40733,6 @@ var blockElement = (content3, field, imageCallback) => {
40733
40733
  type: "paragraph",
40734
40734
  children: eat2(content3.children, field, imageCallback)
40735
40735
  };
40736
- case "mermaid":
40737
- return {
40738
- type: "code",
40739
- lang: "mermaid",
40740
- value: content3.value
40741
- };
40742
40736
  case "code_block":
40743
40737
  return {
40744
40738
  type: "code",
@@ -40747,11 +40741,11 @@ var blockElement = (content3, field, imageCallback) => {
40747
40741
  };
40748
40742
  case "mdxJsxFlowElement":
40749
40743
  if (content3.name === "table") {
40750
- const table = content3.props;
40744
+ const table2 = content3.props;
40751
40745
  return {
40752
40746
  type: "table",
40753
- align: table.align,
40754
- children: table.tableRows.map((tableRow) => {
40747
+ align: table2.align,
40748
+ children: table2.tableRows.map((tableRow) => {
40755
40749
  const tr2 = {
40756
40750
  type: "tableRow",
40757
40751
  children: tableRow.tableCells.map(({ value }) => {
@@ -40847,6 +40841,27 @@ var blockElement = (content3, field, imageCallback) => {
40847
40841
  }
40848
40842
  ]
40849
40843
  };
40844
+ case "table":
40845
+ const table = content3.props;
40846
+ return {
40847
+ type: "table",
40848
+ align: table?.align,
40849
+ children: content3.children.map((tableRow) => {
40850
+ return {
40851
+ type: "tableRow",
40852
+ children: tableRow.children.map((tableCell) => {
40853
+ return {
40854
+ type: "tableCell",
40855
+ children: eat2(
40856
+ tableCell.children?.at(0)?.children || [],
40857
+ field,
40858
+ imageCallback
40859
+ )
40860
+ };
40861
+ })
40862
+ };
40863
+ })
40864
+ };
40850
40865
  default:
40851
40866
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
40852
40867
  }
@@ -41066,7 +41081,6 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
41066
41081
  if (field.list) {
41067
41082
  throw new Error(`Rich-text list is not supported`);
41068
41083
  } else {
41069
- console.log("RICH-TEXT StringifyProps", value);
41070
41084
  const joiner = flatten2 ? " " : "\n";
41071
41085
  let val = "";
41072
41086
  assertShape2(
@@ -41418,11 +41432,11 @@ var blockElement2 = (content3, field, imageCallback) => {
41418
41432
  };
41419
41433
  case "mdxJsxFlowElement":
41420
41434
  if (content3.name === "table") {
41421
- const table = content3.props;
41435
+ const table2 = content3.props;
41422
41436
  return {
41423
41437
  type: "table",
41424
- align: table.align,
41425
- children: table.tableRows.map((tableRow) => {
41438
+ align: table2.align,
41439
+ children: table2.tableRows.map((tableRow) => {
41426
41440
  const tr2 = {
41427
41441
  type: "tableRow",
41428
41442
  children: tableRow.tableCells.map(({ value }) => {
@@ -41489,6 +41503,27 @@ var blockElement2 = (content3, field, imageCallback) => {
41489
41503
  }
41490
41504
  ]
41491
41505
  };
41506
+ case "table":
41507
+ const table = content3.props;
41508
+ return {
41509
+ type: "table",
41510
+ align: table?.align,
41511
+ children: content3.children.map((tableRow) => {
41512
+ return {
41513
+ type: "tableRow",
41514
+ children: tableRow.children.map((tableCell) => {
41515
+ return {
41516
+ type: "tableCell",
41517
+ children: eat3(
41518
+ tableCell.children?.at(0)?.children || [],
41519
+ field,
41520
+ imageCallback
41521
+ )
41522
+ };
41523
+ })
41524
+ };
41525
+ })
41526
+ };
41492
41527
  default:
41493
41528
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
41494
41529
  }
@@ -43922,32 +43957,29 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43922
43957
  switch (content4.type) {
43923
43958
  case "table": {
43924
43959
  return {
43925
- type: "mdxJsxFlowElement",
43926
- children: [{ type: "text", text: "" }],
43927
- name: "table",
43928
- props: {
43929
- align: content4.align?.filter((item) => !!item),
43930
- tableRows: content4.children.map((child) => {
43931
- return {
43932
- tableCells: child.children.map((child2) => {
43933
- return {
43934
- value: {
43935
- type: "root",
43936
- children: [
43937
- {
43938
- type: "p",
43939
- children: (0, import_lodash.default)(
43940
- child2.children.map(
43941
- (child3) => phrasingContent(child3)
43942
- )
43943
- )
43944
- }
43945
- ]
43960
+ type: "table",
43961
+ children: content4.children.map((tableRow) => {
43962
+ return {
43963
+ type: "tr",
43964
+ children: tableRow.children.map((tableCell) => {
43965
+ return {
43966
+ type: "td",
43967
+ children: [
43968
+ {
43969
+ type: "p",
43970
+ children: (0, import_lodash.default)(
43971
+ tableCell.children.map(
43972
+ (child) => phrasingContent(child)
43973
+ )
43974
+ )
43946
43975
  }
43947
- };
43948
- })
43949
- };
43950
- })
43976
+ ]
43977
+ };
43978
+ })
43979
+ };
43980
+ }),
43981
+ props: {
43982
+ align: content4.align?.filter((item) => !!item)
43951
43983
  }
43952
43984
  };
43953
43985
  }
@@ -43966,7 +43998,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43966
43998
  case "heading":
43967
43999
  return heading2(content4);
43968
44000
  case "code":
43969
- return parseCode(content4);
44001
+ return code3(content4);
43970
44002
  case "paragraph":
43971
44003
  return paragraph2(content4);
43972
44004
  case "mdxJsxFlowElement":
@@ -44113,19 +44145,6 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44113
44145
  );
44114
44146
  }
44115
44147
  };
44116
- const parseCode = (content4) => {
44117
- if (content4.lang === "mermaid") {
44118
- return mermaid(content4);
44119
- }
44120
- return code3(content4);
44121
- };
44122
- const mermaid = (content4) => {
44123
- return {
44124
- type: "mermaid",
44125
- value: content4.value,
44126
- children: [{ type: "text", text: "" }]
44127
- };
44128
- };
44129
44148
  const code3 = (content4) => {
44130
44149
  const extra = {};
44131
44150
  if (content4.lang)
@@ -119,17 +119,31 @@ export type ParagraphElement = {
119
119
  children: InlineElement[];
120
120
  };
121
121
  /**
122
- * @group MermaidElement
122
+ * @group BlockElement
123
123
  */
124
- export type MermaidElement = {
125
- type: 'mermaid';
126
- value: string;
127
- children: [EmptyTextElement];
124
+ export type TableCellElement = {
125
+ type: 'td';
126
+ children: ParagraphElement[];
127
+ };
128
+ /**
129
+ * @group BlockElement
130
+ */
131
+ export type TableRowElement = {
132
+ type: 'tr';
133
+ children: TableCellElement[];
134
+ };
135
+ /**
136
+ * @group BlockElement
137
+ */
138
+ export type TableElement = {
139
+ type: 'table';
140
+ children: TableRowElement[];
141
+ props: Record<string, unknown>;
128
142
  };
129
143
  /**
130
144
  * @group BlockElement
131
145
  */
132
- export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | MermaidElement | OrderedListElement | UnorderedListElement;
146
+ export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | OrderedListElement | UnorderedListElement | TableCellElement | TableRowElement | TableElement;
133
147
  /**
134
148
  * @group InlineElement
135
149
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/mdx",
3
- "version": "0.0.0-8434fe2-20241004062927",
3
+ "version": "0.0.0-8eeb2df-20241010045955",
4
4
  "typings": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "browser": "dist/index.browser.mjs",
@@ -56,7 +56,7 @@
56
56
  "unist-util-visit": "4.1.2",
57
57
  "uvu": "0.5.6",
58
58
  "vfile-message": "3.1.4",
59
- "@tinacms/schema-tools": "0.0.0-8434fe2-20241004062927"
59
+ "@tinacms/schema-tools": "1.6.5"
60
60
  },
61
61
  "publishConfig": {
62
62
  "registry": "https://registry.npmjs.org"
@@ -80,7 +80,7 @@
80
80
  "typescript": "^5.6.2",
81
81
  "vite": "^4.5.5",
82
82
  "vitest": "^0.32.4",
83
- "@tinacms/scripts": "1.2.3"
83
+ "@tinacms/scripts": "0.0.0-8eeb2df-20241010045955"
84
84
  },
85
85
  "scripts": {
86
86
  "types": "tsc",
@@ -1,2 +0,0 @@
1
- import type { RichTextField } from '@tinacms/schema-tools';
2
- export declare const field: RichTextField;
@@ -1 +0,0 @@
1
- export {};