@miliastry/quasar 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/dist/Visuals/lyne.css +117 -6
  2. package/dist/Visuals/osu.css +36 -5
  3. package/dist/index.js +9664 -3282
  4. package/dist/index.mjs +9535 -3283
  5. package/dist/types/Analysis/Contracts/AnalysisReport.d.ts +22 -0
  6. package/dist/types/Analysis/Contracts/Contribution.d.ts +68 -0
  7. package/dist/types/Analysis/Contracts/Pass.d.ts +59 -0
  8. package/dist/types/Analysis/Contracts/PipelineContext.d.ts +34 -0
  9. package/dist/types/Analysis/Passes/Analysis/ColorUsageAnalyzer.d.ts +56 -0
  10. package/dist/types/Analysis/Passes/Analysis/GradientAnalyzer.d.ts +111 -0
  11. package/dist/types/Analysis/Passes/Analysis/MergeableColorAnalyzer.d.ts +26 -0
  12. package/dist/types/Analysis/Passes/Analysis/RainbowAnalyzer.d.ts +47 -0
  13. package/dist/types/Analysis/Passes/Analysis/SymbolAnalyzer.d.ts +89 -0
  14. package/dist/types/Analysis/Passes/Analysis/WaveAnalyzer.d.ts +44 -0
  15. package/dist/types/Analysis/Passes/Analysis/__tests__/GradientAnalyzer.test.d.ts +4 -0
  16. package/dist/types/Analysis/Passes/Analysis/__tests__/MergeableColorAnalyzer.test.d.ts +4 -0
  17. package/dist/types/Analysis/Passes/Analysis/__tests__/RainbowAnalyzer.test.d.ts +4 -0
  18. package/dist/types/Analysis/Passes/Analysis/__tests__/WaveAnalyzer.test.d.ts +4 -0
  19. package/dist/types/Analysis/Passes/Decision/DefaultDecision.d.ts +30 -0
  20. package/dist/types/Analysis/Passes/Decision/PaletteRemapDecision.d.ts +169 -0
  21. package/dist/types/Analysis/Passes/Decision/__tests__/DefaultDecision.test.d.ts +4 -0
  22. package/dist/types/Analysis/Passes/Transform/CollapseGradientTransform.d.ts +37 -0
  23. package/dist/types/Analysis/Passes/Transform/MergeColorsTransform.d.ts +28 -0
  24. package/dist/types/Analysis/Passes/Transform/RainbowCollapseTransform.d.ts +19 -0
  25. package/dist/types/Analysis/Passes/Transform/WaveCollapseTransform.d.ts +20 -0
  26. package/dist/types/Analysis/Passes/Utility/CharacterCountAnalyzer.d.ts +19 -0
  27. package/dist/types/Analysis/Pipeline/Pipeline.d.ts +69 -0
  28. package/dist/types/Analysis/Pipeline/PipelineBuilder.d.ts +31 -0
  29. package/dist/types/Analysis/Pipeline/PipelineStage.d.ts +17 -0
  30. package/dist/types/Analysis/Utils/color-utils.d.ts +60 -0
  31. package/dist/types/Analysis/__tests__/Integration.test.d.ts +8 -0
  32. package/dist/types/Analysis/__tests__/PaletteRemap.test.d.ts +14 -0
  33. package/dist/types/Analysis/__tests__/Pipeline.test.d.ts +10 -0
  34. package/dist/types/Analysis/__tests__/RoundTrip.test.d.ts +30 -0
  35. package/dist/types/Analysis/__tests__/SymbolAnalyzer.test.d.ts +11 -0
  36. package/dist/types/Analysis/index.d.ts +40 -0
  37. package/dist/types/BBCode/BBCodeDocumentModel.d.ts +92 -0
  38. package/dist/types/BBCode/BBCodeToGreenNode.d.ts +111 -0
  39. package/dist/types/BBCode/Parser.d.ts +78 -0
  40. package/dist/types/BBCode/index.d.ts +4 -0
  41. package/dist/types/Collab/positions.d.ts +55 -0
  42. package/dist/types/Commands/Command.d.ts +37 -0
  43. package/dist/types/Commands/CommandRegistry.d.ts +48 -0
  44. package/dist/types/Commands/DeleteNode.d.ts +7 -0
  45. package/dist/types/Commands/InsertText.d.ts +8 -0
  46. package/dist/types/Commands/SplitMerge.d.ts +9 -0
  47. package/dist/types/Commands/WrapInTag.d.ts +8 -0
  48. package/dist/types/Commands/index.d.ts +6 -0
  49. package/dist/types/Diff/TreeDiffer.d.ts +52 -0
  50. package/dist/types/Diff/__tests__/TreeDiffer.test.d.ts +1 -0
  51. package/dist/types/Diff/index.d.ts +2 -0
  52. package/dist/types/Edits/EditPlan.d.ts +144 -0
  53. package/dist/types/Edits/Optimizer.d.ts +78 -0
  54. package/dist/types/Edits/Rules/Rule.d.ts +91 -0
  55. package/dist/types/Edits/Rules/dropEmptyTags.d.ts +40 -0
  56. package/dist/types/Edits/Rules/dropRedundantNesting.d.ts +59 -0
  57. package/dist/types/Edits/Rules/index.d.ts +9 -0
  58. package/dist/types/Edits/Rules/mergeAdjacent.d.ts +93 -0
  59. package/dist/types/Edits/Rules/reorderWrappers.d.ts +42 -0
  60. package/dist/types/Edits/Rules/shortenHex.d.ts +30 -0
  61. package/dist/types/Edits/Rules/tagValue.d.ts +56 -0
  62. package/dist/types/Edits/Rules/unwrapInvisibleColor.d.ts +47 -0
  63. package/dist/types/Edits/applyEdits.d.ts +36 -0
  64. package/dist/types/Edits/index.d.ts +6 -0
  65. package/dist/types/Events/EventBus.d.ts +103 -0
  66. package/dist/types/Events/index.d.ts +2 -0
  67. package/dist/types/Formatter/Formatter.d.ts +32 -0
  68. package/dist/types/Formatter/index.d.ts +2 -0
  69. package/dist/types/HTML/HTMLDocumentModel.d.ts +13 -0
  70. package/dist/types/HTML/HTMLToGreenNode.d.ts +4 -0
  71. package/dist/types/Incremental/BracketIndex.d.ts +101 -0
  72. package/dist/types/Incremental/ChangeTracker.d.ts +69 -0
  73. package/dist/types/Incremental/IncrementalParser.d.ts +246 -0
  74. package/dist/types/Incremental/__tests__/BracketIndex.test.d.ts +1 -0
  75. package/dist/types/Incremental/__tests__/IncrementalParser.test.d.ts +1 -0
  76. package/dist/types/Incremental/index.d.ts +4 -0
  77. package/dist/types/Lexer/BBCodeLexer.d.ts +74 -0
  78. package/dist/types/Lexer/Lexer.d.ts +54 -0
  79. package/dist/types/Lexer/index.d.ts +4 -0
  80. package/dist/types/Linter/Linter.d.ts +58 -0
  81. package/dist/types/Linter/index.d.ts +2 -0
  82. package/dist/types/Markdown/MarkdownAST.d.ts +122 -0
  83. package/dist/types/Markdown/MarkdownDocumentModel.d.ts +15 -0
  84. package/dist/types/Markdown/MarkdownLexer.d.ts +155 -0
  85. package/dist/types/Markdown/MarkdownParser.d.ts +42 -0
  86. package/dist/types/Markdown/MarkdownToGreenNode.d.ts +6 -0
  87. package/dist/types/MilHibri/MilHibriDocumentModel.d.ts +21 -0
  88. package/dist/types/Model/DocumentModel.d.ts +318 -0
  89. package/dist/types/Model/NodeFactory.d.ts +29 -0
  90. package/dist/types/Model/TagRegistry.d.ts +165 -0
  91. package/dist/types/Model/index.d.ts +5 -0
  92. package/dist/types/Plugins/PluginAPI.d.ts +44 -0
  93. package/dist/types/Plugins/PluginRegistry.d.ts +81 -0
  94. package/dist/types/Plugins/index.d.ts +3 -0
  95. package/dist/types/Queries/QueryEngine.d.ts +32 -0
  96. package/dist/types/Queries/index.d.ts +1 -0
  97. package/dist/types/Reconciler/SurgicalReconciler.d.ts +23 -0
  98. package/dist/types/RenderPipeline/RenderPipeline.d.ts +46 -0
  99. package/dist/types/RenderPipeline/RenderTree.d.ts +55 -0
  100. package/dist/types/RenderPipeline/index.d.ts +4 -0
  101. package/dist/types/Repair/NestingRepair.d.ts +48 -0
  102. package/dist/types/Repair/index.d.ts +1 -0
  103. package/dist/types/Semantic/SemanticAnalyzer.d.ts +321 -0
  104. package/dist/types/Semantic/index.d.ts +2 -0
  105. package/dist/types/Symbols/SymbolTable.d.ts +47 -0
  106. package/dist/types/Symbols/index.d.ts +1 -0
  107. package/dist/types/Syntax/GreenNode.d.ts +154 -0
  108. package/dist/types/Syntax/GreenNodePool.d.ts +134 -0
  109. package/dist/types/Syntax/NodeMatcher.d.ts +75 -0
  110. package/dist/types/Syntax/RedNode.d.ts +280 -0
  111. package/dist/types/Syntax/RedNodeStore.d.ts +116 -0
  112. package/dist/types/Syntax/TreeBuilder.d.ts +54 -0
  113. package/dist/types/Syntax/__tests__/GreenNode.test.d.ts +1 -0
  114. package/dist/types/Syntax/__tests__/RedNode.test.d.ts +1 -0
  115. package/dist/types/Syntax/__tests__/RedNodeStore.test.d.ts +1 -0
  116. package/dist/types/Syntax/greenEdit.d.ts +64 -0
  117. package/dist/types/Syntax/hash.d.ts +17 -0
  118. package/dist/types/Syntax/index.d.ts +8 -0
  119. package/dist/types/Syntax/nodeAttr.d.ts +63 -0
  120. package/dist/types/Syntax/partition.d.ts +67 -0
  121. package/dist/types/Syntax/preserveNodeIds.d.ts +47 -0
  122. package/dist/types/Tokens/TokenResolver.d.ts +25 -0
  123. package/dist/types/Tokens/index.d.ts +1 -0
  124. package/dist/types/Transactions/Transaction.d.ts +36 -0
  125. package/dist/types/Transactions/UndoManager.d.ts +63 -0
  126. package/dist/types/Transactions/index.d.ts +3 -0
  127. package/dist/types/Transformers/ASTOptimizer.d.ts +34 -0
  128. package/dist/types/Transformers/GradientTransformer.d.ts +18 -0
  129. package/dist/types/Transformers/GrowTransformer.d.ts +16 -0
  130. package/dist/types/Transformers/RainbowTransformer.d.ts +17 -0
  131. package/dist/types/Transformers/SineWaveTransformer.d.ts +17 -0
  132. package/dist/types/Transformers/Transformer.d.ts +17 -0
  133. package/dist/types/Types/core.d.ts +104 -0
  134. package/dist/types/Types/diagnostics.d.ts +85 -0
  135. package/dist/types/Types/index.d.ts +11 -0
  136. package/dist/types/Types/operations.d.ts +109 -0
  137. package/dist/types/Types/queries.d.ts +67 -0
  138. package/dist/types/Types/symbols.d.ts +42 -0
  139. package/dist/types/Types/tokens.d.ts +75 -0
  140. package/dist/types/Utils/BBCodeGenerator.d.ts +21 -0
  141. package/dist/types/Utils/ColorMath.d.ts +92 -0
  142. package/dist/types/Utils/EffectMath.d.ts +643 -0
  143. package/dist/types/Utils/TagVocabulary.d.ts +104 -0
  144. package/dist/types/Utils/TagVocabulary.test.d.ts +1 -0
  145. package/dist/types/Utils/color.d.ts +29 -0
  146. package/dist/types/Utils/dom-to-svg.d.ts +28 -0
  147. package/dist/types/Utils/dom-to-svg.test.d.ts +1 -0
  148. package/dist/types/Utils/treeTransformers.d.ts +160 -0
  149. package/dist/types/Visitors/BBBlocksExporter.d.ts +27 -0
  150. package/dist/types/Visitors/BBCodeExporter.d.ts +90 -0
  151. package/dist/types/Visitors/BlockPatcher.d.ts +91 -0
  152. package/dist/types/Visitors/DOMMorpher.d.ts +13 -0
  153. package/dist/types/Visitors/HTMLRenderer.d.ts +380 -0
  154. package/dist/types/Visitors/JSONExporter.d.ts +42 -0
  155. package/dist/types/Visitors/MarkdownExporter.d.ts +28 -0
  156. package/dist/types/Visitors/SVGRenderer.d.ts +16 -0
  157. package/dist/types/Visitors/TiptapExporter.d.ts +40 -0
  158. package/dist/types/Visitors/Visitor.d.ts +35 -0
  159. package/dist/types/Visitors/index.d.ts +9 -0
  160. package/dist/types/Visuals/BoxDrawer.d.ts +49 -0
  161. package/dist/types/Visuals/index.d.ts +38 -0
  162. package/dist/types/index.d.ts +154 -0
  163. package/package.json +14 -10
  164. package/src/Analysis/Passes/Analysis/ColorUsageAnalyzer.ts +103 -0
  165. package/src/Analysis/Passes/Analysis/GradientAnalyzer.ts +294 -20
  166. package/src/Analysis/Passes/Analysis/SymbolAnalyzer.ts +257 -0
  167. package/src/Analysis/Passes/Decision/PaletteRemapDecision.ts +425 -0
  168. package/src/Analysis/Pipeline/Pipeline.ts +15 -2
  169. package/src/Analysis/index.ts +8 -2
  170. package/src/BBCode/BBCodeDocumentModel.ts +3 -0
  171. package/src/BBCode/BBCodeToGreenNode.ts +18 -12
  172. package/src/BBCode/Parser.ts +38 -1
  173. package/src/Edits/EditPlan.ts +290 -0
  174. package/src/Edits/Optimizer.ts +185 -0
  175. package/src/Edits/Rules/Rule.ts +145 -0
  176. package/src/Edits/Rules/dropEmptyTags.ts +110 -0
  177. package/src/Edits/Rules/dropRedundantNesting.ts +120 -0
  178. package/src/Edits/Rules/index.ts +28 -0
  179. package/src/Edits/Rules/mergeAdjacent.ts +224 -0
  180. package/src/Edits/Rules/reorderWrappers.ts +154 -0
  181. package/src/Edits/Rules/shortenHex.ts +79 -0
  182. package/src/Edits/Rules/tagValue.ts +105 -0
  183. package/src/Edits/Rules/unwrapInvisibleColor.ts +93 -0
  184. package/src/Edits/applyEdits.ts +54 -0
  185. package/src/Edits/index.ts +22 -0
  186. package/src/Events/EventBus.ts +18 -0
  187. package/src/HTML/HTMLToGreenNode.ts +185 -37
  188. package/src/Incremental/BracketIndex.ts +249 -0
  189. package/src/Incremental/IncrementalParser.ts +464 -41
  190. package/src/Lexer/BBCodeLexer.ts +25 -3
  191. package/src/Lexer/index.ts +1 -1
  192. package/src/Markdown/MarkdownAST.ts +65 -2
  193. package/src/Markdown/MarkdownLexer.ts +69 -14
  194. package/src/Markdown/MarkdownParser.ts +749 -62
  195. package/src/Markdown/MarkdownToGreenNode.ts +148 -27
  196. package/src/MilHibri/MilHibriDocumentModel.ts +56 -0
  197. package/src/Model/DocumentModel.ts +138 -5
  198. package/src/Model/TagRegistry.ts +129 -134
  199. package/src/Reconciler/SurgicalReconciler.ts +460 -0
  200. package/src/Repair/NestingRepair.ts +116 -0
  201. package/src/Repair/index.ts +1 -0
  202. package/src/Semantic/SemanticAnalyzer.ts +1802 -65
  203. package/src/Syntax/GreenNodePool.ts +12 -12
  204. package/src/Syntax/RedNode.ts +17 -3
  205. package/src/Syntax/RedNodeStore.ts +9 -1
  206. package/src/Syntax/nodeAttr.ts +172 -0
  207. package/src/Tokens/TokenResolver.ts +55 -0
  208. package/src/Tokens/index.ts +1 -0
  209. package/src/Types/core.ts +15 -0
  210. package/src/Utils/ColorMath.ts +276 -55
  211. package/src/Utils/EffectMath.ts +2462 -0
  212. package/src/Utils/TagVocabulary.ts +141 -0
  213. package/src/Utils/dom-to-svg.ts +28 -12
  214. package/src/Visitors/BBBlocksExporter.ts +15 -1
  215. package/src/Visitors/BBCodeExporter.ts +319 -32
  216. package/src/Visitors/BlockPatcher.ts +87 -11
  217. package/src/Visitors/DOMMorpher.ts +15 -5
  218. package/src/Visitors/HTMLRenderer.ts +374 -151
  219. package/src/Visitors/MarkdownExporter.ts +98 -41
  220. package/src/Visitors/TiptapExporter.ts +1 -0
  221. package/src/Visuals/index.ts +7 -4
  222. package/src/Visuals/lyne.css +117 -6
  223. package/src/Visuals/osu.css +36 -5
  224. package/src/index.ts +172 -5
  225. package/dist/index.d.mts +0 -4612
  226. package/dist/index.d.ts +0 -4612
  227. package/src/Analysis/Passes/Analysis/__tests__/GradientAnalyzer.test.ts +0 -135
  228. package/src/Analysis/Passes/Analysis/__tests__/MergeableColorAnalyzer.test.ts +0 -84
  229. package/src/Analysis/Passes/Analysis/__tests__/RainbowAnalyzer.test.ts +0 -99
  230. package/src/Analysis/Passes/Analysis/__tests__/WaveAnalyzer.test.ts +0 -119
  231. package/src/Analysis/Passes/Decision/__tests__/DefaultDecision.test.ts +0 -179
  232. package/src/Analysis/__tests__/Integration.test.ts +0 -162
  233. package/src/Analysis/__tests__/Pipeline.test.ts +0 -133
  234. package/src/Diff/__tests__/TreeDiffer.test.ts +0 -65
  235. package/src/Incremental/__tests__/IncrementalParser.test.ts +0 -164
  236. package/src/Syntax/__tests__/GreenNode.test.ts +0 -33
  237. package/src/Syntax/__tests__/RedNode.test.ts +0 -81
  238. package/src/Syntax/__tests__/RedNodeStore.test.ts +0 -104
  239. package/src/Tests/ASTOptimizerIdempotence.test.ts +0 -77
  240. package/src/Tests/BlockPatcher.test.ts +0 -437
  241. package/src/Tests/BlockPatcherWindowed.test.ts +0 -364
  242. package/src/Tests/BoxDrawer.test.ts +0 -217
  243. package/src/Tests/BoxRichTitle.test.ts +0 -105
  244. package/src/Tests/Chars500kBenchmark.test.ts +0 -151
  245. package/src/Tests/Chars500kEdits.test.ts +0 -321
  246. package/src/Tests/CollabPositions.test.ts +0 -146
  247. package/src/Tests/CompilerPathProfiling.test.ts +0 -186
  248. package/src/Tests/DOMMorpher.test.ts +0 -142
  249. package/src/Tests/DomPatchPerf.test.ts +0 -60
  250. package/src/Tests/EffectSegments.snapshot.json +0 -616
  251. package/src/Tests/EffectSegments.test.ts +0 -68
  252. package/src/Tests/FindNodeAtOffset.test.ts +0 -65
  253. package/src/Tests/Fuzzer.test.ts +0 -166
  254. package/src/Tests/GreenNodePool.test.ts +0 -153
  255. package/src/Tests/Lexer.test.ts +0 -238
  256. package/src/Tests/LyneMode.test.ts +0 -291
  257. package/src/Tests/ModelCoherence.test.ts +0 -180
  258. package/src/Tests/Partition.test.ts +0 -238
  259. package/src/Tests/PluginTags.test.ts +0 -150
  260. package/src/Tests/ProblematicSection.test.ts +0 -46
  261. package/src/Tests/ProblematicSectionHTML.test.ts +0 -58
  262. package/src/Tests/RedReuse.test.ts +0 -134
  263. package/src/Tests/ReproDelete20k.test.ts +0 -62
  264. package/src/Tests/SemanticValidators.test.ts +0 -136
  265. package/src/Tests/StableNodeIds.test.ts +0 -210
  266. package/src/Tests/StudioColorBloat.test.ts +0 -25
  267. package/src/Tests/StudioDebugText.test.ts +0 -27
  268. package/src/Tests/StudioTrailingChar.test.ts +0 -25
  269. package/src/Tests/StudioValidText.test.ts +0 -25
  270. package/src/Tests/UrlImgBug.test.ts +0 -23
  271. package/src/Tests/VisualBuilderFidelity.test.ts +0 -105
  272. package/src/Tests/referenceDocument.ts +0 -119
  273. package/src/Utils/dom-to-svg.test.ts +0 -86
