@xenosystem/blocks 0.23.1 → 0.24.0

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.
@@ -1,5 +1,6 @@
1
- import { XenoDocNode } from './format.js';
2
- export { DOCUMENT_MARK_TYPES, DOCUMENT_NODE_TYPES, JSONContent, LIMITS, SAFE_IMAGE, SAFE_LINK, ValidateOptions, XDOC_EXTENSION, XDOC_FORMAT, XDOC_VERSION, XdocError, XenoDocFile, XenoDocMark, XenoDocProblem, documentToMarkdown, emptyContent, markdownToDocument, nodeTypesIn, pageLinksIn, parseXdoc, plainText, serializeXdoc, validateContent, wordCount } from './format.js';
1
+ import { X as XenoDocNode } from '../format-BoLLqtrs.js';
2
+ export { D as DOCUMENT_MARK_TYPES, a as DOCUMENT_NODE_TYPES, L as LIMITS, S as SAFE_IMAGE, b as SAFE_LINK, V as ValidateOptions, c as XDOC_EXTENSION, d as XDOC_FORMAT, e as XDOC_VERSION, f as XdocError, g as XenoDocFile, h as XenoDocMark, i as XenoDocProblem, j as emptyContent, n as nodeTypesIn, p as pageLinksIn, k as parseXdoc, l as plainText, s as serializeXdoc, v as validateContent, w as wordCount } from '../format-BoLLqtrs.js';
3
+ export { JSONContent, documentToMarkdown, markdownToDocument } from './format.js';
3
4
  import * as _tiptap_core from '@tiptap/core';
4
5
  import { Node, Mark, AnyExtension, Editor } from '@tiptap/core';
5
6
  import * as _tiptap_extension_image from '@tiptap/extension-image';
@@ -286,11 +287,17 @@ interface DocumentSurfaceOptions extends Omit<DocumentExtensionOptions, 'onOpenP
286
287
  editorClass?: string;
287
288
  /** Accessible name for the text area. */
288
289
  label?: string;
290
+ /**
291
+ * The text lives in a SHARED document that `extensions` bind the editor to (`@xenosystem/blocks/docs/collaboration`,
292
+ * a Y.js document the host keeps in step). The surface then puts no content in the editor and a `load` never replaces
293
+ * it: replacing it here would replace it for everyone writing in it. Pass `history: false` with it (Y.js brings undo).
294
+ */
295
+ shared?: boolean;
289
296
  }
290
297
  /** Run one format command on a TipTap editor. Exported so XENO Docs' toolbar uses the SAME map. */
291
298
  declare function runFormat(editor: Editor, command: DocumentFormatCommand, arg?: unknown, promptLink?: DocumentSurfaceOptions['promptLink']): boolean;
292
299
  /** A {@link DocumentEditorHandle} over a TipTap editor. */
