@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,58 @@
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).
6
+ */
7
+ import { type OrbitStrings } from '../languages.js';
8
+ import type { OrbitDocument, OrbitRendererTheme, ViewMode } from '../types.js';
9
+ export interface OrbitWebPageOptions {
10
+ /**
11
+ * Orbit's web page script, the file `@restless-dreams/orbit/web-page.js`,
12
+ * as text. It goes inside the page, so the page needs nothing else.
13
+ */
14
+ script: string;
15
+ /** The page's title. Default: the map's `title`, or its root's text. */
16
+ title?: string;
17
+ /** The map's theme, instead of its frontmatter's: a theme name or `{ preset, tokens }`. */
18
+ theme?: string | OrbitRendererTheme;
19
+ /** How the map opens: `focus` (default) or `all`, the overview. */
20
+ viewMode?: ViewMode;
21
+ /** The node in focus when the map opens, by id. Default: the root. */
22
+ focus?: string;
23
+ /** The language of the page and the map's words: a tag like `es`. Default: English. */
24
+ language?: string;
25
+ /** Single words to change: `{ present: 'Show' }`. */
26
+ strings?: Partial<OrbitStrings>;
27
+ /**
28
+ * Pictures to put inside the page, by the address the map gives them:
29
+ * `{ 'photos/summit.jpg': 'data:image/jpeg;base64,…' }`. A node's picture,
30
+ * a video's thumbnail and pictures in notes are swapped for them, so they
31
+ * show wherever the page goes.
32
+ */
33
+ media?: Record<string, string>;
34
+ }
35
+ /** What a web page carries for its script, as JSON in `#orbit-page`. */
36
+ export interface WebPageData {
37
+ /** The map, in markdown or YAML. */
38
+ source: string;
39
+ theme?: string | OrbitRendererTheme;
40
+ viewMode?: ViewMode;
41
+ focus?: string;
42
+ language?: string;
43
+ strings?: Partial<OrbitStrings>;
44
+ media: Record<string, string>;
45
+ }
46
+ /**
47
+ * The map as one HTML page, with Orbit inside (`options.script`): open it in
48
+ * any browser, offline, to explore the map or present it.
49
+ *
50
+ * ```ts
51
+ * import { readFileSync } from 'node:fs';
52
+ * import { exportWebPage } from '@restless-dreams/orbit';
53
+ *
54
+ * const script = readFileSync(new URL(import.meta.resolve('@restless-dreams/orbit/web-page.js')), 'utf8');
55
+ * const html = exportWebPage(markdown, { script, theme: 'night' });
56
+ * ```
57
+ */
58
+ 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.
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;
@@ -0,0 +1 @@
1
+ export * from './core/index.js';