worldorbit 2.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 (113) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +250 -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/test.html +1 -0
  25. package/dist/unpkg/viewer/dist/index.js +6038 -0
  26. package/dist/unpkg/worldorbit-core.min.js +5 -0
  27. package/dist/unpkg/worldorbit-markdown.min.js +81 -0
  28. package/dist/unpkg/worldorbit-viewer.min.js +232 -0
  29. package/dist/unpkg/worldorbit.d.ts +2 -0
  30. package/dist/unpkg/worldorbit.js +2 -0
  31. package/dist/unpkg/worldorbit.min.js +236 -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 +64 -0
  39. package/packages/core/README.md +13 -0
  40. package/packages/core/dist/atlas-edit.d.ts +11 -0
  41. package/packages/core/dist/atlas-edit.js +210 -0
  42. package/packages/core/dist/diagnostics.d.ts +10 -0
  43. package/packages/core/dist/diagnostics.js +109 -0
  44. package/packages/core/dist/draft-parse.d.ts +3 -0
  45. package/packages/core/dist/draft-parse.js +642 -0
  46. package/packages/core/dist/draft.d.ts +15 -0
  47. package/packages/core/dist/draft.js +343 -0
  48. package/packages/core/dist/errors.d.ts +7 -0
  49. package/packages/core/dist/errors.js +16 -0
  50. package/packages/core/dist/format.d.ts +4 -0
  51. package/packages/core/dist/format.js +364 -0
  52. package/packages/core/dist/index.d.ts +28 -0
  53. package/packages/core/dist/index.js +44 -0
  54. package/packages/core/dist/load.d.ts +4 -0
  55. package/packages/core/dist/load.js +130 -0
  56. package/packages/core/dist/markdown.d.ts +2 -0
  57. package/packages/core/dist/markdown.js +37 -0
  58. package/packages/core/dist/normalize.d.ts +2 -0
  59. package/packages/core/dist/normalize.js +304 -0
  60. package/packages/core/dist/parse.d.ts +2 -0
  61. package/packages/core/dist/parse.js +133 -0
  62. package/packages/core/dist/scene.d.ts +3 -0
  63. package/packages/core/dist/scene.js +1484 -0
  64. package/packages/core/dist/schema.d.ts +8 -0
  65. package/packages/core/dist/schema.js +298 -0
  66. package/packages/core/dist/tokenize.d.ts +4 -0
  67. package/packages/core/dist/tokenize.js +68 -0
  68. package/packages/core/dist/types.d.ts +382 -0
  69. package/packages/core/dist/types.js +1 -0
  70. package/packages/core/dist/validate.d.ts +2 -0
  71. package/packages/core/dist/validate.js +56 -0
  72. package/packages/editor/dist/editor.d.ts +2 -0
  73. package/packages/editor/dist/editor.js +2620 -0
  74. package/packages/editor/dist/index.d.ts +2 -0
  75. package/packages/editor/dist/index.js +1 -0
  76. package/packages/editor/dist/types.d.ts +53 -0
  77. package/packages/editor/dist/types.js +1 -0
  78. package/packages/markdown/README.md +9 -0
  79. package/packages/markdown/dist/html.d.ts +3 -0
  80. package/packages/markdown/dist/html.js +57 -0
  81. package/packages/markdown/dist/index.d.ts +4 -0
  82. package/packages/markdown/dist/index.js +3 -0
  83. package/packages/markdown/dist/rehype.d.ts +10 -0
  84. package/packages/markdown/dist/rehype.js +49 -0
  85. package/packages/markdown/dist/remark.d.ts +9 -0
  86. package/packages/markdown/dist/remark.js +28 -0
  87. package/packages/markdown/dist/types.d.ts +11 -0
  88. package/packages/markdown/dist/types.js +1 -0
  89. package/packages/viewer/README.md +12 -0
  90. package/packages/viewer/dist/atlas-state.d.ts +12 -0
  91. package/packages/viewer/dist/atlas-state.js +251 -0
  92. package/packages/viewer/dist/atlas-viewer.d.ts +2 -0
  93. package/packages/viewer/dist/atlas-viewer.js +448 -0
  94. package/packages/viewer/dist/custom-element.d.ts +1 -0
  95. package/packages/viewer/dist/custom-element.js +64 -0
  96. package/packages/viewer/dist/embed.d.ts +20 -0
  97. package/packages/viewer/dist/embed.js +138 -0
  98. package/packages/viewer/dist/index.d.ts +9 -0
  99. package/packages/viewer/dist/index.js +8 -0
  100. package/packages/viewer/dist/minimap.d.ts +3 -0
  101. package/packages/viewer/dist/minimap.js +63 -0
  102. package/packages/viewer/dist/render.d.ts +6 -0
  103. package/packages/viewer/dist/render.js +585 -0
  104. package/packages/viewer/dist/theme.d.ts +4 -0
  105. package/packages/viewer/dist/theme.js +98 -0
  106. package/packages/viewer/dist/tooltip.d.ts +3 -0
  107. package/packages/viewer/dist/tooltip.js +154 -0
  108. package/packages/viewer/dist/types.d.ts +256 -0
  109. package/packages/viewer/dist/types.js +1 -0
  110. package/packages/viewer/dist/viewer-state.d.ts +19 -0
  111. package/packages/viewer/dist/viewer-state.js +162 -0
  112. package/packages/viewer/dist/viewer.d.ts +2 -0
  113. package/packages/viewer/dist/viewer.js +1156 -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,250 @@
