@restless-dreams/orbit 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +168 -2
- package/dist/bin/orbit.js +11666 -0
- package/dist/bin/orbit.js.map +60 -0
- package/dist/chunk-fkdfgtx9.js +17295 -0
- package/dist/chunk-fkdfgtx9.js.map +75 -0
- package/dist/chunk-y748hzcr.js +82 -0
- package/dist/chunk-y748hzcr.js.map +10 -0
- package/dist/chunk-zze4tc9n.js +408 -0
- package/dist/chunk-zze4tc9n.js.map +10 -0
- package/dist/core/auto-render.d.ts +85 -0
- package/dist/core/branch-colors.d.ts +57 -0
- package/dist/core/browser.d.ts +23 -0
- package/dist/core/create.d.ts +23 -0
- package/dist/core/diagnostics.d.ts +40 -0
- package/dist/core/dispatch.d.ts +23 -0
- package/dist/core/document-options.d.ts +18 -0
- package/dist/core/document-source.d.ts +128 -0
- package/dist/core/editing.d.ts +66 -0
- package/dist/core/engine/animation-clock.d.ts +40 -0
- package/dist/core/engine/camera.d.ts +70 -0
- package/dist/core/engine/colors.d.ts +51 -0
- package/dist/core/engine/display.d.ts +125 -0
- package/dist/core/engine/export.d.ts +32 -0
- package/dist/core/engine/glide.d.ts +34 -0
- package/dist/core/engine/labels.d.ts +106 -0
- package/dist/core/engine/node-drag.d.ts +49 -0
- package/dist/core/engine/scene.d.ts +160 -0
- package/dist/core/engine/spin.d.ts +62 -0
- package/dist/core/engine/surface-pattern.d.ts +20 -0
- package/dist/core/engine/text-measure.d.ts +116 -0
- package/dist/core/engine/views.d.ts +361 -0
- package/dist/core/extensions.d.ts +155 -0
- package/dist/core/format-upgrades.d.ts +33 -0
- package/dist/core/index.d.ts +46 -0
- package/dist/core/input-controller.d.ts +116 -0
- package/dist/core/languages.d.ts +201 -0
- package/dist/core/layout.d.ts +61 -0
- package/dist/core/map-tools/definitions.d.ts +71 -0
- package/dist/core/map-tools/input.d.ts +62 -0
- package/dist/core/map-tools/reading.d.ts +40 -0
- package/dist/core/map-tools/tools.d.ts +51 -0
- package/dist/core/markdown-writing.d.ts +87 -0
- package/dist/core/material.d.ts +25 -0
- package/dist/core/media.d.ts +42 -0
- package/dist/core/node-attributes.d.ts +31 -0
- package/dist/core/node-links.d.ts +25 -0
- package/dist/core/other-apps/freemind.d.ts +8 -0
- package/dist/core/other-apps/icons.d.ts +16 -0
- package/dist/core/other-apps/ideas.d.ts +76 -0
- package/dist/core/other-apps/import.d.ts +28 -0
- package/dist/core/other-apps/inflate.d.ts +22 -0
- package/dist/core/other-apps/markup.d.ts +51 -0
- package/dist/core/other-apps/notes.d.ts +80 -0
- package/dist/core/other-apps/opml.d.ts +26 -0
- package/dist/core/other-apps/reading.d.ts +36 -0
- package/dist/core/other-apps/xmind.d.ts +14 -0
- package/dist/core/other-apps/zip.d.ts +37 -0
- package/dist/core/parser-markdown.d.ts +42 -0
- package/dist/core/parser-yaml.d.ts +8 -0
- package/dist/core/print-layout.d.ts +70 -0
- package/dist/core/render-to-svg.d.ts +57 -0
- package/dist/core/renderer/content-painter.d.ts +30 -0
- package/dist/core/renderer/dom.d.ts +15 -0
- package/dist/core/renderer/families.d.ts +35 -0
- package/dist/core/renderer/label-painter.d.ts +93 -0
- package/dist/core/renderer/node-painter.d.ts +113 -0
- package/dist/core/renderer/numbers.d.ts +2 -0
- package/dist/core/renderer/options.d.ts +12 -0
- package/dist/core/renderer/rings-and-links.d.ts +23 -0
- package/dist/core/renderer/scene-helpers.d.ts +33 -0
- package/dist/core/renderer/trees.d.ts +22 -0
- package/dist/core/serializer-markdown.d.ts +18 -0
- package/dist/core/serializer-yaml.d.ts +2 -0
- package/dist/core/source-patch.d.ts +24 -0
- package/dist/core/source.d.ts +27 -0
- package/dist/core/styles.d.ts +6 -0
- package/dist/core/suggest.d.ts +8 -0
- package/dist/core/svg-renderer.d.ts +626 -0
- package/dist/core/text-layout.d.ts +54 -0
- package/dist/core/themes.d.ts +62 -0
- package/dist/core/types.d.ts +471 -0
- package/dist/core/ui/actions.d.ts +75 -0
- package/dist/core/ui/controls.d.ts +61 -0
- package/dist/core/ui/detail-sheet.d.ts +88 -0
- package/dist/core/ui/frames.d.ts +11 -0
- package/dist/core/ui/icons.d.ts +14 -0
- package/dist/core/ui/inline-editor.d.ts +79 -0
- package/dist/core/ui/media-players.d.ts +65 -0
- package/dist/core/ui/media-viewer.d.ts +169 -0
- package/dist/core/ui/media-zoom.d.ts +51 -0
- package/dist/core/ui/note-markdown.d.ts +19 -0
- package/dist/core/ui/outline.d.ts +44 -0
- package/dist/core/url-guard.d.ts +40 -0
- package/dist/core/utils.d.ts +23 -0
- package/dist/core/web-page/page.d.ts +59 -0
- package/dist/core/web-page/runtime.d.ts +13 -0
- package/dist/core/web-page/start.d.ts +1 -0
- package/dist/core/yaml-mini.d.ts +54 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4357 -0
- package/dist/index.js.map +29 -0
- package/dist/marked/index.d.ts +31 -0
- package/dist/marked/index.js +110 -0
- package/dist/marked/index.js.map +10 -0
- package/dist/react/index.d.ts +55 -0
- package/dist/react/index.js +352 -0
- package/dist/react/index.js.map +1 -0
- package/dist/web-page.d.ts +2 -0
- package/dist/web-page.js +130 -0
- package/llms-full.txt +2785 -0
- package/llms.txt +36 -0
- package/package.json +118 -4
- package/skills/orbit/SKILL.md +140 -0
- package/skills/orbit/references/editing.md +195 -0
- package/skills/orbit/references/extending.md +247 -0
- package/skills/orbit/references/format.md +331 -0
- package/skills/orbit/references/guide.md +546 -0
- package/skills/orbit/references/import-export.md +115 -0
- package/skills/orbit/references/languages.md +160 -0
- package/skills/orbit/references/map-tools.md +188 -0
- package/skills/orbit/references/media.md +160 -0
- package/skills/orbit/references/recipes.md +236 -0
- package/skills/orbit/references/theming.md +199 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A map as a web page: one HTML file with Orbit, the map and its pictures
|
|
3
|
+
* inside, which opens in any browser, offline. Readers explore it with
|
|
4
|
+
* Orbit's own controls, or present it: one idea at a time, in reading order,
|
|
5
|
+
* with its note as a caption (see runtime.ts, the page's script). Printed,
|
|
6
|
+
* it's the map laid out for paper (print-layout.ts) instead.
|
|
7
|
+
*/
|
|
8
|
+
import { type OrbitStrings } from '../languages.js';
|
|
9
|
+
import type { OrbitDocument, OrbitRendererTheme, ViewMode } from '../types.js';
|
|
10
|
+
export interface OrbitWebPageOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Orbit's web page script, the file `@restless-dreams/orbit/web-page.js`,
|
|
13
|
+
* as text. It goes inside the page, so the page needs nothing else.
|
|
14
|
+
*/
|
|
15
|
+
script: string;
|
|
16
|
+
/** The page's title. Default: the map's `title`, or its root's text. */
|
|
17
|
+
title?: string;
|
|
18
|
+
/** The map's theme, instead of its frontmatter's: a theme name or `{ preset, tokens }`. */
|
|
19
|
+
theme?: string | OrbitRendererTheme;
|
|
20
|
+
/** How the map opens: `focus` (default) or `all`, the overview. */
|
|
21
|
+
viewMode?: ViewMode;
|
|
22
|
+
/** The node in focus when the map opens, by id. Default: the root. */
|
|
23
|
+
focus?: string;
|
|
24
|
+
/** The language of the page and the map's words: a tag like `es`. Default: English. */
|
|
25
|
+
language?: string;
|
|
26
|
+
/** Single words to change: `{ present: 'Show' }`. */
|
|
27
|
+
strings?: Partial<OrbitStrings>;
|
|
28
|
+
/**
|
|
29
|
+
* Pictures to put inside the page, by the address the map gives them:
|
|
30
|
+
* `{ 'photos/summit.jpg': 'data:image/jpeg;base64,…' }`. A node's picture,
|
|
31
|
+
* a video's thumbnail and pictures in notes are swapped for them, so they
|
|
32
|
+
* show wherever the page goes.
|
|
33
|
+
*/
|
|
34
|
+
media?: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
/** What a web page carries for its script, as JSON in `#orbit-page`. */
|
|
37
|
+
export interface WebPageData {
|
|
38
|
+
/** The map, in markdown or YAML. */
|
|
39
|
+
source: string;
|
|
40
|
+
theme?: string | OrbitRendererTheme;
|
|
41
|
+
viewMode?: ViewMode;
|
|
42
|
+
focus?: string;
|
|
43
|
+
language?: string;
|
|
44
|
+
strings?: Partial<OrbitStrings>;
|
|
45
|
+
media: Record<string, string>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The map as one HTML page, with Orbit inside (`options.script`): open it in
|
|
49
|
+
* any browser, offline, to explore the map or present it.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { readFileSync } from 'node:fs';
|
|
53
|
+
* import { exportWebPage } from '@restless-dreams/orbit';
|
|
54
|
+
*
|
|
55
|
+
* const script = readFileSync(new URL(import.meta.resolve('@restless-dreams/orbit/web-page.js')), 'utf8');
|
|
56
|
+
* const html = exportWebPage(markdown, { script, theme: 'night' });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare const exportWebPage: (input: string | OrbitDocument, options: OrbitWebPageOptions) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The script of a map shared as a web page (see page.ts). It draws the map
|
|
3
|
+
* from the page's JSON, with its pictures swapped for the ones inside the
|
|
4
|
+
* page, and presents it on request: one idea at a time, in reading order,
|
|
5
|
+
* with its note as a caption, stepped with keys, buttons or swipes, full
|
|
6
|
+
* screen where the browser allows. Printed, it's the map laid out for paper.
|
|
7
|
+
*/
|
|
8
|
+
import type { OrbitSVGRenderer } from '../svg-renderer.js';
|
|
9
|
+
import type { OrbitDocument } from '../types.js';
|
|
10
|
+
/** Draws the page's map and lets it be presented. Returns the map, or null on a page that isn't one. */
|
|
11
|
+
export declare const startWebPage: (page?: Document) => OrbitSVGRenderer | null;
|
|
12
|
+
/** The map with its pictures swapped for the ones inside the page, wherever the map shows them. */
|
|
13
|
+
export declare const withMedia: (map: OrbitDocument, media: Record<string, string>) => OrbitDocument;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny YAML subset parser + emitter for Orbit, with no dependencies.
|
|
3
|
+
* Reads what maps and the frontmatter of other apps (Obsidian, static site
|
|
4
|
+
* generators) write: maps, block lists (indented under their key or not),
|
|
5
|
+
* flow lists and maps (`[a, b]`, `{name: Ana}`), strings, numbers,
|
|
6
|
+
* booleans and null, block scalars (`|` literal, `>` folded), plain and
|
|
7
|
+
* quoted strings over several lines, comments, anchors, aliases and merge
|
|
8
|
+
* keys (`&base`, `*base`, `<<: *base`). Not read: tags (`!!str`) and
|
|
9
|
+
* complex keys (`? key`).
|
|
10
|
+
*
|
|
11
|
+
* One leniency on purpose: a value that starts with `#` is text, not a
|
|
12
|
+
* comment, so `color: #FF6B6B` reads as the color people mean.
|
|
13
|
+
*/
|
|
14
|
+
export declare class YamlMiniError extends Error {
|
|
15
|
+
/** 1-based line of the problem in the text given to the parser. */
|
|
16
|
+
line: number;
|
|
17
|
+
/** The problem, without where it is. */
|
|
18
|
+
reason: string;
|
|
19
|
+
constructor(reason: string, line: number);
|
|
20
|
+
}
|
|
21
|
+
export type YamlValue = string | number | boolean | null | YamlValue[] | {
|
|
22
|
+
[k: string]: YamlValue;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The line `key` was written on in a map the last `parseYaml` read, or the
|
|
26
|
+
* map's first key's line without one: for problems that point at a node of
|
|
27
|
+
* a YAML document. Flow maps (`{ … }`) have none.
|
|
28
|
+
*/
|
|
29
|
+
export declare const yamlLineOf: (map: object, key?: string) => number | undefined;
|
|
30
|
+
/** The line item `index` of a block list starts on. */
|
|
31
|
+
export declare const yamlItemLine: (list: object, index: number) => number | undefined;
|
|
32
|
+
export declare const parseYaml: (input: string) => YamlValue;
|
|
33
|
+
/**
|
|
34
|
+
* Sets `obj[key]`, even when `key` is `__proto__`: a plain assignment would
|
|
35
|
+
* then change the object's prototype and lose the key, so it becomes an own
|
|
36
|
+
* enumerable data property.
|
|
37
|
+
*/
|
|
38
|
+
export declare const assignKey: (obj: Record<string, unknown>, key: string, value: unknown) => void;
|
|
39
|
+
export declare const emitYaml: (value: YamlValue) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Whether a string written plain would read back as itself: no when other
|
|
42
|
+
* YAML readers would take it for a number or boolean, and no when this
|
|
43
|
+
* parser itself would hand back something else. Used by the emitter.
|
|
44
|
+
*/
|
|
45
|
+
export declare const needsQuotes: (s: string) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether a one-line value written plain after `key:` reads back as the same
|
|
48
|
+
* string through this parser: no anchors (`&a`), aliases (`*a`), block-scalar
|
|
49
|
+
* starts (`|`, `>+`), comments (` #`), or scalars read as something else
|
|
50
|
+
* (`~`, `.5`). Unlike `needsQuotes` this ignores what *other* YAML readers
|
|
51
|
+
* would do; markdown-writing uses it for values inside `<!-- orbit … -->`
|
|
52
|
+
* comments, which only Orbit reads.
|
|
53
|
+
*/
|
|
54
|
+
export declare const plainScalarReadsBack: (s: string) => boolean;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core/index.js';
|