293
- declare function editorHandle(editor: Editor, promptLink?: DocumentSurfaceOptions['promptLink']): DocumentEditorHandle;
300
+ declare function editorHandle(editor: Editor, promptLink?: DocumentSurfaceOptions['promptLink'], shared?: boolean): DocumentEditorHandle;
294
301
  /**
295
302
  * Mount the editor into `element` and bind it to `controller`. Returns the teardown, which destroys
296
303
  * the editor — call it before the element is removed.
package/dist/docs/core.js CHANGED
@@ -1,18 +1,24 @@
1
1
  import {
2
- Callout,
3
2
  DOCUMENT_FORMAT_COMMANDS,
4
3
  DOCUMENT_TOOLBAR,
5
4
  DocumentController,
6
- PageBreak,
7
- SafeImage,
8
- ToggleBlock,
9
- WikiLinkMark,
10
- createDocumentExtensions,
11
5
  editorHandle,
12
6
  mountDocumentSurface,
13
7
  runFormat
14
- } from "../chunk-5VOA3OSG.js";
8
+ } from "../chunk-JEY4JFVJ.js";
15
9
  import "../chunk-HDP35LGH.js";
10
+ import {
11
+ documentToMarkdown,
12
+ markdownToDocument
13
+ } from "../chunk-5NDMACVU.js";
14
+ import {
15
+ Callout,
16
+ PageBreak,
17
+ SafeImage,
18
+ ToggleBlock,
19
+ WikiLinkMark,
20
+ createDocumentExtensions
21
+ } from "../chunk-KC2QBI2I.js";
16
22
  import {
17
23
  DOCUMENT_MARK_TYPES,
18
24
  DOCUMENT_NODE_TYPES,
@@ -23,9 +29,7 @@ import {
23
29
  XDOC_FORMAT,
24
30
  XDOC_VERSION,
25
31
  XdocError,
26
- documentToMarkdown,
27
32
  emptyContent,
28
- markdownToDocument,
29
33
  nodeTypesIn,
30
34
  pageLinksIn,
31
35
  parseXdoc,
@@ -33,7 +37,7 @@ import {
33
37
  serializeXdoc,
34
38
  validateContent,
35
39
  wordCount
36
- } from "../chunk-NFOBZJDF.js";
40
+ } from "../chunk-MDNEMOZD.js";
37
41
  import "../chunk-2KG3PWR4.js";
38
42
  export {
39
43
  Callout,
@@ -1,125 +1,5 @@
1
- /**
2
- * The XENO document FORMAT — `.xdoc`, XENO Docs' native file, now the one format every surface that
3
- * edits a document reads and writes (XENO Docs, XENO Notes' link mark, the platform workspace's
4
- * Write and Notes).
5
- *
6
- * A `.xdoc` is JSON: an envelope around a ProseMirror document (`content`, the TipTap `getJSON()`
7
- * shape). It is NOT HTML and is never rendered as HTML: a surface turns `content` into DOM through
8
- * the schema in `./schema`, which only knows the node and mark types listed here. That is the whole
9
- * XSS argument, and this module is what keeps it true at every boundary that accepts a file:
10
- *
11
- * - every node / mark type must be one of {@link DOCUMENT_NODE_TYPES} / {@link DOCUMENT_MARK_TYPES}
12
- * (a product may widen the set for ITS OWN extensions with `extraNodes` / `extraMarks`);
13
- * - every attribute is checked against the type's own rule — a link's `href` must be http(s) or
14
- * mailto, an image's `src` https or a raster `data:` image, a page link's id a UUID;
15
- * - depth and node count are bounded.
16
- *
17
- * {@link validateContent} reports what it refused instead of dropping it: a server refuses the file,
18
- * a surface opens it read-only. Silently dropping an unknown block would lose the user's words on the
19
- * next save — the same outcome as a bug, with a better excuse.
20
- *
21
- * This module imports nothing (no TipTap, no DOM), so a server, a migration script or a test can use
22
- * it without an editor.
23
- *
24
- * @module
25
- */
26
- /** The `format` field every `.xdoc` written from now on carries. */
27
- declare const XDOC_FORMAT = "xeno.xdoc";
28
- /** The current envelope version. */
29
- declare const XDOC_VERSION = 1;
30
- /** The file extension XENO Docs ships (`DocumentEditor.tsx` — `${title}.xdoc`). */
31
- declare const XDOC_EXTENSION = ".xdoc";
32
- /** One ProseMirror node, as TipTap's `getJSON()` writes it. */
33
- interface XenoDocNode {
34
- type: string;
35
- attrs?: Record<string, unknown>;
36
- content?: XenoDocNode[];
37
- marks?: XenoDocMark[];
38
- text?: string;
39
- }
40
- /** One mark on a text node. */
41
- interface XenoDocMark {
42
- type: string;
43
- attrs?: Record<string, unknown>;
44
- }
45
- /**
46
- * The `.xdoc` envelope. Field names are exactly the ones XENO Docs' autosave has always written
47
- * (`id, title, content, lastModified, created, wordCount`), so every existing file still parses;
48
- * `format` and `version` are the additive part.
49
- */
50
- interface XenoDocFile {
51
- format: typeof XDOC_FORMAT;
52
- version: number;
53
- id?: string;
54
- title: string;
55
- content: XenoDocNode;
56
- created: number;
57
- lastModified: number;
58
- wordCount: number;
59
- /**
60
- * XENO Docs' comment threads (its `Comment` mark points into them; XENO Docs keeps them as an object keyed by thread id). Carried through untouched by every surface,
61
- * so a document that round-trips through the workspace keeps its comments; only XENO Docs reads them.
62
- */
63
- commentThreads?: unknown;
64
- }
65
- /** Node types the shared schema renders. A file with any other type is refused, never coerced. */
66
- declare const DOCUMENT_NODE_TYPES: readonly ["doc", "paragraph", "text", "heading", "blockquote", "bulletList", "orderedList", "listItem", "taskList", "taskItem", "codeBlock", "horizontalRule", "hardBreak", "table", "tableRow", "tableCell", "tableHeader", "image", "callout", "toggleBlock", "pageBreak"];
67
- /** Mark types the shared schema renders. */
68
- declare const DOCUMENT_MARK_TYPES: readonly ["bold", "italic", "strike", "code", "underline", "link", "subscript", "superscript", "highlight", "wikiLink"];
69
- /** A link a reader can follow without running anything. */
70
- declare const SAFE_LINK: RegExp;
71
- /** An image a reader can load without running anything: https, or a raster image inline. */
72
- declare const SAFE_IMAGE: RegExp;
73
- /** Limits a file must stay inside. */
74
- declare const LIMITS: Readonly<{
75
- depth: 64;
76
- nodes: 50000;
77
- text: 2000000;
78
- }>;
79
- /** One reason a document was refused. `path` points at the offending node (`content[2].content[0]`). */
80
- interface XenoDocProblem {
81
- path: string;
82
- code: 'unknown_node' | 'unknown_mark' | 'bad_attr' | 'bad_shape' | 'too_deep' | 'too_large';
83
- detail: string;
84
- }
85
- /** Options for {@link validateContent}: a product's own extensions, allowed in ITS files only. */
86
- interface ValidateOptions {
87
- extraNodes?: Iterable<string>;
88
- extraMarks?: Iterable<string>;
89
- }
90
- /**
91
- * Check a ProseMirror document against the shared schema. Pure; never throws for bad input.
92
- *
93
- * Types in `extraNodes` / `extraMarks` are accepted with their attributes unchecked: they belong to the
94
- * product that declared them, and only that product's surface renders them.
95
- */
96
- declare function validateContent(content: unknown, options?: ValidateOptions): XenoDocProblem[];
97
- /** The error {@link parseXdoc} throws: the problems ride on it so a caller can say exactly what is wrong. */
98
- declare class XdocError extends Error {
99
- readonly problems: XenoDocProblem[];
100
- constructor(message: string, problems?: XenoDocProblem[]);
101
- }
102
- /** An empty document: one empty paragraph, which is what TipTap writes for a blank editor. */
103
- declare const emptyContent: () => XenoDocNode;
104
- /**
105
- * Parse a `.xdoc` file (text or an already-parsed object). Accepts the legacy XENO Docs envelope with
106
- * no `format` field. Throws {@link XdocError} for anything the shared schema would not render.
107
- */
108
- declare function parseXdoc(input: string | unknown, options?: ValidateOptions): XenoDocFile;
109
- /** Write a `.xdoc`. Validates first: a surface must never write a file the next surface refuses. */
110
- declare function serializeXdoc(doc: Omit<XenoDocFile, 'format' | 'version' | 'wordCount'> & {
111
- wordCount?: number;
112
- }, options?: ValidateOptions & {
113
- pretty?: boolean;
114
- }): string;
115
- /** The document's words without structure — what search indexes and an excerpt shows. */
116
- declare function plainText(content: XenoDocNode | undefined): string;
117
- /** Words, the way XENO Docs' status bar counts them. */
118
- declare function wordCount(content: XenoDocNode | undefined): number;
119
- /** The ids every page link (`wikiLink` mark) in the document points at, deduplicated, in order. */
120
- declare function pageLinksIn(content: XenoDocNode | undefined): string[];
121
- /** Every node type in a document — what a surface checks before it decides it can edit it. */
122
- declare function nodeTypesIn(content: XenoDocNode | undefined): Set<string>;
1
+ import { X as XenoDocNode } from '../format-BoLLqtrs.js';
2
+ export { D as DOCUMENT_MARK_TYPES, a as DOCUMENT_NODE_TYPES, L as LIMITS, S as SAFE_IMAGE, b as SAFE_LINK, V as ValidateOptions, c as XDOC_EXTENSION, d as XDOC_FORMAT, e as XDOC_VERSION, f as XdocError, g as XenoDocFile, h as XenoDocMark, i as XenoDocProblem, j as emptyContent, n as nodeTypesIn, p as pageLinksIn, k as parseXdoc, l as plainText, s as serializeXdoc, v as validateContent, w as wordCount } from '../format-BoLLqtrs.js';
123
3
 
