worldorbit 2.5.1-5.2

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 (117) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +468 -0
  3. package/dist/browser/core/dist/index.js +4009 -0
  4. package/dist/browser/markdown/dist/index.js +3951 -0
  5. package/dist/browser/viewer/dist/index.js +5981 -0
  6. package/dist/constants.d.ts +8 -0
  7. package/dist/constants.js +84 -0
  8. package/dist/errors.d.ts +7 -0
  9. package/dist/errors.js +16 -0
  10. package/dist/index.d.ts +18 -0
  11. package/dist/index.js +25 -0
  12. package/dist/normalize.d.ts +2 -0
  13. package/dist/normalize.js +243 -0
  14. package/dist/parse.d.ts +2 -0
  15. package/dist/parse.js +126 -0
  16. package/dist/render.d.ts +6 -0
  17. package/dist/render.js +683 -0
  18. package/dist/tokenize.d.ts +4 -0
  19. package/dist/tokenize.js +68 -0
  20. package/dist/types.d.ts +208 -0
  21. package/dist/types.js +1 -0
  22. package/dist/unpkg/core/dist/index.js +4081 -0
  23. package/dist/unpkg/markdown/dist/index.js +3979 -0
  24. package/dist/unpkg/viewer/dist/index.js +6038 -0
  25. package/dist/unpkg/worldorbit-core.min.js +12 -0
  26. package/dist/unpkg/worldorbit-markdown.min.js +95 -0
  27. package/dist/unpkg/worldorbit-viewer.min.js +251 -0
  28. package/dist/unpkg/worldorbit.d.ts +2 -0
  29. package/dist/unpkg/worldorbit.esm.js +2 -0
  30. package/dist/unpkg/worldorbit.js +8524 -0
  31. package/dist/unpkg/worldorbit.min.js +255 -0
  32. package/dist/validate.d.ts +2 -0
  33. package/dist/validate.js +31 -0
  34. package/dist/viewer-state.d.ts +16 -0
  35. package/dist/viewer-state.js +130 -0
  36. package/dist/viewer.d.ts +2 -0
  37. package/dist/viewer.js +434 -0
  38. package/package.json +68 -0
  39. package/packages/core/README.md +17 -0
  40. package/packages/core/dist/atlas-edit.d.ts +11 -0
  41. package/packages/core/dist/atlas-edit.js +273 -0
  42. package/packages/core/dist/atlas-utils.d.ts +22 -0
  43. package/packages/core/dist/atlas-utils.js +189 -0
  44. package/packages/core/dist/atlas-validate.d.ts +2 -0
  45. package/packages/core/dist/atlas-validate.js +285 -0
  46. package/packages/core/dist/diagnostics.d.ts +10 -0
  47. package/packages/core/dist/diagnostics.js +109 -0
  48. package/packages/core/dist/draft-parse.d.ts +3 -0
  49. package/packages/core/dist/draft-parse.js +1275 -0
  50. package/packages/core/dist/draft.d.ts +18 -0
  51. package/packages/core/dist/draft.js +387 -0
  52. package/packages/core/dist/errors.d.ts +7 -0
  53. package/packages/core/dist/errors.js +16 -0
  54. package/packages/core/dist/format.d.ts +4 -0
  55. package/packages/core/dist/format.js +520 -0
  56. package/packages/core/dist/index.d.ts +28 -0
  57. package/packages/core/dist/index.js +44 -0
  58. package/packages/core/dist/load.d.ts +4 -0
  59. package/packages/core/dist/load.js +175 -0
  60. package/packages/core/dist/markdown.d.ts +2 -0
  61. package/packages/core/dist/markdown.js +37 -0
  62. package/packages/core/dist/normalize.d.ts +2 -0
  63. package/packages/core/dist/normalize.js +311 -0
  64. package/packages/core/dist/parse.d.ts +2 -0
  65. package/packages/core/dist/parse.js +133 -0
  66. package/packages/core/dist/scene.d.ts +3 -0
  67. package/packages/core/dist/scene.js +1565 -0
  68. package/packages/core/dist/schema.d.ts +8 -0
  69. package/packages/core/dist/schema.js +298 -0
  70. package/packages/core/dist/tokenize.d.ts +4 -0
  71. package/packages/core/dist/tokenize.js +68 -0
  72. package/packages/core/dist/types.d.ts +476 -0
  73. package/packages/core/dist/types.js +1 -0
  74. package/packages/core/dist/validate.d.ts +2 -0
  75. package/packages/core/dist/validate.js +56 -0
  76. package/packages/editor/dist/editor.d.ts +2 -0
  77. package/packages/editor/dist/editor.js +3042 -0
  78. package/packages/editor/dist/index.d.ts +2 -0
  79. package/packages/editor/dist/index.js +1 -0
  80. package/packages/editor/dist/types.d.ts +53 -0
  81. package/packages/editor/dist/types.js +1 -0
  82. package/packages/markdown/README.md +9 -0
  83. package/packages/markdown/dist/html.d.ts +3 -0
  84. package/packages/markdown/dist/html.js +57 -0
  85. package/packages/markdown/dist/index.d.ts +4 -0
  86. package/packages/markdown/dist/index.js +3 -0
  87. package/packages/markdown/dist/rehype.d.ts +10 -0
  88. package/packages/markdown/dist/rehype.js +49 -0
  89. package/packages/markdown/dist/remark.d.ts +9 -0
  90. package/packages/markdown/dist/remark.js +28 -0
  91. package/packages/markdown/dist/types.d.ts +11 -0
  92. package/packages/markdown/dist/types.js +1 -0
  93. package/packages/viewer/README.md +13 -0
  94. package/packages/viewer/dist/atlas-state.d.ts +12 -0
  95. package/packages/viewer/dist/atlas-state.js +257 -0
  96. package/packages/viewer/dist/atlas-viewer.d.ts +2 -0
  97. package/packages/viewer/dist/atlas-viewer.js +482 -0
  98. package/packages/viewer/dist/custom-element.d.ts +1 -0
  99. package/packages/viewer/dist/custom-element.js +64 -0
  100. package/packages/viewer/dist/embed.d.ts +20 -0
  101. package/packages/viewer/dist/embed.js +138 -0
  102. package/packages/viewer/dist/index.d.ts +9 -0
  103. package/packages/viewer/dist/index.js +8 -0
  104. package/packages/viewer/dist/minimap.d.ts +3 -0
  105. package/packages/viewer/dist/minimap.js +63 -0
  106. package/packages/viewer/dist/render.d.ts +6 -0
  107. package/packages/viewer/dist/render.js +641 -0
  108. package/packages/viewer/dist/theme.d.ts +4 -0
  109. package/packages/viewer/dist/theme.js +102 -0
  110. package/packages/viewer/dist/tooltip.d.ts +3 -0
  111. package/packages/viewer/dist/tooltip.js +189 -0
  112. package/packages/viewer/dist/types.d.ts +263 -0
  113. package/packages/viewer/dist/types.js +1 -0
  114. package/packages/viewer/dist/viewer-state.d.ts +19 -0
  115. package/packages/viewer/dist/viewer-state.js +162 -0
  116. package/packages/viewer/dist/viewer.d.ts +2 -0
  117. package/packages/viewer/dist/viewer.js +1175 -0
