@superinterface/react 2.17.0 → 2.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +125 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +95 -67
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1353,87 +1353,114 @@ var components = {
|
|
|
1353
1353
|
annotation: Annotation
|
|
1354
1354
|
};
|
|
1355
1355
|
// src/lib/remark/remarkAnnotation.ts
|
|
1356
|
-
import {
|
|
1356
|
+
import { isNumber } from "radash";
|
|
1357
|
+
import flatMap from "unist-util-flatmap";
|
|
1357
1358
|
var remarkAnnotation = function(param) {
|
|
1358
1359
|
var content = param.content;
|
|
1359
1360
|
return function() {
|
|
1360
1361
|
return function(tree) {
|
|
1361
|
-
|
|
1362
|
-
if (
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1362
|
+
flatMap(tree, function(node) {
|
|
1363
|
+
if (node.type !== "text") {
|
|
1364
|
+
return [
|
|
1365
|
+
node
|
|
1366
|
+
];
|
|
1367
|
+
}
|
|
1368
|
+
if (!content.text.annotations.length) {
|
|
1369
|
+
return [
|
|
1370
|
+
node
|
|
1371
|
+
];
|
|
1372
|
+
}
|
|
1373
|
+
if (!node.position) {
|
|
1374
|
+
return [
|
|
1375
|
+
node
|
|
1376
|
+
];
|
|
1377
|
+
}
|
|
1378
|
+
var nodeStart = node.position.start.offset;
|
|
1379
|
+
if (!isNumber(nodeStart)) {
|
|
1380
|
+
return [
|
|
1381
|
+
node
|
|
1382
|
+
];
|
|
1383
|
+
}
|
|
1384
|
+
var nodeEnd = node.position.end.offset;
|
|
1385
|
+
if (!isNumber(nodeEnd)) {
|
|
1386
|
+
return [
|
|
1387
|
+
node
|
|
1388
|
+
];
|
|
1389
|
+
}
|
|
1390
|
+
var newNodes = [];
|
|
1391
|
+
var sortedAnnotations = content.text.annotations.sort(function(a, b) {
|
|
1392
|
+
return a.start_index - b.start_index;
|
|
1393
|
+
});
|
|
1394
|
+
var lastProcessedIndex = nodeStart;
|
|
1395
|
+
sortedAnnotations.forEach(function(annotation) {
|
|
1396
|
+
var annotationStart = annotation.start_index;
|
|
1397
|
+
var annotationEnd = annotation.end_index;
|
|
1398
|
+
if (nodeEnd < annotationStart || nodeStart > annotationEnd) {
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1401
|
+
var startIndex = Math.max(nodeStart, annotationStart);
|
|
1402
|
+
var endIndex = Math.min(nodeEnd, annotationEnd);
|
|
1403
|
+
if (lastProcessedIndex < startIndex) {
|
|
1398
1404
|
newNodes.push({
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
hName: "annotation",
|
|
1402
|
-
hProperties: {
|
|
1403
|
-
annotation: annotation
|
|
1404
|
-
}
|
|
1405
|
-
},
|
|
1405
|
+
type: "text",
|
|
1406
|
+
value: node.value.slice(lastProcessedIndex - nodeStart, startIndex - nodeStart),
|
|
1406
1407
|
position: {
|
|
1407
1408
|
start: {
|
|
1408
|
-
|
|
1409
|
+
line: node.position.start.line,
|
|
1410
|
+
column: node.position.start.column,
|
|
1411
|
+
offset: lastProcessedIndex
|
|
1409
1412
|
},
|
|
1410
1413
|
end: {
|
|
1411
|
-
|
|
1414
|
+
line: node.position.end.line,
|
|
1415
|
+
column: node.position.end.column,
|
|
1416
|
+
offset: startIndex
|
|
1412
1417
|
}
|
|
1413
1418
|
}
|
|
1414
1419
|
});
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1420
|
+
}
|
|
1421
|
+
newNodes.push({
|
|
1422
|
+
type: "annotation",
|
|
1423
|
+
value: node.value.slice(startIndex - nodeStart, endIndex - nodeStart),
|
|
1424
|
+
position: {
|
|
1425
|
+
start: {
|
|
1426
|
+
line: node.position.start.line,
|
|
1427
|
+
column: node.position.start.column,
|
|
1428
|
+
offset: startIndex
|
|
1429
|
+
},
|
|
1430
|
+
end: {
|
|
1431
|
+
line: node.position.end.line,
|
|
1432
|
+
column: node.position.end.column,
|
|
1433
|
+
offset: endIndex
|
|
1434
|
+
}
|
|
1435
|
+
},
|
|
1436
|
+
data: {
|
|
1437
|
+
hName: "annotation",
|
|
1438
|
+
hProperties: {
|
|
1439
|
+
annotation: annotation
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
lastProcessedIndex = endIndex;
|
|
1444
|
+
});
|
|
1445
|
+
if (lastProcessedIndex < nodeEnd) {
|
|
1446
|
+
newNodes.push({
|
|
1447
|
+
type: "text",
|
|
1448
|
+
value: node.value.slice(lastProcessedIndex - nodeStart, nodeEnd - nodeStart),
|
|
1449
|
+
position: {
|
|
1450
|
+
start: {
|
|
1451
|
+
line: node.position.start.line,
|
|
1452
|
+
column: node.position.start.column,
|
|
1453
|
+
offset: lastProcessedIndex
|
|
1454
|
+
},
|
|
1455
|
+
end: {
|
|
1456
|
+
line: node.position.end.line,
|
|
1457
|
+
column: node.position.end.column,
|
|
1458
|
+
offset: nodeEnd
|
|
1459
|
+
}
|
|
1428
1460
|
}
|
|
1429
|
-
(_parent_children = parent.children).splice.apply(_parent_children, [
|
|
1430
|
-
index,
|
|
1431
|
-
1
|
|
1432
|
-
].concat(_to_consumable_array(newNodes)));
|
|
1433
1461
|
});
|
|
1434
|
-
return SKIP;
|
|
1435
1462
|
}
|
|
1436
|
-
return;
|
|
1463
|
+
return newNodes;
|
|
1437
1464
|
});
|
|
1438
1465
|
};
|
|
1439
1466
|
};
|
|
@@ -1812,7 +1839,8 @@ var Messages = function(param) {
|
|
|
1812
1839
|
/* @__PURE__ */ jsx46(NextPageSkeleton, {}),
|
|
1813
1840
|
/* @__PURE__ */ jsx46(Flex14, {
|
|
1814
1841
|
flexShrink: "0",
|
|
1815
|
-
flexGrow: "1"
|
|
1842
|
+
flexGrow: "1",
|
|
1843
|
+
minHeight: "var(--space-5)"
|
|
1816
1844
|
})
|
|
1817
1845
|
]
|
|
1818
1846
|
});
|