worldorbit 3.2.1 → 4.0.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 (143) hide show
  1. package/README.md +546 -545
  2. package/dist/browser/core/dist/atlas-edit.js +146 -1
  3. package/dist/browser/core/dist/atlas-validate.js +105 -10
  4. package/dist/browser/core/dist/draft-parse.js +341 -16
  5. package/dist/browser/core/dist/draft.d.ts +2 -1
  6. package/dist/browser/core/dist/draft.js +25 -3
  7. package/dist/browser/core/dist/format.js +86 -4
  8. package/dist/browser/core/dist/index.d.ts +1 -0
  9. package/dist/browser/core/dist/index.js +1 -0
  10. package/dist/browser/core/dist/load.js +7 -2
  11. package/dist/browser/core/dist/normalize.js +1 -0
  12. package/dist/browser/core/dist/scene.js +11 -2
  13. package/dist/browser/core/dist/schema.js +11 -1
  14. package/dist/browser/core/dist/solver.d.ts +26 -0
  15. package/dist/browser/core/dist/solver.js +27 -0
  16. package/dist/browser/core/dist/types.d.ts +57 -3
  17. package/dist/browser/editor/dist/editor.js +844 -719
  18. package/dist/browser/editor/dist/types.d.ts +2 -1
  19. package/dist/browser/obsidian-plugin/dist/diagnostics.d.ts +3 -0
  20. package/dist/browser/obsidian-plugin/dist/diagnostics.js +23 -0
  21. package/dist/browser/obsidian-plugin/dist/examples.d.ts +3 -0
  22. package/dist/browser/obsidian-plugin/dist/examples.js +77 -0
  23. package/dist/browser/obsidian-plugin/dist/index.d.ts +9 -0
  24. package/dist/browser/obsidian-plugin/dist/index.js +8 -0
  25. package/dist/browser/obsidian-plugin/dist/main.d.ts +2 -0
  26. package/dist/browser/obsidian-plugin/dist/main.js +2 -0
  27. package/dist/browser/obsidian-plugin/dist/navigation.d.ts +6 -0
  28. package/dist/browser/obsidian-plugin/dist/navigation.js +44 -0
  29. package/dist/browser/obsidian-plugin/dist/plugin.d.ts +8 -0
  30. package/dist/browser/obsidian-plugin/dist/plugin.js +508 -0
  31. package/dist/browser/obsidian-plugin/dist/positions.d.ts +7 -0
  32. package/dist/browser/obsidian-plugin/dist/positions.js +14 -0
  33. package/dist/browser/obsidian-plugin/dist/settings.d.ts +2 -0
  34. package/dist/browser/obsidian-plugin/dist/settings.js +5 -0
  35. package/dist/browser/obsidian-plugin/dist/theme.d.ts +2 -0
  36. package/dist/browser/obsidian-plugin/dist/theme.js +31 -0
  37. package/dist/browser/obsidian-plugin/dist/types.d.ts +42 -0
  38. package/dist/browser/obsidian-plugin/dist/types.js +1 -0
  39. package/dist/browser/obsidian-plugin/dist/viewer-host.d.ts +14 -0
  40. package/dist/browser/obsidian-plugin/dist/viewer-host.js +110 -0
  41. package/dist/browser/viewer/dist/index.d.ts +1 -0
  42. package/dist/browser/viewer/dist/index.js +1 -0
  43. package/dist/browser/viewer/dist/interactive-2d.d.ts +21 -0
  44. package/dist/browser/viewer/dist/interactive-2d.js +201 -0
  45. package/dist/browser/viewer/dist/minimap.js +9 -7
  46. package/dist/browser/viewer/dist/render.d.ts +1 -1
  47. package/dist/browser/viewer/dist/render.js +25 -20
  48. package/dist/browser/viewer/dist/runtime-3d.js +2 -0
  49. package/dist/browser/viewer/dist/viewer-state.d.ts +1 -1
  50. package/dist/browser/viewer/dist/viewer-state.js +1 -1
  51. package/dist/browser/viewer/dist/viewer.js +7 -3
  52. package/dist/obsidian-plugin/LICENSE +21 -0
  53. package/dist/obsidian-plugin/README.md +141 -0
  54. package/dist/obsidian-plugin/main.js +108 -0
  55. package/dist/obsidian-plugin/manifest.json +9 -0
  56. package/dist/obsidian-plugin/obsidian_scsh_1.png +0 -0
  57. package/dist/obsidian-plugin/obsidian_scsh_2.png +0 -0
  58. package/dist/obsidian-plugin/styles.css +164 -0
  59. package/dist/unpkg/core/dist/atlas-edit.js +146 -1
  60. package/dist/unpkg/core/dist/atlas-validate.js +105 -10
  61. package/dist/unpkg/core/dist/draft-parse.js +341 -16
  62. package/dist/unpkg/core/dist/draft.d.ts +2 -1
  63. package/dist/unpkg/core/dist/draft.js +25 -3
  64. package/dist/unpkg/core/dist/format.js +86 -4
  65. package/dist/unpkg/core/dist/index.d.ts +1 -0
  66. package/dist/unpkg/core/dist/index.js +1 -0
  67. package/dist/unpkg/core/dist/load.js +7 -2
  68. package/dist/unpkg/core/dist/normalize.js +1 -0
  69. package/dist/unpkg/core/dist/scene.js +11 -2
  70. package/dist/unpkg/core/dist/schema.js +11 -1
  71. package/dist/unpkg/core/dist/solver.d.ts +26 -0
  72. package/dist/unpkg/core/dist/solver.js +27 -0
  73. package/dist/unpkg/core/dist/types.d.ts +57 -3
  74. package/dist/unpkg/editor/dist/editor.js +844 -719
  75. package/dist/unpkg/editor/dist/types.d.ts +2 -1
  76. package/dist/unpkg/obsidian-plugin/dist/diagnostics.d.ts +3 -0
  77. package/dist/unpkg/obsidian-plugin/dist/diagnostics.js +23 -0
  78. package/dist/unpkg/obsidian-plugin/dist/examples.d.ts +3 -0
  79. package/dist/unpkg/obsidian-plugin/dist/examples.js +77 -0
  80. package/dist/unpkg/obsidian-plugin/dist/index.d.ts +9 -0
  81. package/dist/unpkg/obsidian-plugin/dist/index.js +8 -0
  82. package/dist/unpkg/obsidian-plugin/dist/main.d.ts +2 -0
  83. package/dist/unpkg/obsidian-plugin/dist/main.js +2 -0
  84. package/dist/unpkg/obsidian-plugin/dist/navigation.d.ts +6 -0
  85. package/dist/unpkg/obsidian-plugin/dist/navigation.js +44 -0
  86. package/dist/unpkg/obsidian-plugin/dist/plugin.d.ts +8 -0
  87. package/dist/unpkg/obsidian-plugin/dist/plugin.js +508 -0
  88. package/dist/unpkg/obsidian-plugin/dist/positions.d.ts +7 -0
  89. package/dist/unpkg/obsidian-plugin/dist/positions.js +14 -0
  90. package/dist/unpkg/obsidian-plugin/dist/settings.d.ts +2 -0
  91. package/dist/unpkg/obsidian-plugin/dist/settings.js +5 -0
  92. package/dist/unpkg/obsidian-plugin/dist/theme.d.ts +2 -0
  93. package/dist/unpkg/obsidian-plugin/dist/theme.js +31 -0
  94. package/dist/unpkg/obsidian-plugin/dist/types.d.ts +42 -0
  95. package/dist/unpkg/obsidian-plugin/dist/types.js +1 -0
  96. package/dist/unpkg/obsidian-plugin/dist/viewer-host.d.ts +14 -0
  97. package/dist/unpkg/obsidian-plugin/dist/viewer-host.js +110 -0
  98. package/dist/unpkg/viewer/dist/index.d.ts +1 -0
  99. package/dist/unpkg/viewer/dist/index.js +1 -0
  100. package/dist/unpkg/viewer/dist/interactive-2d.d.ts +21 -0
  101. package/dist/unpkg/viewer/dist/interactive-2d.js +201 -0
  102. package/dist/unpkg/viewer/dist/minimap.js +9 -7
  103. package/dist/unpkg/viewer/dist/render.d.ts +1 -1
  104. package/dist/unpkg/viewer/dist/render.js +25 -20
  105. package/dist/unpkg/viewer/dist/runtime-3d.js +2 -0
  106. package/dist/unpkg/viewer/dist/viewer-state.d.ts +1 -1
  107. package/dist/unpkg/viewer/dist/viewer-state.js +1 -1
  108. package/dist/unpkg/viewer/dist/viewer.js +7 -3
  109. package/dist/unpkg/worldorbit-core.min.js +10 -10
  110. package/dist/unpkg/worldorbit-editor.min.js +359 -332
  111. package/dist/unpkg/worldorbit-markdown.min.js +28 -28
  112. package/dist/unpkg/worldorbit-viewer.min.js +203 -203
  113. package/dist/unpkg/worldorbit.js +958 -40
  114. package/dist/unpkg/worldorbit.min.js +214 -214
  115. package/package.json +22 -1
  116. package/packages/core/dist/atlas-edit.js +146 -1
  117. package/packages/core/dist/atlas-validate.js +105 -10
  118. package/packages/core/dist/draft-parse.js +341 -16
  119. package/packages/core/dist/draft.d.ts +2 -1
  120. package/packages/core/dist/draft.js +25 -3
  121. package/packages/core/dist/format.js +86 -4
  122. package/packages/core/dist/index.d.ts +1 -0
  123. package/packages/core/dist/index.js +1 -0
  124. package/packages/core/dist/load.js +7 -2
  125. package/packages/core/dist/normalize.js +1 -0
  126. package/packages/core/dist/scene.js +11 -2
  127. package/packages/core/dist/schema.js +11 -1
  128. package/packages/core/dist/solver.d.ts +26 -0
  129. package/packages/core/dist/solver.js +27 -0
  130. package/packages/core/dist/types.d.ts +57 -3
  131. package/packages/editor/dist/editor.js +844 -719
  132. package/packages/editor/dist/types.d.ts +2 -1
  133. package/packages/viewer/dist/index.d.ts +1 -0
  134. package/packages/viewer/dist/index.js +1 -0
  135. package/packages/viewer/dist/interactive-2d.d.ts +21 -0
  136. package/packages/viewer/dist/interactive-2d.js +201 -0
  137. package/packages/viewer/dist/minimap.js +9 -7
  138. package/packages/viewer/dist/render.d.ts +1 -1
  139. package/packages/viewer/dist/render.js +25 -20
  140. package/packages/viewer/dist/runtime-3d.js +2 -0
  141. package/packages/viewer/dist/viewer-state.d.ts +1 -1
  142. package/packages/viewer/dist/viewer-state.js +1 -1
  143. package/packages/viewer/dist/viewer.js +7 -3
