@folijs/core 0.0.0-stage → 0.1.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.
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +34 -2
- package/dist/document.d.ts +49 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/document.js +72 -0
- package/dist/document.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/model/attrs.d.ts +14 -0
- package/dist/model/attrs.d.ts.map +1 -0
- package/dist/model/attrs.js +40 -0
- package/dist/model/attrs.js.map +1 -0
- package/dist/model/content.d.ts +43 -0
- package/dist/model/content.d.ts.map +1 -0
- package/dist/model/content.js +123 -0
- package/dist/model/content.js.map +1 -0
- package/dist/model/errors.d.ts +11 -0
- package/dist/model/errors.d.ts.map +1 -0
- package/dist/model/errors.js +13 -0
- package/dist/model/errors.js.map +1 -0
- package/dist/model/fragment.d.ts +44 -0
- package/dist/model/fragment.d.ts.map +1 -0
- package/dist/model/fragment.js +172 -0
- package/dist/model/fragment.js.map +1 -0
- package/dist/model/index.d.ts +10 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +9 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/mark.d.ts +30 -0
- package/dist/model/mark.d.ts.map +1 -0
- package/dist/model/mark.js +75 -0
- package/dist/model/mark.js.map +1 -0
- package/dist/model/node.d.ts +91 -0
- package/dist/model/node.d.ts.map +1 -0
- package/dist/model/node.js +209 -0
- package/dist/model/node.js.map +1 -0
- package/dist/model/replace.d.ts +9 -0
- package/dist/model/replace.d.ts.map +1 -0
- package/dist/model/replace.js +119 -0
- package/dist/model/replace.js.map +1 -0
- package/dist/model/resolvedpos.d.ts +49 -0
- package/dist/model/resolvedpos.d.ts.map +1 -0
- package/dist/model/resolvedpos.js +142 -0
- package/dist/model/resolvedpos.js.map +1 -0
- package/dist/model/schema.d.ts +118 -0
- package/dist/model/schema.d.ts.map +1 -0
- package/dist/model/schema.js +317 -0
- package/dist/model/schema.js.map +1 -0
- package/dist/model/slice.d.ts +24 -0
- package/dist/model/slice.d.ts.map +1 -0
- package/dist/model/slice.js +30 -0
- package/dist/model/slice.js.map +1 -0
- package/dist/schema.d.ts +45 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +32 -0
- package/dist/schema.js.map +1 -0
- package/dist/state/commands.d.ts +43 -0
- package/dist/state/commands.d.ts.map +1 -0
- package/dist/state/commands.js +291 -0
- package/dist/state/commands.js.map +1 -0
- package/dist/state/editor.d.ts +50 -0
- package/dist/state/editor.d.ts.map +1 -0
- package/dist/state/editor.js +77 -0
- package/dist/state/editor.js.map +1 -0
- package/dist/state/history.d.ts +21 -0
- package/dist/state/history.d.ts.map +1 -0
- package/dist/state/history.js +277 -0
- package/dist/state/history.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +6 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/selection.d.ts +50 -0
- package/dist/state/selection.d.ts.map +1 -0
- package/dist/state/selection.js +139 -0
- package/dist/state/selection.js.map +1 -0
- package/dist/state/state.d.ts +90 -0
- package/dist/state/state.d.ts.map +1 -0
- package/dist/state/state.js +193 -0
- package/dist/state/state.js.map +1 -0
- package/dist/transform/index.d.ts +4 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +4 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/stepmap.d.ts +63 -0
- package/dist/transform/stepmap.d.ts.map +1 -0
- package/dist/transform/stepmap.js +160 -0
- package/dist/transform/stepmap.js.map +1 -0
- package/dist/transform/steps.d.ts +92 -0
- package/dist/transform/steps.d.ts.map +1 -0
- package/dist/transform/steps.js +286 -0
- package/dist/transform/steps.js.map +1 -0
- package/dist/transform/transform.d.ts +57 -0
- package/dist/transform/transform.d.ts.map +1 -0
- package/dist/transform/transform.js +179 -0
- package/dist/transform/transform.js.map +1 -0
- package/package.json +36 -3
- package/src/document.ts +107 -0
- package/src/index.ts +31 -0
- package/src/model/attrs.ts +52 -0
- package/src/model/content.ts +137 -0
- package/src/model/errors.ts +14 -0
- package/src/model/fragment.ts +182 -0
- package/src/model/index.ts +16 -0
- package/src/model/mark.ts +79 -0
- package/src/model/node.ts +256 -0
- package/src/model/replace.ts +137 -0
- package/src/model/resolvedpos.ts +144 -0
- package/src/model/schema.ts +398 -0
- package/src/model/slice.ts +40 -0
- package/src/schema.ts +78 -0
- package/src/state/commands.ts +309 -0
- package/src/state/editor.ts +151 -0
- package/src/state/history.ts +310 -0
- package/src/state/index.ts +44 -0
- package/src/state/selection.ts +164 -0
- package/src/state/state.ts +248 -0
- package/src/transform/index.ts +11 -0
- package/src/transform/stepmap.ts +181 -0
- package/src/transform/steps.ts +333 -0
- package/src/transform/transform.ts +198 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @folijs/core
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- First release: a document editor for the web with its own editing engine, on real pages.
|
|
8
|
+
- **Documents** (`@folijs/core`): a versioned JSON format (`schemaVersion: 1`) with page size and margins in millimetres; `parseDocument` validates untrusted input and never drops document content silently. Schema v1: paragraphs, headings 1–6, line breaks, page breaks; bold, italic, underline, strikethrough.
|
|
9
|
+
- **Engine** (`@folijs/core`): immutable state, steps and transactions, undo/redo history, commands, key bindings, a headless `createEditor`. No DOM.
|
|
10
|
+
- **View** (`@folijs/view`): `EditorView` renders the document on A4 or Letter pages in one `contenteditable` host. Paragraphs split across pages at a line, with widow/orphan and keep-with-next rules, explicit page breaks, incremental reflow, and print with one sheet per page (PDF output checked in Chromium). Typing, IME composition, copy, cut and paste (Foli JSON, HTML mapped to the schema, plain text), read-only mode, placeholder.
|
|
11
|
+
- **React** (`@folijs/react`, React 18.2+ and 19): `FoliEditor` with a formatting toolbar and `onChange`; `useFoliEditor`, `FoliEditorProvider`, `FoliCanvas`, `FoliToolbar`, `useCurrentEditor`, `useEditorState`. Server rendering gives the editor's shell; the document appears on hydration. Default theme in `@folijs/react/styles.css` (CSS variables).
|
|
12
|
+
|
|
13
|
+
Known risks: real IME and dead keys (Windows, macOS, Android, iOS input methods), NVDA and VoiceOver, macOS key bindings, spellcheck at a page break, and pastes from real Word, Google Docs and LibreOffice have not been checked by hand. Automated tests run in Chromium, Firefox and WebKit on Windows (IME only through Chromium's emulation, paste not in WebKit, no screen-reader tests); Safari on macOS and iOS is not tested. See [Known limitations](https://github.com/josep-audenis/foli/blob/main/docs/limitations.md).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Josep Audenis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @folijs/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The document model and headless editing engine of [Foli](https://github.com/josep-audenis/foli):
|
|
4
|
+
document format and validation, schema, transactions, undo history and commands. No DOM: runs
|
|
5
|
+
in the browser, Node and workers.
|
|
6
|
+
|
|
7
|
+
> Early release: the API may change in any 0.x minor version (changes in `CHANGELOG.md`).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @folijs/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { createDocument, createEditor, parseDocument } from "@folijs/core";
|
|
15
|
+
|
|
16
|
+
const text = JSON.stringify(createDocument()); // stand-in for a saved document
|
|
17
|
+
const doc = parseDocument(JSON.parse(text)); // throws FoliDocumentError on invalid input
|
|
18
|
+
const editor = createEditor({ document: doc });
|
|
19
|
+
editor.subscribe((_state, transactions) => {
|
|
20
|
+
if (transactions.some((tr) => tr.docChanged)) console.log("content changed");
|
|
21
|
+
});
|
|
22
|
+
editor.select(1); // inside the first paragraph
|
|
23
|
+
editor.commands.toggleMark("bold"); // the next typed text is bold
|
|
24
|
+
editor.commands.insertText("Hello");
|
|
25
|
+
const saved = JSON.stringify(editor.getDocument());
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To show and edit a document in the browser, use [`@folijs/react`](https://www.npmjs.com/package/@folijs/react)
|
|
29
|
+
or [`@folijs/view`](https://www.npmjs.com/package/@folijs/view).
|
|
30
|
+
|
|
31
|
+
- [Document format](https://github.com/josep-audenis/foli/blob/main/docs/document-model.md)
|
|
32
|
+
- [API reference](https://github.com/josep-audenis/foli/blob/main/docs/api.md#folicore)
|
|
33
|
+
- [Known limitations](https://github.com/josep-audenis/foli/blob/main/docs/limitations.md)
|
|
34
|
+
|
|
35
|
+
MIT
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Node } from "./model/index.js";
|
|
2
|
+
import { type DocJSON } from "./schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* Bump when the persisted envelope or content schema changes incompatibly; add a migration.
|
|
5
|
+
* v1 ships in 0.1.0: once saved documents exist, it never changes in place.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SCHEMA_VERSION = 1;
|
|
8
|
+
/** All page geometry is in millimetres. See docs/document-model.md for unit conversions. */
|
|
9
|
+
export interface PageSize {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
export interface PageMargins {
|
|
14
|
+
top: number;
|
|
15
|
+
right: number;
|
|
16
|
+
bottom: number;
|
|
17
|
+
left: number;
|
|
18
|
+
}
|
|
19
|
+
export interface DocumentSettings {
|
|
20
|
+
pageSize: PageSize;
|
|
21
|
+
margins: PageMargins;
|
|
22
|
+
}
|
|
23
|
+
/** The persisted document: a versioned envelope around the content tree. */
|
|
24
|
+
export interface FoliDocument {
|
|
25
|
+
schemaVersion: typeof SCHEMA_VERSION;
|
|
26
|
+
settings: DocumentSettings;
|
|
27
|
+
content: DocJSON;
|
|
28
|
+
}
|
|
29
|
+
export declare const PAGE_SIZES: {
|
|
30
|
+
readonly A4: {
|
|
31
|
+
readonly width: 210;
|
|
32
|
+
readonly height: 297;
|
|
33
|
+
};
|
|
34
|
+
readonly Letter: {
|
|
35
|
+
readonly width: 215.9;
|
|
36
|
+
readonly height: 279.4;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const DEFAULT_SETTINGS: DocumentSettings;
|
|
40
|
+
export declare function createDocument(content?: DocJSON, settings?: Partial<DocumentSettings>): FoliDocument;
|
|
41
|
+
/**
|
|
42
|
+
* Validates untrusted input (e.g. JSON loaded from storage) against the schema and returns a
|
|
43
|
+
* FoliDocument with content in canonical form (see docs/document-model.md, "Normalization").
|
|
44
|
+
* Throws FoliDocumentError instead of silently dropping invalid content.
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseDocument(input: unknown): FoliDocument;
|
|
47
|
+
/** Parses untrusted content JSON into a `doc` node of the v1 schema. */
|
|
48
|
+
export declare function parseContent(value: unknown, path?: string): Node;
|
|
49
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,4FAA4F;AAC5F,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,OAAO,cAAc,CAAC;IACrC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,UAAU;;iBACf,KAAK,EAAE,GAAG;iBAAE,MAAM,EAAE,GAAG;;;iBACnB,KAAK,EAAE,KAAK;iBAAE,MAAM,EAAE,KAAK;;CACM,CAAC;AAE9C,eAAO,MAAM,gBAAgB,EAAE,gBAG9B,CAAC;AAEF,wBAAgB,cAAc,CAC5B,OAAO,GAAE,OAA2D,EACpE,QAAQ,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACvC,YAAY,CAEd;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAQ1D;AAED,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAY,GAAG,IAAI,CAQnE"}
|
package/dist/document.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { FoliDocumentError } from "./model/index.js";
|
|
2
|
+
import { schema } from "./schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* Bump when the persisted envelope or content schema changes incompatibly; add a migration.
|
|
5
|
+
* v1 ships in 0.1.0: once saved documents exist, it never changes in place.
|
|
6
|
+
*/
|
|
7
|
+
export const SCHEMA_VERSION = 1;
|
|
8
|
+
export const PAGE_SIZES = {
|
|
9
|
+
A4: { width: 210, height: 297 },
|
|
10
|
+
Letter: { width: 215.9, height: 279.4 },
|
|
11
|
+
};
|
|
12
|
+
export const DEFAULT_SETTINGS = {
|
|
13
|
+
pageSize: PAGE_SIZES.A4,
|
|
14
|
+
margins: { top: 25.4, right: 25.4, bottom: 25.4, left: 25.4 },
|
|
15
|
+
};
|
|
16
|
+
export function createDocument(content = { type: "doc", content: [{ type: "paragraph" }] }, settings = {}) {
|
|
17
|
+
return { schemaVersion: SCHEMA_VERSION, settings: { ...DEFAULT_SETTINGS, ...settings }, content };
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Validates untrusted input (e.g. JSON loaded from storage) against the schema and returns a
|
|
21
|
+
* FoliDocument with content in canonical form (see docs/document-model.md, "Normalization").
|
|
22
|
+
* Throws FoliDocumentError instead of silently dropping invalid content.
|
|
23
|
+
*/
|
|
24
|
+
export function parseDocument(input) {
|
|
25
|
+
if (!isRecord(input))
|
|
26
|
+
throw new FoliDocumentError("Document must be an object");
|
|
27
|
+
if (input.schemaVersion !== SCHEMA_VERSION) {
|
|
28
|
+
throw new FoliDocumentError(`Unsupported schemaVersion: ${String(input.schemaVersion)}`);
|
|
29
|
+
}
|
|
30
|
+
const settings = parseSettings(input.settings);
|
|
31
|
+
const content = parseContent(input.content).toJSON();
|
|
32
|
+
return { schemaVersion: SCHEMA_VERSION, settings, content };
|
|
33
|
+
}
|
|
34
|
+
/** Parses untrusted content JSON into a `doc` node of the v1 schema. */
|
|
35
|
+
export function parseContent(value, path = "content") {
|
|
36
|
+
const doc = schema.nodeFromJSON(value, path);
|
|
37
|
+
if (doc.type !== schema.topNodeType) {
|
|
38
|
+
throw new FoliDocumentError(`${path}: root node must be of type "doc"`);
|
|
39
|
+
}
|
|
40
|
+
// The root has no parent to check its marks against.
|
|
41
|
+
if (doc.marks.length)
|
|
42
|
+
throw new FoliDocumentError(`${path}.marks: doc cannot have marks`);
|
|
43
|
+
return doc;
|
|
44
|
+
}
|
|
45
|
+
function parseSettings(input) {
|
|
46
|
+
if (!isRecord(input) || !isRecord(input.pageSize) || !isRecord(input.margins)) {
|
|
47
|
+
throw new FoliDocumentError("settings.pageSize and settings.margins are required");
|
|
48
|
+
}
|
|
49
|
+
const { width, height } = input.pageSize;
|
|
50
|
+
const { top, right, bottom, left } = input.margins;
|
|
51
|
+
if (!isPositive(width) || !isPositive(height)) {
|
|
52
|
+
throw new FoliDocumentError("pageSize width/height must be positive numbers (mm)");
|
|
53
|
+
}
|
|
54
|
+
if (![top, right, bottom, left].every(isNonNegative)) {
|
|
55
|
+
throw new FoliDocumentError("margins must be non-negative numbers (mm)");
|
|
56
|
+
}
|
|
57
|
+
const margins = { top, right, bottom, left };
|
|
58
|
+
if (margins.left + margins.right >= width || margins.top + margins.bottom >= height) {
|
|
59
|
+
throw new FoliDocumentError("margins leave no content area on the page");
|
|
60
|
+
}
|
|
61
|
+
return { pageSize: { width, height }, margins };
|
|
62
|
+
}
|
|
63
|
+
function isRecord(value) {
|
|
64
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
65
|
+
}
|
|
66
|
+
function isPositive(value) {
|
|
67
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
68
|
+
}
|
|
69
|
+
function isNonNegative(value) {
|
|
70
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAa,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAgB,MAAM,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AA2BhC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IAC/B,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;CACI,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAqB;IAChD,QAAQ,EAAE,UAAU,CAAC,EAAE;IACvB,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;CAC9D,CAAC;AAEF,MAAM,UAAU,cAAc,CAC5B,OAAO,GAAY,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,EACpE,QAAQ,GAA8B,EAAE;IAExC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,GAAG,gBAAgB,EAAE,GAAG,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC;AACpG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,C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I,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC3E,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createDocument, DEFAULT_SETTINGS, type DocumentSettings, type FoliDocument, PAGE_SIZES, type PageMargins, type PageSize, parseContent, parseDocument, SCHEMA_VERSION, } from "./document.js";
|
|
2
|
+
export * from "./model/index.js";
|
|
3
|
+
export { type BlockJSON, type DocJSON, type HardBreakJSON, HEADING_LEVELS, type HeadingJSON, type HeadingLevel, type InlineJSON, MARK_TYPES, type MarkName, type MarkNameJSON, type PageBreakJSON, type ParagraphJSON, schema, type TextJSON, } from "./schema.js";
|
|
4
|
+
export * from "./state/index.js";
|
|
5
|
+
export * from "./transform/index.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,YAAY,EACZ,aAAa,EACb,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,MAAM,EACN,KAAK,QAAQ,GACd,MAAM,aAAa,CAAC;AACrB,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createDocument, DEFAULT_SETTINGS, PAGE_SIZES, parseContent, parseDocument, SCHEMA_VERSION, } from "./document.js";
|
|
2
|
+
export * from "./model/index.js";
|
|
3
|
+
export { HEADING_LEVELS, MARK_TYPES, schema, } from "./schema.js";
|
|
4
|
+
export * from "./state/index.js";
|
|
5
|
+
export * from "./transform/index.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAGhB,UAAU,EAGV,YAAY,EACZ,aAAa,EACb,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAIL,cAAc,EAId,UAAU,EAKV,MAAM,GAEP,MAAM,aAAa,CAAC;AACrB,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Attrs = Readonly<Record<string, unknown>>;
|
|
2
|
+
export interface AttributeSpec {
|
|
3
|
+
/** Used when the attribute is missing. Without a default the attribute is required. */
|
|
4
|
+
default?: unknown;
|
|
5
|
+
/** Returns an error message for an invalid value, or undefined when it is valid. */
|
|
6
|
+
validate?: (value: unknown) => string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export type AttributeSpecs = Readonly<Record<string, AttributeSpec>>;
|
|
9
|
+
export declare const NO_ATTRS: Attrs;
|
|
10
|
+
/** Fills defaults and validates. Unknown or missing required attributes are errors. */
|
|
11
|
+
export declare function computeAttrs(specs: AttributeSpecs | undefined, given: Attrs | undefined, path: string): Attrs;
|
|
12
|
+
/** Structural equality for JSON-like attribute values. */
|
|
13
|
+
export declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
14
|
+
//# sourceMappingURL=attrs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attrs.d.ts","sourceRoot":"","sources":["../../src/model/attrs.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,uFAAuF;IACvF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAErE,eAAO,MAAM,QAAQ,EAAE,KAAyB,CAAC;AAEjD,uFAAuF;AACvF,wBAAgB,YAAY,CAC1B,KAAK,EAAE,cAAc,GAAG,SAAS,EACjC,KAAK,EAAE,KAAK,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,GACX,KAAK,CAiBP;AAED,0DAA0D;AAC1D,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAWzD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { fail } from "./errors.js";
|
|
2
|
+
export const NO_ATTRS = Object.freeze({});
|
|
3
|
+
/** Fills defaults and validates. Unknown or missing required attributes are errors. */
|
|
4
|
+
export function computeAttrs(specs, given, path) {
|
|
5
|
+
for (const key of Object.keys(given ?? NO_ATTRS)) {
|
|
6
|
+
if (!specs || !Object.hasOwn(specs, key))
|
|
7
|
+
fail(`${path}.${key}`, "unknown attribute");
|
|
8
|
+
}
|
|
9
|
+
if (!specs)
|
|
10
|
+
return NO_ATTRS;
|
|
11
|
+
const attrs = {};
|
|
12
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
13
|
+
let value = given?.[name];
|
|
14
|
+
if (value === undefined) {
|
|
15
|
+
if (!("default" in spec))
|
|
16
|
+
fail(`${path}.${name}`, "required attribute is missing");
|
|
17
|
+
value = spec.default;
|
|
18
|
+
}
|
|
19
|
+
const error = spec.validate?.(value);
|
|
20
|
+
if (error !== undefined)
|
|
21
|
+
fail(`${path}.${name}`, error);
|
|
22
|
+
attrs[name] = value;
|
|
23
|
+
}
|
|
24
|
+
return attrs;
|
|
25
|
+
}
|
|
26
|
+
/** Structural equality for JSON-like attribute values. */
|
|
27
|
+
export function deepEqual(a, b) {
|
|
28
|
+
if (a === b)
|
|
29
|
+
return true;
|
|
30
|
+
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null)
|
|
31
|
+
return false;
|
|
32
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
33
|
+
return false;
|
|
34
|
+
const keys = Object.keys(a);
|
|
35
|
+
if (keys.length !== Object.keys(b).length)
|
|
36
|
+
return false;
|
|
37
|
+
return keys.every((key) => Object.hasOwn(b, key) &&
|
|
38
|
+
deepEqual(a[key], b[key]));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=attrs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attrs.js","sourceRoot":"","sources":["../../src/model/attrs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAanC,MAAM,CAAC,MAAM,QAAQ,GAAU,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEjD,uFAAuF;AACvF,MAAM,UAAU,YAAY,CAC1B,KAAiC,EACjC,KAAwB,EACxB,IAAY;IAEZ,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC;YAAE,IAAI,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,mBAAmB,CAAC,CAAC;IACxF,CAAC;IACD,IAAI,CAAC,KAAK;QAAE,OAAO,QAAQ,CAAC;IAC5B,MAAM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xD,OAAO,IAAI,CAAC,KAAK,CACf,CAAC,GAAG,EAAE,EAAE,CACN,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC;QACrB,SAAS,CAAE,CAA6B,CAAC,GAAG,CAAC,EAAG,CAA6B,CAAC,GAAG,CAAC,CAAC,CACtF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Fragment } from "./fragment.js";
|
|
2
|
+
import type { NodeType } from "./schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* Content expressions, a deliberately small subset: a space-separated sequence of terms; a term
|
|
5
|
+
* is a node name or group, or a choice `(a | b)`, optionally followed by `*`, `+` or `?`.
|
|
6
|
+
* Examples: `block+`, `inline*`, `heading paragraph*`, `(paragraph | heading)+`.
|
|
7
|
+
* Compiled to an NFA whose state sets are interned, so matching allocates nothing once warm.
|
|
8
|
+
*/
|
|
9
|
+
interface Element {
|
|
10
|
+
readonly types: readonly NodeType[];
|
|
11
|
+
readonly optional: boolean;
|
|
12
|
+
readonly repeat: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare class Program {
|
|
15
|
+
readonly expr: string;
|
|
16
|
+
readonly elements: readonly Element[];
|
|
17
|
+
readonly matches: Map<string, ContentMatch>;
|
|
18
|
+
constructor(expr: string, elements: readonly Element[]);
|
|
19
|
+
/** The interned match for a state set (sorted, epsilon-closed). */
|
|
20
|
+
match(states: number[]): ContentMatch;
|
|
21
|
+
/** Adds the states reachable by skipping optional elements; returns them sorted. */
|
|
22
|
+
close(states: Iterable<number>): number[];
|
|
23
|
+
}
|
|
24
|
+
/** A position inside a content expression: which node types may come next, and whether it may end. */
|
|
25
|
+
export declare class ContentMatch {
|
|
26
|
+
private readonly program;
|
|
27
|
+
private readonly states;
|
|
28
|
+
private readonly next;
|
|
29
|
+
/** True when the content may end here. */
|
|
30
|
+
readonly validEnd: boolean;
|
|
31
|
+
/** @internal Use NodeType.contentMatch. */
|
|
32
|
+
constructor(program: Program, states: readonly number[]);
|
|
33
|
+
/** The match after a node of `type`, or null if `type` is not allowed here. */
|
|
34
|
+
matchType(type: NodeType): ContentMatch | null;
|
|
35
|
+
/** Matches `fragment.child(start)` up to `end`; null as soon as a child is not allowed. */
|
|
36
|
+
matchFragment(fragment: Fragment, start?: number, end?: number): ContentMatch | null;
|
|
37
|
+
/** True when the expression's node types are inline (all are, or none are). */
|
|
38
|
+
get inlineContent(): boolean;
|
|
39
|
+
toString(): string;
|
|
40
|
+
static compile(expr: string, types: readonly NodeType[]): ContentMatch;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/model/content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;GAKG;AAEH,UAAU,OAAO;IACf,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,cAAM,OAAO;IAGT,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE;IAHvC,QAAQ,CAAC,OAAO,4BAAmC;IACnD,YACW,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,OAAO,EAAE,EACnC;IAEJ,mEAAmE;IACnE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAQpC;IAED,oFAAoF;IACpF,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAOxC;CACF;AAED,sGAAsG;AACtG,qBAAa,YAAY;IAOrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA4C;IACjE,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,2CAA2C;IAC3C,YACmB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,MAAM,EAAE,EAG3C;IAED,+EAA+E;IAC/E,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY,GAAG,IAAI,CAY7C;IAED,2FAA2F;IAC3F,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,SAAI,EAAE,GAAG,SAAsB,GAAG,YAAY,GAAG,IAAI,CAI3F;IAED,+EAA+E;IAC/E,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,QAAQ,IAAI,MAAM,CAEjB;IAED,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,YAAY,CAOrE;CACF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
class Program {
|
|
2
|
+
expr;
|
|
3
|
+
elements;
|
|
4
|
+
matches = new Map();
|
|
5
|
+
constructor(expr, elements) {
|
|
6
|
+
this.expr = expr;
|
|
7
|
+
this.elements = elements;
|
|
8
|
+
}
|
|
9
|
+
/** The interned match for a state set (sorted, epsilon-closed). */
|
|
10
|
+
match(states) {
|
|
11
|
+
const key = states.join(",");
|
|
12
|
+
let match = this.matches.get(key);
|
|
13
|
+
if (!match) {
|
|
14
|
+
match = new ContentMatch(this, states);
|
|
15
|
+
this.matches.set(key, match);
|
|
16
|
+
}
|
|
17
|
+
return match;
|
|
18
|
+
}
|
|
19
|
+
/** Adds the states reachable by skipping optional elements; returns them sorted. */
|
|
20
|
+
close(states) {
|
|
21
|
+
const out = new Set();
|
|
22
|
+
for (let state of states) {
|
|
23
|
+
out.add(state);
|
|
24
|
+
while (state < this.elements.length && this.elements[state]?.optional)
|
|
25
|
+
out.add(++state);
|
|
26
|
+
}
|
|
27
|
+
return [...out].sort((a, b) => a - b);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** A position inside a content expression: which node types may come next, and whether it may end. */
|
|
31
|
+
export class ContentMatch {
|
|
32
|
+
program;
|
|
33
|
+
states;
|
|
34
|
+
next = new Map();
|
|
35
|
+
/** True when the content may end here. */
|
|
36
|
+
validEnd;
|
|
37
|
+
/** @internal Use NodeType.contentMatch. */
|
|
38
|
+
constructor(program, states) {
|
|
39
|
+
this.program = program;
|
|
40
|
+
this.states = states;
|
|
41
|
+
this.validEnd = states.includes(program.elements.length);
|
|
42
|
+
}
|
|
43
|
+
/** The match after a node of `type`, or null if `type` is not allowed here. */
|
|
44
|
+
matchType(type) {
|
|
45
|
+
let result = this.next.get(type);
|
|
46
|
+
if (result === undefined) {
|
|
47
|
+
const reached = [];
|
|
48
|
+
for (const state of this.states) {
|
|
49
|
+
const element = this.program.elements[state];
|
|
50
|
+
if (element?.types.includes(type))
|
|
51
|
+
reached.push(element.repeat ? state : state + 1);
|
|
52
|
+
}
|
|
53
|
+
result = reached.length ? this.program.match(this.program.close(reached)) : null;
|
|
54
|
+
this.next.set(type, result);
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
/** Matches `fragment.child(start)` up to `end`; null as soon as a child is not allowed. */
|
|
59
|
+
matchFragment(fragment, start = 0, end = fragment.childCount) {
|
|
60
|
+
let match = this;
|
|
61
|
+
for (let i = start; match && i < end; i++)
|
|
62
|
+
match = match.matchType(fragment.child(i).type);
|
|
63
|
+
return match;
|
|
64
|
+
}
|
|
65
|
+
/** True when the expression's node types are inline (all are, or none are). */
|
|
66
|
+
get inlineContent() {
|
|
67
|
+
return this.program.elements[0]?.types[0]?.isInline ?? false;
|
|
68
|
+
}
|
|
69
|
+
toString() {
|
|
70
|
+
return this.program.expr;
|
|
71
|
+
}
|
|
72
|
+
static compile(expr, types) {
|
|
73
|
+
const program = new Program(expr, parse(expr, types));
|
|
74
|
+
const inline = program.elements.flatMap((e) => e.types).map((t) => t.isInline);
|
|
75
|
+
if (inline.some((value) => value !== inline[0])) {
|
|
76
|
+
throw new Error(`Content expression "${expr}" mixes inline and block nodes`);
|
|
77
|
+
}
|
|
78
|
+
return program.match(program.close([0]));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function parse(expr, types) {
|
|
82
|
+
const tokens = expr.match(/\w+|[()|*+?]|\S/g) ?? [];
|
|
83
|
+
const elements = [];
|
|
84
|
+
let pos = 0;
|
|
85
|
+
const error = (message) => {
|
|
86
|
+
throw new Error(`Invalid content expression "${expr}": ${message}`);
|
|
87
|
+
};
|
|
88
|
+
const resolve = (name) => {
|
|
89
|
+
if (name === undefined || !/^\w+$/.test(name))
|
|
90
|
+
return error(`expected a name, got ${name}`);
|
|
91
|
+
const found = types.filter((t) => t.name === name);
|
|
92
|
+
const matched = found.length ? found : types.filter((t) => t.groups.includes(name));
|
|
93
|
+
return matched.length ? matched : error(`no node type or group "${name}"`);
|
|
94
|
+
};
|
|
95
|
+
while (pos < tokens.length) {
|
|
96
|
+
let choice;
|
|
97
|
+
if (tokens[pos] === "(") {
|
|
98
|
+
pos++;
|
|
99
|
+
choice = resolve(tokens[pos++]);
|
|
100
|
+
while (tokens[pos] === "|") {
|
|
101
|
+
pos++;
|
|
102
|
+
choice = choice.concat(resolve(tokens[pos++]));
|
|
103
|
+
}
|
|
104
|
+
if (tokens[pos++] !== ")")
|
|
105
|
+
error('expected ")"');
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
choice = resolve(tokens[pos++]);
|
|
109
|
+
}
|
|
110
|
+
const quantifier = tokens[pos];
|
|
111
|
+
if (quantifier === "*" || quantifier === "+" || quantifier === "?")
|
|
112
|
+
pos++;
|
|
113
|
+
if (quantifier === "+")
|
|
114
|
+
elements.push({ types: choice, optional: false, repeat: false });
|
|
115
|
+
elements.push({
|
|
116
|
+
types: choice,
|
|
117
|
+
optional: quantifier === "*" || quantifier === "+" || quantifier === "?",
|
|
118
|
+
repeat: quantifier === "*" || quantifier === "+",
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return elements;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/model/content.ts"],"names":[],"mappings":"AAgBA,MAAM,OAAO;IAGA,IAAI;IACJ,QAAQ;IAHV,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;IACnD,YACW,IAAY,EACZ,QAA4B;oBAD5B,IAAI;wBACJ,QAAQ;IAChB,CAAC;IAEJ,mEAAmE;IACnE,KAAK,CAAC,MAAgB;QACpB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oFAAoF;IACpF,KAAK,CAAC,MAAwB;QAC5B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;QAC9B,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;YACzB,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACf,OAAO,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ;gBAAE,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAC1F,CAAC;QACD,O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C;YACN,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAChC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;gBAC3B,GAAG,EAAE,CAAC;gBACN,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;YACjD,CAAC;YACD,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG;gBAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAClC,CAAC;QACD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG;YAAE,GAAG,EAAE,CAAC;QAC1E,IAAI,UAAU,KAAK,GAAG;YAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACzF,QAAQ,CAAC,IAAI,CAAC;YACZ,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG;YACxE,MAAM,EAAE,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG;SACjD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Invalid document content: unknown types, bad attributes, content that breaks the schema. */
|
|
2
|
+
export declare class FoliDocumentError extends Error {
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
/** A replace that would produce content the schema does not allow. */
|
|
6
|
+
export declare class ReplaceError extends Error {
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/** Throws a FoliDocumentError whose message starts with a JSON path. */
|
|
10
|
+
export declare function fail(path: string, message: string): never;
|
|
11
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/model/errors.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,qBAAa,iBAAkB,SAAQ,KAAK;IACjC,IAAI,SAAuB;CACrC;AAED,sEAAsE;AACtE,qBAAa,YAAa,SAAQ,KAAK;IAC5B,IAAI,SAAkB;CAChC;AAED,wEAAwE;AACxE,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAEzD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Invalid document content: unknown types, bad attributes, content that breaks the schema. */
|
|
2
|
+
export class FoliDocumentError extends Error {
|
|
3
|
+
name = "FoliDocumentError";
|
|
4
|
+
}
|
|
5
|
+
/** A replace that would produce content the schema does not allow. */
|
|
6
|
+
export class ReplaceError extends Error {
|
|
7
|
+
name = "ReplaceError";
|
|
8
|
+
}
|
|
9
|
+
/** Throws a FoliDocumentError whose message starts with a JSON path. */
|
|
10
|
+
export function fail(path, message) {
|
|
11
|
+
throw new FoliDocumentError(`${path}: ${message}`);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/model/errors.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,GAAG,mBAAmB,CAAC;CACrC;AAED,sEAAsE;AACtE,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,GAAG,cAAc,CAAC;CAChC;AAED,wEAAwE;AACxE,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,OAAe;IAChD,MAAM,IAAI,iBAAiB,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Node, NodeJSON } from "./node.js";
|
|
2
|
+
/**
|
|
3
|
+
* An immutable sequence of child nodes with its total size in positions. Adjacent text nodes
|
|
4
|
+
* with equal marks are always merged, so every fragment is in normal form.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Fragment {
|
|
7
|
+
readonly content: readonly Node[];
|
|
8
|
+
/** Total size of the children, in positions. */
|
|
9
|
+
readonly size: number;
|
|
10
|
+
static readonly empty: Fragment;
|
|
11
|
+
private constructor();
|
|
12
|
+
/** Builds a fragment, merging adjacent text nodes with equal marks. */
|
|
13
|
+
static fromArray(nodes: readonly Node[]): Fragment;
|
|
14
|
+
static from(nodes?: Fragment | Node | readonly Node[] | null): Fragment;
|
|
15
|
+
get childCount(): number;
|
|
16
|
+
get firstChild(): Node | null;
|
|
17
|
+
get lastChild(): Node | null;
|
|
18
|
+
child(index: number): Node;
|
|
19
|
+
maybeChild(index: number): Node | null;
|
|
20
|
+
/** Calls `f` for each child with its offset inside this fragment and its index. */
|
|
21
|
+
forEach(f: (node: Node, offset: number, index: number) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* Calls `f` for every node overlapping `from..to`, depth first, with its absolute position
|
|
24
|
+
* (`nodeStart` is the position of this fragment's start). Return false to skip a node's children.
|
|
25
|
+
*/
|
|
26
|
+
nodesBetween(from: number, to: number, f: (node: Node, pos: number, parent: Node | null, index: number) => boolean | undefined, nodeStart?: number, parent?: Node | null): void;
|
|
27
|
+
/** Text between two positions; `blockSeparator` goes between textblocks, `leafText` for leaves. */
|
|
28
|
+
textBetween(from: number, to: number, blockSeparator?: string, leafText?: string): string;
|
|
29
|
+
/** Concatenates, merging text across the boundary. */
|
|
30
|
+
append(other: Fragment): Fragment;
|
|
31
|
+
/** The part of this fragment between two offsets; nodes cut in half become open copies. */
|
|
32
|
+
cut(from: number, to?: number): Fragment;
|
|
33
|
+
/** A copy with the child at `index` replaced. Does not merge text; callers keep normal form. */
|
|
34
|
+
replaceChild(index: number, node: Node): Fragment;
|
|
35
|
+
/** The child containing `pos`, or the child starting at `pos`; `index` = childCount at the end. */
|
|
36
|
+
findIndex(pos: number): {
|
|
37
|
+
index: number;
|
|
38
|
+
offset: number;
|
|
39
|
+
};
|
|
40
|
+
eq(other: Fragment): boolean;
|
|
41
|
+
toJSON(): NodeJSON[];
|
|
42
|
+
toString(): string;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=fragment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragment.d.ts","sourceRoot":"","sources":["../../src/model/fragment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAY,MAAM,WAAW,CAAC;AAE1D;;;GAGG;AACH,qBAAa,QAAQ;IAIjB,QAAQ,CAAC,OAAO,EAAE,SAAS,IAAI,EAAE;IACjC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM;IALvB,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAuB;IAE5C,OAAO,eAIH;IAEJ,uEAAuE;IACvE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,QAAQ,CAcjD;IAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,IAAI,EAAE,GAAG,IAAI,GAAG,QAAQ,CAItE;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,UAAU,IAAI,IAAI,GAAG,IAAI,CAE5B;IAED,IAAI,SAAS,IAAI,IAAI,GAAG,IAAI,CAE3B;IAED,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKzB;IAED,UAAU,CAAC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