124
4
  /**
125
5
  * Markdown import/export engine
@@ -142,4 +22,4 @@ interface JSONContent {
142
22
  declare function documentToMarkdown(doc: JSONContent): string;
143
23
  declare function markdownToDocument(md: string): XenoDocNode;
144
24
 
145
- export { DOCUMENT_MARK_TYPES, DOCUMENT_NODE_TYPES, type JSONContent, LIMITS, SAFE_IMAGE, SAFE_LINK, type ValidateOptions, XDOC_EXTENSION, XDOC_FORMAT, XDOC_VERSION, XdocError, type XenoDocFile, type XenoDocMark, type XenoDocNode, type XenoDocProblem, documentToMarkdown, emptyContent, markdownToDocument, nodeTypesIn, pageLinksIn, parseXdoc, plainText, serializeXdoc, validateContent, wordCount };
25
+ export { type JSONContent, XenoDocNode, documentToMarkdown, markdownToDocument };
@@ -1,4 +1,8 @@
1
1
  import "../chunk-HDP35LGH.js";
2
+ import {
3
+ documentToMarkdown,
4
+ markdownToDocument
5
+ } from "../chunk-5NDMACVU.js";
2
6
  import {
3
7
  DOCUMENT_MARK_TYPES,
4
8
  DOCUMENT_NODE_TYPES,
@@ -9,9 +13,7 @@ import {
9
13
  XDOC_FORMAT,
10
14
  XDOC_VERSION,
11
15
  XdocError,
12
- documentToMarkdown,
13
16
  emptyContent,
14
- markdownToDocument,
15
17
  nodeTypesIn,
16
18
  pageLinksIn,
17
19
  parseXdoc,
@@ -19,7 +21,7 @@ import {
19
21
  serializeXdoc,
20
22
  validateContent,
21
23
  wordCount
22
- } from "../chunk-NFOBZJDF.js";
24
+ } from "../chunk-MDNEMOZD.js";
23
25
  import "../chunk-2KG3PWR4.js";
24
26
  export {
25
27
  DOCUMENT_MARK_TYPES,
@@ -1,4 +1,5 @@
1
- export { DOCUMENT_MARK_TYPES, DOCUMENT_NODE_TYPES, JSONContent, LIMITS, SAFE_IMAGE, SAFE_LINK, ValidateOptions, XDOC_EXTENSION, XDOC_FORMAT, XDOC_VERSION, XdocError, XenoDocFile, XenoDocMark, XenoDocNode, XenoDocProblem, documentToMarkdown, emptyContent, markdownToDocument, nodeTypesIn, pageLinksIn, parseXdoc, plainText, serializeXdoc, validateContent, wordCount } from './format.js';
1
+ export { D as DOCUMENT_MARK_TYPES, a as DOCUMENT_NODE_TYPES, L as LIMITS, S as SAFE_IMAGE, b as SAFE_LINK, V as ValidateOptions, c as XDOC_EXTENSION, d as XDOC_FORMAT, e as XDOC_VERSION, f as XdocError, g as XenoDocFile, h as XenoDocMark, X as XenoDocNode, i as XenoDocProblem, j as emptyContent, n as nodeTypesIn, p as pageLinksIn, k as parseXdoc, l as plainText, s as serializeXdoc, v as validateContent, w as wordCount } from '../format-BoLLqtrs.js';
2
+ export { JSONContent, documentToMarkdown, markdownToDocument } from './format.js';
2
3
  import { DocumentController, DocumentSurfaceOptions, DocumentFormatCommand } from './core.js';
3
4
  export { Callout, CalloutType, DOCUMENT_FORMAT_COMMANDS, DOCUMENT_TOOLBAR, DocumentControllerOptions, DocumentEditorHandle, DocumentExtensionOptions, DocumentHostBridge, DocumentState, PageBreak, SafeImage, ToggleBlock, WikiLinkMark, WikiLinkOptions, XenoDocumentInput, XenoDocumentOpenPage, XenoDocumentSave, XenoDocumentStatus, createDocumentExtensions, editorHandle, mountDocumentSurface, runFormat } from './core.js';
4
5
  import { PanelModule, PanelManifest, BlockDeclaration } from '@xenosystem/block-sdk';
@@ -1,17 +1,23 @@
1
1
  import {
2
- Callout,
3
2
  DOCUMENT_FORMAT_COMMANDS,
4
3
  DOCUMENT_TOOLBAR,
5
4
  DocumentController,
5
+ editorHandle,
6
+ mountDocumentSurface,
7
+ runFormat
8
+ } from "../chunk-JEY4JFVJ.js";
9
+ import {
10
+ documentToMarkdown,
11
+ markdownToDocument
12
+ } from "../chunk-5NDMACVU.js";
13
+ import {
14
+ Callout,
6
15
  PageBreak,
7
16
  SafeImage,
8
17
  ToggleBlock,
9
18
  WikiLinkMark,
10
- createDocumentExtensions,
11
- editorHandle,
12
- mountDocumentSurface,
13
- runFormat
14
- } from "../chunk-5VOA3OSG.js";
19
+ createDocumentExtensions
20
+ } from "../chunk-KC2QBI2I.js";
15
21
  import {
16
22
  DOCUMENT_MARK_TYPES,
17
23
  DOCUMENT_NODE_TYPES,
@@ -22,9 +28,7 @@ import {
22
28
  XDOC_FORMAT,
23
29
  XDOC_VERSION,
24
30
  XdocError,
25
- documentToMarkdown,
26
31
  emptyContent,
27
- markdownToDocument,
28
32
  nodeTypesIn,
29
33
  pageLinksIn,
30
34
  parseXdoc,
@@ -32,7 +36,7 @@ import {
32
36
  serializeXdoc,
33
37
  validateContent,
34
38
  wordCount
35
- } from "../chunk-NFOBZJDF.js";
39
+ } from "../chunk-MDNEMOZD.js";
36
40
  import "../chunk-2KG3PWR4.js";
37
41
 
38
42
  // src/docs/document/panel.ts
@@ -0,0 +1,124 @@
1
+ /**
2
+ * The XENO document FORMAT — `.xdoc`, XENO Docs' native file, now the one format every surface that
3
+ * edits a document reads and writes (XENO Docs, XENO Notes' link mark, the platform workspace's
4
+ * Write and Notes).
5
+ *
6
+ * A `.xdoc` is JSON: an envelope around a ProseMirror document (`content`, the TipTap `getJSON()`
7
+ * shape). It is NOT HTML and is never rendered as HTML: a surface turns `content` into DOM through
8
+ * the schema in `./schema`, which only knows the node and mark types listed here. That is the whole
9
+ * XSS argument, and this module is what keeps it true at every boundary that accepts a file:
10
+ *
11
+ * - every node / mark type must be one of {@link DOCUMENT_NODE_TYPES} / {@link DOCUMENT_MARK_TYPES}
12
+ * (a product may widen the set for ITS OWN extensions with `extraNodes` / `extraMarks`);
13
+ * - every attribute is checked against the type's own rule — a link's `href` must be http(s) or
14
+ * mailto, an image's `src` https or a raster `data:` image, a page link's id a UUID;
15
+ * - depth and node count are bounded.
16
+ *
17
+ * {@link validateContent} reports what it refused instead of dropping it: a server refuses the file,
18
+ * a surface opens it read-only. Silently dropping an unknown block would lose the user's words on the
19
+ * next save — the same outcome as a bug, with a better excuse.
20
+ *
21
+ * This module imports nothing (no TipTap, no DOM), so a server, a migration script or a test can use
22
+ * it without an editor.
23
+ *
24
+ * @module
25
+ */
26
+ /** The `format` field every `.xdoc` written from now on carries. */
27
+ declare const XDOC_FORMAT = "xeno.xdoc";
28
+ /** The current envelope version. */
29
+ declare const XDOC_VERSION = 1;
30
+ /** The file extension XENO Docs ships (`DocumentEditor.tsx` — `${title}.xdoc`). */
31
+ declare const XDOC_EXTENSION = ".xdoc";
32
+ /** One ProseMirror node, as TipTap's `getJSON()` writes it. */
33
+ interface XenoDocNode {
34
+ type: string;
35
+ attrs?: Record<string, unknown>;
36
+ content?: XenoDocNode[];
37
+ marks?: XenoDocMark[];
38
+ text?: string;
39
+ }
40
+ /** One mark on a text node. */
41
+ interface XenoDocMark {
42
+ type: string;
43
+ attrs?: Record<string, unknown>;
44
+ }
45
+ /**
46
+ * The `.xdoc` envelope. Field names are exactly the ones XENO Docs' autosave has always written
47
+ * (`id, title, content, lastModified, created, wordCount`), so every existing file still parses;
48
+ * `format` and `version` are the additive part.
49
+ */
50
+ interface XenoDocFile {
51
+ format: typeof XDOC_FORMAT;
52
+ version: number;
53
+ id?: string;
54
+ title: string;
55
+ content: XenoDocNode;
56
+ created: number;
57
+ lastModified: number;
58
+ wordCount: number;
59
+ /**
60
+ * XENO Docs' comment threads (its `Comment` mark points into them; XENO Docs keeps them as an object keyed by thread id). Carried through untouched by every surface,
61
+ * so a document that round-trips through the workspace keeps its comments; only XENO Docs reads them.
62
+ */
63
+ commentThreads?: unknown;
64
+ }
65
+ /** Node types the shared schema renders. A file with any other type is refused, never coerced. */
66
+ declare const DOCUMENT_NODE_TYPES: readonly ["doc", "paragraph", "text", "heading", "blockquote", "bulletList", "orderedList", "listItem", "taskList", "taskItem", "codeBlock", "horizontalRule", "hardBreak", "table", "tableRow", "tableCell", "tableHeader", "image", "callout", "toggleBlock", "pageBreak"];
67
+ /** Mark types the shared schema renders. */
68
+ declare const DOCUMENT_MARK_TYPES: readonly ["bold", "italic", "strike", "code", "underline", "link", "subscript", "superscript", "highlight", "wikiLink"];
69
+ /** A link a reader can follow without running anything. */
70
+ declare const SAFE_LINK: RegExp;
71
+ /** An image a reader can load without running anything: https, or a raster image inline. */
72
+ declare const SAFE_IMAGE: RegExp;
73
+ /** Limits a file must stay inside. */
74
+ declare const LIMITS: Readonly<{
75
+ depth: 64;
76
+ nodes: 50000;
77
+ text: 2000000;
78
+ }>;
79
+ /** One reason a document was refused. `path` points at the offending node (`content[2].content[0]`). */
80
+ interface XenoDocProblem {
81
+ path: string;
82
+ code: 'unknown_node' | 'unknown_mark' | 'bad_attr' | 'bad_shape' | 'too_deep' | 'too_large';
83
+ detail: string;
84
+ }
85
+ /** Options for {@link validateContent}: a product's own extensions, allowed in ITS files only. */
86
+ interface ValidateOptions {
87
+ extraNodes?: Iterable<string>;
88
+ extraMarks?: Iterable<string>;
89
+ }
90
+ /**
91
+ * Check a ProseMirror document against the shared schema. Pure; never throws for bad input.
92
+ *
93
+ * Types in `extraNodes` / `extraMarks` are accepted with their attributes unchecked: they belong to the
94
+ * product that declared them, and only that product's surface renders them.
95
+ */
96
+ declare function validateContent(content: unknown, options?: ValidateOptions): XenoDocProblem[];
97
+ /** The error {@link parseXdoc} throws: the problems ride on it so a caller can say exactly what is wrong. */
98
+ declare class XdocError extends Error {
99
+ readonly problems: XenoDocProblem[];
100
+ constructor(message: string, problems?: XenoDocProblem[]);
101
+ }
102
+ /** An empty document: one empty paragraph, which is what TipTap writes for a blank editor. */
103
+ declare const emptyContent: () => XenoDocNode;
104
+ /**
105
+ * Parse a `.xdoc` file (text or an already-parsed object). Accepts the legacy XENO Docs envelope with
106
+ * no `format` field. Throws {@link XdocError} for anything the shared schema would not render.
107
+ */
108
+ declare function parseXdoc(input: string | unknown, options?: ValidateOptions): XenoDocFile;
109
+ /** Write a `.xdoc`. Validates first: a surface must never write a file the next surface refuses. */
110
+ declare function serializeXdoc(doc: Omit<XenoDocFile, 'format' | 'version' | 'wordCount'> & {
111
+ wordCount?: number;
112
+ }, options?: ValidateOptions & {
113
+ pretty?: boolean;
114
+ }): string;
115
+ /** The document's words without structure — what search indexes and an excerpt shows. */
116
+ declare function plainText(content: XenoDocNode | undefined): string;
117
+ /** Words, the way XENO Docs' status bar counts them. */
118
+ declare function wordCount(content: XenoDocNode | undefined): number;
119
+ /** The ids every page link (`wikiLink` mark) in the document points at, deduplicated, in order. */
120
+ declare function pageLinksIn(content: XenoDocNode | undefined): string[];
121
+ /** Every node type in a document — what a surface checks before it decides it can edit it. */
122
+ declare function nodeTypesIn(content: XenoDocNode | undefined): Set<string>;
123
+
124
+ export { DOCUMENT_MARK_TYPES as D, LIMITS as L, SAFE_IMAGE as S, type ValidateOptions as V, type XenoDocNode as X, DOCUMENT_NODE_TYPES as a, SAFE_LINK as b, XDOC_EXTENSION as c, XDOC_FORMAT as d, XDOC_VERSION as e, XdocError as f, type XenoDocFile as g, type XenoDocMark as h, type XenoDocProblem as i, emptyContent as j, parseXdoc as k, plainText as l, nodeTypesIn as n, pageLinksIn as p, serializeXdoc as s, validateContent as v, wordCount as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenosystem/blocks",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "description": "XENO Blocks — rung 3 of the front ladder: components composed into a contract-bearing unit (manifest: ports, intents, commands, agent surface), rendered by @xenosystem/workbench. ONE package, one subpath per family (/auth, /edit, /data, /time, /ops, /trust, /agent, /docs, /corpus; framework-free /docs/core and pure /docs/format), one named export per block — XENO PACKAGE NAMING - STANDARD.md.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -62,6 +62,10 @@
62
62
  "types": "./dist/docs/format.d.ts",
63
63
  "import": "./dist/docs/format.js"
64
64
  },