package/LICENSE.md ADDED
@@ -0,0 +1,5 @@
1
+ Copyright 2026 Hanjo Winter
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.
4
+
5
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,468 @@
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.1
33
+
34
+ system Iyath
35
+ title "Iyath System"
36
+ epoch "JY-0001.0"
37
+ referencePlane ecliptic
38
+
39
+ defaults
40
+ view isometric
41
+ scale presentation
42
+ preset atlas-card
43
+ theme atlas
44
+
45
+ group inner-system
46
+ label "Inner System"
47
+ color #d9b37a
48
+
49
+ object star Iyath
50
+
51
+ object planet Naar
52
+ orbit Iyath
53
+ semiMajor 1.18au
54
+ eccentricity 0.08
55
+ angle 28deg
56
+ inclination 24deg
57
+ phase 42deg
58
+ atmosphere nitrogen-oxygen
59
+ groups inner-system
60
+ ````
61
+
62
+ ## Installation
63
+
64
+ ### npm
65
+
66
+ ```bash
67
+ npm install worldorbit
68
+ ```
69
+
70
+ ### What the `worldorbit` package contains
71
+
72
+ The published `worldorbit` package is the public entry point.
73
+
74
+ It includes:
75
+
76
+ * the browser bundles
77
+ * subpath exports for core modules
78
+ * the packages used by the viewer, Markdown integration, and editor tooling
79
+
80
+ So for most users, this is enough:
81
+
82
+ ```bash
83
+ npm install worldorbit
84
+ ```
85
+
86
+ And then:
87
+
88
+ ```ts
89
+ import { parse, loadWorldOrbitSource } from "worldorbit";
90
+ import * as Viewer from "worldorbit/viewer";
91
+ ```
92
+
93
+ ## Browser / CDN Quick Setup
94
+
95
+ For direct browser usage, use the browser bundle:
96
+
97
+ ```html
98
+ <!DOCTYPE html>
99
+ <html>
100
+ <head>
101
+ <meta charset="utf-8" />
102
+ <script src="https://unpkg.com/worldorbit/dist/unpkg/worldorbit.min.js"></script>
103
+ <style>
104
+ html, body {
105
+ margin: 0;
106
+ width: 100%;
107
+ height: 100%;
108
+ }
109
+
110
+ #view {
111
+ width: 100vw;
112
+ height: 100vh;
113
+ }
114
+ </style>
115
+ </head>
116
+ <body>
117
+ <div id="view"></div>
118
+
119
+ <script>
120
+ const source = `
121
+ schema 2.1
122
+
123
+ system Iyath
124
+ epoch "JY-0001.0"
125
+
126
+ object star Iyath
127
+ object planet Naar
128
+ orbit Iyath
129
+ semiMajor 1.18au
130
+ `.trim();
131
+
132
+ const loaded = WorldOrbit.loadWorldOrbitSource(source);
133
+
134
+ WorldOrbit.createInteractiveViewer(document.getElementById("view"), {
135
+ document: loaded.document
136
+ });
137
+ </script>
138
+ </body>
139
+ </html>
140
+ ```
141
+
142
+ For browser usage, `worldorbit.min.js` is the recommended public entry point.
143
+
144
+ ## Static and Interactive Rendering
145
+
146
+ WorldOrbit can be used in different ways from the same source:
147
+
148
+ * as a static diagram
149
+ * as an interactive SVG viewer
150
+ * inside Markdown pipelines
151
+ * inside the optional Studio editor
152
+
153
+ This means the same WorldOrbit document can be:
154
+
155
+ * written in plain text
156
+ * embedded in Markdown
157
+ * rendered in a documentation page
158
+ * explored interactively
159
+ * edited visually if needed
160
+
161
+ ## Studio Editor
162
+
163
+ WorldOrbit includes an optional Studio editor for easier authoring and exploration.
164
+
165
+ Studio is useful when you want:
166
+
167
+ * visual placement editing
168
+ * source and preview side by side
169
+ * inspector-based editing
170
+ * faster onboarding for non-technical users
171
+
172
+ The editor is optional. The core format remains text-first.
173
+
174
+ ## Canonical Schema
175
+
176
+ New atlas authoring should start with:
177
+
178
+ ```worldorbit
179
+ schema 2.1
180
+ ```
181
+
182
+ Example:
183
+
184
+ ```worldorbit
185
+ schema 2.1
186
+
187
+ system Iyath
188
+ title "Iyath System"
189
+ epoch "JY-0001.0"
190
+ referencePlane ecliptic
191
+
192
+ defaults
193
+ view isometric
194
+ scale presentation
195
+ preset atlas-card
196
+ theme atlas
197
+
198
+ group inner-system
199
+ label "Inner System"
200
+ summary "Naar and its inhabited infrastructure"
201
+ color #d9b37a
202
+
203
+ viewpoint overview
204
+ label "Atlas Overview"
205
+ summary "Fit the whole system."
206
+ projection isometric
207
+ filter
208
+ groups inner-system
209
+
210
+ annotation naar-notes
211
+ label "Naar Notes"
212
+ target Naar
213
+ body "Heimatwelt der Enari."
214
+
215
+ object star Iyath
216
+ mass 1.02sol
217
+
218
+ object planet Naar
219
+ orbit Iyath
220
+ semiMajor 1.18au
221
+ eccentricity 0.08
222
+ angle 28deg
223
+ inclination 24deg
224
+ phase 42deg
225
+ groups inner-system
226
+ image /demo/assets/naar-map.png
227
+ atmosphere nitrogen-oxygen
228
+ ```
229
+
230
+ Schema `2.1` adds comments, semantic `group` and `relation` sections, object-level `epoch` and `referencePlane`, declarative resonance and validation hints, and optional structured lore blocks such as `climate`, `habitability`, and `settlement`.
231
+
232
+ 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.
233
+
234
+ ## Basic Usage
235
+
236
+ ### Parse and load source
237
+
238
+ ```ts
239
+ import {
240
+ loadWorldOrbitSource,
241
+ parse,
242
+ } from "worldorbit";
243
+
244
+ const parsed = parse(`
245
+ system Iyath
246
+ star Iyath
247
+ planet Naar orbit Iyath distance 1.18au
248
+ `.trim());
249
+
250
+ const loaded = loadWorldOrbitSource(`
251
+ schema 2.1
252
+
253
+ system Iyath
254
+ object star Iyath
255
+ object planet Naar
256
+ orbit Iyath
257
+ semiMajor 1.18au
258
+ `.trim());
259
+ ```
260
+
261
+ ### Render a scene
262
+
263
+ ```ts
264
+ import {
265
+ loadWorldOrbitSource,
266
+ renderDocumentToScene,
267
+ } from "worldorbit";
268
+
269
+ const loaded = loadWorldOrbitSource(source);
270
+
271
+ const scene = renderDocumentToScene(loaded.document, {
272
+ projection: "isometric",
273
+ scaleModel: {
274
+ orbitDistanceMultiplier: 1.1,
275
+ bodyRadiusMultiplier: 1.15,
276
+ },
277
+ });
278
+ ```
279
+
280
+ ### Create an interactive viewer
281
+
282
+ ```ts
283
+ import { loadWorldOrbitSource } from "worldorbit";
284
+ import { createInteractiveViewer } from "worldorbit/viewer";
285
+
286
+ const loaded = loadWorldOrbitSource(source);
287
+
288
+ createInteractiveViewer(document.getElementById("preview"), {
289
+ document: loaded.document,
290
+ projection: "isometric",
291
+ theme: "atlas",
292
+ });
293
+ ```
294
+
295
+ ## Package Overview
296
+
297
+ WorldOrbit is organized internally as a small ecosystem.
298
+
299
+ ### `worldorbit`
300
+
301
+ Public package entry point with browser bundles and main exports.
302
+
303
+ ### `worldorbit/core`
304
+
305
+ Use this when you need:
306
+
307
+ * parsing
308
+ * normalization
309
+ * validation
310
+ * diagnostics
311
+ * schema loading
312
+ * canonical formatting
313
+ * scene generation
314
+
315
+ ### `worldorbit/viewer`
316
+
317
+ Use this when you need:
318
+
319
+ * static SVG rendering
320
+ * interactive viewing
321
+ * atlas-style exploration
322
+ * themes and embeds
323
+
324
+ ### `worldorbit/markdown`
325
+
326
+ Use this when you want to transform fenced `worldorbit` blocks inside Markdown pipelines.
327
+
328
+ ### `worldorbit/editor`
329
+
330
+ Use this when you want browser-based visual authoring on top of the text format.
331
+
332
+ ## Core Example
333
+
334
+ ```ts
335
+ import {
336
+ formatDocument,
337
+ loadWorldOrbitSource,
338
+ parse,
339
+ parseWorldOrbitAtlas,
340
+ renderDocumentToScene,
341
+ upgradeDocumentToV2,
342
+ } from "worldorbit/core";
343
+
344
+ const stable = parse(`
345
+ system Iyath
346
+ star Iyath
347
+ planet Naar orbit Iyath distance 1.18au
348
+ `.trim());
349
+
350
+ const atlasDocument = upgradeDocumentToV2(stable.document, {
351
+ preset: "atlas-card",
352
+ });
353
+
354
+ const atlasSource = formatDocument(atlasDocument, { schema: "2.1" });
355
+ const loaded = loadWorldOrbitSource(atlasSource);
356
+ const parsedAtlas = parseWorldOrbitAtlas(atlasSource);
357
+ const scene = renderDocumentToScene(loaded.document, {
358
+ projection: "isometric",
359
+ scaleModel: {
360
+ orbitDistanceMultiplier: 1.1,
361
+ bodyRadiusMultiplier: 1.15,
362
+ },
363
+ });
364
+ ```
365
+
366
+ ## Viewer Capabilities
367
+
368
+ Viewer features in `v2.5` include:
369
+
370
+ * scene-based SVG rendering
371
+ * projections: `topdown` and `isometric`
372
+ * theme presets: `atlas`, `nightglass`, `ember`
373
+ * layer controls for background, guides, orbits, objects, labels, metadata, and relations
374
+ * selection, hover, focus, fit, pan, zoom, and rotate
375
+ * tooltip cards and object detail payloads
376
+ * viewpoints, filters, search, and bookmark capture
377
+ * deep-linkable atlas state
378
+ * embeddable viewer custom elements
379
+ * semantic group filters, relation overlays, and schema 2.1 detail metadata
380
+
381
+ ## Markdown Integration
382
+
383
+ Use `worldorbit/markdown` to transform fenced `worldorbit` blocks into static or interactive output.
384
+
385
+ ```ts
386
+ import rehypeStringify from "rehype-stringify";
387
+ import remarkParse from "remark-parse";
388
+ import remarkRehype from "remark-rehype";
389
+ import { unified } from "unified";
390
+
391
+ import { remarkWorldOrbit } from "worldorbit/markdown";
392
+
393
+ const html = String(
394
+ await unified()
395
+ .use(remarkParse)
396
+ .use(remarkWorldOrbit, { mode: "interactive" })
397
+ .use(remarkRehype, { allowDangerousHtml: true })
398
+ .use(rehypeStringify, { allowDangerousHtml: true })
399
+ .process(markdownSource),
400
+ );
401
+ ```
402
+
403
+ In the browser:
404
+
405
+ ```ts
406
+ import { mountWorldOrbitEmbeds } from "worldorbit/viewer";
407
+
408
+ mountWorldOrbitEmbeds(document, {
409
+ mode: "interactive",
410
+ });
411
+ ```
412
+
413
+ ## Examples
414
+
415
+ Examples live in:
416
+
417
+ * [examples/minimal.worldorbit](./examples/minimal.worldorbit)
418
+ * [examples/iyath.worldorbit](./examples/iyath.worldorbit)
419
+ * [examples/iyath.schema2.worldorbit](./examples/iyath.schema2.worldorbit)
420
+ * [examples/iyath.schema21.worldorbit](./examples/iyath.schema21.worldorbit)
421
+ * [examples/iyath.schema2-draft.worldorbit](./examples/iyath.schema2-draft.worldorbit)
422
+ * [examples/markdown/static.md](./examples/markdown/static.md)
423
+ * [examples/markdown/interactive.md](./examples/markdown/interactive.md)
424
+ * [examples/markdown/build.mjs](./examples/markdown/build.mjs)
425
+
426
+ Browser-facing examples and demos live in the repository under `demo/`, `studio/`, and `examples/`.
427
+
428
+ ## Documentation
429
+
430
+ * [migration guide: v0.8 to v1.0](./docs/migration-v0.8-to-v1.0.md)
431
+ * [migration guide: v1 to v2](./docs/migration-v1-to-v2.md)
432
+ * [migration guide: v2.0 to v2.1](./docs/migration-v2-to-v2.1.md)
433
+ * [language reference](./docs/language-reference.md)
434
+ * [language reference (DE)](./docs/language-reference.de.md)
435
+ * [API inventory](./docs/api-inventory.md)
436
+ * [changelog](./docs/changelog.md)
437
+
438
+ ## Development
439
+
440
+ ```bash
441
+ npm install
442
+ npm run build
443
+ npm test
444
+ ```
445
+
446
+ The workspace builds outputs into package-specific distribution folders and browser bundles.
447
+
448
+ Useful notes:
449
+
450
+ * `npm run build` compiles all packages and refreshes local package shims
451
+ * `npm test` rebuilds first, then runs the regression suite
452
+ * the repository remains parser-first: rendering and atlas interaction stay downstream of parse, normalize, and validate
453
+
454
+ ## Project Direction
455
+
456
+ WorldOrbit is intended as a specialized Mermaid-like solution for fictional orbital systems.
457
+
458
+ The long-term focus is:
459
+
460
+ * strong text-first authoring
461
+ * clean Markdown embedding
462
+ * rich static and interactive rendering
463
+ * optional visual editing
464
+ * stable schema evolution over time
465
+
466
+ ## License
467
+
468
+ MIT