@@ -0,0 +1,17 @@
1
+ import { DocumentModel } from '../Model/DocumentModel';
2
+ import { Transformer, TransformResult } from './Transformer';
3
+ export interface RainbowOptions {
4
+ saturation: number;
5
+ lightness: number;
6
+ spread: number;
7
+ offset: number;
8
+ selectionRange?: {
9
+ start: number;
10
+ end: number;
11
+ };
12
+ }
13
+ export declare class RainbowTransformer implements Transformer {
14
+ private options;
15
+ constructor(options?: Partial<RainbowOptions>);
16
+ transform(document: DocumentModel): TransformResult;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { DocumentModel } from '../Model/DocumentModel';
2
+ import { Transformer, TransformResult } from './Transformer';
3
+ export interface SineWaveOptions {
4
+ minSize: number;
5
+ maxSize: number;
6
+ frequency: number;
7
+ step: 'char' | 'word';
8
+ selectionRange?: {
9
+ start: number;
10
+ end: number;
11
+ };
12
+ }
13
+ export declare class SineWaveTransformer implements Transformer {
14
+ private options;
15
+ constructor(options?: Partial<SineWaveOptions>);
16
+ transform(document: DocumentModel): TransformResult;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { DocumentModel } from '../Model/DocumentModel';
2
+ import { Transaction } from '../Transactions/Transaction';
3
+ export interface TransformResult {
4
+ document: DocumentModel;
5
+ transaction?: Transaction;
6
+ }
7
+ export interface Transformer {
8
+ /**
9
+ * Transforms a DocumentModel.
10
+ * Should ideally return a Transaction that contains the operations applied.
11
+ */
12
+ transform(document: DocumentModel): TransformResult;
13
+ }
14
+ /**
15
+ * Helper to apply a transformer.
16
+ */
17
+ export declare function applyTransformer(document: DocumentModel, transformer: Transformer): TransformResult;
@@ -0,0 +1,104 @@
1
+ /**
2
+ * DocumentEngine — Core Types
3
+ *
4
+ * The foundational types for the entire Language Platform.
5
+ * Every layer builds on these.
6
+ */
7
+ import type { Diagnostic } from './diagnostics';
8
+ /** Stable identifier that survives incremental re-parses */
9
+ export type NodeId = string & {
10
+ readonly __brand: 'NodeId';
11
+ };
12
+ export declare function createNodeId(): NodeId;
13
+ /**
14
+ * Reset the node ID counter. Test-only: lets a suite assert on stable IDs.
15
+ * Never call this while a document tree is alive — reusing IDs across live
16
+ * trees would break every `Map<NodeId, …>` in the engine.
17
+ */
18
+ export declare function __resetNodeIdCounter(): void;
19
+ /**
20
+ * The semantic kind of a node in the document tree.
21
+ *
22
+ * Language-agnostic at the core — BBCode tags, Markdown headings,
23
+ * HTML elements, etc. all map to these.
24
+ */
25
+ export type NodeKind = 'document' | 'paragraph' | 'text' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'color' | 'font_size' | 'font' | 'code' | 'inline_code' | 'spoiler' | 'heading' | 'center' | 'right' | 'left' | 'url' | 'email' | 'profile' | 'image' | 'video' | 'audio' | 'imagemap' | 'imagemap_area' | 'svg' | 'quote' | 'notice' | 'spoilerbox' | 'box' | 'boxw' | 'list' | 'list_item' | 'zalgo' | 'aesthetic' | 'sparkle' | 'bubble' | 'flower' | 'gradient' | 'grow' | 'sinewave' | 'rainbow' | 'paint' | 'spacing' | 'empty_line'
26
+ /**
27
+ * Una etiqueta de cierre que no cerró nada y que no debe verse.
28
+ *
29
+ * Nace cuando un cierre llega tarde: su etiqueta ya se cerró sola porque un
30
+ * cierre anterior pasó por encima de ella (ver `Parser.ts`, modo legacy).
31
+ * osu! tira esos cierres, así que el renderer los omite.
32
+ *
33
+ * Existe como nodo, y no como texto, por dos razones. Conserva su rango, que
34
+ * es lo que necesita el parser incremental para saber a qué nodo pertenece
35
+ * cada carácter. Y el exportador puede saltárselo: escrito como texto volvía
36
+ * a salir por el otro lado convertido en etiqueta viva, y el documento no
37
+ * era estable al reexportarlo.
38
+ */
39
+ | 'discarded_tag' | 'group' | 'wnotice' | 'align' | 'tables' | 'table_row' | 'table_col' | 'table_th' | 'gallery' | 'columns' | 'separator' | 'scroll' | 'sup' | 'sub' | 'abbr' | 'mark' | 'kbd' | 'tooltip' | 'flip' | 'raw' | 'plain' | 'effect' | 'anim' | 'container' | 'style_tag' | 'guild' | 'map' | 'custom' | 'error' | 'unknown';
40
+ export type NodeAttributes = Record<string, string | number | boolean | null | undefined>;
41
+ export interface NodeMetadata {
42
+ /** Arbitrary extensions data (plugins can add here) */
43
+ [key: string]: unknown;
44
+ }
45
+ export interface SourceRange {
46
+ start: number;
47
+ end: number;
48
+ }
49
+ /**
50
+ * The primary user-facing node in the Document Model.
51
+ *
52
+ * This is the Red Tree node — mutable, with identity.
53
+ * It wraps/holds reference to the Green Tree node for structural info.
54
+ */
55
+ export interface DocumentNode {
56
+ /** Stable ID that survives incremental re-parses */
57
+ id: NodeId;
58
+ /** Monotonically increasing version number for change tracking */
59
+ version: number;
60
+ /** Semantic kind */
61
+ kind: NodeKind;
62
+ /** Raw text content (for text leaves) */
63
+ text: string;
64
+ /** Tag-level attributes (e.g. color=#ff0000, size=150) */
65
+ attributes: NodeAttributes;
66
+ /** Arbitrary metadata (extensible by plugins) */
67
+ metadata: NodeMetadata;
68
+ /** Child nodes */
69
+ children: DocumentNode[];
70
+ /** Diagnostics attached to this specific node */
71
+ diagnostics: Diagnostic[];
72
+ /** Source position in the original text (for mapping back) */
73
+ sourceRange: SourceRange | null;
74
+ /** Reference back to parent (null for root) */
75
+ parentId: NodeId | null;
76
+ /** Whether this node is "synthetic" (not from source, e.g. auto-generated) */
77
+ isSynthetic: boolean;
78
+ }
79
+ export interface DocumentSnapshot {
80
+ root: DocumentNode;
81
+ source: string;
82
+ language: string;
83
+ version: number;
84
+ createdAt: number;
85
+ }
86
+ export type DocumentChangeKind = 'node_inserted' | 'node_deleted' | 'node_updated' | 'node_moved' | 'attribute_changed' | 'text_changed' | 'source_changed' | 'full_rebuild';
87
+ export interface DocumentChangeEvent {
88
+ kind: DocumentChangeKind;
89
+ nodeId: NodeId;
90
+ /** The affected node (after the change) */
91
+ node: DocumentNode | null;
92
+ /** Previous version of the node (before the change) */
93
+ previousNode: DocumentNode | null;
94
+ /** Additional context data */
95
+ metadata?: Record<string, unknown>;
96
+ }
97
+ export declare function createDocumentNode(kind: NodeKind, text?: string, attributes?: NodeAttributes, children?: DocumentNode[]): DocumentNode;
98
+ export declare function cloneNode(node: DocumentNode, deep?: boolean): DocumentNode;
99
+ /** Get the text content of a node and all its descendants */
100
+ export declare function getNodeText(node: DocumentNode): string;
101
+ /** Walk all descendants in pre-order */
102
+ export declare function walkPreOrder(node: DocumentNode, visitor: (n: DocumentNode, depth: number) => void | 'skip', depth?: number): void;
103
+ /** Find a node by ID */
104
+ export declare function findById(root: DocumentNode, id: NodeId): DocumentNode | null;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * DocumentEngine — Diagnostic Types
3
+ *
4
+ * Diagnostics are messages attached to specific nodes or ranges
5
+ * in the document tree. Inspired by VSCode's diagnostic model.
6
+ */
7
+ import type { Range } from './tokens';
8
+ import type { NodeId, NodeKind } from './core';
9
+ export type DiagnosticSeverity = 'hint' | 'info' | 'warning' | 'error';
10
+ export declare const DIAGNOSTIC_SEVERITY: Record<DiagnosticSeverity, number>;
11
+ export type DiagnosticTag = 'unnecessary' | 'deprecated' | 'unused' | 'redundant';
12
+ export interface Diagnostic {
13
+ /** Machine-readable code (e.g. 'invalid-color', 'missing-close-tag') */
14
+ code: string;
15
+ /** Human-readable message */
16
+ message: string;
17
+ /** Severity level */
18
+ severity: DiagnosticSeverity;
19
+ /** Optional tags for additional categorization */
20
+ tags: DiagnosticTag[];
21
+ /** Source range in the original text */
22
+ range: Range | null;
23
+ /** Node ID this diagnostic is attached to */
24
+ nodeId: NodeId | null;
25
+ /** Node kind for context */
26
+ nodeKind: NodeKind | null;
27
+ /** Source of this diagnostic (built-in, plugin name, etc.) */
28
+ source: string;
29
+ /** Optional related information */
30
+ related?: DiagnosticRelatedInfo[];
31
+ /** Optional fix suggestions */
32
+ fixes?: DiagnosticFix[];
33
+ }
34
+ export interface DiagnosticRelatedInfo {
35
+ message: string;
36
+ range: Range | null;
37
+ nodeId: NodeId | null;
38
+ }
39
+ export interface DiagnosticFix {
40
+ description: string;
41
+ /** Whether this fix is automatic or requires user confirmation */
42
+ isAutomatic: boolean;
43
+ /** The operations to apply as a fix */
44
+ operations: FixOperation[];
45
+ }
46
+ export type FixOperation = {
47
+ kind: 'replace_text';
48
+ range: Range;
49
+ newText: string;
50
+ } | {
51
+ kind: 'insert_text';
52
+ position: number;
53
+ text: string;
54
+ } | {
55
+ kind: 'delete_range';
56
+ range: Range;
57
+ } | {
58
+ kind: 'wrap_in_tag';
59
+ tagName: string;
60
+ range: Range;
61
+ };
62
+ export interface DiagnosticCollection {
63
+ /** All diagnostics */
64
+ items: Diagnostic[];
65
+ /** Count by severity */
66
+ errorCount: number;
67
+ warningCount: number;
68
+ infoCount: number;
69
+ hintCount: number;
70
+ /** Quick access: only errors */
71
+ errors: Diagnostic[];
72
+ /** Quick access: only warnings */
73
+ warnings: Diagnostic[];
74
+ }
75
+ export declare function createDiagnosticCollection(): DiagnosticCollection;
76
+ export declare function createDiagnostic(code: string, message: string, severity: DiagnosticSeverity, options?: {
77
+ nodeId?: NodeId | null;
78
+ nodeKind?: NodeKind | null;
79
+ range?: Range | null;
80
+ tags?: DiagnosticTag[];
81
+ source?: string;
82
+ related?: DiagnosticRelatedInfo[];
83
+ fixes?: DiagnosticFix[];
84
+ }): Diagnostic;
85
+ export declare function addDiagnostic(collection: DiagnosticCollection, diagnostic: Diagnostic): void;
@@ -0,0 +1,11 @@
1
+ export type { Token, TokenKind, TokenStream, Trivia, TriviaKind, Range } from './tokens';
2
+ export { createToken, createTrivia, range, rangeLength, rangeContains, ArrayTokenStream } from './tokens';
3
+ export type { DocumentNode, NodeId, NodeKind, NodeAttributes, NodeMetadata, DocumentSnapshot, DocumentChangeEvent, DocumentChangeKind, SourceRange, } from './core';
4
+ export { createNodeId, createDocumentNode, cloneNode, getNodeText, walkPreOrder, findById } from './core';
5
+ export type { Diagnostic, DiagnosticSeverity, DiagnosticTag, DiagnosticCollection, DiagnosticRelatedInfo, DiagnosticFix, FixOperation, } from './diagnostics';
6
+ export { createDiagnosticCollection, createDiagnostic, addDiagnostic, DIAGNOSTIC_SEVERITY } from './diagnostics';
7
+ export type { Operation, OperationKind, InsertNodeOperation, DeleteNodeOperation, ReplaceNodeOperation, MoveNodeOperation, UpdateAttributesOperation, SetTextOperation, InsertTextOperation, DeleteTextOperation, ReplaceTextOperation, WrapInTagOperation, UnwrapNodeOperation, SplitNodeOperation, MergeNodesOperation, } from './operations';
8
+ export { createOperationId, operationLabel } from './operations';
9
+ export type { Query, QuerySelector, QueryCombinator, QueryStep, QueryMatch, QueryResult } from './queries';
10
+ export { query } from './queries';
11
+ export type { SymbolInfo, SymbolKind, Reference, SymbolTableData, SymbolSearchResult } from './symbols';
@@ -0,0 +1,109 @@
1
+ /**
2
+ * DocumentEngine — Operation & Transaction Types
3
+ *
4
+ * Operations are the atomic units of change in the document.
5
+ * Every modification goes through operations, never direct mutation.
6
+ *
7
+ * Inspired by ProseMirror and Roslyn.
8
+ */
9
+ import type { NodeId, NodeAttributes } from './core';
10
+ import type { RedNode } from '../Syntax/RedNode';
11
+ export type OperationKind = 'insert_node' | 'delete_node' | 'replace_node' | 'move_node' | 'update_attributes' | 'set_text' | 'insert_text' | 'delete_text' | 'replace_text' | 'wrap_in_tag' | 'unwrap_node' | 'split_node' | 'merge_nodes';
12
+ export interface BaseOperation {
13
+ kind: OperationKind;
14
+ /** Stable ID for the operation (for undo/redo pairing) */
15
+ id: string;
16
+ /** Whether this operation can be undone */
17
+ undoable: boolean;
18
+ /** Timestamp */
19
+ timestamp: number;
20
+ }
21
+ export interface InsertNodeOperation extends BaseOperation {
22
+ kind: 'insert_node';
23
+ parentId: NodeId;
24
+ index: number;
25
+ node: RedNode;
26
+ }
27
+ export interface DeleteNodeOperation extends BaseOperation {
28
+ kind: 'delete_node';
29
+ nodeId: NodeId;
30
+ /** The deleted node (stored for undo) */
31
+ node: RedNode;
32
+ parentId: NodeId;
33
+ index: number;
34
+ }
35
+ export interface ReplaceNodeOperation extends BaseOperation {
36
+ kind: 'replace_node';
37
+ nodeId: NodeId;
38
+ newNode: RedNode;
39
+ oldNode: RedNode;
40
+ }
41
+ export interface MoveNodeOperation extends BaseOperation {
42
+ kind: 'move_node';
43
+ nodeId: NodeId;
44
+ fromParentId: NodeId;
45
+ fromIndex: number;
46
+ toParentId: NodeId;
47
+ toIndex: number;
48
+ }
49
+ export interface UpdateAttributesOperation extends BaseOperation {
50
+ kind: 'update_attributes';
51
+ nodeId: NodeId;
52
+ newAttributes: NodeAttributes;
53
+ oldAttributes: NodeAttributes;
54
+ }
55
+ export interface SetTextOperation extends BaseOperation {
56
+ kind: 'set_text';
57
+ nodeId: NodeId;
58
+ newText: string;
59
+ oldText: string;
60
+ }
61
+ export interface InsertTextOperation extends BaseOperation {
62
+ kind: 'insert_text';
63
+ nodeId: NodeId;
64
+ position: number;
65
+ text: string;
66
+ }
67
+ export interface DeleteTextOperation extends BaseOperation {
68
+ kind: 'delete_text';
69
+ nodeId: NodeId;
70
+ position: number;
71
+ length: number;
72
+ text: string;
73
+ }
74
+ export interface ReplaceTextOperation extends BaseOperation {
75
+ kind: 'replace_text';
76
+ nodeId: NodeId;
77
+ position: number;
78
+ length: number;
79
+ newText: string;
80
+ oldText: string;
81
+ }
82
+ export interface WrapInTagOperation extends BaseOperation {
83
+ kind: 'wrap_in_tag';
84
+ nodeId: NodeId;
85
+ tagName: string;
86
+ attributes: NodeAttributes;
87
+ }
88
+ export interface UnwrapNodeOperation extends BaseOperation {
89
+ kind: 'unwrap_node';
90
+ nodeId: NodeId;
91
+ parentId: NodeId;
92
+ children: RedNode[];
93
+ }
94
+ export interface SplitNodeOperation extends BaseOperation {
95
+ kind: 'split_node';
96
+ nodeId: NodeId;
97
+ position: number;
98
+ leftNode: RedNode;
99
+ rightNode: RedNode;
100
+ }
101
+ export interface MergeNodesOperation extends BaseOperation {
102
+ kind: 'merge_nodes';
103
+ leftNodeId: NodeId;
104
+ rightNodeId: NodeId;
105
+ mergedNode: RedNode;
106
+ }
107
+ export type Operation = InsertNodeOperation | DeleteNodeOperation | ReplaceNodeOperation | MoveNodeOperation | UpdateAttributesOperation | SetTextOperation | InsertTextOperation | DeleteTextOperation | ReplaceTextOperation | WrapInTagOperation | UnwrapNodeOperation | SplitNodeOperation | MergeNodesOperation;
108
+ export declare function createOperationId(): string;
109
+ export declare function operationLabel(op: Operation): string;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * DocumentEngine — Query Types
3
+ *
4
+ * CSS-inspired query selectors for the document tree.
5
+ * Enables queries like: `paragraph > bold`, `quote text`, `[color]`
6
+ */
7
+ import type { NodeKind } from './core';
8
+ import type { RedNode } from '../Syntax/RedNode';
9
+ export type QuerySelector = {
10
+ type: 'kind';
11
+ kind: NodeKind;
12
+ } | {
13
+ type: 'tag';
14
+ tag: string;
15
+ } | {
16
+ type: 'attribute';
17
+ name: string;
18
+ value?: string;
19
+ } | {
20
+ type: 'has_attribute';
21
+ name: string;
22
+ } | {
23
+ type: 'text';
24
+ pattern: string;
25
+ } | {
26
+ type: 'has_child';
27
+ selector: QuerySelector;
28
+ } | {
29
+ type: 'has_descendant';
30
+ selector: QuerySelector;
31
+ } | {
32
+ type: 'nth_child';
33
+ n: number;
34
+ } | {
35
+ type: 'first_child';
36
+ } | {
37
+ type: 'last_child';
38
+ } | {
39
+ type: 'position';
40
+ min?: number;
41
+ max?: number;
42
+ } | {
43
+ type: 'depth';
44
+ min?: number;
45
+ max?: number;
46
+ };
47
+ export type QueryCombinator = 'child' | 'descendant' | 'adjacent' | 'sibling';
48
+ export interface QueryStep {
49
+ selector: QuerySelector[];
50
+ combinator: QueryCombinator | 'root';
51
+ }
52
+ export interface Query {
53
+ steps: QueryStep[];
54
+ }
55
+ export interface QueryMatch {
56
+ node: RedNode;
57
+ /** How well this node matches (for sorting results) */
58
+ score: number;
59
+ /** The specific selectors that matched */
60
+ matchedSelectors: string[];
61
+ }
62
+ export declare function query(selector: string): Query;
63
+ export interface QueryResult {
64
+ matches: QueryMatch[];
65
+ total: number;
66
+ time: number;
67
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * DocumentEngine — Symbol Types
3
+ *
4
+ * Symbol system for definitions and references in BBCode documents.
5
+ * Enables: go-to-definition, find-all-references, rename, etc.
6
+ *
7
+ * Inspired by Language Server Protocol (LSP).
8
+ */
9
+ import type { NodeId, SourceRange } from './core';
10
+ export type SymbolKind = 'tag' | 'id_definition' | 'id_reference' | 'class' | 'property' | 'variable' | 'function' | 'module' | 'snippet' | 'template' | 'other';
11
+ export interface SymbolInfo {
12
+ /** Unique ID for this symbol */
13
+ id: string;
14
+ /** Symbol name (e.g. 'hero', 'my-block') */
15
+ name: string;
16
+ /** Symbol kind */
17
+ kind: SymbolKind;
18
+ /** The node that defines this symbol */
19
+ definitionNodeId: NodeId;
20
+ /** Source range of the definition */
21
+ definitionRange: SourceRange;
22
+ /** Container node (e.g. the document) */
23
+ containerNodeId: NodeId;
24
+ /** All references to this symbol */
25
+ references: Reference[];
26
+ /** Additional data */
27
+ data?: Record<string, unknown>;
28
+ }
29
+ export interface Reference {
30
+ nodeId: NodeId;
31
+ range: SourceRange;
32
+ kind: 'definition' | 'reference' | 'implementation';
33
+ }
34
+ export interface SymbolTableData {
35
+ symbols: Map<string, SymbolInfo>;
36
+ /** Quick lookup: node ID → symbol */
37
+ nodeToSymbol: Map<NodeId, string>;
38
+ }
39
+ export interface SymbolSearchResult {
40
+ symbol: SymbolInfo;
41
+ score: number;
42
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * DocumentEngine — Token & Trivia Types
3
+ *
4
+ * Tokens are the output of the Lexer and input to the Parser.
5
+ * Trivia is whitespace, newlines, formatting that is preserved
6
+ * but not semantically meaningful — inspired by Roslyn.
7
+ */
8
+ export type TriviaKind = 'whitespace' | 'newline' | 'carriage_return' | 'comment' | 'line_continuation';
9
+ export interface Trivia {
10
+ kind: TriviaKind;
11
+ text: string;
12
+ range: Range;
13
+ }
14
+ export interface Range {
15
+ start: number;
16
+ end: number;
17
+ }
18
+ export declare function range(start: number, end: number): Range;
19
+ export declare function rangeLength(r: Range): number;
20
+ export declare function rangeContains(r: Range, pos: number): boolean;
21
+ export type TokenKind = 'open_tag' | 'close_tag' | 'self_closing_tag' | 'text' | 'newline' | 'whitespace' | 'attribute_name' | 'attribute_value' | 'equals' | 'quote' | 'end_of_file' | 'error';
22
+ export interface Token {
23
+ kind: TokenKind;
24
+ text: string;
25
+ range: Range;
26
+ /** Tag name or attribute name if applicable */
27
+ name?: string;
28
+ /** Full raw tag text including brackets: [b], [/color], [*] */
29
+ tagText?: string;
30
+ /** Raw attribute string (everything between tag name and closing ]) */
31
+ attrs?: string;
32
+ /** Trivia attached BEFORE this token (whitespace, newlines) */
33
+ leadingTrivia: Trivia[];
34
+ /** Trivia attached AFTER this token */
35
+ trailingTrivia: Trivia[];
36
+ }
37
+ export interface TokenStream {
38
+ /** Peek at the current token without consuming */
39
+ peek(): Token;
40
+ /** Consume and return the current token, advance */
41
+ advance(): Token;
42
+ /** Look ahead n tokens (0 = next) */
43
+ lookAhead(n: number): Token;
44
+ /** Whether we've consumed all tokens */
45
+ isEof(): boolean;
46
+ /** Get current position in the stream */
47
+ position(): number;
48
+ /** Reset to a position */
49
+ seek(pos: number): void;
50
+ /** Get all remaining tokens */
51
+ remaining(): Token[];
52
+ /** Get all tokens */
53
+ getAll(): Token[];
54
+ }
55
+ export declare function createToken(kind: TokenKind, text: string, start: number, end: number, options?: {
56
+ name?: string;
57
+ tagText?: string;
58
+ attrs?: string;
59
+ leadingTrivia?: Trivia[];
60
+ trailingTrivia?: Trivia[];
61
+ }): Token;
62
+ export declare function createTrivia(kind: TriviaKind, text: string, start: number, end: number): Trivia;
63
+ export declare class ArrayTokenStream implements TokenStream {
64
+ private tokens;
65
+ private pos;
66
+ constructor(tokens: Token[]);
67
+ peek(): Token;
68
+ advance(): Token;
69
+ lookAhead(n: number): Token;
70
+ isEof(): boolean;
71
+ position(): number;
72
+ seek(pos: number): void;
73
+ remaining(): Token[];
74
+ getAll(): Token[];
75
+ }
@@ -0,0 +1,21 @@
1
+ export type GeneratorTheme = 'forum_post' | 'beatmap_desc' | 'random_chat';
2
+ export declare class BBCodeGenerator {
3
+ private nouns;
4
+ private adjectives;
5
+ private verbs;
6
+ private players;
7
+ private colors;
8
+ private randomInt;
9
+ private pick;
10
+ private generateSentence;
11
+ private generateParagraph;
12
+ private generateHeading;
13
+ private generateHighlight;
14
+ private generateList;
15
+ private generateNotice;
16
+ private generateBox;
17
+ generate(theme?: GeneratorTheme): string;
18
+ private generateForumPost;
19
+ private generateBeatmapDesc;
20
+ private generateRandomChat;
21
+ }
@@ -0,0 +1,92 @@
1
+ export type Easing = "linear" | "easeIn" | "easeOut" | "easeInOut" | "easeIO" | "parabola" | "half-parabola" | string;
2
+ export declare function solveCubicBezierY(x: number, x1: number, y1: number, x2: number, y2: number): number;
3
+ /**
4
+ * Set by EffectMath at module load. ColorMath cannot import it directly —
5
+ * EffectMath depends on ColorMath — and `ease` is the only place that
6
+ * needs it, so the dependency is injected rather than inverted.
7
+ */
8
+ type ExpressionFn = (vars: Record<string, number>) => number;
9
+ /** @internal Wire the expression compiler into `ease`. */
10
+ export declare function __setExpressionCompiler(fn: (src: string) => ExpressionFn | null): void;
11
+ /**
12
+ * Resuelve una vez todo lo que en `ease` no depende de `t`, y devuelve la
13
+ * función que sí lo hace.
14
+ *
15
+ * `evaluateEffect` llama a `ease` UNA VEZ POR CARÁCTER con la misma cadena de
16
+ * suavizado. Para `bezier(a,b,c,d)` eso significaba volver a lanzar la
17
+ * expresión regular y cuatro `parseFloat` sobre la misma cadena en cada
18
+ * carácter; para `expr(...)`, un `slice` por carácter. Compilar arriba del
19
+ * bucle deja el trabajo por carácter en la aritmética que de verdad varía.
20
+ *
21
+ * Medido sobre 150 líneas de `[gradient …;easing=bezier(...)]` (19 KiB): el
22
+ * render pasó de 16,4 ms a 1,2 ms.
23
+ */
24
+ export declare function compileEase(easing: Easing, center?: number, power?: number): (t: number) => number;
25
+ export declare function ease(t: number, easing: Easing, center?: number, power?: number): number;
26
+ export declare function hslToHex(h: number, s: number, l: number): string;
27
+ /**
28
+ * A hex colour token to RGB.
29
+ *
30
+ * Accepts `#rgb`, `#rgba`, `#rrggbb` and `#rrggbbaa`, hash optional.
31
+ * Anything else returns black instead of `NaN`: these strings come from
32
+ * BBCode attributes and from a text field the user is mid-way through
33
+ * typing, and a `NaN` channel propagates into `#NaNNaNNaN`, corrupting
34
+ * the whole gradient rather than the one bad stop.
35
+ *
36
+ * Parsed by char code rather than by regex + `parseInt`. This runs once
37
+ * per character per colour layer per keystroke — two calls for every
38
+ * `mixHex` — and the regex version was the single largest cost in
39
+ * compiling a long document.
40
+ */
41
+ export declare function hexToRgb(hex: string): [number, number, number];
42
+ /** True when a token is a hex colour `hexToRgb` can read exactly. */
43
+ export declare function isHexColor(value: string): boolean;
44
+ export declare function hexToHsl(hex: string): [number, number, number];
45
+ export declare function mixHex(color1: string, color2: string, weight: number): string;
46
+ export declare function mixMultiple(colors: string[], weight: number): string;
47
+ export interface ColorStop {
48
+ color: string;
49
+ position: number;
50
+ }
51
+ /**
52
+ * Sample a stop list at `weight`.
53
+ *
54
+ * `perceptual` interpolates in OKLab instead of sRGB. The difference
55
+ * shows wherever two stops differ in hue: an sRGB ramp from blue to
56
+ * yellow dips through a desaturated grey at the midpoint, while OKLab
57
+ * holds chroma. Two conversions per character, so it stays opt-in.
58
+ */
59
+ export declare function mixMultipleStops(stops: ColorStop[], weight: number, perceptual?: boolean): string;
60
+ /**
61
+ * Convert a hex colour to OKLab [L, a, b] components.
62
+ * L (lightness) in [0, 1], a/b (opponent axes) roughly in [-0.4, 0.4].
63
+ */
64
+ export declare function hexToOklab(hex: string): [number, number, number];
65
+ /**
66
+ * Calculate the perceptual distance between two hex colours using OKLab.
67
+ * Returns a value in [0, ~0.4] where:
68
+ * < 0.02 ≈ imperceptible difference
69
+ * < 0.05 ≈ small but noticeable
70
+ * > 0.1 ≈ very noticeable
71
+ */
72
+ export declare function perceptualDistance(hex1: string, hex2: string): number;
73
+ /**
74
+ * `perceptualDistance` for callers that already hold both OKLab triples.
75
+ *
76
+ * Gradient detection converts a colour to OKLab once per stop and then asks
77
+ * for distances between neighbours, between chord endpoints and against an
78
+ * ideal ramp — each of which re-derived both triples from their hex strings.
79
+ * The results are identical; this just stops paying for the conversion again.
80
+ */
81
+ export declare function perceptualDistanceOklab(c1: readonly [number, number, number], c2: readonly [number, number, number]): number;
82
+ /**
83
+ * Mix two hex colours in OKLab space for perceptually uniform interpolation.
84
+ */
85
+ export declare function mixHexOklab(color1: string, color2: string, weight: number): string;
86
+ /**
87
+ * `mixHexOklab` for callers that already hold both OKLab triples — the same
88
+ * saving as {@link perceptualDistanceOklab}, for the ideal-ramp comparison
89
+ * that mixes the *same* two endpoints once per colour in the sequence.
90
+ */
91
+ export declare function mixOklabToHex(c1: readonly [number, number, number], c2: readonly [number, number, number], weight: number): string;
92
+ export {};