@restless-dreams/orbit 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.
Files changed (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +165 -2
  3. package/dist/bin/orbit.js +8907 -0
  4. package/dist/bin/orbit.js.map +48 -0
  5. package/dist/chunk-0gwh723s.js +408 -0
  6. package/dist/chunk-0gwh723s.js.map +10 -0
  7. package/dist/chunk-7n00wx0t.js +82 -0
  8. package/dist/chunk-7n00wx0t.js.map +10 -0
  9. package/dist/chunk-mtrnm0yc.js +16993 -0
  10. package/dist/chunk-mtrnm0yc.js.map +63 -0
  11. package/dist/core/auto-render.d.ts +85 -0
  12. package/dist/core/browser.d.ts +23 -0
  13. package/dist/core/create.d.ts +23 -0
  14. package/dist/core/diagnostics.d.ts +40 -0
  15. package/dist/core/dispatch.d.ts +23 -0
  16. package/dist/core/document-options.d.ts +18 -0
  17. package/dist/core/document-source.d.ts +128 -0
  18. package/dist/core/editing.d.ts +63 -0
  19. package/dist/core/engine/animation-clock.d.ts +40 -0
  20. package/dist/core/engine/camera.d.ts +70 -0
  21. package/dist/core/engine/colors.d.ts +51 -0
  22. package/dist/core/engine/display.d.ts +125 -0
  23. package/dist/core/engine/export.d.ts +32 -0
  24. package/dist/core/engine/glide.d.ts +34 -0
  25. package/dist/core/engine/labels.d.ts +106 -0
  26. package/dist/core/engine/node-drag.d.ts +49 -0
  27. package/dist/core/engine/scene.d.ts +159 -0
  28. package/dist/core/engine/spin.d.ts +62 -0
  29. package/dist/core/engine/surface-pattern.d.ts +20 -0
  30. package/dist/core/engine/text-measure.d.ts +116 -0
  31. package/dist/core/engine/views.d.ts +353 -0
  32. package/dist/core/extensions.d.ts +155 -0
  33. package/dist/core/format-upgrades.d.ts +33 -0
  34. package/dist/core/index.d.ts +36 -0
  35. package/dist/core/input-controller.d.ts +109 -0
  36. package/dist/core/languages.d.ts +199 -0
  37. package/dist/core/layout.d.ts +61 -0
  38. package/dist/core/map-tools/definitions.d.ts +71 -0
  39. package/dist/core/map-tools/input.d.ts +62 -0
  40. package/dist/core/map-tools/reading.d.ts +40 -0
  41. package/dist/core/map-tools/tools.d.ts +51 -0
  42. package/dist/core/markdown-writing.d.ts +87 -0
  43. package/dist/core/material.d.ts +25 -0
  44. package/dist/core/media.d.ts +42 -0
  45. package/dist/core/node-attributes.d.ts +31 -0
  46. package/dist/core/node-links.d.ts +25 -0
  47. package/dist/core/parser-markdown.d.ts +42 -0
  48. package/dist/core/parser-yaml.d.ts +8 -0
  49. package/dist/core/render-to-svg.d.ts +57 -0
  50. package/dist/core/serializer-markdown.d.ts +18 -0
  51. package/dist/core/serializer-yaml.d.ts +2 -0
  52. package/dist/core/source-patch.d.ts +24 -0
  53. package/dist/core/source.d.ts +27 -0
  54. package/dist/core/styles.d.ts +6 -0
  55. package/dist/core/suggest.d.ts +8 -0
  56. package/dist/core/svg-renderer.d.ts +729 -0
  57. package/dist/core/text-layout.d.ts +54 -0
  58. package/dist/core/themes.d.ts +62 -0
  59. package/dist/core/types.d.ts +463 -0
  60. package/dist/core/ui/actions.d.ts +75 -0
  61. package/dist/core/ui/controls.d.ts +61 -0
  62. package/dist/core/ui/detail-sheet.d.ts +88 -0
  63. package/dist/core/ui/frames.d.ts +11 -0
  64. package/dist/core/ui/icons.d.ts +14 -0
  65. package/dist/core/ui/inline-editor.d.ts +79 -0
  66. package/dist/core/ui/media-players.d.ts +65 -0
  67. package/dist/core/ui/media-viewer.d.ts +169 -0
  68. package/dist/core/ui/media-zoom.d.ts +51 -0
  69. package/dist/core/ui/note-markdown.d.ts +19 -0
  70. package/dist/core/ui/outline.d.ts +44 -0
  71. package/dist/core/url-guard.d.ts +40 -0
  72. package/dist/core/utils.d.ts +23 -0
  73. package/dist/core/web-page/page.d.ts +58 -0
  74. package/dist/core/web-page/runtime.d.ts +13 -0
  75. package/dist/core/web-page/start.d.ts +1 -0
  76. package/dist/core/yaml-mini.d.ts +54 -0
  77. package/dist/index.d.ts +1 -0
  78. package/dist/index.js +1448 -0
  79. package/dist/index.js.map +17 -0
  80. package/dist/marked/index.d.ts +31 -0
  81. package/dist/marked/index.js +110 -0
  82. package/dist/marked/index.js.map +10 -0
  83. package/dist/react/index.d.ts +55 -0
  84. package/dist/react/index.js +352 -0
  85. package/dist/react/index.js.map +1 -0
  86. package/dist/web-page.d.ts +2 -0
  87. package/dist/web-page.js +130 -0
  88. package/llms-full.txt +2585 -0
  89. package/llms.txt +35 -0
  90. package/package.json +118 -4
  91. package/skills/orbit/SKILL.md +140 -0
  92. package/skills/orbit/references/editing.md +194 -0
  93. package/skills/orbit/references/extending.md +247 -0
  94. package/skills/orbit/references/format.md +303 -0
  95. package/skills/orbit/references/guide.md +522 -0
  96. package/skills/orbit/references/languages.md +159 -0
  97. package/skills/orbit/references/map-tools.md +188 -0
  98. package/skills/orbit/references/media.md +160 -0
  99. package/skills/orbit/references/recipes.md +227 -0
  100. package/skills/orbit/references/theming.md +184 -0
@@ -0,0 +1,87 @@
1
+ /**
2
+ * How Orbit writes a map as markdown: its own form, the way people write
3
+ * maps. `serializeOrbitMarkdown` writes a whole map this way, and saving an
4
+ * edited map writes its changed ideas this way (see source-patch.ts).
5
+ */
6
+ import type { OrbitDocument, OrbitNode } from './types.js';
7
+ /** A whole map in Orbit's own form. */
8
+ export declare const writeMarkdown: (doc: OrbitDocument) => string;
9
+ export declare const collectFrontmatter: (doc: Pick<OrbitDocument, "options" | "extra">) => Record<string, unknown>;
10
+ /**
11
+ * The root and its children are headings; everything under them is a
12
+ * list, the way people write maps. Below two levels, headings would only
13
+ * make a map harder to read.
14
+ */
15
+ export declare const HEADING_LEVELS = 2;
16
+ /** The statuses a list item writes as a checkbox. */
17
+ export declare const CHECKBOXES: Record<string, string>;
18
+ /** What writing a node needs besides the node: which ids to write. */
19
+ export interface Writing {
20
+ /** The nodes whose ids the parsers wouldn't make from their text, so they are written. */
21
+ explicitIds: ReadonlySet<OrbitNode>;
22
+ }
23
+ export declare const emitHeading: (node: OrbitNode, level: number, writing: Writing) => string;
24
+ export declare const emitList: (children: OrbitNode[], indent: string, writing: Writing) => string;
25
+ /**
26
+ * A node as written: its line after the heading's `#`s or the item's
27
+ * marker (title, then the attributes that fit on it), and what follows the
28
+ * line, indented by `indent`.
29
+ */
30
+ export declare const nodeParts: (node: OrbitNode, listItem: boolean, writing: Writing, indent: string) => {
31
+ line: string;
32
+ title: string;
33
+ inline: string;
34
+ body: string;
35
+ };
36
+ /** The pieces of a node as written, each ending with a line break (or empty): see `nodeParts`. */
37
+ export interface NodePieces {
38
+ title: string;
39
+ /** The attributes on the title line, with the space before them; empty when they don't fit there. */
40
+ inline: string;
41
+ /** The attributes that didn't fit on the line, as a block of their own. */
42
+ attributes: string;
43
+ media: string;
44
+ note: string;
45
+ }
46
+ export declare const nodePieces: (node: OrbitNode, listItem: boolean, writing: Writing, indent: string) => NodePieces;
47
+ export declare const titleLine: (node: OrbitNode, listItem: boolean, writing: Writing) => {
48
+ title: string;
49
+ attributes: Record<string, unknown>;
50
+ };
51
+ /**
52
+ * Attributes on the node's own line, `<!-- orbit status: done, priority: 2 -->`,
53
+ * when they are short, plain values: up to three of them, or more while the
54
+ * comment stays short, as a goal's numbers are (`type: goal, target: 5,
55
+ * current: 2, unit: apples`). Keys that wouldn't survive the comma-separated
56
+ * form (with a quote, a comma, a colon or a space of their own) go to the
57
+ * block form instead.
58
+ */
59
+ export declare const inlineAttributes: (attributes: Record<string, unknown>) => string;
60
+ export declare const inlineValue: (value: unknown) => string | null;
61
+ /** What follows a node's line, indented under a list item: attributes that didn't fit on the line, media, then the note. */
62
+ export declare const body: (node: OrbitNode, blockAttributes: Record<string, unknown>, indent: string) => string;
63
+ /** Attributes as a `<!-- orbit … -->` block of their own, indented by `indent`; nothing when there are none. */
64
+ export declare const attributeBlock: (attributes: Record<string, unknown>, indent: string) => string;
65
+ /** A node's note as written under it, indented by `indent`. */
66
+ export declare const noteLines: (node: OrbitNode, indent: string) => string;
67
+ /**
68
+ * A note as paragraphs when they read back as the same note, otherwise
69
+ * quoted: quoted lines never turn into nodes, so a note can hold lines that
70
+ * look like headings, lists or media.
71
+ */
72
+ export declare const noteText: (note: string, listItem: boolean) => string;
73
+ export declare const indentLines: (text: string, indent: string) => string;
74
+ /**
75
+ * A node's text as a heading or list item title: as is when it reads back
76
+ * unchanged, otherwise with its markup characters escaped.
77
+ */
78
+ export declare const escapeTitle: (text: string) => string;
79
+ export declare const renderMedia: (node: OrbitNode) => string;
80
+ /**
81
+ * YAML to write inside an HTML comment. A "-->" in a value would end the
82
+ * comment early, so its ">" is written as an escape; strings holding one are
83
+ * always double-quoted, where the escape reads back as ">".
84
+ */
85
+ export declare const commentYaml: (value: Record<string, unknown>) => string;
86
+ /** Attributes carried in `<!-- orbit ... -->` comments: the ones a node's title and lines don't show. */
87
+ export declare const collectAttrs: (node: OrbitNode, explicitIds: ReadonlySet<OrbitNode>) => Record<string, unknown>;
@@ -0,0 +1,25 @@
1
+ import type { OrbitRendererTheme } from './types.js';
2
+ /**
3
+ * Material 3 themes from one color, the way Material You colors an app from
4
+ * its wallpaper: tonal palettes in the color's hue, surfaces and containers
5
+ * picked by tone, and branches in hues spread evenly around the color wheel
6
+ * from it. Picking colors by tone is what keeps text readable: two tones 50
7
+ * apart always have at least 4.5:1 contrast.
8
+ */
9
+ /** Material's baseline color: the `material` and `material-night` themes are built from it. */
10
+ export declare const MATERIAL_SEED = "#6750A4";
11
+ export interface MaterialThemeOptions {
12
+ /** Dark surfaces with light text, like `material-night`, instead of light ones. */
13
+ dark?: boolean;
14
+ }
15
+ /** The tokens a Material theme takes from its color: everything else comes from `material` or `material-night`. */
16
+ export declare const MATERIAL_COLOR_TOKENS: readonly ["surface", "text", "muted-text", "root-text", "node-text", "node-text-inverse", "color-root", "color-1", "color-2", "color-3", "color-4", "color-5", "color-6", "color-7", "shade-light", "shade-dark", "node-stroke", "badge-stroke", "sun-halo", "ring-stroke", "link-stroke", "focus-ring", "note-indicator", "control-background", "control-text", "control-muted-text", "control-active-background", "control-active-text", "tooltip-background", "tooltip-text", "action-background", "action-text", "sheet-background", "sheet-text", "sheet-muted-text", "sheet-border", "chip-background", "chip-text", "link-text", "status-active", "status-done", "status-blocked", "status-todo", "status-neutral", "error-background", "error-border", "error-text"];
17
+ export type MaterialColorToken = (typeof MATERIAL_COLOR_TOKENS)[number];
18
+ /**
19
+ * A Material 3 theme built from `seed`, any CSS color Orbit reads (hex,
20
+ * `rgb()`, `oklch()`…). Use it as the `theme` option, or name it for every
21
+ * map: `registerTheme('brand', materialTheme('#0B57D0'))`.
22
+ */
23
+ export declare const materialTheme: (seed: string, options?: MaterialThemeOptions) => OrbitRendererTheme;
24
+ /** Every color token of a Material theme built from `seed`. */
25
+ export declare const materialColors: (seed: string, dark: boolean) => Record<MaterialColorToken, string>;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Video provider helpers shared by the parser (provider detection), the
3
+ * renderer (thumbnail derivation), and the detail sheet and media viewer
4
+ * (embed URL conversion, and links to a video's page on its site).
5
+ *
6
+ * YouTube and Vimeo forbid framing their watch pages (X-Frame-Options /
7
+ * frame-ancestors); only the dedicated embed endpoints may be iframed, so
8
+ * anything that puts a video URL into an <iframe> must go through
9
+ * `toVideoEmbedUrl` first.
10
+ */
11
+ export type VideoProvider = 'youtube' | 'vimeo' | 'native';
12
+ /** Which player a video URL needs, by the site it is on; null when it isn't a video. */
13
+ export declare const detectVideoProvider: (url: string) => VideoProvider | null;
14
+ export declare const isNativeVideoUrl: (url: string) => boolean;
15
+ /** The video id in any of YouTube's URL shapes: watch pages, youtu.be, embeds, Shorts and lives. */
16
+ export declare const youtubeVideoId: (url: string) => string | null;
17
+ /**
18
+ * A Vimeo video's id, and the hash an unlisted video needs, from its page
19
+ * (`vimeo.com/123`, `/123/abc`, channels, groups, showcases) or its player.
20
+ */
21
+ export declare const vimeoVideo: (url: string) => {
22
+ id: string;
23
+ hash?: string;
24
+ } | null;
25
+ /** The numeric id of a Vimeo video. */
26
+ export declare const vimeoVideoId: (url: string) => string | null;
27
+ /**
28
+ * Convert a video URL to a frameable embed URL. Returns null when no
29
+ * conversion is known (callers fall back to the original URL).
30
+ */
31
+ export declare const toVideoEmbedUrl: (url: string, provider?: string) => string | null;
32
+ /** Whether a YouTube URL is a Short, a video that plays upright. */
33
+ export declare const isYouTubeShort: (url: string) => boolean;
34
+ /** Where a video is watched on its site: its YouTube or Vimeo page, or the URL itself. */
35
+ export declare const videoPageUrl: (url: string, provider?: string) => string;
36
+ export declare const youtubeThumbnailUrl: (url: string) => string | null;
37
+ /** True when an image, video or embed value has a usable `src`. */
38
+ export declare const hasMediaSource: (media: {
39
+ src?: unknown;
40
+ } | undefined | null) => media is {
41
+ src: string;
42
+ };
@@ -0,0 +1,31 @@
1
+ import type { DiagnosticCollector } from './diagnostics.js';
2
+ import type { OrbitNode } from './types.js';
3
+ type ImageMedia = NonNullable<OrbitNode['image']>;
4
+ type VideoMedia = NonNullable<OrbitNode['video']>;
5
+ type EmbedMedia = NonNullable<OrbitNode['embed']>;
6
+ /**
7
+ * The fields a picture, video or embed was written with that Orbit doesn't
8
+ * read (a `width`, a provider it doesn't know): kept so saving writes them
9
+ * back, for a newer version or another app that reads them.
10
+ */
11
+ export declare const mediaExtras: (media: object | undefined) => Record<string, unknown> | undefined;
12
+ /** A copy of a picture, video or embed, with the fields Orbit doesn't read. */
13
+ export declare const copyMedia: <Media extends object>(media: Media) => Media;
14
+ export declare const readImage: (value: unknown) => ImageMedia | undefined;
15
+ export declare const readVideo: (value: unknown) => VideoMedia | undefined;
16
+ export declare const readEmbed: (value: unknown) => EmbedMedia | undefined;
17
+ /** The attributes every node takes, in `<!-- orbit … -->` blocks and in YAML. */
18
+ export declare const NODE_ATTRIBUTE_KEYS: readonly ["color", "icon", "status", "priority", "tags", "collapsed", "link", "note", "noteFormat", "image", "video", "embed", "caption", "id", "type"];
19
+ /** Keys a flavor accepts besides the node attributes, and the words that stand in for them. */
20
+ export interface AttributeVocabulary {
21
+ keys: readonly string[];
22
+ synonyms?: Readonly<Record<string, string>>;
23
+ }
24
+ /**
25
+ * Applies one typed attribute (from a `<!-- orbit ... -->` block or a YAML
26
+ * node map) to a node. Unknown keys are kept in `node.attrs`, with a note
27
+ * when they look like a misspelled attribute. Values Orbit can't read are
28
+ * reported and kept in `node.attrs` too, so they're written back.
29
+ */
30
+ export declare const assignNodeAttribute: (node: OrbitNode, key: string, value: unknown, diagnostics: DiagnosticCollector, line?: number, vocabulary?: AttributeVocabulary) => void;
31
+ export {};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Links between nodes. A node's link, or a link in its note, written as
3
+ * `#id` points at another node of the same map, the way `#heading` links
4
+ * point at a heading in a markdown page.
5
+ */
6
+ import type { OrbitNode } from './types.js';
7
+ import type { DiagnosticCollector } from './diagnostics.js';
8
+ /** Whether a link points at a node of the same map: `#research`. */
9
+ export declare const isNodeLink: (href: string | undefined) => href is string;
10
+ /**
11
+ * The node a `#id` link points at: the node with that id, or the one whose
12
+ * id the fragment's text would get, so `#Research` and GitHub-style
13
+ * `#-research` anchors find `research` too.
14
+ */
15
+ export declare const findLinkedNode: (root: OrbitNode, href: string) => OrbitNode | null;
16
+ /** `findLinkedNode` with the map's nodes indexed by `indexNodes`, for checking many links at once. */
17
+ export declare const findIndexedLinkedNode: (nodes: Map<string, OrbitNode>, href: string) => OrbitNode | null;
18
+ /** The map's nodes by id; when ids repeat, the first in the tree, as `findNodeById` finds it. */
19
+ export declare const indexNodes: (root: OrbitNode) => Map<string, OrbitNode>;
20
+ /** The `#id` links a node has: its link, then the ones in its note. */
21
+ export declare const nodeLinksOf: (node: OrbitNode) => string[];
22
+ /** Where a parser saw a node's link (`inNote` false) or a link in its note: the line it's on, when it knows. */
23
+ export type LinkLine = (node: OrbitNode, href: string, inNote: boolean) => number | undefined;
24
+ /** Reports each `#id` link, in a node's link or note, that points at no node of the map, on its own line where `lineOf` knows it. */
25
+ export declare const checkNodeLinks: (root: OrbitNode, diagnostics: DiagnosticCollector, lineOf?: LinkLine) => void;
@@ -0,0 +1,42 @@
1
+ import type { ParsedOrbitDocument } from './types.js';
2
+ export { OrbitParseError } from './diagnostics.js';
3
+ export { SUPPORTED_SCHEMA_VERSION } from './format-upgrades.js';
4
+ export interface ParseOptions {
5
+ /**
6
+ * Throw an `OrbitParseError` on the first problem instead of recording a
7
+ * diagnostic and carrying on. Off by default; `orbit validate` turns it on.
8
+ */
9
+ strict?: boolean;
10
+ /**
11
+ * The name of the root Orbit makes up for a document with no single top
12
+ * heading and no title, in the reader's language. Default "Untitled map".
13
+ * Its id is `untitled-map` whatever its name.
14
+ */
15
+ untitled?: string;
16
+ }
17
+ /** Text of the generated root when a document has no single top-level heading or title. */
18
+ export declare const UNTITLED_ROOT_TEXT = "Untitled map";
19
+ /** The generated root's id, whatever the `untitled` option names it. */
20
+ export declare const UNTITLED_ROOT_ID = "untitled-map";
21
+ /** Whether an icon reads back from the start of a title (emoji do; other symbols need an `icon:` attribute). */
22
+ export declare const isTitleIcon: (icon: string) => boolean;
23
+ /** The emoji a title starts with, which a map reads as the node's icon, and the text after it; null for a title without one. */
24
+ export declare const leadingEmoji: (title: string) => {
25
+ icon: string;
26
+ text: string;
27
+ } | null;
28
+ export interface TitleParts {
29
+ text: string;
30
+ icon?: string;
31
+ link?: string;
32
+ status?: string;
33
+ tags?: string[];
34
+ }
35
+ /**
36
+ * Reads a heading's or list item's text. `[ ]`, `[x]` and `[/]` set the
37
+ * status, an emoji first is the icon, hashtags at the end are tags, a link
38
+ * gives the node its link, and bold, italics, code and strikethrough show
39
+ * as plain text. A backslash keeps any of those characters literal.
40
+ */
41
+ export declare const parseTitle: (raw: string) => TitleParts;
42
+ export declare const parseOrbitMarkdown: (input: string, options?: ParseOptions) => ParsedOrbitDocument;
@@ -0,0 +1,8 @@
1
+ import type { ParsedOrbitDocument } from './types.js';
2
+ export interface ParseYamlOptions {
3
+ /** Throw on the first problem instead of recording a diagnostic. Off by default. */
4
+ strict?: boolean;
5
+ /** The name of the root Orbit makes up for several top-level nodes and no title. Default "Untitled map"; its id is `untitled-map` whatever its name. */
6
+ untitled?: string;
7
+ }
8
+ export declare const parseOrbitYAML: (input: string, options?: ParseYamlOptions) => ParsedOrbitDocument;
@@ -0,0 +1,57 @@
1
+ import { type OrbitNodeType, type OrbitStatusStyle } from './extensions.js';
2
+ import type { OrbitDocument, OrbitNode, OrbitRendererTheme, OrbitThemePreset, ViewMode } from './types.js';
3
+ import { type OrbitStrings } from './languages.js';
4
+ /**
5
+ * The largest width or height the exporter accepts: a million pixels, far
6
+ * past any drawing. The label grid numbers its 64 px cells, and past about
7
+ * 6 × 10⁹ px a side those numbers stop being exact; past about 6 × 10¹⁷ its
8
+ * loops stop advancing and the export never finishes.
9
+ */
10
+ export declare const MAX_SVG_EXPORT_SIZE = 1000000;
11
+ export interface RenderToSVGOptions {
12
+ /** Width of the drawing, in pixels: positive, at most `MAX_SVG_EXPORT_SIZE`. Default 800. */
13
+ width?: number;
14
+ /** Height of the drawing, in pixels: positive, at most `MAX_SVG_EXPORT_SIZE`. Default 600. */
15
+ height?: number;
16
+ /** `focus` (default) or `all` for the overview. */
17
+ viewMode?: ViewMode;
18
+ /** The node at the center in focus mode, by id. Default: the root. */
19
+ focus?: string;
20
+ /** A theme name or an object of theme values. Default: the document's theme, or `paper`. */
21
+ theme?: OrbitThemePreset | (string & {}) | OrbitRendererTheme;
22
+ palette?: string[];
23
+ maxDepth?: number;
24
+ showRings?: boolean;
25
+ /** The SVG's title and accessible name. Default: the document's title, or the root's text. */
26
+ title?: string;
27
+ /** The language of the few words the drawing has (an untitled idea, the empty map): a BCP 47 tag. Default: English. */
28
+ language?: string;
29
+ /** Words to change, over the language's. */
30
+ strings?: Partial<OrbitStrings>;
31
+ /** Resolves relative image URLs. */
32
+ baseUrl?: string;
33
+ /** Size the SVG to its container (100% wide and tall) instead of in pixels. */
34
+ responsive?: boolean;
35
+ /** Prefix for the SVG's ids; give each SVG inlined in one page its own. */
36
+ idPrefix?: string;
37
+ /** Node types by name, before the registered ones: their icons, colors and tokens. */
38
+ nodeTypes?: Record<string, OrbitNodeType>;
39
+ /** Status words and how they look, before the registered ones. */
40
+ statuses?: Record<string, OrbitStatusStyle>;
41
+ /** The type a node that names none is drawn as, for display only (see `RendererOptions.nodeTypeFor`). */
42
+ nodeTypeFor?: (node: OrbitNode) => string | undefined;
43
+ }
44
+ /**
45
+ * Renders a map to a standalone SVG string, without a browser: for files,
46
+ * the command line, static sites and server rendering. It draws what the
47
+ * renderer shows at rest, with the theme's colors resolved to plain values
48
+ * and the labels as SVG text.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { renderToSVGString } from '@restless-dreams/orbit';
53
+ *
54
+ * const svg = renderToSVGString('# Launch\n## Research\n## Build', { width: 1200, height: 800, theme: 'cosmos' });
55
+ * ```
56
+ */
57
+ export declare const renderToSVGString: (input: string | OrbitDocument | OrbitNode, options?: RenderToSVGOptions) => string;
@@ -0,0 +1,18 @@
1
+ import type { OrbitDocument } from './types.js';
2
+ export interface SerializeOptions {
3
+ /**
4
+ * Keep the source's own lines for everything an edit didn't change (the
5
+ * default, for a document parsed from markdown): its formatting, and the
6
+ * text Orbit doesn't read, such as other HTML comments or frontmatter
7
+ * keys of other apps. `false` writes the whole map in Orbit's own form.
8
+ */
9
+ keepSource?: boolean;
10
+ }
11
+ /**
12
+ * A map as orbit-md. A document parsed from markdown comes back as it was
13
+ * written, with only what changed since rewritten, so maps written by hand
14
+ * or by other apps keep their formatting and everything Orbit doesn't read.
15
+ * Other documents (built in code, or read from YAML) are written in Orbit's
16
+ * own form: headings for the root and its children, lists below them.
17
+ */
18
+ export declare const serializeOrbitMarkdown: (doc: OrbitDocument, options?: SerializeOptions) => string;
@@ -0,0 +1,2 @@
1
+ import type { OrbitDocument } from './types.js';
2
+ export declare const serializeOrbitYAML: (doc: OrbitDocument) => string;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Saving an edited map without rewriting it. Every line an edit didn't
3
+ * change is written back as it was, and only what changed is written again,
4
+ * in place, in Orbit's own form: a renamed idea gets a new title, a moved
5
+ * one takes its lines along. A map written by hand, or by another app,
6
+ * keeps its formatting and everything Orbit doesn't read: other HTML
7
+ * comments, rules, the frontmatter keys of other apps.
8
+ *
9
+ * The result is read back before it's used: when it doesn't read as the
10
+ * edited map, saving falls back to rewriting the changed ideas whole, then
11
+ * to Orbit's own form for the whole map.
12
+ */
13
+ import type { OrbitDocument } from './types.js';
14
+ import { type DocumentSource } from './document-source.js';
15
+ /**
16
+ * The document as markdown, its source's lines kept wherever nothing
17
+ * changed; null when that can't be done faithfully.
18
+ */
19
+ export declare const patchMarkdown: (document: OrbitDocument, source: DocumentSource) => string | null;
20
+ /**
21
+ * The patched text without checking that it reads back, or why it couldn't
22
+ * be made: for tests and debugging.
23
+ */
24
+ export declare const patchedText: (document: OrbitDocument, source: DocumentSource, coarse?: boolean) => string;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Source text helpers shared by the dispatcher and both parsers. Normalizing
3
+ * never adds or removes lines, so diagnostics keep pointing at the line the
4
+ * author wrote.
5
+ */
6
+ /**
7
+ * Strips a byte-order mark, converts CRLF/CR line endings to LF, and removes
8
+ * indentation shared by every non-blank line, so markdown indented inside
9
+ * HTML or a template literal parses like flush-left markdown.
10
+ */
11
+ export declare const normalizeSource: (input: string) => string;
12
+ /** The indentation every non-blank line shares, which `normalizeSource` removes. */
13
+ export declare const sharedIndentation: (text: string) => string;
14
+ export declare const dedent: (text: string) => string;
15
+ export declare const firstContentLineIndex: (lines: string[]) => number;
16
+ export interface FrontmatterBlock {
17
+ /** The YAML between the fences. */
18
+ yaml: string;
19
+ /** 0-based index of the opening `---` line. */
20
+ openIndex: number;
21
+ /** 0-based index of the closing `---` line. */
22
+ closeIndex: number;
23
+ }
24
+ /** Frontmatter is a `---` fenced block starting on the first non-blank line. */
25
+ export declare const findFrontmatter: (lines: string[]) => FrontmatterBlock | null;
26
+ /** 1-based line of the first `key:` entry inside a frontmatter or YAML block. */
27
+ export declare const lineOfKey: (lines: string[], key: string, fromIndex?: number, toIndex?: number) => number | undefined;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Adds the orbit stylesheet, once, to the document or shadow root that holds
3
+ * `element`. Constructable stylesheets are used where available, so pages
4
+ * with a strict Content Security Policy keep working.
5
+ */
6
+ export declare const ensureStyles: (element: Node) => void;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * "Did you mean …?" for keys and values a document misspells: a known
3
+ * synonym (`colour` for `color`, `dark` for `night`), or the closest known name
4
+ * within a couple of typos, ignoring case.
5
+ */
6
+ export declare const suggest: (input: string, candidates: readonly string[], synonyms?: Readonly<Record<string, string>>) => string | undefined;
7
+ /** " Did you mean "x"?" when there is a suggestion, otherwise nothing. */
8
+ export declare const didYouMean: (input: string, candidates: readonly string[], synonyms?: Readonly<Record<string, string>>) => string;