@columnus/shared 0.1.49 → 0.1.51
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/clipboardTransfer.js.map +1 -1
- package/dist/csv.js +26 -1
- package/dist/csv.js.map +1 -1
- package/dist/dateValues.d.ts +3 -0
- package/dist/dateValues.js +23 -1
- package/dist/dateValues.js.map +1 -1
- package/dist/displayLabel.js +26 -1
- package/dist/displayLabel.js.map +1 -1
- package/dist/importMatch.js +26 -1
- package/dist/importMatch.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +221 -43
- package/dist/index.js.map +1 -1
- package/dist/recordTableColumns.d.ts +3 -1
- package/dist/recordTableColumns.js +202 -2
- package/dist/recordTableColumns.js.map +1 -1
- package/dist/recordTablePreload.d.ts +19 -0
- package/dist/recordTablePreload.js +4330 -0
- package/dist/recordTablePreload.js.map +1 -0
- package/dist/refDisplayRequests.js.map +1 -1
- package/dist/richDoc.d.ts +10 -0
- package/dist/richDoc.js +65 -2
- package/dist/richDoc.js.map +1 -1
- package/dist/schemaTypes.js.map +1 -1
- package/dist/shareProposal.js.map +1 -1
- package/dist/spaceBundle.js.map +1 -1
- package/dist/storageFieldValues.js.map +1 -1
- package/package.json +1 -1
package/dist/richDoc.d.ts
CHANGED
|
@@ -65,3 +65,13 @@ export declare function collectRecordLinkIdsFromBlocks(blocks: RichDocBlock[]):
|
|
|
65
65
|
export declare function collectRecordLinkIds(value: unknown): Map<string, Set<string>>;
|
|
66
66
|
/** Parse doc cross-links from markdown hrefs. Supports `doc:slug` and relative `.md` paths. */
|
|
67
67
|
export declare function parseDocLinkHref(href: string): string | null;
|
|
68
|
+
/** True when `value` is a BlockNote envelope JSON string. */
|
|
69
|
+
export declare function isBlockNoteContent(value: string): boolean;
|
|
70
|
+
export declare function isHttpUrl(value: string): boolean;
|
|
71
|
+
/** Convex storage ids referenced by image blocks (skips http(s) URLs). */
|
|
72
|
+
export declare function collectRichDocStorageIds(value: string): string[];
|
|
73
|
+
/**
|
|
74
|
+
* Plain text from BlockNote JSON or legacy markdown — feed previews, meta, stamps.
|
|
75
|
+
* Empty input / empty result → `undefined`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function richContentPlainText(value: string): string | undefined;
|
package/dist/richDoc.js
CHANGED
|
@@ -4326,10 +4326,33 @@ function visitInlineContent(content, visit) {
|
|
|
4326
4326
|
function walkInlineContent(content, parts) {
|
|
4327
4327
|
visitInlineContent(content, {
|
|
4328
4328
|
text: (t) => parts.push(t),
|
|
4329
|
-
recordLink: (props) => parts.push(props.table ? `[${props.table}]` : "[
|
|
4329
|
+
recordLink: (props) => parts.push(props.table ? `[${props.table}]` : "[Record]"),
|
|
4330
4330
|
link: (nested) => walkInlineContent(nested, parts)
|
|
4331
4331
|
});
|
|
4332
4332
|
}
|
|
4333
|
+
function walkTableCell(cell, parts) {
|
|
4334
|
+
if (Array.isArray(cell)) {
|
|
4335
|
+
walkInlineContent(cell, parts);
|
|
4336
|
+
return;
|
|
4337
|
+
}
|
|
4338
|
+
if (cell && typeof cell === "object") {
|
|
4339
|
+
const node = cell;
|
|
4340
|
+
if (node.type === "tableCell" && Array.isArray(node.content)) {
|
|
4341
|
+
walkInlineContent(node.content, parts);
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
function walkTableContent(content, parts) {
|
|
4346
|
+
if (!content || typeof content !== "object" || Array.isArray(content)) return;
|
|
4347
|
+
const rows = content.rows ?? [];
|
|
4348
|
+
for (const row of rows) {
|
|
4349
|
+
for (const cell of row.cells ?? []) {
|
|
4350
|
+
const before = parts.length;
|
|
4351
|
+
walkTableCell(cell, parts);
|
|
4352
|
+
if (parts.length > before) parts.push(" ");
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4333
4356
|
function walkBlocks(blocks, parts) {
|
|
4334
4357
|
for (const block of blocks) {
|
|
4335
4358
|
if (block.type === "recordTable") {
|
|
@@ -4343,6 +4366,8 @@ function walkBlocks(blocks, parts) {
|
|
|
4343
4366
|
parts.push("[data table]");
|
|
4344
4367
|
}
|
|
4345
4368
|
parts.push(" ");
|
|
4369
|
+
} else if (block.type === "table") {
|
|
4370
|
+
walkTableContent(block.content, parts);
|
|
4346
4371
|
} else if (Array.isArray(block.content)) {
|
|
4347
4372
|
walkInlineContent(block.content, parts);
|
|
4348
4373
|
parts.push(" ");
|
|
@@ -4402,7 +4427,45 @@ function parseDocLinkHref(href) {
|
|
|
4402
4427
|
if (mdMatch) return mdMatch[1].replace(/\.md$/i, "").toLowerCase();
|
|
4403
4428
|
return null;
|
|
4404
4429
|
}
|
|
4430
|
+
function isBlockNoteContent(value) {
|
|
4431
|
+
try {
|
|
4432
|
+
return isBlockNoteEnvelope(JSON.parse(value));
|
|
4433
|
+
} catch {
|
|
4434
|
+
return false;
|
|
4435
|
+
}
|
|
4436
|
+
}
|
|
4437
|
+
function isHttpUrl(value) {
|
|
4438
|
+
return /^https?:\/\//i.test(value);
|
|
4439
|
+
}
|
|
4440
|
+
function collectImageStorageIdsFromBlocks(blocks, out) {
|
|
4441
|
+
for (const block of blocks) {
|
|
4442
|
+
if (block.type === "image") {
|
|
4443
|
+
const url = block.props?.url;
|
|
4444
|
+
if (typeof url === "string" && url.trim() !== "" && !isHttpUrl(url)) out.add(url);
|
|
4445
|
+
}
|
|
4446
|
+
if (block.children?.length) collectImageStorageIdsFromBlocks(block.children, out);
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
function collectRichDocStorageIds(value) {
|
|
4450
|
+
if (!isBlockNoteContent(value)) return [];
|
|
4451
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4452
|
+
collectImageStorageIdsFromBlocks(parseRichDocBlocks(value), ids);
|
|
4453
|
+
return [...ids];
|
|
4454
|
+
}
|
|
4455
|
+
function plainMarkdownText(value) {
|
|
4456
|
+
return value.replace(/```[\s\S]*?```/g, " ").replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/^#+\s+/gm, "").replace(/^\s*[-*+]\s+/gm, "").replace(/[*_`>#]/g, "").replace(/\s+/g, " ").trim();
|
|
4457
|
+
}
|
|
4458
|
+
function richContentPlainText(value) {
|
|
4459
|
+
const trimmed = value.trim();
|
|
4460
|
+
if (!trimmed) return void 0;
|
|
4461
|
+
if (isBlockNoteContent(trimmed)) {
|
|
4462
|
+
const text = extractPlainText(trimmed).replace(/\s+/g, " ").trim();
|
|
4463
|
+
return text || void 0;
|
|
4464
|
+
}
|
|
4465
|
+
const plain = plainMarkdownText(trimmed);
|
|
4466
|
+
return plain || void 0;
|
|
4467
|
+
}
|
|
4405
4468
|
|
|
4406
|
-
export { COLUMNUS_DOC_LINK_MARKER, EMPTY_BLOCK_ID, EMPTY_MARKDOWN_DOC, EMPTY_RICH_DOC, RICH_DOC_FORMAT, RICH_DOC_VERSION, STUDIO_DOC_LINK_MARKER, blocksForBlockNoteDisplay, canonicalRichFieldJson, collectRecordLinkIds, collectRecordLinkIdsFromBlocks, emptyParagraphBlock, extractPlainText, isBlockNoteEnvelope, isValidMarkdownDocJson, isValidRichFieldJson, normalizeMarkdownField, normalizeRichField, parseDocLinkHref, parseRecordTableQueryJson, parseRichDocBlocks, postprocessDocLinksInBlocks, preprocessDocLinksInBlocks, preprocessDocLinksInMarkdown, stringifyRecordTableQuery, stringifyRichDoc, wrapPlainTextAsRichDoc };
|
|
4469
|
+
export { COLUMNUS_DOC_LINK_MARKER, EMPTY_BLOCK_ID, EMPTY_MARKDOWN_DOC, EMPTY_RICH_DOC, RICH_DOC_FORMAT, RICH_DOC_VERSION, STUDIO_DOC_LINK_MARKER, blocksForBlockNoteDisplay, canonicalRichFieldJson, collectRecordLinkIds, collectRecordLinkIdsFromBlocks, collectRichDocStorageIds, emptyParagraphBlock, extractPlainText, isBlockNoteContent, isBlockNoteEnvelope, isHttpUrl, isValidMarkdownDocJson, isValidRichFieldJson, normalizeMarkdownField, normalizeRichField, parseDocLinkHref, parseRecordTableQueryJson, parseRichDocBlocks, postprocessDocLinksInBlocks, preprocessDocLinksInBlocks, preprocessDocLinksInMarkdown, richContentPlainText, stringifyRecordTableQuery, stringifyRichDoc, wrapPlainTextAsRichDoc };
|
|
4407
4470
|
//# sourceMappingURL=richDoc.js.map
|
|
4408
4471
|
//# sourceMappingURL=richDoc.js.map
|