package/README.md CHANGED
@@ -1,545 +1,546 @@
1
- # WorldOrbit
2
-
3
- WorldOrbit is a text-first DSL, viewer, and optional editor platform for fictional orbital systems.
4
-
5
- It is designed as a specialized Mermaid-like alternative for worldbuilding: you can describe stellar systems in plain text, embed them in Markdown, render them as static diagrams, or explore them interactively with pan, rotate, zoom, and object tooltips.
6
-
7
- WorldOrbit is built for:
8
-
9
- - worldbuilding projects
10
- - Markdown-based lore repositories and CMS setups
11
- - fictional atlases and codices
12
- - interactive setting documentation
13
- - browser-based orbital diagram tooling
14
-
15
- ## Why WorldOrbit?
16
-
17
- Generic diagram tools can show relationships, but they are not built for fictional orbital systems.
18
-
19
- WorldOrbit is designed specifically for:
20
-
21
- - stars, planets, moons, belts, structures, and phenomena
22
- - orbit-aware layouts instead of generic node graphs
23
- - Markdown-native embedding
24
- - optional interactivity
25
- - optional visual authoring through Studio
26
-
27
- WorldOrbit is not intended to be a real-world astronomy simulator or a high-precision astrophysics engine. Its goal is clear, expressive orbital worldbuilding that works well in content workflows.
28
-
29
- ## Quick Example
30
-
31
- ```worldorbit
32
- schema 2.5
33
-
34
- system Iyath
35
- title "Iyath System"
36
- epoch "JY-0001.0"
37
- referencePlane ecliptic
38
-
39
- defaults
40
- view orthographic
41
- scale presentation
42
- preset atlas-card
43
- theme atlas
44
-
45
- group inner-system
46
- label "Inner System"
47
- color #d9b37a
48
-
49
- viewpoint eclipse
50
- label "Eclipse View"
51
- projection perspective
52
- camera
53
- azimuth 36
54
- elevation 22
55
- distance 6
56
- layers background guides orbits-back events objects labels metadata
57
- events naar-eclipse
58
-
59
- object star Iyath
60
-
61
- object planet Naar
62
- orbit Iyath
63
- semiMajor 1.18au
64
- eccentricity 0.08
65
- angle 28deg
66
- inclination 24deg
67
- phase 42deg
68
- atmosphere nitrogen-oxygen
69
- groups inner-system
70
-
71
- object moon Seyra
72
- orbit Naar
73
- distance 384400km
74
-
75
- event naar-eclipse
76
- kind solar-eclipse
77
- target Naar
78
- participants Iyath Naar Seyra
79
- ````
80
-
81
- ## Installation
82
-
83
- ### npm
84
-
85
- ```bash
86
- npm install worldorbit
87
- ```
88
-
89
- ### What the `worldorbit` package contains
90
-
91
- The published `worldorbit` package is the public entry point.
92
-
93
- It includes:
94
-
95
- * the browser bundles
96
- * subpath exports for core modules
97
- * the packages used by the viewer, Markdown integration, and editor tooling
98
-
99
- So for most users, this is enough:
100
-
101
- ```bash
102
- npm install worldorbit
103
- ```
104
-
105
- And then:
106
-
107
- ```ts
108
- import { parse, loadWorldOrbitSource } from "worldorbit";
109
- import * as Viewer from "worldorbit/viewer";
110
- ```
111
-
112
- ## Browser / CDN Quick Setup
113
-
114
- For direct browser usage, use the browser bundle:
115
-
116
- ```html
117
- <!DOCTYPE html>
118
- <html>
119
- <head>
120
- <meta charset="utf-8" />
121
- <style>
122
- html, body {
123
- margin: 0;
124
- width: 100%;
125
- height: 100%;
126
- }
127
-
128
- #view {
129
- width: 100vw;
130
- height: 100vh;
131
- }
132
- </style>
133
- </head>
134
- <body>
135
- <div id="view"></div>
136
-
137
- <script type="module">
138
- import {
139
- createInteractiveViewer,
140
- loadWorldOrbitSource
141
- } from "https://unpkg.com/worldorbit@3.0.7/dist/unpkg/worldorbit.esm.js";
142
-
143
- const source = `
144
- schema 2.5
145
-
146
- system Iyath
147
- epoch "JY-0001.0"
148
-
149
- object star Iyath
150
- object planet Naar
151
- orbit Iyath
152
- semiMajor 1.18au
153
- `.trim();
154
-
155
- const loaded = loadWorldOrbitSource(source);
156
-
157
- createInteractiveViewer(document.getElementById("view"), {
158
- document: loaded.document
159
- });
160
- </script>
161
- </body>
162
- </html>
163
- ```
164
-
165
- For browser usage today, prefer the ESM entry point `worldorbit.esm.js`.
166
-
167
- ## Static and Interactive Rendering
168
-
169
- WorldOrbit can be used in different ways from the same source:
170
-
171
- * as a static diagram
172
- * as an interactive SVG viewer
173
- * inside Markdown pipelines
174
- * inside the optional Studio editor
175
-
176
- This means the same WorldOrbit document can be:
177
-
178
- * written in plain text
179
- * embedded in Markdown
180
- * rendered in a documentation page
181
- * explored interactively
182
- * edited visually if needed
183
-
184
- ## Studio Editor
185
-
186
- WorldOrbit includes an optional Studio editor for easier authoring and exploration.
187
-
188
- Studio is useful when you want:
189
-
190
- * visual placement editing
191
- * source and preview side by side
192
- * inspector-based editing
193
- * faster onboarding for non-technical users
194
-
195
- The editor is optional. The core format remains text-first.
196
-
197
- ## Canonical Schema
198
-
199
- New atlas authoring should start with:
200
-
201
- ```worldorbit
202
- schema 2.5
203
- ```
204
-
205
- Example:
206
-
207
- ```worldorbit
208
- schema 2.5
209
-
210
- system Iyath
211
- title "Iyath System"
212
- epoch "JY-0001.0"
213
- referencePlane ecliptic
214
-
215
- defaults
216
- view orthographic
217
- scale presentation
218
- preset atlas-card
219
- theme atlas
220
-
221
- group inner-system
222
- label "Inner System"
223
- summary "Naar and its inhabited infrastructure"
224
- color #d9b37a
225
-
226
- viewpoint overview
227
- label "Atlas Overview"
228
- summary "Fit the whole system."
229
- projection orthographic
230
- camera
231
- azimuth 24
232
- elevation 18
233
- layers background guides orbits-back events objects labels metadata
234
- events naar-eclipse
235
- filter
236
- groups inner-system
237
-
238
- annotation naar-notes
239
- label "Naar Notes"
240
- target Naar
241
- body "Heimatwelt der Enari."
242
-
243
- object star Iyath
244
- mass 1.02sol
245
-
246
- object planet Naar
247
- orbit Iyath
248
- semiMajor 1.18au
249
- eccentricity 0.08
250
- angle 28deg
251
- inclination 24deg
252
- phase 42deg
253
- groups inner-system
254
- image /demo/assets/naar-map.png
255
- atmosphere nitrogen-oxygen
256
-
257
- object moon Seyra
258
- orbit Naar
259
- distance 384400km
260
- groups inner-system
261
-
262
- event naar-eclipse
263
- kind solar-eclipse
264
- label "Naar Eclipse"
265
- target Naar
266
- participants Iyath Naar Seyra
267
- epoch "JY-0001.0"
268
- referencePlane ecliptic
269
-
270
- positions
271
- pose Naar
272
- orbit Iyath
273
- semiMajor 1.18au
274
- phase 90deg
275
-
276
- pose Seyra
277
- orbit Naar
278
- distance 384400km
279
- phase 90deg
280
- ```
281
-
282
- ## What's New In Schema 2.5
283
-
284
- Schema `2.5` keeps Schema `2.1` fully readable and adds a clearer 3D-ready authoring surface without turning WorldOrbit into a full 3D engine.
285
-
286
- It adds:
287
-
288
- * new viewpoint projections: `orthographic` and `perspective`
289
- * a Schema-level `camera` block with `azimuth`, `elevation`, optional `roll`, and optional `distance`
290
- * clearer inheritance for `epoch` and `referencePlane` across system, object, event, and pose contexts
291
- * more stable event snapshots, where missing pose fields fall back to object, event, and system context instead of implying empty values
292
- * stronger validation around viewpoints, camera fields, event/pose consistency, and ambiguous authoring combinations
293
-
294
- Schema `2.5` still does **not** add full 3D coordinates, meshes, materials, quaternions, lighting, or simulation-heavy orbital solving.
295
-
296
- Schema `2.1` already added comments, semantic `group` and `relation` sections, declarative `event` sections with per-event `positions`/`pose` snapshots, viewpoint-linked `events`, object-level `epoch` and `referencePlane`, declarative resonance and validation hints, and optional structured lore blocks such as `climate`, `habitability`, and `settlement`.
297
-
298
- Stable `1.0` source is still accepted. Canonical `schema 2.0` source remains fully supported, and legacy `schema 2.0-draft` files stay readable as a compatibility path with a deprecation diagnostic.
299
-
300
- ## Basic Usage
301
-
302
- ### Parse and load source
303
-
304
- ```ts
305
- import {
306
- loadWorldOrbitSource,
307
- parse,
308
- } from "worldorbit";
309
-
310
- const parsed = parse(`
311
- system Iyath
312
- star Iyath
313
- planet Naar orbit Iyath distance 1.18au
314
- `.trim());
315
-
316
- const loaded = loadWorldOrbitSource(`
317
- schema 2.5
318
-
319
- system Iyath
320
- object star Iyath
321
- object planet Naar
322
- orbit Iyath
323
- semiMajor 1.18au
324
- `.trim());
325
- ```
326
-
327
- ### Render a scene
328
-
329
- ```ts
330
- import {
331
- loadWorldOrbitSource,
332
- renderDocumentToScene,
333
- } from "worldorbit";
334
-
335
- const loaded = loadWorldOrbitSource(source);
336
-
337
- const scene = renderDocumentToScene(loaded.document, {
338
- projection: "isometric",
339
- scaleModel: {
340
- orbitDistanceMultiplier: 1.1,
341
- bodyRadiusMultiplier: 1.15,
342
- },
343
- });
344
- ```
345
-
346
- ### Create an interactive viewer
347
-
348
- ```ts
349
- import { loadWorldOrbitSource } from "worldorbit";
350
- import { createInteractiveViewer } from "worldorbit/viewer";
351
-
352
- const loaded = loadWorldOrbitSource(source);
353
-
354
- createInteractiveViewer(document.getElementById("preview"), {
355
- document: loaded.document,
356
- projection: "isometric",
357
- theme: "atlas",
358
- viewMode: "3d",
359
- });
360
- ```
361
-
362
- ## Package Overview
363
-
364
- WorldOrbit is organized internally as a small ecosystem.
365
-
366
- ### `worldorbit`
367
-
368
- Public package entry point with browser bundles and main exports.
369
-
370
- ### `worldorbit/core`
371
-
372
- Use this when you need:
373
-
374
- * parsing
375
- * normalization
376
- * validation
377
- * diagnostics
378
- * schema loading
379
- * canonical formatting
380
- * scene generation
381
-
382
- ### `worldorbit/viewer`
383
-
384
- Use this when you need:
385
-
386
- * static SVG rendering
387
- * interactive viewing
388
- * atlas-style exploration
389
- * themes and embeds
390
-
391
- ### `worldorbit/markdown`
392
-
393
- Use this when you want to transform fenced `worldorbit` blocks inside Markdown pipelines.
394
-
395
- ### `worldorbit/editor`
396
-
397
- Use this when you want browser-based visual authoring on top of the text format.
398
-
399
- ## Core Example
400
-
401
- ```ts
402
- import {
403
- formatDocument,
404
- loadWorldOrbitSource,
405
- parse,
406
- parseWorldOrbitAtlas,
407
- renderDocumentToScene,
408
- upgradeDocumentToV2,
409
- } from "worldorbit/core";
410
-
411
- const stable = parse(`
412
- system Iyath
413
- star Iyath
414
- planet Naar orbit Iyath distance 1.18au
415
- `.trim());
416
-
417
- const atlasDocument = upgradeDocumentToV2(stable.document, {
418
- preset: "atlas-card",
419
- });
420
-
421
- const atlasSource = formatDocument(atlasDocument, { schema: "2.5" });
422
- const loaded = loadWorldOrbitSource(atlasSource);
423
- const parsedAtlas = parseWorldOrbitAtlas(atlasSource);
424
- const scene = renderDocumentToScene(loaded.document, {
425
- projection: "isometric",
426
- scaleModel: {
427
- orbitDistanceMultiplier: 1.1,
428
- bodyRadiusMultiplier: 1.15,
429
- },
430
- });
431
- ```
432
-
433
- ## Viewer Capabilities
434
-
435
- Viewer features in `v3.0.7` include:
436
-
437
- * scene-based SVG rendering
438
- * renderer-neutral spatial scenes through `renderDocumentToSpatialScene(...)`
439
- * a full 3D viewer mode on the same documents and placements as 2D
440
- * deterministic orbit animation with play, pause, reset, and speed controls
441
- * projections: `topdown`, `isometric`, `orthographic`, and `perspective`
442
- * theme presets: `atlas`, `nightglass`, `ember`
443
- * layer controls for background, guides, orbits, events, objects, labels, metadata, and relations
444
- * selection, hover, focus, fit, pan, zoom, and rotate
445
- * tooltip cards and object detail payloads
446
- * viewpoints, filters, search, and bookmark capture
447
- * deep-linkable atlas state
448
- * embeddable viewer custom elements
449
- * semantic group filters, relation and event overlays, active event scenes, Schema 2.5 camera metadata, and event/object reference-context detail metadata
450
-
451
- ## Markdown Integration
452
-
453
- Use `worldorbit/markdown` to transform fenced `worldorbit` blocks into static output, interactive 2D output, or interactive 3D output.
454
-
455
- ```ts
456
- import rehypeStringify from "rehype-stringify";
457
- import remarkParse from "remark-parse";
458
- import remarkRehype from "remark-rehype";
459
- import { unified } from "unified";
460
-
461
- import { remarkWorldOrbit } from "worldorbit/markdown";
462
-
463
- const html = String(
464
- await unified()
465
- .use(remarkParse)
466
- .use(remarkWorldOrbit, { mode: "interactive-3d" })
467
- .use(remarkRehype, { allowDangerousHtml: true })
468
- .use(rehypeStringify, { allowDangerousHtml: true })
469
- .process(markdownSource),
470
- );
471
- ```
472
-
473
- In the browser:
474
-
475
- ```ts
476
- import { mountWorldOrbitEmbeds } from "worldorbit/viewer";
477
-
478
- mountWorldOrbitEmbeds(document, {
479
- mode: "interactive-3d",
480
- });
481
- ```
482
-
483
- ## Examples
484
-
485
- Examples live in:
486
-
487
- * [examples/minimal.worldorbit](./examples/minimal.worldorbit)
488
- * [examples/minimal-3d.worldorbit](./examples/minimal-3d.worldorbit)
489
- * [examples/showcase-3d.worldorbit](./examples/showcase-3d.worldorbit)
490
- * [examples/schema25-camera.worldorbit](./examples/schema25-camera.worldorbit)
491
- * [examples/schema25-event-snapshot.worldorbit](./examples/schema25-event-snapshot.worldorbit)
492
- * [examples/studio.schema25.worldorbit](./examples/studio.schema25.worldorbit)
493
- * [examples/iyath.worldorbit](./examples/iyath.worldorbit)
494
- * [examples/iyath.schema2.worldorbit](./examples/iyath.schema2.worldorbit)
495
- * [examples/iyath.schema21.worldorbit](./examples/iyath.schema21.worldorbit)
496
- * [examples/iyath.schema2-draft.worldorbit](./examples/iyath.schema2-draft.worldorbit)
497
- * [examples/markdown/static.md](./examples/markdown/static.md)
498
- * [examples/markdown/interactive.md](./examples/markdown/interactive.md)
499
- * [examples/markdown/build.mjs](./examples/markdown/build.mjs)
500
-
501
- Browser-facing examples and demos live in the repository under `demo/`, `studio/`, and `examples/`.
502
-
503
- ## Documentation
504
-
505
- * [migration guide: v0.8 to v1.0](./docs/migration-v0.8-to-v1.0.md)
506
- * [migration guide: v1 to v2](./docs/migration-v1-to-v2.md)
507
- * [migration guide: v2.0 to v2.1](./docs/migration-v2-to-v2.1.md)
508
- * [migration guide: v2.1 to v2.5](./docs/migration-v2.1-to-v2.5.md)
509
- * [migration guide: v2.6 to v3.0](./docs/migration-v2.6-to-v3.0.md)
510
- * [language reference](./docs/language-reference.md)
511
- * [language reference (DE)](./docs/language-reference.de.md)
512
- * [API inventory](./docs/api-inventory.md)
513
- * [changelog](./docs/changelog.md)
514
-
515
- ## Development
516
-
517
- ```bash
518
- npm install
519
- npm run build
520
- npm test
521
- ```
522
-
523
- The workspace builds outputs into package-specific distribution folders and browser bundles.
524
-
525
- Useful notes:
526
-
527
- * `npm run build` compiles all packages and refreshes local package shims
528
- * `npm test` rebuilds first, then runs the regression suite
529
- * the repository remains parser-first: rendering and atlas interaction stay downstream of parse, normalize, and validate
530
-
531
- ## Project Direction
532
-
533
- WorldOrbit is intended as a specialized Mermaid-like solution for fictional orbital systems.
534
-
535
- The long-term focus is:
536
-
537
- * strong text-first authoring
538
- * clean Markdown embedding
539
- * rich static and interactive rendering
540
- * optional visual editing
541
- * stable schema evolution over time
542
-
543
- ## License
544
-
545
- MIT
1
+ # WorldOrbit
2
+
3
+ WorldOrbit is a text-first DSL, viewer, and optional editor platform for fictional orbital systems.
4
+
5
+ It is designed as a specialized Mermaid-like alternative for worldbuilding: you can describe stellar systems in plain text, embed them in Markdown, render them as static diagrams, or explore them interactively with pan, rotate, zoom, and object tooltips.
6
+
7
+ WorldOrbit is built for:
8
+
9
+ - worldbuilding projects
10
+ - Markdown-based lore repositories and CMS setups
11
+ - fictional atlases and codices
12
+ - interactive setting documentation
13
+ - browser-based orbital diagram tooling
14
+
15
+ ## Why WorldOrbit?
16
+
17
+ Generic diagram tools can show relationships, but they are not built for fictional orbital systems.
18
+
19
+ WorldOrbit is designed specifically for:
20
+
21
+ - stars, planets, moons, belts, structures, and phenomena
22
+ - orbit-aware layouts instead of generic node graphs
23
+ - Markdown-native embedding
24
+ - optional interactivity
25
+ - optional visual authoring through Studio
26
+
27
+ WorldOrbit is not intended to be a real-world astronomy simulator or a high-precision astrophysics engine. Its goal is clear, expressive orbital worldbuilding that works well in content workflows.
28
+
29
+ ## Quick Example
30
+
31
+ ```worldorbit
32
+ schema 3.0
33
+
34
+ system Iyath
35
+ title "Iyath System"
36
+ epoch "JY-0001.0"
37
+ referencePlane ecliptic
38
+
39
+ defaults
40
+ view orthographic
41
+ scale presentation
42
+ preset atlas-card
43
+ theme atlas
44
+
45
+ group inner-system
46
+ label "Inner System"
47
+ color #d9b37a
48
+
49
+ viewpoint eclipse
50
+ label "Eclipse View"
51
+ projection perspective
52
+ camera
53
+ azimuth 36
54
+ elevation 22
55
+ distance 6
56
+ layers background guides orbits-back events objects labels metadata
57
+ events naar-eclipse
58
+
59
+ object star Iyath
60
+
61
+ object planet Naar
62
+ orbit Iyath
63
+ semiMajor 1.18au
64
+ eccentricity 0.08
65
+ angle 28deg
66
+ inclination 24deg
67
+ phase 42deg
68
+ atmosphere nitrogen-oxygen
69
+ groups inner-system
70
+
71
+ object moon Seyra
72
+ orbit Naar
73
+ distance 384400km
74
+
75
+ event naar-eclipse
76
+ kind solar-eclipse
77
+ target Naar
78
+ participants Iyath Naar Seyra
79
+ ````
80
+
81
+ ## Installation
82
+
83
+ ### npm
84
+
85
+ ```bash
86
+ npm install worldorbit
87
+ ```
88
+
89
+ ### What the `worldorbit` package contains
90
+
91
+ The published `worldorbit` package is the public entry point.
92
+
93
+ It includes:
94
+
95
+ * the browser bundles
96
+ * subpath exports for core modules
97
+ * the packages used by the viewer, Markdown integration, and editor tooling
98
+
99
+ So for most users, this is enough:
100
+
101
+ ```bash
102
+ npm install worldorbit
103
+ ```
104
+
105
+ And then:
106
+
107
+ ```ts
108
+ import { parse, loadWorldOrbitSource } from "worldorbit";
109
+ import * as Viewer from "worldorbit/viewer";
110
+ ```
111
+
112
+ ## Browser / CDN Quick Setup
113
+
114
+ For direct browser usage, use the browser bundle:
115
+
116
+ ```html
117
+ <!DOCTYPE html>
118
+ <html>
119
+ <head>
120
+ <meta charset="utf-8" />
121
+ <style>
122
+ html, body {
123
+ margin: 0;
124
+ width: 100%;
125
+ height: 100%;
126
+ }
127
+
128
+ #view {
129
+ width: 100vw;
130
+ height: 100vh;
131
+ }
132
+ </style>
133
+ </head>
134
+ <body>
135
+ <div id="view"></div>
136
+
137
+ <script type="module">
138
+ import {
139
+ createInteractiveViewer,
140
+ loadWorldOrbitSource
141
+ } from "https://unpkg.com/worldorbit@4.0.0/dist/unpkg/worldorbit.esm.js";
142
+
143
+ const source = `
144
+ schema 3.0
145
+
146
+ system Iyath
147
+ epoch "JY-0001.0"
148
+
149
+ object star Iyath
150
+ object planet Naar
151
+ orbit Iyath
152
+ semiMajor 1.18au
153
+ `.trim();
154
+
155
+ const loaded = loadWorldOrbitSource(source);
156
+
157
+ createInteractiveViewer(document.getElementById("view"), {
158
+ document: loaded.document
159
+ });
160
+ </script>
161
+ </body>
162
+ </html>
163
+ ```
164
+
165
+ For browser usage today, prefer the ESM entry point `worldorbit.esm.js`.
166
+
167
+ ## Static and Interactive Rendering
168
+
169
+ WorldOrbit can be used in different ways from the same source:
170
+
171
+ * as a static diagram
172
+ * as an interactive SVG viewer
173
+ * inside Markdown pipelines
174
+ * inside the optional Studio editor
175
+
176
+ This means the same WorldOrbit document can be:
177
+
178
+ * written in plain text
179
+ * embedded in Markdown
180
+ * rendered in a documentation page
181
+ * explored interactively
182
+ * edited visually if needed
183
+
184
+ ## Studio Editor
185
+
186
+ WorldOrbit includes an optional Studio editor for easier authoring and exploration.
187
+
188
+ Studio is useful when you want:
189
+
190
+ * visual placement editing
191
+ * source and preview side by side
192
+ * inspector-based editing
193
+ * faster onboarding for non-technical users
194
+
195
+ The editor is optional. The core format remains text-first.
196
+
197
+ ## Canonical Schema
198
+
199
+ New atlas authoring should start with:
200
+
201
+ ```worldorbit
202
+ schema 3.0
203
+ ```
204
+
205
+ Example:
206
+
207
+ ```worldorbit
208
+ schema 3.0
209
+
210
+ system Iyath
211
+ title "Iyath System"
212
+ epoch "JY-0001.0"
213
+ referencePlane ecliptic
214
+
215
+ defaults
216
+ view orthographic
217
+ scale presentation
218
+ preset atlas-card
219
+ theme atlas
220
+
221
+ group inner-system
222
+ label "Inner System"
223
+ summary "Naar and its inhabited infrastructure"
224
+ color #d9b37a
225
+
226
+ viewpoint overview
227
+ label "Atlas Overview"
228
+ summary "Fit the whole system."
229
+ projection orthographic
230
+ camera
231
+ azimuth 24
232
+ elevation 18
233
+ layers background guides orbits-back events objects labels metadata
234
+ events naar-eclipse
235
+ filter
236
+ groups inner-system
237
+
238
+ annotation naar-notes
239
+ label "Naar Notes"
240
+ target Naar
241
+ body "Heimatwelt der Enari."
242
+
243
+ object star Iyath
244
+ mass 1.02sol
245
+
246
+ object planet Naar
247
+ orbit Iyath
248
+ semiMajor 1.18au
249
+ eccentricity 0.08
250
+ angle 28deg
251
+ inclination 24deg
252
+ phase 42deg
253
+ groups inner-system
254
+ image /demo/assets/naar-map.png
255
+ atmosphere nitrogen-oxygen
256
+
257
+ object moon Seyra
258
+ orbit Naar
259
+ distance 384400km
260
+ groups inner-system
261
+
262
+ event naar-eclipse
263
+ kind solar-eclipse
264
+ label "Naar Eclipse"
265
+ target Naar
266
+ participants Iyath Naar Seyra
267
+ epoch "JY-0001.0"
268
+ referencePlane ecliptic
269
+
270
+ positions
271
+ pose Naar
272
+ orbit Iyath
273
+ semiMajor 1.18au
274
+ phase 90deg
275
+
276
+ pose Seyra
277
+ orbit Naar
278
+ distance 384400km
279
+ phase 90deg
280
+ ```
281
+
282
+ ## What's New In Schema 3.0
283
+
284
+ Schema `3.0` keeps Schema `2.6` fully readable and expands WorldOrbit from orbit-only worldbuilding into declarative mission and trajectory authoring.
285
+
286
+ It adds:
287
+
288
+ * a canonical `craft` object type for ships, probes, and stations
289
+ * a declarative `trajectory` top-level block for reusable mission paths
290
+ * trajectory segments for transfers, departures, flybys, captures, escapes, and stationkeeping
291
+ * swing-by and gravity-assist metadata such as `assist`, `turnAngle`, `periapsis`, `deltaV`, and `energy`
292
+ * explicit links between `craft`, `trajectory`, `event`, and `pose` snapshots for curated mission states
293
+ * a solver-friendly data model without forcing the core parser to perform numerical simulation
294
+
295
+ Schema `3.0` still does **not** add a built-in orbital solver, continuous XYZ path authoring, meshes, materials, quaternions, or lighting.
296
+
297
+ Schema `2.6` remains the direct compatibility base, and older documents continue to load through the same parser and normalization pipeline.
298
+
299
+ Stable `1.0` source is still accepted. Canonical `schema 2.0` source remains fully supported, and legacy `schema 2.0-draft` files stay readable as a compatibility path with a deprecation diagnostic.
300
+
301
+ ## Basic Usage
302
+
303
+ ### Parse and load source
304
+
305
+ ```ts
306
+ import {
307
+ loadWorldOrbitSource,
308
+ parse,
309
+ } from "worldorbit";
310
+
311
+ const parsed = parse(`
312
+ system Iyath
313
+ star Iyath
314
+ planet Naar orbit Iyath distance 1.18au
315
+ `.trim());
316
+
317
+ const loaded = loadWorldOrbitSource(`
318
+ schema 3.0
319
+
320
+ system Iyath
321
+ object star Iyath
322
+ object planet Naar
323
+ orbit Iyath
324
+ semiMajor 1.18au
325
+ `.trim());
326
+ ```
327
+
328
+ ### Render a scene
329
+
330
+ ```ts
331
+ import {
332
+ loadWorldOrbitSource,
333
+ renderDocumentToScene,
334
+ } from "worldorbit";
335
+
336
+ const loaded = loadWorldOrbitSource(source);
337
+
338
+ const scene = renderDocumentToScene(loaded.document, {
339
+ projection: "isometric",
340
+ scaleModel: {
341
+ orbitDistanceMultiplier: 1.1,
342
+ bodyRadiusMultiplier: 1.15,
343
+ },
344
+ });
345
+ ```
346
+
347
+ ### Create an interactive viewer
348
+
349
+ ```ts
350
+ import { loadWorldOrbitSource } from "worldorbit";
351
+ import { createInteractiveViewer } from "worldorbit/viewer";
352
+
353
+ const loaded = loadWorldOrbitSource(source);
354
+
355
+ createInteractiveViewer(document.getElementById("preview"), {
356
+ document: loaded.document,
357
+ projection: "isometric",
358
+ theme: "atlas",
359
+ viewMode: "3d",
360
+ });
361
+ ```
362
+
363
+ ## Package Overview
364
+
365
+ WorldOrbit is organized internally as a small ecosystem.
366
+
367
+ ### `worldorbit`
368
+
369
+ Public package entry point with browser bundles and main exports.
370
+
371
+ ### `worldorbit/core`
372
+
373
+ Use this when you need:
374
+
375
+ * parsing
376
+ * normalization
377
+ * validation
378
+ * diagnostics
379
+ * schema loading
380
+ * canonical formatting
381
+ * scene generation
382
+
383
+ ### `worldorbit/viewer`
384
+
385
+ Use this when you need:
386
+
387
+ * static SVG rendering
388
+ * interactive viewing
389
+ * atlas-style exploration
390
+ * themes and embeds
391
+
392
+ ### `worldorbit/markdown`
393
+
394
+ Use this when you want to transform fenced `worldorbit` blocks inside Markdown pipelines.
395
+
396
+ ### `worldorbit/editor`
397
+
398
+ Use this when you want browser-based visual authoring on top of the text format.
399
+
400
+ ## Core Example
401
+
402
+ ```ts
403
+ import {
404
+ formatDocument,
405
+ loadWorldOrbitSource,
406
+ parse,
407
+ parseWorldOrbitAtlas,
408
+ renderDocumentToScene,
409
+ upgradeDocumentToV2,
410
+ } from "worldorbit/core";
411
+
412
+ const stable = parse(`
413
+ system Iyath
414
+ star Iyath
415
+ planet Naar orbit Iyath distance 1.18au
416
+ `.trim());
417
+
418
+ const atlasDocument = upgradeDocumentToV2(stable.document, {
419
+ preset: "atlas-card",
420
+ });
421
+
422
+ const atlasSource = formatDocument(atlasDocument, { schema: "3.0" });
423
+ const loaded = loadWorldOrbitSource(atlasSource);
424
+ const parsedAtlas = parseWorldOrbitAtlas(atlasSource);
425
+ const scene = renderDocumentToScene(loaded.document, {
426
+ projection: "isometric",
427
+ scaleModel: {
428
+ orbitDistanceMultiplier: 1.1,
429
+ bodyRadiusMultiplier: 1.15,
430
+ },
431
+ });
432
+ ```
433
+
434
+ ## Viewer Capabilities
435
+
436
+ Viewer features in `v4.0.0` include:
437
+
438
+ * scene-based SVG rendering
439
+ * renderer-neutral spatial scenes through `renderDocumentToSpatialScene(...)`
440
+ * a full 3D viewer mode on the same documents and placements as 2D
441
+ * deterministic orbit animation with play, pause, reset, and speed controls
442
+ * projections: `topdown`, `isometric`, `orthographic`, and `perspective`
443
+ * theme presets: `atlas`, `nightglass`, `ember`
444
+ * layer controls for background, guides, orbits, events, objects, labels, metadata, and relations
445
+ * selection, hover, focus, fit, pan, zoom, and rotate
446
+ * tooltip cards and object detail payloads
447
+ * viewpoints, filters, search, and bookmark capture
448
+ * deep-linkable atlas state
449
+ * embeddable viewer custom elements
450
+ * semantic group filters, relation and event overlays, active event scenes, Schema 3.0 camera metadata, mission trajectory overlays, and event/object reference-context detail metadata
451
+
452
+ ## Markdown Integration
453
+
454
+ Use `worldorbit/markdown` to transform fenced `worldorbit` blocks into static output, interactive 2D output, or interactive 3D output.
455
+
456
+ ```ts
457
+ import rehypeStringify from "rehype-stringify";
458
+ import remarkParse from "remark-parse";
459
+ import remarkRehype from "remark-rehype";
460
+ import { unified } from "unified";
461
+
462
+ import { remarkWorldOrbit } from "worldorbit/markdown";
463
+
464
+ const html = String(
465
+ await unified()
466
+ .use(remarkParse)
467
+ .use(remarkWorldOrbit, { mode: "interactive-3d" })
468
+ .use(remarkRehype, { allowDangerousHtml: true })
469
+ .use(rehypeStringify, { allowDangerousHtml: true })
470
+ .process(markdownSource),
471
+ );
472
+ ```
473
+
474
+ In the browser:
475
+
476
+ ```ts
477
+ import { mountWorldOrbitEmbeds } from "worldorbit/viewer";
478
+
479
+ mountWorldOrbitEmbeds(document, {
480
+ mode: "interactive-3d",
481
+ });
482
+ ```
483
+
484
+ ## Examples
485
+
486
+ Examples live in:
487
+
488
+ * [examples/minimal.worldorbit](./examples/minimal.worldorbit)
489
+ * [examples/minimal-3d.worldorbit](./examples/minimal-3d.worldorbit)
490
+ * [examples/showcase-3d.worldorbit](./examples/showcase-3d.worldorbit)
491
+ * [examples/schema25-camera.worldorbit](./examples/schema25-camera.worldorbit)
492
+ * [examples/schema25-event-snapshot.worldorbit](./examples/schema25-event-snapshot.worldorbit)
493
+ * [examples/studio.schema25.worldorbit](./examples/studio.schema25.worldorbit)
494
+ * [examples/iyath.worldorbit](./examples/iyath.worldorbit)
495
+ * [examples/iyath.schema2.worldorbit](./examples/iyath.schema2.worldorbit)
496
+ * [examples/iyath.schema21.worldorbit](./examples/iyath.schema21.worldorbit)
497
+ * [examples/iyath.schema2-draft.worldorbit](./examples/iyath.schema2-draft.worldorbit)
498
+ * [examples/markdown/static.md](./examples/markdown/static.md)
499
+ * [examples/markdown/interactive.md](./examples/markdown/interactive.md)
500
+ * [examples/markdown/build.mjs](./examples/markdown/build.mjs)
501
+
502
+ Browser-facing examples and demos live in the repository under `demo/`, `studio/`, and `examples/`.
503
+
504
+ ## Documentation
505
+
506
+ * [migration guide: v0.8 to v1.0](./docs/migration-v0.8-to-v1.0.md)
507
+ * [migration guide: v1 to v2](./docs/migration-v1-to-v2.md)
508
+ * [migration guide: v2.0 to v2.1](./docs/migration-v2-to-v2.1.md)
509
+ * [migration guide: v2.1 to v2.5](./docs/migration-v2.1-to-v2.5.md)
510
+ * [migration guide: v2.6 to v3.0](./docs/migration-v2.6-to-v3.0.md)
511
+ * [language reference](./docs/language-reference.md)
512
+ * [language reference (DE)](./docs/language-reference.de.md)
513
+ * [API inventory](./docs/api-inventory.md)
514
+ * [changelog](./docs/changelog.md)
515
+
516
+ ## Development
517
+
518
+ ```bash
519
+ npm install
520
+ npm run build
521
+ npm test
522
+ ```
523
+
524
+ The workspace builds outputs into package-specific distribution folders and browser bundles.
525
+
526
+ Useful notes:
527
+
528
+ * `npm run build` compiles all packages and refreshes local package shims
529
+ * `npm test` rebuilds first, then runs the regression suite
530
+ * the repository remains parser-first: rendering and atlas interaction stay downstream of parse, normalize, and validate
531
+
532
+ ## Project Direction
533
+
534
+ WorldOrbit is intended as a specialized Mermaid-like solution for fictional orbital systems.
535
+
536
+ The long-term focus is:
537
+
538
+ * strong text-first authoring
539
+ * clean Markdown embedding
540
+ * rich static and interactive rendering
541
+ * optional visual editing
542
+ * stable schema evolution over time
543
+
544
+ ## License
545
+
546
+ MIT