65
+ "./docs/collaboration": {
66
+ "types": "./dist/docs/collaboration.d.ts",
67
+ "import": "./dist/docs/collaboration.js"
68
+ },
65
69
  "./corpus": {
66
70
  "types": "./dist/corpus/index.d.ts",
67
71
  "import": "./dist/corpus/index.js"
@@ -81,6 +85,8 @@
81
85
  "peerDependencies": {
82
86
  "@duckdb/duckdb-wasm": ">=1.28.0",
83
87
  "@tiptap/core": "^2.11.0",
88
+ "@tiptap/extension-collaboration": "^2.27.2",
89
+ "@tiptap/extension-collaboration-cursor": "^2.27.2",
84
90
  "@tiptap/extension-highlight": "^2.11.0",
85
91
  "@tiptap/extension-image": "^2.11.0",
86
92
  "@tiptap/extension-link": "^2.11.0",
@@ -109,10 +115,15 @@
109
115
  "@xterm/addon-fit": ">=0.10.0",
110
116
  "@xterm/xterm": ">=5.5.0",
111
117
  "react": ">=18.0.0",
112
- "react-dom": ">=18.0.0"
118
+ "react-dom": ">=18.0.0",
119
+ "y-prosemirror": "^1.3.7",
120
+ "y-protocols": "^1.0.7",
121
+ "yjs": "^13.6.30"
113
122
  },
114
123
  "devDependencies": {
115
124
  "@tiptap/core": "^2.27.2",
125
+ "@tiptap/extension-collaboration": "^2.27.3",
126
+ "@tiptap/extension-collaboration-cursor": "^2.27.3",
116
127
  "@tiptap/extension-highlight": "^2.27.2",
117
128
  "@tiptap/extension-image": "^2.27.2",
118
129
  "@tiptap/extension-link": "^2.27.2",
@@ -148,7 +159,10 @@
148
159
  "react-dom": "^19.0.0",
149
160
  "tsup": "^8.0.0",
150
161
  "typescript": "^5.4.0",
151
- "vitest": "^4.1.0"
162
+ "vitest": "^4.1.0",
163
+ "y-prosemirror": "^1.3.7",
164
+ "y-protocols": "^1.0.7",
165
+ "yjs": "^13.6.33"
152
166
  },
153
167
  "publishConfig": {
154
168
  "access": "public"
@@ -160,6 +174,12 @@
160
174
  "@tiptap/core": {
161
175
  "optional": true
162
176
  },
177
+ "@tiptap/extension-collaboration": {
178
+ "optional": true
179
+ },
180
+ "@tiptap/extension-collaboration-cursor": {
181
+ "optional": true
182
+ },
163
183
  "@tiptap/extension-highlight": {
164
184
  "optional": true
165
185
  },
@@ -216,6 +236,15 @@
216
236
  },
217
237
  "@xterm/xterm": {
218
238
  "optional": true
239
+ },
240
+ "y-prosemirror": {
241
+ "optional": true
242
+ },
243
+ "y-protocols": {
244
+ "optional": true
245
+ },
246
+ "yjs": {
247
+ "optional": true
219
248
  }
220
249
  }
221
250
  }