@tinacms/mdx 0.0.0-a63a1f5-20251124043708 → 0.0.0-ab51af8-20251124045003
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.
- package/dist/index.browser.mjs +124 -23
- package/dist/index.js +124 -23
- package/dist/index.mjs +124 -23
- package/dist/parse/remarkToPlate.d.ts +3 -3
- package/package.json +5 -3
package/dist/index.browser.mjs
CHANGED
|
@@ -6360,6 +6360,82 @@ var require_acorn_jsx = __commonJS({
|
|
|
6360
6360
|
}
|
|
6361
6361
|
});
|
|
6362
6362
|
|
|
6363
|
+
// ../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js
|
|
6364
|
+
var require_lodash = __commonJS({
|
|
6365
|
+
"../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js"(exports, module) {
|
|
6366
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
6367
|
+
var argsTag = "[object Arguments]";
|
|
6368
|
+
var funcTag = "[object Function]";
|
|
6369
|
+
var genTag = "[object GeneratorFunction]";
|
|
6370
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
6371
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
6372
|
+
var root2 = freeGlobal || freeSelf || Function("return this")();
|
|
6373
|
+
function arrayPush(array, values2) {
|
|
6374
|
+
var index2 = -1, length = values2.length, offset3 = array.length;
|
|
6375
|
+
while (++index2 < length) {
|
|
6376
|
+
array[offset3 + index2] = values2[index2];
|
|
6377
|
+
}
|
|
6378
|
+
return array;
|
|
6379
|
+
}
|
|
6380
|
+
var objectProto = Object.prototype;
|
|
6381
|
+
var hasOwnProperty4 = objectProto.hasOwnProperty;
|
|
6382
|
+
var objectToString = objectProto.toString;
|
|
6383
|
+
var Symbol2 = root2.Symbol;
|
|
6384
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
6385
|
+
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
|
|
6386
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
6387
|
+
var index2 = -1, length = array.length;
|
|
6388
|
+
predicate || (predicate = isFlattenable);
|
|
6389
|
+
result || (result = []);
|
|
6390
|
+
while (++index2 < length) {
|
|
6391
|
+
var value = array[index2];
|
|
6392
|
+
if (depth > 0 && predicate(value)) {
|
|
6393
|
+
if (depth > 1) {
|
|
6394
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
6395
|
+
} else {
|
|
6396
|
+
arrayPush(result, value);
|
|
6397
|
+
}
|
|
6398
|
+
} else if (!isStrict) {
|
|
6399
|
+
result[result.length] = value;
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
return result;
|
|
6403
|
+
}
|
|
6404
|
+
function isFlattenable(value) {
|
|
6405
|
+
return isArray3(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
6406
|
+
}
|
|
6407
|
+
function flatten2(array) {
|
|
6408
|
+
var length = array ? array.length : 0;
|
|
6409
|
+
return length ? baseFlatten(array, 1) : [];
|
|
6410
|
+
}
|
|
6411
|
+
function isArguments(value) {
|
|
6412
|
+
return isArrayLikeObject(value) && hasOwnProperty4.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
6413
|
+
}
|
|
6414
|
+
var isArray3 = Array.isArray;
|
|
6415
|
+
function isArrayLike(value) {
|
|
6416
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
6417
|
+
}
|
|
6418
|
+
function isArrayLikeObject(value) {
|
|
6419
|
+
return isObjectLike(value) && isArrayLike(value);
|
|
6420
|
+
}
|
|
6421
|
+
function isFunction(value) {
|
|
6422
|
+
var tag = isObject2(value) ? objectToString.call(value) : "";
|
|
6423
|
+
return tag == funcTag || tag == genTag;
|
|
6424
|
+
}
|
|
6425
|
+
function isLength(value) {
|
|
6426
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
6427
|
+
}
|
|
6428
|
+
function isObject2(value) {
|
|
6429
|
+
var type = typeof value;
|
|
6430
|
+
return !!value && (type == "object" || type == "function");
|
|
6431
|
+
}
|
|
6432
|
+
function isObjectLike(value) {
|
|
6433
|
+
return !!value && typeof value == "object";
|
|
6434
|
+
}
|
|
6435
|
+
module.exports = flatten2;
|
|
6436
|
+
}
|
|
6437
|
+
});
|
|
6438
|
+
|
|
6363
6439
|
// ../../../node_modules/.pnpm/mdast-util-to-string@3.2.0/node_modules/mdast-util-to-string/lib/index.js
|
|
6364
6440
|
var emptyOptions = {};
|
|
6365
6441
|
function toString(value, options) {
|
|
@@ -40752,7 +40828,7 @@ var Ty = Rg();
|
|
|
40752
40828
|
var stringifyPropsInline = (element2, field, imageCallback) => {
|
|
40753
40829
|
return stringifyProps(element2, field, true, imageCallback);
|
|
40754
40830
|
};
|
|
40755
|
-
function stringifyProps(element2, parentField,
|
|
40831
|
+
function stringifyProps(element2, parentField, flatten2, imageCallback) {
|
|
40756
40832
|
const attributes2 = [];
|
|
40757
40833
|
const children = [];
|
|
40758
40834
|
let template;
|
|
@@ -40893,7 +40969,7 @@ function stringifyProps(element2, parentField, flatten, imageCallback) {
|
|
|
40893
40969
|
name: name2,
|
|
40894
40970
|
value: {
|
|
40895
40971
|
type: "mdxJsxAttributeValueExpression",
|
|
40896
|
-
value: stringifyObj(result,
|
|
40972
|
+
value: stringifyObj(result, flatten2)
|
|
40897
40973
|
}
|
|
40898
40974
|
});
|
|
40899
40975
|
break;
|
|
@@ -40906,7 +40982,7 @@ function stringifyProps(element2, parentField, flatten, imageCallback) {
|
|
|
40906
40982
|
if (field.list) {
|
|
40907
40983
|
throw new Error(`Rich-text list is not supported`);
|
|
40908
40984
|
} else {
|
|
40909
|
-
const joiner =
|
|
40985
|
+
const joiner = flatten2 ? " " : "\n";
|
|
40910
40986
|
let val = "";
|
|
40911
40987
|
if (isPlainObject2(value) && Object.keys(value).length === 0) {
|
|
40912
40988
|
return;
|
|
@@ -40928,7 +41004,7 @@ function stringifyProps(element2, parentField, flatten, imageCallback) {
|
|
|
40928
41004
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
40929
41005
|
}
|
|
40930
41006
|
}
|
|
40931
|
-
if (
|
|
41007
|
+
if (flatten2) {
|
|
40932
41008
|
attributes2.push({
|
|
40933
41009
|
type: "mdxJsxAttribute",
|
|
40934
41010
|
name: name2,
|
|
@@ -40975,7 +41051,7 @@ ${val}
|
|
|
40975
41051
|
}
|
|
40976
41052
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
40977
41053
|
}
|
|
40978
|
-
function stringifyObj(obj,
|
|
41054
|
+
function stringifyObj(obj, flatten2) {
|
|
40979
41055
|
if (typeof obj === "object" && obj !== null) {
|
|
40980
41056
|
const dummyFunc = `const dummyFunc = `;
|
|
40981
41057
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -40984,7 +41060,7 @@ function stringifyObj(obj, flatten) {
|
|
|
40984
41060
|
semi: false,
|
|
40985
41061
|
plugins: [mc]
|
|
40986
41062
|
}).trim().replace(dummyFunc, "");
|
|
40987
|
-
return
|
|
41063
|
+
return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
40988
41064
|
} else {
|
|
40989
41065
|
throw new Error(
|
|
40990
41066
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -41609,7 +41685,7 @@ var getMarks = (content3) => {
|
|
|
41609
41685
|
var stringifyPropsInline2 = (element2, field, imageCallback) => {
|
|
41610
41686
|
return stringifyProps2(element2, field, true, imageCallback);
|
|
41611
41687
|
};
|
|
41612
|
-
function stringifyProps2(element2, parentField,
|
|
41688
|
+
function stringifyProps2(element2, parentField, flatten2, imageCallback) {
|
|
41613
41689
|
const attributes2 = [];
|
|
41614
41690
|
const children = [];
|
|
41615
41691
|
let template;
|
|
@@ -41745,7 +41821,7 @@ function stringifyProps2(element2, parentField, flatten, imageCallback) {
|
|
|
41745
41821
|
name: name2,
|
|
41746
41822
|
value: {
|
|
41747
41823
|
type: "mdxJsxAttributeValueExpression",
|
|
41748
|
-
value: stringifyObj2(value,
|
|
41824
|
+
value: stringifyObj2(value, flatten2)
|
|
41749
41825
|
}
|
|
41750
41826
|
});
|
|
41751
41827
|
break;
|
|
@@ -41758,7 +41834,7 @@ function stringifyProps2(element2, parentField, flatten, imageCallback) {
|
|
|
41758
41834
|
if (field.list) {
|
|
41759
41835
|
throw new Error(`Rich-text list is not supported`);
|
|
41760
41836
|
} else {
|
|
41761
|
-
const joiner =
|
|
41837
|
+
const joiner = flatten2 ? " " : "\n";
|
|
41762
41838
|
let val = "";
|
|
41763
41839
|
assertShape2(
|
|
41764
41840
|
value,
|
|
@@ -41777,7 +41853,7 @@ function stringifyProps2(element2, parentField, flatten, imageCallback) {
|
|
|
41777
41853
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
41778
41854
|
}
|
|
41779
41855
|
}
|
|
41780
|
-
if (
|
|
41856
|
+
if (flatten2) {
|
|
41781
41857
|
attributes2.push({
|
|
41782
41858
|
type: "mdxJsxAttribute",
|
|
41783
41859
|
name: name2,
|
|
@@ -41824,7 +41900,7 @@ ${val}
|
|
|
41824
41900
|
}
|
|
41825
41901
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
41826
41902
|
}
|
|
41827
|
-
function stringifyObj2(obj,
|
|
41903
|
+
function stringifyObj2(obj, flatten2) {
|
|
41828
41904
|
if (typeof obj === "object" && obj !== null) {
|
|
41829
41905
|
const dummyFunc = `const dummyFunc = `;
|
|
41830
41906
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -41833,7 +41909,7 @@ function stringifyObj2(obj, flatten) {
|
|
|
41833
41909
|
semi: false,
|
|
41834
41910
|
plugins: [mc]
|
|
41835
41911
|
}).trim().replace(dummyFunc, "");
|
|
41836
|
-
return
|
|
41912
|
+
return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
41837
41913
|
} else {
|
|
41838
41914
|
throw new Error(
|
|
41839
41915
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -48083,6 +48159,9 @@ function compact(tree) {
|
|
|
48083
48159
|
return tree;
|
|
48084
48160
|
}
|
|
48085
48161
|
|
|
48162
|
+
// src/parse/remarkToPlate.ts
|
|
48163
|
+
var import_lodash = __toESM(require_lodash());
|
|
48164
|
+
|
|
48086
48165
|
// src/parse/acorn.ts
|
|
48087
48166
|
var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
48088
48167
|
const properties = {};
|
|
@@ -48479,7 +48558,11 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48479
48558
|
children: [
|
|
48480
48559
|
{
|
|
48481
48560
|
type: "p",
|
|
48482
|
-
children:
|
|
48561
|
+
children: (0, import_lodash.default)(
|
|
48562
|
+
tableCell.children.map(
|
|
48563
|
+
(child) => phrasingContent(child)
|
|
48564
|
+
)
|
|
48565
|
+
)
|
|
48483
48566
|
}
|
|
48484
48567
|
]
|
|
48485
48568
|
};
|
|
@@ -48522,7 +48605,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48522
48605
|
children: [
|
|
48523
48606
|
{
|
|
48524
48607
|
type: "lic",
|
|
48525
|
-
children:
|
|
48608
|
+
children: (0, import_lodash.default)(
|
|
48609
|
+
content4.children.map((child) => unwrapBlockContent(child))
|
|
48610
|
+
)
|
|
48526
48611
|
}
|
|
48527
48612
|
]
|
|
48528
48613
|
};
|
|
@@ -48586,7 +48671,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48586
48671
|
case "paragraph":
|
|
48587
48672
|
return {
|
|
48588
48673
|
type: "lic",
|
|
48589
|
-
children:
|
|
48674
|
+
children: (0, import_lodash.default)(
|
|
48675
|
+
child.children.map((child2) => phrasingContent(child2))
|
|
48676
|
+
)
|
|
48590
48677
|
};
|
|
48591
48678
|
case "blockquote": {
|
|
48592
48679
|
return {
|
|
@@ -48649,7 +48736,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48649
48736
|
const unwrapBlockContent = (content4) => {
|
|
48650
48737
|
const flattenPhrasingContent = (children) => {
|
|
48651
48738
|
const children2 = children.map((child) => phrasingContent(child));
|
|
48652
|
-
return (Array.isArray(children2) ? children2 : [children2])
|
|
48739
|
+
return (0, import_lodash.default)(Array.isArray(children2) ? children2 : [children2]);
|
|
48653
48740
|
};
|
|
48654
48741
|
switch (content4.type) {
|
|
48655
48742
|
case "heading":
|
|
@@ -48699,13 +48786,15 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48699
48786
|
type: "a",
|
|
48700
48787
|
url: sanitizeUrl(content4.url),
|
|
48701
48788
|
title: content4.title,
|
|
48702
|
-
children:
|
|
48789
|
+
children: (0, import_lodash.default)(
|
|
48790
|
+
content4.children.map((child) => staticPhrasingContent(child))
|
|
48791
|
+
)
|
|
48703
48792
|
};
|
|
48704
48793
|
};
|
|
48705
48794
|
const heading2 = (content4) => {
|
|
48706
48795
|
return {
|
|
48707
48796
|
type: ["h1", "h2", "h3", "h4", "h5", "h6"][content4.depth - 1],
|
|
48708
|
-
children: content4.children.map(phrasingContent)
|
|
48797
|
+
children: (0, import_lodash.default)(content4.children.map(phrasingContent))
|
|
48709
48798
|
};
|
|
48710
48799
|
};
|
|
48711
48800
|
const staticPhrasingContent = (content4) => {
|
|
@@ -48778,7 +48867,11 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48778
48867
|
const accum = [];
|
|
48779
48868
|
switch (node2.type) {
|
|
48780
48869
|
case "emphasis": {
|
|
48781
|
-
const children =
|
|
48870
|
+
const children = (0, import_lodash.default)(
|
|
48871
|
+
node2.children.map(
|
|
48872
|
+
(child) => phrashingMark(child, [...marks, "italic"])
|
|
48873
|
+
)
|
|
48874
|
+
);
|
|
48782
48875
|
children.forEach((child) => {
|
|
48783
48876
|
accum.push(child);
|
|
48784
48877
|
});
|
|
@@ -48796,14 +48889,20 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48796
48889
|
break;
|
|
48797
48890
|
}
|
|
48798
48891
|
case "delete": {
|
|
48799
|
-
const children =
|
|
48892
|
+
const children = (0, import_lodash.default)(
|
|
48893
|
+
node2.children.map(
|
|
48894
|
+
(child) => phrashingMark(child, [...marks, "strikethrough"])
|
|
48895
|
+
)
|
|
48896
|
+
);
|
|
48800
48897
|
children.forEach((child) => {
|
|
48801
48898
|
accum.push(child);
|
|
48802
48899
|
});
|
|
48803
48900
|
break;
|
|
48804
48901
|
}
|
|
48805
48902
|
case "strong": {
|
|
48806
|
-
const children =
|
|
48903
|
+
const children = (0, import_lodash.default)(
|
|
48904
|
+
node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
|
|
48905
|
+
);
|
|
48807
48906
|
children.forEach((child) => {
|
|
48808
48907
|
accum.push(child);
|
|
48809
48908
|
});
|
|
@@ -48814,7 +48913,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48814
48913
|
break;
|
|
48815
48914
|
}
|
|
48816
48915
|
case "link": {
|
|
48817
|
-
const children =
|
|
48916
|
+
const children = (0, import_lodash.default)(
|
|
48917
|
+
node2.children.map((child) => phrashingMark(child, marks))
|
|
48918
|
+
);
|
|
48818
48919
|
accum.push({
|
|
48819
48920
|
type: "a",
|
|
48820
48921
|
url: sanitizeUrl(node2.url),
|
|
@@ -48876,7 +48977,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48876
48977
|
};
|
|
48877
48978
|
};
|
|
48878
48979
|
const paragraph2 = (content4) => {
|
|
48879
|
-
const children = content4.children.map(phrasingContent)
|
|
48980
|
+
const children = (0, import_lodash.default)(content4.children.map(phrasingContent));
|
|
48880
48981
|
if (children.length === 1) {
|
|
48881
48982
|
if (children[0]) {
|
|
48882
48983
|
if (children[0].type === "html_inline") {
|
package/dist/index.js
CHANGED
|
@@ -6360,6 +6360,82 @@ var require_acorn_jsx = __commonJS({
|
|
|
6360
6360
|
}
|
|
6361
6361
|
});
|
|
6362
6362
|
|
|
6363
|
+
// ../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js
|
|
6364
|
+
var require_lodash = __commonJS({
|
|
6365
|
+
"../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js"(exports2, module2) {
|
|
6366
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
6367
|
+
var argsTag = "[object Arguments]";
|
|
6368
|
+
var funcTag = "[object Function]";
|
|
6369
|
+
var genTag = "[object GeneratorFunction]";
|
|
6370
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
6371
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
6372
|
+
var root2 = freeGlobal || freeSelf || Function("return this")();
|
|
6373
|
+
function arrayPush(array, values2) {
|
|
6374
|
+
var index2 = -1, length = values2.length, offset3 = array.length;
|
|
6375
|
+
while (++index2 < length) {
|
|
6376
|
+
array[offset3 + index2] = values2[index2];
|
|
6377
|
+
}
|
|
6378
|
+
return array;
|
|
6379
|
+
}
|
|
6380
|
+
var objectProto = Object.prototype;
|
|
6381
|
+
var hasOwnProperty4 = objectProto.hasOwnProperty;
|
|
6382
|
+
var objectToString = objectProto.toString;
|
|
6383
|
+
var Symbol2 = root2.Symbol;
|
|
6384
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
6385
|
+
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
|
|
6386
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
6387
|
+
var index2 = -1, length = array.length;
|
|
6388
|
+
predicate || (predicate = isFlattenable);
|
|
6389
|
+
result || (result = []);
|
|
6390
|
+
while (++index2 < length) {
|
|
6391
|
+
var value = array[index2];
|
|
6392
|
+
if (depth > 0 && predicate(value)) {
|
|
6393
|
+
if (depth > 1) {
|
|
6394
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
6395
|
+
} else {
|
|
6396
|
+
arrayPush(result, value);
|
|
6397
|
+
}
|
|
6398
|
+
} else if (!isStrict) {
|
|
6399
|
+
result[result.length] = value;
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
return result;
|
|
6403
|
+
}
|
|
6404
|
+
function isFlattenable(value) {
|
|
6405
|
+
return isArray3(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
6406
|
+
}
|
|
6407
|
+
function flatten2(array) {
|
|
6408
|
+
var length = array ? array.length : 0;
|
|
6409
|
+
return length ? baseFlatten(array, 1) : [];
|
|
6410
|
+
}
|
|
6411
|
+
function isArguments(value) {
|
|
6412
|
+
return isArrayLikeObject(value) && hasOwnProperty4.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
6413
|
+
}
|
|
6414
|
+
var isArray3 = Array.isArray;
|
|
6415
|
+
function isArrayLike(value) {
|
|
6416
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
6417
|
+
}
|
|
6418
|
+
function isArrayLikeObject(value) {
|
|
6419
|
+
return isObjectLike(value) && isArrayLike(value);
|
|
6420
|
+
}
|
|
6421
|
+
function isFunction(value) {
|
|
6422
|
+
var tag = isObject2(value) ? objectToString.call(value) : "";
|
|
6423
|
+
return tag == funcTag || tag == genTag;
|
|
6424
|
+
}
|
|
6425
|
+
function isLength(value) {
|
|
6426
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
6427
|
+
}
|
|
6428
|
+
function isObject2(value) {
|
|
6429
|
+
var type = typeof value;
|
|
6430
|
+
return !!value && (type == "object" || type == "function");
|
|
6431
|
+
}
|
|
6432
|
+
function isObjectLike(value) {
|
|
6433
|
+
return !!value && typeof value == "object";
|
|
6434
|
+
}
|
|
6435
|
+
module2.exports = flatten2;
|
|
6436
|
+
}
|
|
6437
|
+
});
|
|
6438
|
+
|
|
6363
6439
|
// src/index.ts
|
|
6364
6440
|
var index_exports = {};
|
|
6365
6441
|
__export(index_exports, {
|
|
@@ -42630,7 +42706,7 @@ var Ty = Rg();
|
|
|
42630
42706
|
var stringifyPropsInline = (element, field, imageCallback) => {
|
|
42631
42707
|
return stringifyProps(element, field, true, imageCallback);
|
|
42632
42708
|
};
|
|
42633
|
-
function stringifyProps(element, parentField,
|
|
42709
|
+
function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
42634
42710
|
const attributes2 = [];
|
|
42635
42711
|
const children = [];
|
|
42636
42712
|
let template;
|
|
@@ -42771,7 +42847,7 @@ function stringifyProps(element, parentField, flatten, imageCallback) {
|
|
|
42771
42847
|
name: name2,
|
|
42772
42848
|
value: {
|
|
42773
42849
|
type: "mdxJsxAttributeValueExpression",
|
|
42774
|
-
value: stringifyObj(result,
|
|
42850
|
+
value: stringifyObj(result, flatten2)
|
|
42775
42851
|
}
|
|
42776
42852
|
});
|
|
42777
42853
|
break;
|
|
@@ -42784,7 +42860,7 @@ function stringifyProps(element, parentField, flatten, imageCallback) {
|
|
|
42784
42860
|
if (field.list) {
|
|
42785
42861
|
throw new Error(`Rich-text list is not supported`);
|
|
42786
42862
|
} else {
|
|
42787
|
-
const joiner =
|
|
42863
|
+
const joiner = flatten2 ? " " : "\n";
|
|
42788
42864
|
let val = "";
|
|
42789
42865
|
if (isPlainObject2(value) && Object.keys(value).length === 0) {
|
|
42790
42866
|
return;
|
|
@@ -42806,7 +42882,7 @@ function stringifyProps(element, parentField, flatten, imageCallback) {
|
|
|
42806
42882
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
42807
42883
|
}
|
|
42808
42884
|
}
|
|
42809
|
-
if (
|
|
42885
|
+
if (flatten2) {
|
|
42810
42886
|
attributes2.push({
|
|
42811
42887
|
type: "mdxJsxAttribute",
|
|
42812
42888
|
name: name2,
|
|
@@ -42853,7 +42929,7 @@ ${val}
|
|
|
42853
42929
|
}
|
|
42854
42930
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
42855
42931
|
}
|
|
42856
|
-
function stringifyObj(obj,
|
|
42932
|
+
function stringifyObj(obj, flatten2) {
|
|
42857
42933
|
if (typeof obj === "object" && obj !== null) {
|
|
42858
42934
|
const dummyFunc = `const dummyFunc = `;
|
|
42859
42935
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -42862,7 +42938,7 @@ function stringifyObj(obj, flatten) {
|
|
|
42862
42938
|
semi: false,
|
|
42863
42939
|
plugins: [mc]
|
|
42864
42940
|
}).trim().replace(dummyFunc, "");
|
|
42865
|
-
return
|
|
42941
|
+
return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
42866
42942
|
} else {
|
|
42867
42943
|
throw new Error(
|
|
42868
42944
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -43487,7 +43563,7 @@ var getMarks = (content3) => {
|
|
|
43487
43563
|
var stringifyPropsInline2 = (element, field, imageCallback) => {
|
|
43488
43564
|
return stringifyProps2(element, field, true, imageCallback);
|
|
43489
43565
|
};
|
|
43490
|
-
function stringifyProps2(element, parentField,
|
|
43566
|
+
function stringifyProps2(element, parentField, flatten2, imageCallback) {
|
|
43491
43567
|
const attributes2 = [];
|
|
43492
43568
|
const children = [];
|
|
43493
43569
|
let template;
|
|
@@ -43623,7 +43699,7 @@ function stringifyProps2(element, parentField, flatten, imageCallback) {
|
|
|
43623
43699
|
name: name2,
|
|
43624
43700
|
value: {
|
|
43625
43701
|
type: "mdxJsxAttributeValueExpression",
|
|
43626
|
-
value: stringifyObj2(value,
|
|
43702
|
+
value: stringifyObj2(value, flatten2)
|
|
43627
43703
|
}
|
|
43628
43704
|
});
|
|
43629
43705
|
break;
|
|
@@ -43636,7 +43712,7 @@ function stringifyProps2(element, parentField, flatten, imageCallback) {
|
|
|
43636
43712
|
if (field.list) {
|
|
43637
43713
|
throw new Error(`Rich-text list is not supported`);
|
|
43638
43714
|
} else {
|
|
43639
|
-
const joiner =
|
|
43715
|
+
const joiner = flatten2 ? " " : "\n";
|
|
43640
43716
|
let val = "";
|
|
43641
43717
|
assertShape2(
|
|
43642
43718
|
value,
|
|
@@ -43655,7 +43731,7 @@ function stringifyProps2(element, parentField, flatten, imageCallback) {
|
|
|
43655
43731
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
43656
43732
|
}
|
|
43657
43733
|
}
|
|
43658
|
-
if (
|
|
43734
|
+
if (flatten2) {
|
|
43659
43735
|
attributes2.push({
|
|
43660
43736
|
type: "mdxJsxAttribute",
|
|
43661
43737
|
name: name2,
|
|
@@ -43702,7 +43778,7 @@ ${val}
|
|
|
43702
43778
|
}
|
|
43703
43779
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
43704
43780
|
}
|
|
43705
|
-
function stringifyObj2(obj,
|
|
43781
|
+
function stringifyObj2(obj, flatten2) {
|
|
43706
43782
|
if (typeof obj === "object" && obj !== null) {
|
|
43707
43783
|
const dummyFunc = `const dummyFunc = `;
|
|
43708
43784
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -43711,7 +43787,7 @@ function stringifyObj2(obj, flatten) {
|
|
|
43711
43787
|
semi: false,
|
|
43712
43788
|
plugins: [mc]
|
|
43713
43789
|
}).trim().replace(dummyFunc, "");
|
|
43714
|
-
return
|
|
43790
|
+
return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
43715
43791
|
} else {
|
|
43716
43792
|
throw new Error(
|
|
43717
43793
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -49961,6 +50037,9 @@ function compact(tree) {
|
|
|
49961
50037
|
return tree;
|
|
49962
50038
|
}
|
|
49963
50039
|
|
|
50040
|
+
// src/parse/remarkToPlate.ts
|
|
50041
|
+
var import_lodash = __toESM(require_lodash());
|
|
50042
|
+
|
|
49964
50043
|
// src/parse/acorn.ts
|
|
49965
50044
|
var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
49966
50045
|
const properties = {};
|
|
@@ -50357,7 +50436,11 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50357
50436
|
children: [
|
|
50358
50437
|
{
|
|
50359
50438
|
type: "p",
|
|
50360
|
-
children:
|
|
50439
|
+
children: (0, import_lodash.default)(
|
|
50440
|
+
tableCell.children.map(
|
|
50441
|
+
(child) => phrasingContent(child)
|
|
50442
|
+
)
|
|
50443
|
+
)
|
|
50361
50444
|
}
|
|
50362
50445
|
]
|
|
50363
50446
|
};
|
|
@@ -50400,7 +50483,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50400
50483
|
children: [
|
|
50401
50484
|
{
|
|
50402
50485
|
type: "lic",
|
|
50403
|
-
children:
|
|
50486
|
+
children: (0, import_lodash.default)(
|
|
50487
|
+
content4.children.map((child) => unwrapBlockContent(child))
|
|
50488
|
+
)
|
|
50404
50489
|
}
|
|
50405
50490
|
]
|
|
50406
50491
|
};
|
|
@@ -50464,7 +50549,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50464
50549
|
case "paragraph":
|
|
50465
50550
|
return {
|
|
50466
50551
|
type: "lic",
|
|
50467
|
-
children:
|
|
50552
|
+
children: (0, import_lodash.default)(
|
|
50553
|
+
child.children.map((child2) => phrasingContent(child2))
|
|
50554
|
+
)
|
|
50468
50555
|
};
|
|
50469
50556
|
case "blockquote": {
|
|
50470
50557
|
return {
|
|
@@ -50527,7 +50614,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50527
50614
|
const unwrapBlockContent = (content4) => {
|
|
50528
50615
|
const flattenPhrasingContent = (children) => {
|
|
50529
50616
|
const children2 = children.map((child) => phrasingContent(child));
|
|
50530
|
-
return (Array.isArray(children2) ? children2 : [children2])
|
|
50617
|
+
return (0, import_lodash.default)(Array.isArray(children2) ? children2 : [children2]);
|
|
50531
50618
|
};
|
|
50532
50619
|
switch (content4.type) {
|
|
50533
50620
|
case "heading":
|
|
@@ -50577,13 +50664,15 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50577
50664
|
type: "a",
|
|
50578
50665
|
url: sanitizeUrl(content4.url),
|
|
50579
50666
|
title: content4.title,
|
|
50580
|
-
children:
|
|
50667
|
+
children: (0, import_lodash.default)(
|
|
50668
|
+
content4.children.map((child) => staticPhrasingContent(child))
|
|
50669
|
+
)
|
|
50581
50670
|
};
|
|
50582
50671
|
};
|
|
50583
50672
|
const heading2 = (content4) => {
|
|
50584
50673
|
return {
|
|
50585
50674
|
type: ["h1", "h2", "h3", "h4", "h5", "h6"][content4.depth - 1],
|
|
50586
|
-
children: content4.children.map(phrasingContent)
|
|
50675
|
+
children: (0, import_lodash.default)(content4.children.map(phrasingContent))
|
|
50587
50676
|
};
|
|
50588
50677
|
};
|
|
50589
50678
|
const staticPhrasingContent = (content4) => {
|
|
@@ -50656,7 +50745,11 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50656
50745
|
const accum = [];
|
|
50657
50746
|
switch (node2.type) {
|
|
50658
50747
|
case "emphasis": {
|
|
50659
|
-
const children =
|
|
50748
|
+
const children = (0, import_lodash.default)(
|
|
50749
|
+
node2.children.map(
|
|
50750
|
+
(child) => phrashingMark(child, [...marks, "italic"])
|
|
50751
|
+
)
|
|
50752
|
+
);
|
|
50660
50753
|
children.forEach((child) => {
|
|
50661
50754
|
accum.push(child);
|
|
50662
50755
|
});
|
|
@@ -50674,14 +50767,20 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50674
50767
|
break;
|
|
50675
50768
|
}
|
|
50676
50769
|
case "delete": {
|
|
50677
|
-
const children =
|
|
50770
|
+
const children = (0, import_lodash.default)(
|
|
50771
|
+
node2.children.map(
|
|
50772
|
+
(child) => phrashingMark(child, [...marks, "strikethrough"])
|
|
50773
|
+
)
|
|
50774
|
+
);
|
|
50678
50775
|
children.forEach((child) => {
|
|
50679
50776
|
accum.push(child);
|
|
50680
50777
|
});
|
|
50681
50778
|
break;
|
|
50682
50779
|
}
|
|
50683
50780
|
case "strong": {
|
|
50684
|
-
const children =
|
|
50781
|
+
const children = (0, import_lodash.default)(
|
|
50782
|
+
node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
|
|
50783
|
+
);
|
|
50685
50784
|
children.forEach((child) => {
|
|
50686
50785
|
accum.push(child);
|
|
50687
50786
|
});
|
|
@@ -50692,7 +50791,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50692
50791
|
break;
|
|
50693
50792
|
}
|
|
50694
50793
|
case "link": {
|
|
50695
|
-
const children =
|
|
50794
|
+
const children = (0, import_lodash.default)(
|
|
50795
|
+
node2.children.map((child) => phrashingMark(child, marks))
|
|
50796
|
+
);
|
|
50696
50797
|
accum.push({
|
|
50697
50798
|
type: "a",
|
|
50698
50799
|
url: sanitizeUrl(node2.url),
|
|
@@ -50754,7 +50855,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50754
50855
|
};
|
|
50755
50856
|
};
|
|
50756
50857
|
const paragraph2 = (content4) => {
|
|
50757
|
-
const children = content4.children.map(phrasingContent)
|
|
50858
|
+
const children = (0, import_lodash.default)(content4.children.map(phrasingContent));
|
|
50758
50859
|
if (children.length === 1) {
|
|
50759
50860
|
if (children[0]) {
|
|
50760
50861
|
if (children[0].type === "html_inline") {
|
package/dist/index.mjs
CHANGED
|
@@ -6360,6 +6360,82 @@ var require_acorn_jsx = __commonJS({
|
|
|
6360
6360
|
}
|
|
6361
6361
|
});
|
|
6362
6362
|
|
|
6363
|
+
// ../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js
|
|
6364
|
+
var require_lodash = __commonJS({
|
|
6365
|
+
"../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js"(exports, module) {
|
|
6366
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
6367
|
+
var argsTag = "[object Arguments]";
|
|
6368
|
+
var funcTag = "[object Function]";
|
|
6369
|
+
var genTag = "[object GeneratorFunction]";
|
|
6370
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
6371
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
6372
|
+
var root2 = freeGlobal || freeSelf || Function("return this")();
|
|
6373
|
+
function arrayPush(array, values2) {
|
|
6374
|
+
var index2 = -1, length = values2.length, offset3 = array.length;
|
|
6375
|
+
while (++index2 < length) {
|
|
6376
|
+
array[offset3 + index2] = values2[index2];
|
|
6377
|
+
}
|
|
6378
|
+
return array;
|
|
6379
|
+
}
|
|
6380
|
+
var objectProto = Object.prototype;
|
|
6381
|
+
var hasOwnProperty4 = objectProto.hasOwnProperty;
|
|
6382
|
+
var objectToString = objectProto.toString;
|
|
6383
|
+
var Symbol2 = root2.Symbol;
|
|
6384
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
6385
|
+
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
|
|
6386
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
6387
|
+
var index2 = -1, length = array.length;
|
|
6388
|
+
predicate || (predicate = isFlattenable);
|
|
6389
|
+
result || (result = []);
|
|
6390
|
+
while (++index2 < length) {
|
|
6391
|
+
var value = array[index2];
|
|
6392
|
+
if (depth > 0 && predicate(value)) {
|
|
6393
|
+
if (depth > 1) {
|
|
6394
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
6395
|
+
} else {
|
|
6396
|
+
arrayPush(result, value);
|
|
6397
|
+
}
|
|
6398
|
+
} else if (!isStrict) {
|
|
6399
|
+
result[result.length] = value;
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
return result;
|
|
6403
|
+
}
|
|
6404
|
+
function isFlattenable(value) {
|
|
6405
|
+
return isArray3(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
6406
|
+
}
|
|
6407
|
+
function flatten2(array) {
|
|
6408
|
+
var length = array ? array.length : 0;
|
|
6409
|
+
return length ? baseFlatten(array, 1) : [];
|
|
6410
|
+
}
|
|
6411
|
+
function isArguments(value) {
|
|
6412
|
+
return isArrayLikeObject(value) && hasOwnProperty4.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
6413
|
+
}
|
|
6414
|
+
var isArray3 = Array.isArray;
|
|
6415
|
+
function isArrayLike(value) {
|
|
6416
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
6417
|
+
}
|
|
6418
|
+
function isArrayLikeObject(value) {
|
|
6419
|
+
return isObjectLike(value) && isArrayLike(value);
|
|
6420
|
+
}
|
|
6421
|
+
function isFunction(value) {
|
|
6422
|
+
var tag = isObject2(value) ? objectToString.call(value) : "";
|
|
6423
|
+
return tag == funcTag || tag == genTag;
|
|
6424
|
+
}
|
|
6425
|
+
function isLength(value) {
|
|
6426
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
6427
|
+
}
|
|
6428
|
+
function isObject2(value) {
|
|
6429
|
+
var type = typeof value;
|
|
6430
|
+
return !!value && (type == "object" || type == "function");
|
|
6431
|
+
}
|
|
6432
|
+
function isObjectLike(value) {
|
|
6433
|
+
return !!value && typeof value == "object";
|
|
6434
|
+
}
|
|
6435
|
+
module.exports = flatten2;
|
|
6436
|
+
}
|
|
6437
|
+
});
|
|
6438
|
+
|
|
6363
6439
|
// ../../../node_modules/.pnpm/mdast-util-to-string@3.2.0/node_modules/mdast-util-to-string/lib/index.js
|
|
6364
6440
|
var emptyOptions = {};
|
|
6365
6441
|
function toString(value, options) {
|
|
@@ -42622,7 +42698,7 @@ var Ty = Rg();
|
|
|
42622
42698
|
var stringifyPropsInline = (element, field, imageCallback) => {
|
|
42623
42699
|
return stringifyProps(element, field, true, imageCallback);
|
|
42624
42700
|
};
|
|
42625
|
-
function stringifyProps(element, parentField,
|
|
42701
|
+
function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
42626
42702
|
const attributes2 = [];
|
|
42627
42703
|
const children = [];
|
|
42628
42704
|
let template;
|
|
@@ -42763,7 +42839,7 @@ function stringifyProps(element, parentField, flatten, imageCallback) {
|
|
|
42763
42839
|
name: name2,
|
|
42764
42840
|
value: {
|
|
42765
42841
|
type: "mdxJsxAttributeValueExpression",
|
|
42766
|
-
value: stringifyObj(result,
|
|
42842
|
+
value: stringifyObj(result, flatten2)
|
|
42767
42843
|
}
|
|
42768
42844
|
});
|
|
42769
42845
|
break;
|
|
@@ -42776,7 +42852,7 @@ function stringifyProps(element, parentField, flatten, imageCallback) {
|
|
|
42776
42852
|
if (field.list) {
|
|
42777
42853
|
throw new Error(`Rich-text list is not supported`);
|
|
42778
42854
|
} else {
|
|
42779
|
-
const joiner =
|
|
42855
|
+
const joiner = flatten2 ? " " : "\n";
|
|
42780
42856
|
let val = "";
|
|
42781
42857
|
if (isPlainObject2(value) && Object.keys(value).length === 0) {
|
|
42782
42858
|
return;
|
|
@@ -42798,7 +42874,7 @@ function stringifyProps(element, parentField, flatten, imageCallback) {
|
|
|
42798
42874
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
42799
42875
|
}
|
|
42800
42876
|
}
|
|
42801
|
-
if (
|
|
42877
|
+
if (flatten2) {
|
|
42802
42878
|
attributes2.push({
|
|
42803
42879
|
type: "mdxJsxAttribute",
|
|
42804
42880
|
name: name2,
|
|
@@ -42845,7 +42921,7 @@ ${val}
|
|
|
42845
42921
|
}
|
|
42846
42922
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
42847
42923
|
}
|
|
42848
|
-
function stringifyObj(obj,
|
|
42924
|
+
function stringifyObj(obj, flatten2) {
|
|
42849
42925
|
if (typeof obj === "object" && obj !== null) {
|
|
42850
42926
|
const dummyFunc = `const dummyFunc = `;
|
|
42851
42927
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -42854,7 +42930,7 @@ function stringifyObj(obj, flatten) {
|
|
|
42854
42930
|
semi: false,
|
|
42855
42931
|
plugins: [mc]
|
|
42856
42932
|
}).trim().replace(dummyFunc, "");
|
|
42857
|
-
return
|
|
42933
|
+
return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
42858
42934
|
} else {
|
|
42859
42935
|
throw new Error(
|
|
42860
42936
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -43479,7 +43555,7 @@ var getMarks = (content3) => {
|
|
|
43479
43555
|
var stringifyPropsInline2 = (element, field, imageCallback) => {
|
|
43480
43556
|
return stringifyProps2(element, field, true, imageCallback);
|
|
43481
43557
|
};
|
|
43482
|
-
function stringifyProps2(element, parentField,
|
|
43558
|
+
function stringifyProps2(element, parentField, flatten2, imageCallback) {
|
|
43483
43559
|
const attributes2 = [];
|
|
43484
43560
|
const children = [];
|
|
43485
43561
|
let template;
|
|
@@ -43615,7 +43691,7 @@ function stringifyProps2(element, parentField, flatten, imageCallback) {
|
|
|
43615
43691
|
name: name2,
|
|
43616
43692
|
value: {
|
|
43617
43693
|
type: "mdxJsxAttributeValueExpression",
|
|
43618
|
-
value: stringifyObj2(value,
|
|
43694
|
+
value: stringifyObj2(value, flatten2)
|
|
43619
43695
|
}
|
|
43620
43696
|
});
|
|
43621
43697
|
break;
|
|
@@ -43628,7 +43704,7 @@ function stringifyProps2(element, parentField, flatten, imageCallback) {
|
|
|
43628
43704
|
if (field.list) {
|
|
43629
43705
|
throw new Error(`Rich-text list is not supported`);
|
|
43630
43706
|
} else {
|
|
43631
|
-
const joiner =
|
|
43707
|
+
const joiner = flatten2 ? " " : "\n";
|
|
43632
43708
|
let val = "";
|
|
43633
43709
|
assertShape2(
|
|
43634
43710
|
value,
|
|
@@ -43647,7 +43723,7 @@ function stringifyProps2(element, parentField, flatten, imageCallback) {
|
|
|
43647
43723
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
43648
43724
|
}
|
|
43649
43725
|
}
|
|
43650
|
-
if (
|
|
43726
|
+
if (flatten2) {
|
|
43651
43727
|
attributes2.push({
|
|
43652
43728
|
type: "mdxJsxAttribute",
|
|
43653
43729
|
name: name2,
|
|
@@ -43694,7 +43770,7 @@ ${val}
|
|
|
43694
43770
|
}
|
|
43695
43771
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
43696
43772
|
}
|
|
43697
|
-
function stringifyObj2(obj,
|
|
43773
|
+
function stringifyObj2(obj, flatten2) {
|
|
43698
43774
|
if (typeof obj === "object" && obj !== null) {
|
|
43699
43775
|
const dummyFunc = `const dummyFunc = `;
|
|
43700
43776
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -43703,7 +43779,7 @@ function stringifyObj2(obj, flatten) {
|
|
|
43703
43779
|
semi: false,
|
|
43704
43780
|
plugins: [mc]
|
|
43705
43781
|
}).trim().replace(dummyFunc, "");
|
|
43706
|
-
return
|
|
43782
|
+
return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
43707
43783
|
} else {
|
|
43708
43784
|
throw new Error(
|
|
43709
43785
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -49953,6 +50029,9 @@ function compact(tree) {
|
|
|
49953
50029
|
return tree;
|
|
49954
50030
|
}
|
|
49955
50031
|
|
|
50032
|
+
// src/parse/remarkToPlate.ts
|
|
50033
|
+
var import_lodash = __toESM(require_lodash());
|
|
50034
|
+
|
|
49956
50035
|
// src/parse/acorn.ts
|
|
49957
50036
|
var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
49958
50037
|
const properties = {};
|
|
@@ -50349,7 +50428,11 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50349
50428
|
children: [
|
|
50350
50429
|
{
|
|
50351
50430
|
type: "p",
|
|
50352
|
-
children:
|
|
50431
|
+
children: (0, import_lodash.default)(
|
|
50432
|
+
tableCell.children.map(
|
|
50433
|
+
(child) => phrasingContent(child)
|
|
50434
|
+
)
|
|
50435
|
+
)
|
|
50353
50436
|
}
|
|
50354
50437
|
]
|
|
50355
50438
|
};
|
|
@@ -50392,7 +50475,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50392
50475
|
children: [
|
|
50393
50476
|
{
|
|
50394
50477
|
type: "lic",
|
|
50395
|
-
children:
|
|
50478
|
+
children: (0, import_lodash.default)(
|
|
50479
|
+
content4.children.map((child) => unwrapBlockContent(child))
|
|
50480
|
+
)
|
|
50396
50481
|
}
|
|
50397
50482
|
]
|
|
50398
50483
|
};
|
|
@@ -50456,7 +50541,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50456
50541
|
case "paragraph":
|
|
50457
50542
|
return {
|
|
50458
50543
|
type: "lic",
|
|
50459
|
-
children:
|
|
50544
|
+
children: (0, import_lodash.default)(
|
|
50545
|
+
child.children.map((child2) => phrasingContent(child2))
|
|
50546
|
+
)
|
|
50460
50547
|
};
|
|
50461
50548
|
case "blockquote": {
|
|
50462
50549
|
return {
|
|
@@ -50519,7 +50606,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50519
50606
|
const unwrapBlockContent = (content4) => {
|
|
50520
50607
|
const flattenPhrasingContent = (children) => {
|
|
50521
50608
|
const children2 = children.map((child) => phrasingContent(child));
|
|
50522
|
-
return (Array.isArray(children2) ? children2 : [children2])
|
|
50609
|
+
return (0, import_lodash.default)(Array.isArray(children2) ? children2 : [children2]);
|
|
50523
50610
|
};
|
|
50524
50611
|
switch (content4.type) {
|
|
50525
50612
|
case "heading":
|
|
@@ -50569,13 +50656,15 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50569
50656
|
type: "a",
|
|
50570
50657
|
url: sanitizeUrl(content4.url),
|
|
50571
50658
|
title: content4.title,
|
|
50572
|
-
children:
|
|
50659
|
+
children: (0, import_lodash.default)(
|
|
50660
|
+
content4.children.map((child) => staticPhrasingContent(child))
|
|
50661
|
+
)
|
|
50573
50662
|
};
|
|
50574
50663
|
};
|
|
50575
50664
|
const heading2 = (content4) => {
|
|
50576
50665
|
return {
|
|
50577
50666
|
type: ["h1", "h2", "h3", "h4", "h5", "h6"][content4.depth - 1],
|
|
50578
|
-
children: content4.children.map(phrasingContent)
|
|
50667
|
+
children: (0, import_lodash.default)(content4.children.map(phrasingContent))
|
|
50579
50668
|
};
|
|
50580
50669
|
};
|
|
50581
50670
|
const staticPhrasingContent = (content4) => {
|
|
@@ -50648,7 +50737,11 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50648
50737
|
const accum = [];
|
|
50649
50738
|
switch (node2.type) {
|
|
50650
50739
|
case "emphasis": {
|
|
50651
|
-
const children =
|
|
50740
|
+
const children = (0, import_lodash.default)(
|
|
50741
|
+
node2.children.map(
|
|
50742
|
+
(child) => phrashingMark(child, [...marks, "italic"])
|
|
50743
|
+
)
|
|
50744
|
+
);
|
|
50652
50745
|
children.forEach((child) => {
|
|
50653
50746
|
accum.push(child);
|
|
50654
50747
|
});
|
|
@@ -50666,14 +50759,20 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50666
50759
|
break;
|
|
50667
50760
|
}
|
|
50668
50761
|
case "delete": {
|
|
50669
|
-
const children =
|
|
50762
|
+
const children = (0, import_lodash.default)(
|
|
50763
|
+
node2.children.map(
|
|
50764
|
+
(child) => phrashingMark(child, [...marks, "strikethrough"])
|
|
50765
|
+
)
|
|
50766
|
+
);
|
|
50670
50767
|
children.forEach((child) => {
|
|
50671
50768
|
accum.push(child);
|
|
50672
50769
|
});
|
|
50673
50770
|
break;
|
|
50674
50771
|
}
|
|
50675
50772
|
case "strong": {
|
|
50676
|
-
const children =
|
|
50773
|
+
const children = (0, import_lodash.default)(
|
|
50774
|
+
node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
|
|
50775
|
+
);
|
|
50677
50776
|
children.forEach((child) => {
|
|
50678
50777
|
accum.push(child);
|
|
50679
50778
|
});
|
|
@@ -50684,7 +50783,9 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50684
50783
|
break;
|
|
50685
50784
|
}
|
|
50686
50785
|
case "link": {
|
|
50687
|
-
const children =
|
|
50786
|
+
const children = (0, import_lodash.default)(
|
|
50787
|
+
node2.children.map((child) => phrashingMark(child, marks))
|
|
50788
|
+
);
|
|
50688
50789
|
accum.push({
|
|
50689
50790
|
type: "a",
|
|
50690
50791
|
url: sanitizeUrl(node2.url),
|
|
@@ -50746,7 +50847,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50746
50847
|
};
|
|
50747
50848
|
};
|
|
50748
50849
|
const paragraph2 = (content4) => {
|
|
50749
|
-
const children = content4.children.map(phrasingContent)
|
|
50850
|
+
const children = (0, import_lodash.default)(content4.children.map(phrasingContent));
|
|
50750
50851
|
if (children.length === 1) {
|
|
50751
50852
|
if (children[0]) {
|
|
50752
50853
|
if (children[0].type === "html_inline") {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
*/
|
|
6
|
-
import type { RichTextType } from '@tinacms/schema-tools';
|
|
7
6
|
import type * as Md from 'mdast';
|
|
8
|
-
import type { ContainerDirective } from 'mdast-util-directive';
|
|
9
|
-
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
|
|
10
7
|
import type * as Plate from './plate';
|
|
8
|
+
import type { RichTextType } from '@tinacms/schema-tools';
|
|
9
|
+
import type { MdxJsxTextElement, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
10
|
+
import type { ContainerDirective } from 'mdast-util-directive';
|
|
11
11
|
export type { Position, PositionItem } from './plate';
|
|
12
12
|
declare module 'mdast' {
|
|
13
13
|
interface StaticPhrasingContentMap {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/mdx",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-ab51af8-20251124045003",
|
|
4
4
|
"typings": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"browser": "dist/index.browser.mjs",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"acorn": "8.8.2",
|
|
31
31
|
"ccount": "2.0.1",
|
|
32
32
|
"estree-util-is-identifier-name": "2.1.0",
|
|
33
|
+
"lodash.flatten": "4.4.0",
|
|
33
34
|
"mdast-util-compact": "4.1.1",
|
|
34
35
|
"mdast-util-directive": "2.2.4",
|
|
35
36
|
"mdast-util-from-markdown": "1.3.0",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"unist-util-visit": "4.1.2",
|
|
56
57
|
"uvu": "0.5.6",
|
|
57
58
|
"vfile-message": "3.1.4",
|
|
58
|
-
"@tinacms/schema-tools": "0.0.0-
|
|
59
|
+
"@tinacms/schema-tools": "0.0.0-ab51af8-20251124045003"
|
|
59
60
|
},
|
|
60
61
|
"publishConfig": {
|
|
61
62
|
"registry": "https://registry.npmjs.org"
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
69
|
"@types/estree": "1.0.0",
|
|
70
|
+
"@types/lodash.flatten": "^4.4.9",
|
|
69
71
|
"@types/mdast": "^3.0.15",
|
|
70
72
|
"@types/node": "^22.13.1",
|
|
71
73
|
"@types/prettier": "^2.7.3",
|
|
@@ -78,7 +80,7 @@
|
|
|
78
80
|
"typescript": "^5.7.3",
|
|
79
81
|
"vite": "^4.5.9",
|
|
80
82
|
"vitest": "^0.32.4",
|
|
81
|
-
"@tinacms/scripts": "0.0.0-
|
|
83
|
+
"@tinacms/scripts": "0.0.0-ab51af8-20251124045003"
|
|
82
84
|
},
|
|
83
85
|
"scripts": {
|
|
84
86
|
"types": "tsc",
|