1
+ # WorldOrbit
2
+
3
+ **WorldOrbit is a text-first DSL, atlas viewer, and editor platform for fictional orbital systems.**
4
+
5
+ Built for worldbuilders, sci-fi authors, game designers, and hobbyists, WorldOrbit makes it easy to design, visualize, and share complex stellar systems without getting tangled in node-spaghetti or hard math.
6
+
7
+ With `v2.5`, WorldOrbit provides a production-ready authoring baseline that turns simple text into interactive, beautiful system atlases.
8
+
9
+ ## Why WorldOrbit?
10
+
11
+ - **Text-First & Git-Friendly**: Write your systems in a simple, human-readable Domain Specific Language (DSL). Perfect for version control and Markdown integration.
12
+ - **Relational by Position**: No complex edge types or manual graph drawing. You define where an object is (`orbit`, `at`, `surface`, `free`), and the relationships emerge naturally.
13
+ - **Lore Meets Data**: An intuitive `info` block allows you to attach narrative metadata (factions, population, climate) directly to the physical bodies.
14
+ - **Beautiful Results**: The built-in viewer renders your text into interactive SVG atlases with themes, viewpoints, and rich tooltips.
15
+
16
+ ## ⚡ Quick Example
17
+
18
+ Here is how simple it is to build a star system:
19
+
20
+ ```worldorbit
21
+ schema 2.0
22
+
23
+ system Iyath
24
+ title "Iyath System"
25
+
26
+ defaults
27
+ view isometric
28
+ scale presentation
29
+ preset atlas-card
30
+ theme atlas
31
+
32
+ star Iyath
33
+
34
+ planet Naar
35
+ orbit Iyath
36
+ semiMajor 1.18au
37
+ period 412d
38
+
39
+ info
40
+ faction "Veyrathische Republik"
41
+ population "8.4 billion"
42
+ description "Heimatwelt der Enari."
43
+ ```
44
+
45
+ ## The Studio Editor
46
+
47
+ The easiest way to get started is the **WorldOrbit Studio**, our browser-based authoring environment.
48
+
49
+ Capabilities include:
50
+ - Interactive 2D stage with themes (`atlas`, `nightglass`, `ember`).
51
+ - Live inspector editing for system defaults, viewpoints, annotations, and object properties.
52
+ - Direct manipulation handles for `orbit`, `at`, `surface`, and `free` placements.
53
+ - Split-pane view with live source synchronization.
54
+ - Export to static SVG or interactive Embeds.
55
+
56
+ **[Try the browser demo](/demo/index.html)**
57
+ **[Open Studio Editor](/studio/index.html)**
58
+
59
+ ---
60
+
61
+ ## Quick Setup (Browser/CDN)
62
+
63
+ You don't need a Node.js project to use WorldOrbit. You can drop it directly into any HTML file using our pre-built bundles! Let WorldOrbit parse your data and initialize an interactive atlas directly from a single script block.
64
+
65
+ ```html
66
+ <!DOCTYPE html>
67
+ <html>
68
+ <head>
69
+ <style>
70
+ #view { width: 100vw; height: 100vh; }
71
+ </style>
72
+ <!-- Include WorldOrbit pre-bundled library -->
73
+ <script src="https://unpkg.com/worldorbit@2.5.2/dist/unpkg/worldorbit.min.js"></script>
74
+ </head>
75
+ <body>
76
+ <div id="view"></div>
77
+ <script>
78
+ const source = `
79
+ system Iyath
80
+ star Iyath
81
+ planet Naar orbit Iyath distance 1.18au period 412d
82
+ `;
83
+
84
+ const parsed = WorldOrbit.loadWorldOrbitSource(source);
85
+ WorldOrbit.createInteractiveViewer(document.getElementById('view'), {
86
+ document: parsed.document
87
+ });
88
+ </script>
89
+ </body>
90
+ </html>
91
+ ```
92
+
93
+ ---
94
+
95
+ ## For Developers: The Ecosystem
96
+
97
+ Under the hood, WorldOrbit is a monorepo offering several packages to integrate orbital worldbuilding into your own tools, games, or sites.
98
+
99
+ ### `@worldorbit/core`
100
+ The engine room. Use `core` when you need language tooling, schema conversion, diagnostics, or scene generation.
101
+ - Parsing, normalization, validation, and AST generation.
102
+ - Turn WorldOrbit source into a structured document and stable render scene.
103
+
104
+ <details>
105
+ <summary><b>Show Example Usage</b></summary>
106
+
107
+ ```ts
108
+ import {
109
+ formatDocument,
110
+ loadWorldOrbitSource,
111
+ parse,
112
+ parseWorldOrbitAtlas,
113
+ renderDocumentToScene,
114
+ upgradeDocumentToV2,
115
+ } from "@worldorbit/core";
116
+
117
+ const stable = parse(`
118
+ system Iyath
119
+ star Iyath
120
+ planet Naar orbit Iyath distance 1.18au
121
+ `.trim());
122
+
123
+ // Upgrade and format
124
+ const atlasDocument = upgradeDocumentToV2(stable.document, { preset: "atlas-card" });
125
+ const atlasSource = formatDocument(atlasDocument, { schema: "2.0" });
126
+
127
+ // Load and render
128
+ const loaded = loadWorldOrbitSource(atlasSource);
129
+ const scene = renderDocumentToScene(loaded.document, {
130
+ projection: "isometric",
131
+ scaleModel: {
132
+ orbitDistanceMultiplier: 1.1,
133
+ bodyRadiusMultiplier: 1.15,
134
+ },
135
+ });
136
+ ```
137
+ </details>
138
+
139
+ ### `@worldorbit/viewer`
140
+ The presentation layer. Use `viewer` for SVG output, atlas navigation, embeds, and browser interactivity.
141
+ - Scene-based SVG rendering with theme presets (`atlas`, `nightglass`, `ember`).
142
+ - Rich tooltip cards, layers, projections, and serialized state for embeds.
143
+
144
+ <details>
145
+ <summary><b>Show Example Usage</b></summary>
146
+
147
+ ```ts
148
+ import { loadWorldOrbitSource } from "@worldorbit/core";
149
+ import {
150
+ createAtlasViewer,
151
+ createInteractiveViewer,
152
+ renderSceneToSvg,
153
+ } from "@worldorbit/viewer";
154
+
155
+ const loaded = loadWorldOrbitSource(source);
156
+ const scene = renderDocumentToScene(loaded.document, {
157
+ projection: "isometric",
158
+ });
159
+
160
+ const svg = renderSceneToSvg(scene, {
161
+ theme: "atlas",
162
+ preset: "atlas-card",
163
+ });
164
+
165
+ // High-level atlas with search, filters, and viewpoints
166
+ const atlasViewer = createAtlasViewer(document.getElementById("atlas"), {
167
+ source,
168
+ theme: "atlas",
169
+ });
170
+ ```
171
+ </details>
172
+
173
+ ### `@worldorbit/markdown`
174
+ The publishing bridge. Use `markdown` to transform fenced `worldorbit` blocks into static or hydrated atlas output.
175
+ - Remark/Rehype plugins to parse and render `.md` files.
176
+ - Modes for inline static SVGs or fully interactive serialised embeds.
177
+
178
+ <details>
179
+ <summary><b>Show Example Usage</b></summary>
180
+
181
+ ```ts
182
+ import rehypeStringify from "rehype-stringify";
183
+ import remarkParse from "remark-parse";
184
+ import remarkRehype from "remark-rehype";
185
+ import { unified } from "unified";
186
+ import { remarkWorldOrbit } from "@worldorbit/markdown";
187
+
188
+ const html = String(
189
+ await unified()
190
+ .use(remarkParse)
191
+ .use(remarkWorldOrbit, { mode: "interactive" })
192
+ .use(remarkRehype, { allowDangerousHtml: true })
193
+ .use(rehypeStringify, { allowDangerousHtml: true })
194
+ .process(markdownSource),
195
+ );
196
+ ```
197
+ </details>
198
+
199
+ ### `@worldorbit/editor`
200
+ The authoring component. Use `editor` when you want a browser-based authoring surface that roundtrips to canonical `schema 2.0`.
201
+ - The foundation of the Studio app, exposing `createWorldOrbitEditor(...)`.
202
+
203
+ <details>
204
+ <summary><b>Show Example Usage</b></summary>
205
+
206
+ ```ts
207
+ import { createWorldOrbitEditor } from "@worldorbit/editor";
208
+
209
+ const editor = createWorldOrbitEditor(document.getElementById("studio"), {
210
+ source,
211
+ showInspector: true,
212
+ showTextPane: true,
213
+ showPreview: true,
214
+ });
215
+ ```
216
+ </details>
217
+
218
+ ---
219
+
220
+ ## Installation & Build
221
+
222
+ Want to build WorldOrbit locally or contribute to the packages?
223
+
224
+ ```bash
225
+ # Install dependencies
226
+ npm install
227
+
228
+ # Build all packages locally
229
+ npm run build
230
+
231
+ # Run tests
232
+ npm test
233
+ ```
234
+
235
+ The workspace builds package outputs into `packages/*/dist` and refreshes local package shims in `node_modules/@worldorbit/...` for seamless package-style development.
236
+
237
+ ### Development Notes
238
+ - `npm run build` compiles all packages and refreshes local package shims.
239
+ - `npm test` rebuilds first, then runs the Node and jsdom-based regression suite.
240
+ - **Parser-first**: The repository guarantees that rendering and atlas interaction always stay downstream of parse, normalize, and validate.
241
+
242
+ ---
243
+
244
+ ## Documentation & Resources
245
+
246
+ - API inventory: [docs/api-inventory.md](docs/api-inventory.md)
247
+ - Changelog: [docs/changelog.md](docs/changelog.md)
248
+
249
+ ### Examples
250
+ You can find various example atlases and markdown files in the [`examples/`](examples/) directory, showcasing minimal setups, complex systems, and markdown integrations.