@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.
- package/dist/Visuals/lyne.css +117 -6
- package/dist/Visuals/osu.css +36 -5
- package/dist/index.js +9664 -3282
- package/dist/index.mjs +9535 -3283
- package/dist/types/Analysis/Contracts/AnalysisReport.d.ts +22 -0
- package/dist/types/Analysis/Contracts/Contribution.d.ts +68 -0
- package/dist/types/Analysis/Contracts/Pass.d.ts +59 -0
- package/dist/types/Analysis/Contracts/PipelineContext.d.ts +34 -0
- package/dist/types/Analysis/Passes/Analysis/ColorUsageAnalyzer.d.ts +56 -0
- package/dist/types/Analysis/Passes/Analysis/GradientAnalyzer.d.ts +111 -0
- package/dist/types/Analysis/Passes/Analysis/MergeableColorAnalyzer.d.ts +26 -0
- package/dist/types/Analysis/Passes/Analysis/RainbowAnalyzer.d.ts +47 -0
- package/dist/types/Analysis/Passes/Analysis/SymbolAnalyzer.d.ts +89 -0
- package/dist/types/Analysis/Passes/Analysis/WaveAnalyzer.d.ts +44 -0
- package/dist/types/Analysis/Passes/Analysis/__tests__/GradientAnalyzer.test.d.ts +4 -0
- package/dist/types/Analysis/Passes/Analysis/__tests__/MergeableColorAnalyzer.test.d.ts +4 -0
- package/dist/types/Analysis/Passes/Analysis/__tests__/RainbowAnalyzer.test.d.ts +4 -0
- package/dist/types/Analysis/Passes/Analysis/__tests__/WaveAnalyzer.test.d.ts +4 -0
- package/dist/types/Analysis/Passes/Decision/DefaultDecision.d.ts +30 -0
- package/dist/types/Analysis/Passes/Decision/PaletteRemapDecision.d.ts +169 -0
- package/dist/types/Analysis/Passes/Decision/__tests__/DefaultDecision.test.d.ts +4 -0
- package/dist/types/Analysis/Passes/Transform/CollapseGradientTransform.d.ts +37 -0
- package/dist/types/Analysis/Passes/Transform/MergeColorsTransform.d.ts +28 -0
- package/dist/types/Analysis/Passes/Transform/RainbowCollapseTransform.d.ts +19 -0
- package/dist/types/Analysis/Passes/Transform/WaveCollapseTransform.d.ts +20 -0
- package/dist/types/Analysis/Passes/Utility/CharacterCountAnalyzer.d.ts +19 -0
- package/dist/types/Analysis/Pipeline/Pipeline.d.ts +69 -0
- package/dist/types/Analysis/Pipeline/PipelineBuilder.d.ts +31 -0
- package/dist/types/Analysis/Pipeline/PipelineStage.d.ts +17 -0
- package/dist/types/Analysis/Utils/color-utils.d.ts +60 -0
- package/dist/types/Analysis/__tests__/Integration.test.d.ts +8 -0
- package/dist/types/Analysis/__tests__/PaletteRemap.test.d.ts +14 -0
- package/dist/types/Analysis/__tests__/Pipeline.test.d.ts +10 -0
- package/dist/types/Analysis/__tests__/RoundTrip.test.d.ts +30 -0
- package/dist/types/Analysis/__tests__/SymbolAnalyzer.test.d.ts +11 -0
- package/dist/types/Analysis/index.d.ts +40 -0
- package/dist/types/BBCode/BBCodeDocumentModel.d.ts +92 -0
- package/dist/types/BBCode/BBCodeToGreenNode.d.ts +111 -0
- package/dist/types/BBCode/Parser.d.ts +78 -0
- package/dist/types/BBCode/index.d.ts +4 -0
- package/dist/types/Collab/positions.d.ts +55 -0
- package/dist/types/Commands/Command.d.ts +37 -0
- package/dist/types/Commands/CommandRegistry.d.ts +48 -0
- package/dist/types/Commands/DeleteNode.d.ts +7 -0
- package/dist/types/Commands/InsertText.d.ts +8 -0
- package/dist/types/Commands/SplitMerge.d.ts +9 -0
- package/dist/types/Commands/WrapInTag.d.ts +8 -0
- package/dist/types/Commands/index.d.ts +6 -0
- package/dist/types/Diff/TreeDiffer.d.ts +52 -0
- package/dist/types/Diff/__tests__/TreeDiffer.test.d.ts +1 -0
- package/dist/types/Diff/index.d.ts +2 -0
- package/dist/types/Edits/EditPlan.d.ts +144 -0
- package/dist/types/Edits/Optimizer.d.ts +78 -0
- package/dist/types/Edits/Rules/Rule.d.ts +91 -0
- package/dist/types/Edits/Rules/dropEmptyTags.d.ts +40 -0
- package/dist/types/Edits/Rules/dropRedundantNesting.d.ts +59 -0
- package/dist/types/Edits/Rules/index.d.ts +9 -0
- package/dist/types/Edits/Rules/mergeAdjacent.d.ts +93 -0
- package/dist/types/Edits/Rules/reorderWrappers.d.ts +42 -0
- package/dist/types/Edits/Rules/shortenHex.d.ts +30 -0
- package/dist/types/Edits/Rules/tagValue.d.ts +56 -0
- package/dist/types/Edits/Rules/unwrapInvisibleColor.d.ts +47 -0
- package/dist/types/Edits/applyEdits.d.ts +36 -0
- package/dist/types/Edits/index.d.ts +6 -0
- package/dist/types/Events/EventBus.d.ts +103 -0
- package/dist/types/Events/index.d.ts +2 -0
- package/dist/types/Formatter/Formatter.d.ts +32 -0
- package/dist/types/Formatter/index.d.ts +2 -0
- package/dist/types/HTML/HTMLDocumentModel.d.ts +13 -0
- package/dist/types/HTML/HTMLToGreenNode.d.ts +4 -0
- package/dist/types/Incremental/BracketIndex.d.ts +101 -0
- package/dist/types/Incremental/ChangeTracker.d.ts +69 -0
- package/dist/types/Incremental/IncrementalParser.d.ts +246 -0
- package/dist/types/Incremental/__tests__/BracketIndex.test.d.ts +1 -0
- package/dist/types/Incremental/__tests__/IncrementalParser.test.d.ts +1 -0
- package/dist/types/Incremental/index.d.ts +4 -0
- package/dist/types/Lexer/BBCodeLexer.d.ts +74 -0
- package/dist/types/Lexer/Lexer.d.ts +54 -0
- package/dist/types/Lexer/index.d.ts +4 -0
- package/dist/types/Linter/Linter.d.ts +58 -0
- package/dist/types/Linter/index.d.ts +2 -0
- package/dist/types/Markdown/MarkdownAST.d.ts +122 -0
- package/dist/types/Markdown/MarkdownDocumentModel.d.ts +15 -0
- package/dist/types/Markdown/MarkdownLexer.d.ts +155 -0
- package/dist/types/Markdown/MarkdownParser.d.ts +42 -0
- package/dist/types/Markdown/MarkdownToGreenNode.d.ts +6 -0
- package/dist/types/MilHibri/MilHibriDocumentModel.d.ts +21 -0
- package/dist/types/Model/DocumentModel.d.ts +318 -0
- package/dist/types/Model/NodeFactory.d.ts +29 -0
- package/dist/types/Model/TagRegistry.d.ts +165 -0
- package/dist/types/Model/index.d.ts +5 -0
- package/dist/types/Plugins/PluginAPI.d.ts +44 -0
- package/dist/types/Plugins/PluginRegistry.d.ts +81 -0
- package/dist/types/Plugins/index.d.ts +3 -0
- package/dist/types/Queries/QueryEngine.d.ts +32 -0
- package/dist/types/Queries/index.d.ts +1 -0
- package/dist/types/Reconciler/SurgicalReconciler.d.ts +23 -0
- package/dist/types/RenderPipeline/RenderPipeline.d.ts +46 -0
- package/dist/types/RenderPipeline/RenderTree.d.ts +55 -0
- package/dist/types/RenderPipeline/index.d.ts +4 -0
- package/dist/types/Repair/NestingRepair.d.ts +48 -0
- package/dist/types/Repair/index.d.ts +1 -0
- package/dist/types/Semantic/SemanticAnalyzer.d.ts +321 -0
- package/dist/types/Semantic/index.d.ts +2 -0
- package/dist/types/Symbols/SymbolTable.d.ts +47 -0
- package/dist/types/Symbols/index.d.ts +1 -0
- package/dist/types/Syntax/GreenNode.d.ts +154 -0
- package/dist/types/Syntax/GreenNodePool.d.ts +134 -0
- package/dist/types/Syntax/NodeMatcher.d.ts +75 -0
- package/dist/types/Syntax/RedNode.d.ts +280 -0
- package/dist/types/Syntax/RedNodeStore.d.ts +116 -0
- package/dist/types/Syntax/TreeBuilder.d.ts +54 -0
- package/dist/types/Syntax/__tests__/GreenNode.test.d.ts +1 -0
- package/dist/types/Syntax/__tests__/RedNode.test.d.ts +1 -0
- package/dist/types/Syntax/__tests__/RedNodeStore.test.d.ts +1 -0
- package/dist/types/Syntax/greenEdit.d.ts +64 -0
- package/dist/types/Syntax/hash.d.ts +17 -0
- package/dist/types/Syntax/index.d.ts +8 -0
- package/dist/types/Syntax/nodeAttr.d.ts +63 -0
- package/dist/types/Syntax/partition.d.ts +67 -0
- package/dist/types/Syntax/preserveNodeIds.d.ts +47 -0
- package/dist/types/Tokens/TokenResolver.d.ts +25 -0
- package/dist/types/Tokens/index.d.ts +1 -0
- package/dist/types/Transactions/Transaction.d.ts +36 -0
- package/dist/types/Transactions/UndoManager.d.ts +63 -0
- package/dist/types/Transactions/index.d.ts +3 -0
- package/dist/types/Transformers/ASTOptimizer.d.ts +34 -0
- package/dist/types/Transformers/GradientTransformer.d.ts +18 -0
- package/dist/types/Transformers/GrowTransformer.d.ts +16 -0
- package/dist/types/Transformers/RainbowTransformer.d.ts +17 -0
- package/dist/types/Transformers/SineWaveTransformer.d.ts +17 -0
- package/dist/types/Transformers/Transformer.d.ts +17 -0
- package/dist/types/Types/core.d.ts +104 -0
- package/dist/types/Types/diagnostics.d.ts +85 -0
- package/dist/types/Types/index.d.ts +11 -0
- package/dist/types/Types/operations.d.ts +109 -0
- package/dist/types/Types/queries.d.ts +67 -0
- package/dist/types/Types/symbols.d.ts +42 -0
- package/dist/types/Types/tokens.d.ts +75 -0
- package/dist/types/Utils/BBCodeGenerator.d.ts +21 -0
- package/dist/types/Utils/ColorMath.d.ts +92 -0
- package/dist/types/Utils/EffectMath.d.ts +643 -0
- package/dist/types/Utils/TagVocabulary.d.ts +104 -0
- package/dist/types/Utils/TagVocabulary.test.d.ts +1 -0
- package/dist/types/Utils/color.d.ts +29 -0
- package/dist/types/Utils/dom-to-svg.d.ts +28 -0
- package/dist/types/Utils/dom-to-svg.test.d.ts +1 -0
- package/dist/types/Utils/treeTransformers.d.ts +160 -0
- package/dist/types/Visitors/BBBlocksExporter.d.ts +27 -0
- package/dist/types/Visitors/BBCodeExporter.d.ts +90 -0
- package/dist/types/Visitors/BlockPatcher.d.ts +91 -0
- package/dist/types/Visitors/DOMMorpher.d.ts +13 -0
- package/dist/types/Visitors/HTMLRenderer.d.ts +380 -0
- package/dist/types/Visitors/JSONExporter.d.ts +42 -0
- package/dist/types/Visitors/MarkdownExporter.d.ts +28 -0
- package/dist/types/Visitors/SVGRenderer.d.ts +16 -0
- package/dist/types/Visitors/TiptapExporter.d.ts +40 -0
- package/dist/types/Visitors/Visitor.d.ts +35 -0
- package/dist/types/Visitors/index.d.ts +9 -0
- package/dist/types/Visuals/BoxDrawer.d.ts +49 -0
- package/dist/types/Visuals/index.d.ts +38 -0
- package/dist/types/index.d.ts +154 -0
- package/package.json +14 -10
- package/src/Analysis/Passes/Analysis/ColorUsageAnalyzer.ts +103 -0
- package/src/Analysis/Passes/Analysis/GradientAnalyzer.ts +294 -20
- package/src/Analysis/Passes/Analysis/SymbolAnalyzer.ts +257 -0
- package/src/Analysis/Passes/Decision/PaletteRemapDecision.ts +425 -0
- package/src/Analysis/Pipeline/Pipeline.ts +15 -2
- package/src/Analysis/index.ts +8 -2
- package/src/BBCode/BBCodeDocumentModel.ts +3 -0
- package/src/BBCode/BBCodeToGreenNode.ts +18 -12
- package/src/BBCode/Parser.ts +38 -1
- package/src/Edits/EditPlan.ts +290 -0
- package/src/Edits/Optimizer.ts +185 -0
- package/src/Edits/Rules/Rule.ts +145 -0
- package/src/Edits/Rules/dropEmptyTags.ts +110 -0
- package/src/Edits/Rules/dropRedundantNesting.ts +120 -0
- package/src/Edits/Rules/index.ts +28 -0
- package/src/Edits/Rules/mergeAdjacent.ts +224 -0
- package/src/Edits/Rules/reorderWrappers.ts +154 -0
- package/src/Edits/Rules/shortenHex.ts +79 -0
- package/src/Edits/Rules/tagValue.ts +105 -0
- package/src/Edits/Rules/unwrapInvisibleColor.ts +93 -0
- package/src/Edits/applyEdits.ts +54 -0
- package/src/Edits/index.ts +22 -0
- package/src/Events/EventBus.ts +18 -0
- package/src/HTML/HTMLToGreenNode.ts +185 -37
- package/src/Incremental/BracketIndex.ts +249 -0
- package/src/Incremental/IncrementalParser.ts +464 -41
- package/src/Lexer/BBCodeLexer.ts +25 -3
- package/src/Lexer/index.ts +1 -1
- package/src/Markdown/MarkdownAST.ts +65 -2
- package/src/Markdown/MarkdownLexer.ts +69 -14
- package/src/Markdown/MarkdownParser.ts +749 -62
- package/src/Markdown/MarkdownToGreenNode.ts +148 -27
- package/src/MilHibri/MilHibriDocumentModel.ts +56 -0
- package/src/Model/DocumentModel.ts +138 -5
- package/src/Model/TagRegistry.ts +129 -134
- package/src/Reconciler/SurgicalReconciler.ts +460 -0
- package/src/Repair/NestingRepair.ts +116 -0
- package/src/Repair/index.ts +1 -0
- package/src/Semantic/SemanticAnalyzer.ts +1802 -65
- package/src/Syntax/GreenNodePool.ts +12 -12
- package/src/Syntax/RedNode.ts +17 -3
- package/src/Syntax/RedNodeStore.ts +9 -1
- package/src/Syntax/nodeAttr.ts +172 -0
- package/src/Tokens/TokenResolver.ts +55 -0
- package/src/Tokens/index.ts +1 -0
- package/src/Types/core.ts +15 -0
- package/src/Utils/ColorMath.ts +276 -55
- package/src/Utils/EffectMath.ts +2462 -0
- package/src/Utils/TagVocabulary.ts +141 -0
- package/src/Utils/dom-to-svg.ts +28 -12
- package/src/Visitors/BBBlocksExporter.ts +15 -1
- package/src/Visitors/BBCodeExporter.ts +319 -32
- package/src/Visitors/BlockPatcher.ts +87 -11
- package/src/Visitors/DOMMorpher.ts +15 -5
- package/src/Visitors/HTMLRenderer.ts +374 -151
- package/src/Visitors/MarkdownExporter.ts +98 -41
- package/src/Visitors/TiptapExporter.ts +1 -0
- package/src/Visuals/index.ts +7 -4
- package/src/Visuals/lyne.css +117 -6
- package/src/Visuals/osu.css +36 -5
- package/src/index.ts +172 -5
- package/dist/index.d.mts +0 -4612
- package/dist/index.d.ts +0 -4612
- package/src/Analysis/Passes/Analysis/__tests__/GradientAnalyzer.test.ts +0 -135
- package/src/Analysis/Passes/Analysis/__tests__/MergeableColorAnalyzer.test.ts +0 -84
- package/src/Analysis/Passes/Analysis/__tests__/RainbowAnalyzer.test.ts +0 -99
- package/src/Analysis/Passes/Analysis/__tests__/WaveAnalyzer.test.ts +0 -119
- package/src/Analysis/Passes/Decision/__tests__/DefaultDecision.test.ts +0 -179
- package/src/Analysis/__tests__/Integration.test.ts +0 -162
- package/src/Analysis/__tests__/Pipeline.test.ts +0 -133
- package/src/Diff/__tests__/TreeDiffer.test.ts +0 -65
- package/src/Incremental/__tests__/IncrementalParser.test.ts +0 -164
- package/src/Syntax/__tests__/GreenNode.test.ts +0 -33
- package/src/Syntax/__tests__/RedNode.test.ts +0 -81
- package/src/Syntax/__tests__/RedNodeStore.test.ts +0 -104
- package/src/Tests/ASTOptimizerIdempotence.test.ts +0 -77
- package/src/Tests/BlockPatcher.test.ts +0 -437
- package/src/Tests/BlockPatcherWindowed.test.ts +0 -364
- package/src/Tests/BoxDrawer.test.ts +0 -217
- package/src/Tests/BoxRichTitle.test.ts +0 -105
- package/src/Tests/Chars500kBenchmark.test.ts +0 -151
- package/src/Tests/Chars500kEdits.test.ts +0 -321
- package/src/Tests/CollabPositions.test.ts +0 -146
- package/src/Tests/CompilerPathProfiling.test.ts +0 -186
- package/src/Tests/DOMMorpher.test.ts +0 -142
- package/src/Tests/DomPatchPerf.test.ts +0 -60
- package/src/Tests/EffectSegments.snapshot.json +0 -616
- package/src/Tests/EffectSegments.test.ts +0 -68
- package/src/Tests/FindNodeAtOffset.test.ts +0 -65
- package/src/Tests/Fuzzer.test.ts +0 -166
- package/src/Tests/GreenNodePool.test.ts +0 -153
- package/src/Tests/Lexer.test.ts +0 -238
- package/src/Tests/LyneMode.test.ts +0 -291
- package/src/Tests/ModelCoherence.test.ts +0 -180
- package/src/Tests/Partition.test.ts +0 -238
- package/src/Tests/PluginTags.test.ts +0 -150
- package/src/Tests/ProblematicSection.test.ts +0 -46
- package/src/Tests/ProblematicSectionHTML.test.ts +0 -58
- package/src/Tests/RedReuse.test.ts +0 -134
- package/src/Tests/ReproDelete20k.test.ts +0 -62
- package/src/Tests/SemanticValidators.test.ts +0 -136
- package/src/Tests/StableNodeIds.test.ts +0 -210
- package/src/Tests/StudioColorBloat.test.ts +0 -25
- package/src/Tests/StudioDebugText.test.ts +0 -27
- package/src/Tests/StudioTrailingChar.test.ts +0 -25
- package/src/Tests/StudioValidText.test.ts +0 -25
- package/src/Tests/UrlImgBug.test.ts +0 -23
- package/src/Tests/VisualBuilderFidelity.test.ts +0 -105
- package/src/Tests/referenceDocument.ts +0 -119
- package/src/Utils/dom-to-svg.test.ts +0 -86
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The reference document the heavier suites parse.
|
|
3
|
-
*
|
|
4
|
-
* This replaces two `.milia` fixtures that used to sit next to `src/` and were
|
|
5
|
-
* read with `fs.readFileSync`. They were never committed, so the moment they
|
|
6
|
-
* were gone seven tests failed with `ENOENT` and nothing in the repository
|
|
7
|
-
* could bring them back. A fixture a test cannot survive without belongs in the
|
|
8
|
-
* repository, and the cheapest way to guarantee that is to make it code.
|
|
9
|
-
*
|
|
10
|
-
* Honest limitation: the originals were real posts from the wild, ~12 KB each.
|
|
11
|
-
* This is a reconstruction. It reproduces the *shapes* that made those files
|
|
12
|
-
* worth parsing — the ones listed below — but it cannot reproduce the surprise
|
|
13
|
-
* of real user input. Anything found in a real document that this misses should
|
|
14
|
-
* be added here rather than kept in an untracked file.
|
|
15
|
-
*
|
|
16
|
-
* What it deliberately contains:
|
|
17
|
-
*
|
|
18
|
-
* - Deep nesting, and tags closed out of order by ordinary authors
|
|
19
|
-
* - Braille blanks (`⠀`) used as layout padding, which the exporter must not
|
|
20
|
-
* invent or drop
|
|
21
|
-
* - CRLF alongside LF, and runs of blank lines
|
|
22
|
-
* - Bracketed prose that is *not* a tag — `[90 misses]`, `[Gateron]` — which
|
|
23
|
-
* the parser renders literally and the validators must stay quiet about
|
|
24
|
-
* - Non-ASCII text and emoji, so offsets are exercised beyond one byte
|
|
25
|
-
* - Attribute values that themselves contain markup (`[box=[b]t[/b]]`)
|
|
26
|
-
* - Long stretches of plain text, so a gradient has characters to colour
|
|
27
|
-
*
|
|
28
|
-
* It must stay **valid**: `SemanticValidators` asserts zero errors and zero
|
|
29
|
-
* warnings on it, on the grounds that a checker crying wolf on an ordinary
|
|
30
|
-
* document is worse than a silent one. Adding a deprecated tag here would break
|
|
31
|
-
* that on purpose, so don't.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
const SECTION_PAD = '⠀'.repeat(8)
|
|
35
|
-
|
|
36
|
-
export const REFERENCE_DOCUMENT = [
|
|
37
|
-
'[centre]',
|
|
38
|
-
`${SECTION_PAD}[size=150][b]perfil de ejemplo[/b][/size]${SECTION_PAD}`,
|
|
39
|
-
'[/centre]',
|
|
40
|
-
'',
|
|
41
|
-
'[box=[b]sobre mí[/b]]',
|
|
42
|
-
'Llevo jugando desde 2017 y sigo fallando los mismos patrones.',
|
|
43
|
-
'Mi mejor racha this season fue un [90 misses] limpio — sí, limpio.',
|
|
44
|
-
'Teclado [Gateron] rojo, tableta pequeña, mucha paciencia. 🎵',
|
|
45
|
-
'[/box]',
|
|
46
|
-
'',
|
|
47
|
-
'[centre]',
|
|
48
|
-
// Author colours must stay OUTSIDE `REFERENCE_GRADIENT_COLORS`: the HTML
|
|
49
|
-
// suite proves a gradient's stops are absent without a gradient layer, and a
|
|
50
|
-
// collision here would make that assertion unprovable.
|
|
51
|
-
'[color=#7aa2f7]━━━━━━━━━━━━━━━━━━━━━━━━━━━━[/color]',
|
|
52
|
-
'[/centre]',
|
|
53
|
-
'',
|
|
54
|
-
'[b]Cosas que me gustan[/b]',
|
|
55
|
-
'[list]',
|
|
56
|
-
'[*]Mapas de stream largos, aunque no los pase',
|
|
57
|
-
'[*]Skins minimalistas con hitsounds fuertes',
|
|
58
|
-
'[*]Los mapas de [i]Sotarks[/i] cuando está inspirado',
|
|
59
|
-
'[/list]',
|
|
60
|
-
'',
|
|
61
|
-
// Deliberate CRLF island: the lexer folds line endings and the partition
|
|
62
|
-
// invariant has to keep covering both bytes of a `\r\n`.
|
|
63
|
-
'Una sección con saltos de Windows:\r\nsegunda línea\r\ntercera línea',
|
|
64
|
-
'',
|
|
65
|
-
'',
|
|
66
|
-
'',
|
|
67
|
-
'[quote]',
|
|
68
|
-
'"El ritmo no se piensa, se siente." — alguien en el chat, 3 AM',
|
|
69
|
-
'[/quote]',
|
|
70
|
-
'',
|
|
71
|
-
'[b][i]Texto anidado[/i] que cierra en otro orden[/b]',
|
|
72
|
-
'',
|
|
73
|
-
'Un enlace normal: [url=https://osu.ppy.sh]mi perfil[/url]',
|
|
74
|
-
'Y otro suelto: [url]https://osu.ppy.sh/beatmapsets[/url]',
|
|
75
|
-
'',
|
|
76
|
-
'[centre]',
|
|
77
|
-
`${SECTION_PAD}[color=#9ece6a]gracias por leer[/color]${SECTION_PAD}`,
|
|
78
|
-
'',
|
|
79
|
-
'Texto largo para que un degradado tenga suficientes caracteres que colorear ',
|
|
80
|
-
'y el render produzca un nodo por carácter sin quedarse corto en la prueba: ',
|
|
81
|
-
'áéíóú ñ ü € — signos que ocupan más de un byte y mueven los offsets.',
|
|
82
|
-
'[/centre]',
|
|
83
|
-
'',
|
|
84
|
-
`${SECTION_PAD}`,
|
|
85
|
-
].join('\n')
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The same document under a Studio gradient layer.
|
|
89
|
-
*
|
|
90
|
-
* The second fixture was the first one after the visual builder had run over
|
|
91
|
-
* it, so the two differed in exactly this: colour spans wrapped around
|
|
92
|
-
* individual characters. Kept as a separate export because several suites parse
|
|
93
|
-
* both and a difference between them is the point.
|
|
94
|
-
*/
|
|
95
|
-
export const REFERENCE_DOCUMENT_WITH_GRADIENT = [
|
|
96
|
-
'[centre]',
|
|
97
|
-
'[color=#e8b04b]p[/color][color=#e8ae4b]e[/color][color=#e7ad4b]r[/color]',
|
|
98
|
-
'[color=#e7aa4b]f[/color][color=#e7a84b]i[/color][color=#e6a64b]l[/color]',
|
|
99
|
-
'[/centre]',
|
|
100
|
-
'',
|
|
101
|
-
REFERENCE_DOCUMENT,
|
|
102
|
-
].join('\n')
|
|
103
|
-
|
|
104
|
-
/** The gradient stops the Studio layer tests colour with. */
|
|
105
|
-
export const REFERENCE_GRADIENT_COLORS =
|
|
106
|
-
'#e8b04b,#e8ae4b,#e7ad4b,#e7aa4b,#e7a84b,#e6a64b,#e6a14c,#e59f4c,#e4994c,'
|
|
107
|
-
+ '#e3914c,#e28b4d,#e1854d,#e07c4d,#df754d,#de6f4e,#dd684e,#dc614e,#db5b4f,#da564f'
|
|
108
|
-
|
|
109
|
-
/** The Studio layer shape those suites feed to `processStudioAST`. */
|
|
110
|
-
export const REFERENCE_GRADIENT_LAYER = {
|
|
111
|
-
id: 'grad',
|
|
112
|
-
type: 'gradient',
|
|
113
|
-
enabled: true,
|
|
114
|
-
value: 100,
|
|
115
|
-
properties: { color1: '#ff0000', color2: '#0000ff' },
|
|
116
|
-
colors: REFERENCE_GRADIENT_COLORS,
|
|
117
|
-
opacity: 1.0,
|
|
118
|
-
easing: 'linear',
|
|
119
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
|
-
import { domToSVGResult } from './dom-to-svg'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* El vectorizador del Studio Vector no debe exportar los overlays de EDICIÓN
|
|
6
|
-
* del imagemap (las regiones clicables ni su tooltip de hover): son UI del
|
|
7
|
-
* preview, no contenido real. Antes el skip buscaba la clase legacy
|
|
8
|
-
* `bb-imagemap-area`, pero el HTMLRenderer genera `imagemap-area
|
|
9
|
-
* bbcode-imap-area` — las clases no coincidían y las regiones se colaban en
|
|
10
|
-
* el SVG. El contenedor y la imagen SÍ deben salir.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const IMAGEMAP_HTML = `
|
|
14
|
-
<div class="imagemap-container bbcode-imagemap" style="position:relative;display:inline-block;width:200px;height:100px;">
|
|
15
|
-
<img src="https://example.com/map.png" alt="imagemap" style="width:200px;height:100px;display:block;">
|
|
16
|
-
<a class="imagemap-area bbcode-imap-area" href="https://example.com/1" style="position:absolute;left:10%;top:10%;width:30%;height:30%;"></a>
|
|
17
|
-
<a class="imagemap-area bbcode-imap-area" href="https://example.com/2" style="position:absolute;left:50%;top:10%;width:30%;height:30%;"></a>
|
|
18
|
-
<div class="bb-imagemap-tooltip" style="position:absolute;">tooltip</div>
|
|
19
|
-
</div>
|
|
20
|
-
`
|
|
21
|
-
|
|
22
|
-
/** jsdom no hace layout: rects fake según la posición/el tamaño declarados. */
|
|
23
|
-
function mockLayout(root: HTMLElement) {
|
|
24
|
-
const rectFor = (el: HTMLElement): DOMRect => {
|
|
25
|
-
const style = window.getComputedStyle(el)
|
|
26
|
-
const left = parseFloat(style.left) || 0
|
|
27
|
-
const top = parseFloat(style.top) || 0
|
|
28
|
-
const width = parseFloat(style.width) || (el.tagName === 'IMG' ? 200 : 100)
|
|
29
|
-
const height = parseFloat(style.height) || (el.tagName === 'IMG' ? 100 : 50)
|
|
30
|
-
return new DOMRect(left, top, width, height)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const originals = new Map<Element, () => DOMRect>()
|
|
34
|
-
const walker = (node: Element | null) => {
|
|
35
|
-
if (!node) return
|
|
36
|
-
originals.set(node, node.getBoundingClientRect.bind(node))
|
|
37
|
-
node.getBoundingClientRect = () => rectFor(node as HTMLElement)
|
|
38
|
-
Array.from(node.children).forEach(walker)
|
|
39
|
-
}
|
|
40
|
-
walker(root)
|
|
41
|
-
|
|
42
|
-
return () => originals.forEach((orig, el) => {
|
|
43
|
-
el.getBoundingClientRect = orig
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
describe('dom-to-svg · imagemap overlays', () => {
|
|
48
|
-
let restore: () => void
|
|
49
|
-
|
|
50
|
-
beforeEach(() => {
|
|
51
|
-
document.body.innerHTML = IMAGEMAP_HTML
|
|
52
|
-
restore = mockLayout(document.body.firstElementChild as HTMLElement)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
afterEach(() => {
|
|
56
|
-
restore()
|
|
57
|
-
document.body.innerHTML = ''
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('no exporta las regiones clicables (imagemap-area bbcode-imap-area)', () => {
|
|
61
|
-
const result = domToSVGResult(document.body.firstElementChild as HTMLElement, {
|
|
62
|
-
backgroundColor: '#1c1719',
|
|
63
|
-
scale: 1,
|
|
64
|
-
})
|
|
65
|
-
// Las áreas llevan href de las regiones: su ausencia es la prueba.
|
|
66
|
-
expect(result.svg).not.toContain('example.com/1')
|
|
67
|
-
expect(result.svg).not.toContain('example.com/2')
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('no exporta el tooltip de hover (bb-imagemap-tooltip)', () => {
|
|
71
|
-
const result = domToSVGResult(document.body.firstElementChild as HTMLElement, {
|
|
72
|
-
backgroundColor: '#1c1719',
|
|
73
|
-
scale: 1,
|
|
74
|
-
})
|
|
75
|
-
expect(result.svg).not.toContain('tooltip')
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it('sí exporta la imagen real del imagemap', () => {
|
|
79
|
-
const result = domToSVGResult(document.body.firstElementChild as HTMLElement, {
|
|
80
|
-
backgroundColor: '#1c1719',
|
|
81
|
-
scale: 1,
|
|
82
|
-
})
|
|
83
|
-
expect(result.svg).toContain('map.png')
|
|
84
|
-
expect(result.svg).toContain('<image')
|
|
85
|
-
})
|
|
86
|
-
})
|