@miliastry/quasar 1.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.
- package/LICENSE +119 -0
- package/README.md +45 -0
- package/dist/Visuals/lyne.css +1027 -0
- package/dist/Visuals/osu.css +257 -0
- package/dist/index.d.mts +4563 -0
- package/dist/index.d.ts +4563 -0
- package/dist/index.js +11291 -0
- package/dist/index.mjs +11197 -0
- package/package.json +51 -0
- package/src/Analysis/Contracts/AnalysisReport.ts +26 -0
- package/src/Analysis/Contracts/Contribution.ts +76 -0
- package/src/Analysis/Contracts/Pass.ts +76 -0
- package/src/Analysis/Contracts/PipelineContext.ts +48 -0
- package/src/Analysis/Passes/Analysis/GradientAnalyzer.ts +292 -0
- package/src/Analysis/Passes/Analysis/MergeableColorAnalyzer.ts +112 -0
- package/src/Analysis/Passes/Analysis/RainbowAnalyzer.ts +233 -0
- package/src/Analysis/Passes/Analysis/WaveAnalyzer.ts +211 -0
- package/src/Analysis/Passes/Analysis/__tests__/GradientAnalyzer.test.ts +135 -0
- package/src/Analysis/Passes/Analysis/__tests__/MergeableColorAnalyzer.test.ts +84 -0
- package/src/Analysis/Passes/Analysis/__tests__/RainbowAnalyzer.test.ts +99 -0
- package/src/Analysis/Passes/Analysis/__tests__/WaveAnalyzer.test.ts +119 -0
- package/src/Analysis/Passes/Decision/DefaultDecision.ts +139 -0
- package/src/Analysis/Passes/Decision/__tests__/DefaultDecision.test.ts +179 -0
- package/src/Analysis/Passes/Transform/CollapseGradientTransform.ts +176 -0
- package/src/Analysis/Passes/Transform/MergeColorsTransform.ts +126 -0
- package/src/Analysis/Passes/Transform/RainbowCollapseTransform.ts +83 -0
- package/src/Analysis/Passes/Transform/WaveCollapseTransform.ts +88 -0
- package/src/Analysis/Passes/Utility/CharacterCountAnalyzer.ts +45 -0
- package/src/Analysis/Pipeline/Pipeline.ts +133 -0
- package/src/Analysis/Pipeline/PipelineBuilder.ts +55 -0
- package/src/Analysis/Pipeline/PipelineStage.ts +19 -0
- package/src/Analysis/Utils/color-utils.ts +132 -0
- package/src/Analysis/__tests__/Integration.test.ts +162 -0
- package/src/Analysis/__tests__/Pipeline.test.ts +133 -0
- package/src/Analysis/index.ts +52 -0
- package/src/BBCode/BBCodeDocumentModel.ts +175 -0
- package/src/BBCode/BBCodeToGreenNode.ts +755 -0
- package/src/BBCode/Parser.ts +384 -0
- package/src/BBCode/index.ts +12 -0
- package/src/Collab/positions.ts +91 -0
- package/src/Commands/Command.ts +44 -0
- package/src/Commands/CommandRegistry.ts +78 -0
- package/src/Commands/DeleteNode.ts +20 -0
- package/src/Commands/InsertText.ts +21 -0
- package/src/Commands/SplitMerge.ts +28 -0
- package/src/Commands/WrapInTag.ts +21 -0
- package/src/Commands/index.ts +6 -0
- package/src/Diff/TreeDiffer.ts +264 -0
- package/src/Diff/__tests__/TreeDiffer.test.ts +65 -0
- package/src/Diff/index.ts +2 -0
- package/src/Events/EventBus.ts +160 -0
- package/src/Events/index.ts +2 -0
- package/src/Formatter/Formatter.ts +54 -0
- package/src/Formatter/index.ts +2 -0
- package/src/HTML/HTMLDocumentModel.ts +35 -0
- package/src/HTML/HTMLToGreenNode.ts +290 -0
- package/src/Incremental/ChangeTracker.ts +105 -0
- package/src/Incremental/IncrementalParser.ts +591 -0
- package/src/Incremental/__tests__/IncrementalParser.test.ts +164 -0
- package/src/Incremental/index.ts +4 -0
- package/src/Lexer/BBCodeLexer.ts +382 -0
- package/src/Lexer/Lexer.ts +181 -0
- package/src/Lexer/index.ts +10 -0
- package/src/Linter/Linter.ts +193 -0
- package/src/Linter/index.ts +2 -0
- package/src/Markdown/MarkdownAST.ts +112 -0
- package/src/Markdown/MarkdownDocumentModel.ts +55 -0
- package/src/Markdown/MarkdownLexer.ts +203 -0
- package/src/Markdown/MarkdownParser.ts +455 -0
- package/src/Markdown/MarkdownToGreenNode.ts +153 -0
- package/src/Model/DocumentModel.ts +694 -0
- package/src/Model/NodeFactory.ts +117 -0
- package/src/Model/TagRegistry.ts +495 -0
- package/src/Model/index.ts +5 -0
- package/src/Plugins/PluginAPI.ts +119 -0
- package/src/Plugins/PluginRegistry.ts +132 -0
- package/src/Plugins/index.ts +3 -0
- package/src/Queries/QueryEngine.ts +152 -0
- package/src/Queries/index.ts +1 -0
- package/src/RenderPipeline/RenderPipeline.ts +125 -0
- package/src/RenderPipeline/RenderTree.ts +134 -0
- package/src/RenderPipeline/index.ts +4 -0
- package/src/Semantic/SemanticAnalyzer.ts +506 -0
- package/src/Semantic/index.ts +2 -0
- package/src/Symbols/SymbolTable.ts +124 -0
- package/src/Symbols/index.ts +1 -0
- package/src/Syntax/GreenNode.ts +324 -0
- package/src/Syntax/GreenNodePool.ts +269 -0
- package/src/Syntax/NodeMatcher.ts +370 -0
- package/src/Syntax/RedNode.ts +569 -0
- package/src/Syntax/RedNodeStore.ts +184 -0
- package/src/Syntax/TreeBuilder.ts +214 -0
- package/src/Syntax/__tests__/GreenNode.test.ts +33 -0
- package/src/Syntax/__tests__/RedNode.test.ts +81 -0
- package/src/Syntax/__tests__/RedNodeStore.test.ts +104 -0
- package/src/Syntax/greenEdit.ts +110 -0
- package/src/Syntax/hash.ts +30 -0
- package/src/Syntax/index.ts +12 -0
- package/src/Syntax/partition.ts +161 -0
- package/src/Syntax/preserveNodeIds.ts +201 -0
- package/src/Tests/ASTOptimizerIdempotence.test.ts +77 -0
- package/src/Tests/BlockPatcher.test.ts +437 -0
- package/src/Tests/BlockPatcherWindowed.test.ts +364 -0
- package/src/Tests/BoxDrawer.test.ts +217 -0
- package/src/Tests/BoxRichTitle.test.ts +105 -0
- package/src/Tests/Chars500kBenchmark.test.ts +151 -0
- package/src/Tests/Chars500kEdits.test.ts +321 -0
- package/src/Tests/CollabPositions.test.ts +146 -0
- package/src/Tests/CompilerPathProfiling.test.ts +186 -0
- package/src/Tests/DOMMorpher.test.ts +142 -0
- package/src/Tests/DomPatchPerf.test.ts +60 -0
- package/src/Tests/EffectSegments.snapshot.json +616 -0
- package/src/Tests/EffectSegments.test.ts +68 -0
- package/src/Tests/FindNodeAtOffset.test.ts +65 -0
- package/src/Tests/Fuzzer.test.ts +166 -0
- package/src/Tests/GreenNodePool.test.ts +153 -0
- package/src/Tests/Lexer.test.ts +238 -0
- package/src/Tests/LyneMode.test.ts +187 -0
- package/src/Tests/ModelCoherence.test.ts +180 -0
- package/src/Tests/Partition.test.ts +238 -0
- package/src/Tests/PluginTags.test.ts +150 -0
- package/src/Tests/ProblematicSection.test.ts +46 -0
- package/src/Tests/ProblematicSectionHTML.test.ts +58 -0
- package/src/Tests/RedReuse.test.ts +134 -0
- package/src/Tests/ReproDelete20k.test.ts +62 -0
- package/src/Tests/SemanticValidators.test.ts +136 -0
- package/src/Tests/StableNodeIds.test.ts +210 -0
- package/src/Tests/StudioColorBloat.test.ts +25 -0
- package/src/Tests/StudioDebugText.test.ts +27 -0
- package/src/Tests/StudioTrailingChar.test.ts +25 -0
- package/src/Tests/StudioValidText.test.ts +25 -0
- package/src/Tests/UrlImgBug.test.ts +23 -0
- package/src/Tests/VisualBuilderFidelity.test.ts +105 -0
- package/src/Tests/referenceDocument.ts +119 -0
- package/src/Transactions/Transaction.ts +176 -0
- package/src/Transactions/UndoManager.ts +111 -0
- package/src/Transactions/index.ts +3 -0
- package/src/Transformers/ASTOptimizer.ts +315 -0
- package/src/Transformers/GradientTransformer.ts +143 -0
- package/src/Transformers/GrowTransformer.ts +115 -0
- package/src/Transformers/RainbowTransformer.ts +121 -0
- package/src/Transformers/SineWaveTransformer.ts +130 -0
- package/src/Transformers/Transformer.ts +22 -0
- package/src/Types/core.ts +270 -0
- package/src/Types/diagnostics.ts +156 -0
- package/src/Types/index.ts +23 -0
- package/src/Types/operations.ts +180 -0
- package/src/Types/queries.ts +121 -0
- package/src/Types/symbols.ts +69 -0
- package/src/Types/tokens.ts +186 -0
- package/src/Utils/BBCodeGenerator.ts +126 -0
- package/src/Utils/ColorMath.ts +276 -0
- package/src/Utils/color.ts +112 -0
- package/src/Utils/dom-to-svg.test.ts +86 -0
- package/src/Utils/dom-to-svg.ts +615 -0
- package/src/Utils/treeTransformers.ts +717 -0
- package/src/Visitors/BBBlocksExporter.ts +69 -0
- package/src/Visitors/BBCodeExporter.ts +318 -0
- package/src/Visitors/BlockPatcher.ts +963 -0
- package/src/Visitors/DOMMorpher.ts +134 -0
- package/src/Visitors/HTMLRenderer.ts +1077 -0
- package/src/Visitors/JSONExporter.ts +66 -0
- package/src/Visitors/MarkdownExporter.ts +99 -0
- package/src/Visitors/SVGRenderer.ts +35 -0
- package/src/Visitors/TiptapExporter.ts +145 -0
- package/src/Visitors/Visitor.ts +48 -0
- package/src/Visitors/index.ts +9 -0
- package/src/Visuals/BoxDrawer.ts +175 -0
- package/src/Visuals/index.ts +42 -0
- package/src/Visuals/lyne.css +1027 -0
- package/src/Visuals/osu.css +257 -0
- package/src/index.ts +197 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
MILIASTRY SOURCE LICENSE
|
|
2
|
+
Version 1.0 (MSL-1.0)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 hxovc / Miliastry Team
|
|
5
|
+
|
|
6
|
+
This license governs use of the software accompanying this license.
|
|
7
|
+
By using the software, you agree to the terms of this license.
|
|
8
|
+
|
|
9
|
+
1. DEFINITIONS
|
|
10
|
+
|
|
11
|
+
"Software" means the source code and other materials distributed under
|
|
12
|
+
this license.
|
|
13
|
+
|
|
14
|
+
"Miliastry Nova" means the Miliastry Nova product, including its
|
|
15
|
+
integrated visual editing environment, user interface, workspace
|
|
16
|
+
architecture, and associated visual authoring capabilities, as
|
|
17
|
+
distributed by the copyright holder.
|
|
18
|
+
|
|
19
|
+
"Competing Product" means a software product or service whose primary
|
|
20
|
+
purpose is to compete directly with Miliastry Nova as an integrated
|
|
21
|
+
visual BBCode authoring environment or IDE, or to compete directly
|
|
22
|
+
with the Software itself.
|
|
23
|
+
|
|
24
|
+
A product is not a Competing Product merely because it:
|
|
25
|
+
|
|
26
|
+
(a) uses, depends upon, or incorporates the Software;
|
|
27
|
+
|
|
28
|
+
(b) provides BBCode editing capabilities;
|
|
29
|
+
|
|
30
|
+
(c) provides visual BBCode editing capabilities;
|
|
31
|
+
|
|
32
|
+
(d) provides tools for osu! profile creation or customization; or
|
|
33
|
+
|
|
34
|
+
(e) provides functionality that is technically similar to an individual
|
|
35
|
+
feature of Miliastry Nova.
|
|
36
|
+
|
|
37
|
+
The determination of whether a product is a Competing Product shall be
|
|
38
|
+
based on the product as a whole, including its primary purpose,
|
|
39
|
+
positioning, and intended use, rather than on the presence of individual
|
|
40
|
+
features.
|
|
41
|
+
|
|
42
|
+
2. COPYRIGHT GRANT
|
|
43
|
+
|
|
44
|
+
Subject to the terms and limitations of this license, each contributor
|
|
45
|
+
grants you a perpetual, worldwide, non-exclusive, royalty-free license
|
|
46
|
+
to reproduce, modify, create derivative works from, and distribute the
|
|
47
|
+
Software and such derivative works.
|
|
48
|
+
|
|
49
|
+
3. PATENT GRANT
|
|
50
|
+
|
|
51
|
+
Each contributor grants you a worldwide, non-exclusive, royalty-free
|
|
52
|
+
license under patent claims owned or controlled by that contributor
|
|
53
|
+
that necessarily read on their contribution to make, use, sell, offer
|
|
54
|
+
for sale, import, and otherwise distribute the Software.
|
|
55
|
+
|
|
56
|
+
4. COMPETITION RESTRICTION
|
|
57
|
+
|
|
58
|
+
During the Restricted Period, you may not use the Software, or a
|
|
59
|
+
derivative work of the Software, as a substantial part of a Competing
|
|
60
|
+
Product.
|
|
61
|
+
|
|
62
|
+
This restriction applies only where the Software is used with the
|
|
63
|
+
purpose of creating, operating, or providing a product that directly
|
|
64
|
+
competes with Miliastry Nova.
|
|
65
|
+
|
|
66
|
+
This restriction does not prohibit the creation, distribution, or use of
|
|
67
|
+
general-purpose BBCode editors, osu! profile tools, BBCode libraries,
|
|
68
|
+
renderers, parsers, visual editors, authoring tools, or other software
|
|
69
|
+
that does not directly compete with Miliastry Nova or the Software itself.
|
|
70
|
+
|
|
71
|
+
5. NO TRADEMARK RIGHTS
|
|
72
|
+
|
|
73
|
+
This license does not grant permission to use the names, logos,
|
|
74
|
+
trademarks, or other branding of Miliastry, Miliastry Nova, or any
|
|
75
|
+
contributor.
|
|
76
|
+
|
|
77
|
+
6. RESTRICTED PERIOD
|
|
78
|
+
|
|
79
|
+
The restrictions in Section 4 apply for two (2) years beginning on the
|
|
80
|
+
date on which the applicable version of the Software is first publicly
|
|
81
|
+
released under this license.
|
|
82
|
+
|
|
83
|
+
After the Restricted Period expires, the Software is automatically
|
|
84
|
+
relicensed under the MIT License.
|
|
85
|
+
|
|
86
|
+
7. CONTRIBUTIONS
|
|
87
|
+
|
|
88
|
+
Each contributor grants its contribution under this license unless the
|
|
89
|
+
contributor explicitly states otherwise.
|
|
90
|
+
|
|
91
|
+
Contributors do not receive any rights to use the trademarks or branding
|
|
92
|
+
of Miliastry.
|
|
93
|
+
|
|
94
|
+
8. DISCLAIMER
|
|
95
|
+
|
|
96
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
97
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
|
98
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
|
99
|
+
NON-INFRINGEMENT.
|
|
100
|
+
|
|
101
|
+
9. LIMITATION OF LIABILITY
|
|
102
|
+
|
|
103
|
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, NO CONTRIBUTOR SHALL BE LIABLE
|
|
104
|
+
FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM THE USE OF THE
|
|
105
|
+
SOFTWARE.
|
|
106
|
+
|
|
107
|
+
10. TERMINATION
|
|
108
|
+
|
|
109
|
+
If you violate the restrictions of this license, the rights granted to
|
|
110
|
+
you under this license terminate automatically.
|
|
111
|
+
|
|
112
|
+
Rights that have already permanently converted to the MIT License are
|
|
113
|
+
not affected.
|
|
114
|
+
|
|
115
|
+
11. GOVERNING INTERPRETATION
|
|
116
|
+
|
|
117
|
+
This license shall be interpreted to preserve the broad permission to
|
|
118
|
+
use the Software for purposes that do not directly compete with
|
|
119
|
+
Miliastry Nova.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>🌌 Quasar Document Engine</h1>
|
|
3
|
+
<p><strong>Compiler-grade AST infrastructure for real-time document editing.</strong></p>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
> Traditional BBCode or Markdown parsers rely on brittle Regex that destroy user formatting, collapse on invalid syntax, and freeze the UI on large documents. **Quasar is different.**
|
|
9
|
+
|
|
10
|
+
Quasar is the official document engine powering **Miliastry Nova**. It brings the architectural patterns used by modern language compilers (like C#'s *Roslyn* and Apple's *SwiftSyntax*) directly into the browser and desktop using pure TypeScript.
|
|
11
|
+
|
|
12
|
+
Instead of translating strings to HTML, Quasar builds a living, immutable **Red-Green Syntax Tree**. It parses documents incrementally in microseconds, guarantees perfect round-tripping (preserving every single space and newline), and allows for real-time visual editing at 140 FPS.
|
|
13
|
+
|
|
14
|
+
## ✨ The Core Philosophy
|
|
15
|
+
|
|
16
|
+
- 🌳 **Red-Green Syntax Tree**: An immutable, flyweight `GreenNode` core for structural sharing and memory deduplication, paired with a stateful `RedNode` facade for UI binding and cursor tracking.
|
|
17
|
+
- ⚡ **Incremental Parsing**: When a user types a single character in a 50KB document, Quasar only re-parses the affected span. Average mutation latency: `< 0.15ms`.
|
|
18
|
+
- 🛡️ **Error-Tolerant by Design**: The parser never crashes. Invalid syntax, unclosed tags, or malformed attributes simply produce `ErrorNodes` with diagnostics, keeping the rest of the AST intact.
|
|
19
|
+
- 🔄 **Perfect Round-Tripping**: "Trivia" (spaces, newlines, raw formatting) is strictly preserved. What the user types is exactly what is saved.
|
|
20
|
+
- 🔌 **Agnostic & Multi-Format**: While heavily optimized for BBCode, Quasar's Bridges support ingestion and emission of HTML, Markdown, and JSON ASTs.
|
|
21
|
+
- 📦 **Zero Runtime Dependencies**: Pure TypeScript. Runs natively in the Browser, Node.js, Deno, Bun, or Tauri.
|
|
22
|
+
|
|
23
|
+
## 🚀 Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install github:hxovc/Miliastry-Quasar#main
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
*(Note: Quasar is currently distributed as a git submodule for Miliastry Nova)*
|
|
30
|
+
|
|
31
|
+
## 📚 Documentation & Architecture
|
|
32
|
+
|
|
33
|
+
Quasar's internal architecture is highly advanced. If you want to understand how the parser pipeline works, how memory deduplication is achieved, or how to build AST transformers, start here:
|
|
34
|
+
|
|
35
|
+
- [**Naked Architecture (QuasarArch.MD)**](./QuasarArch.MD): Deep forensic analysis of the internal architecture, parsing pipeline, and modules.
|
|
36
|
+
- [**Roadmap (QuasarRoadmap.MD)**](./QuasarRoadmap.MD): Current and future state of the engine.
|
|
37
|
+
- [**Collaboration (QuasarCollab.MD)**](./QuasarCollab.MD): Contribution guidelines.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 📜 License
|
|
42
|
+
|
|
43
|
+
[**Miliastry Source License (MSL-1.0)**](LICENSE) — Copyright (c) 2026 hxovc / Miliastry Team.
|
|
44
|
+
|
|
45
|
+
Quasar is Source-Available under a custom license designed to protect the Miliastry ecosystem. You can use, modify, and distribute the engine for any project—including standard visual BBCode editors or osu! profile tools—**except** for creating a Competing Product (i.e., a direct clone of Miliastry Nova as an integrated IDE, or a competing standalone engine based on this code). The license automatically converts to a standard MIT License 2 years after each commit.
|