@bendyline/squisq 2.0.1 → 2.2.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 +21 -0
- package/NOTICE.md +24 -0
- package/dist/{ContentContainer-BXUlIf18.d.ts → ContentContainer-B2w9sUoL.d.ts} +15 -0
- package/dist/{Doc-ylqWKDc_.d.ts → Doc-BubIpWsp.d.ts} +160 -3
- package/dist/{ImageEditDoc-D828IXJ1.d.ts → ImageEditDoc-CGxk5CHc.d.ts} +1 -1
- package/dist/{annotationCoercion-Dr_DY9Hx.d.ts → annotationCoercion-PtRQhk5V.d.ts} +1 -1
- package/dist/chunk-2L55443L.js +0 -0
- package/dist/chunk-2ZWIXGAC.js +214 -0
- package/dist/{chunk-2PWOO4ZE.js → chunk-32R2RZAO.js} +72 -3
- package/dist/chunk-3IGPAPQ7.js +645 -0
- package/dist/{chunk-QE7TWGVT.js → chunk-4VOD55SX.js} +0 -1
- package/dist/{chunk-3E5F2XMR.js → chunk-67L6WRJN.js} +0 -1
- package/dist/{chunk-5DKBFXPY.js → chunk-6ECMNUIP.js} +26 -18
- package/dist/{chunk-X6DUONGT.js → chunk-7ARJZYQY.js} +280 -128
- package/dist/{chunk-DBS6RIFL.js → chunk-7N4G32LG.js} +0 -1
- package/dist/{chunk-JOQYPRDZ.js → chunk-7YEZFHLS.js} +10 -8
- package/dist/{chunk-2UQOHYE2.js → chunk-7ZAAICW4.js} +0 -1
- package/dist/{chunk-66QO7XFB.js → chunk-ACZOVWX3.js} +117 -7
- package/dist/{chunk-5J4HKRJF.js → chunk-BAOV476U.js} +0 -1
- package/dist/chunk-BCCXTMN5.js +699 -0
- package/dist/{chunk-W4O2TX5I.js → chunk-C33GTPUZ.js} +579 -4
- package/dist/{chunk-MMPBOUK7.js → chunk-CB45YGAM.js} +7 -2
- package/dist/{chunk-CY2R2VPR.js → chunk-DYPMOPIW.js} +18 -2
- package/dist/{chunk-VR7UPJ7C.js → chunk-FCG3BIZN.js} +12 -1
- package/dist/{chunk-5UYI3RJB.js → chunk-FDYDYL77.js} +54 -40
- package/dist/{chunk-TFJVXUHH.js → chunk-I2O6W7DX.js} +1513 -79
- package/dist/{chunk-Q7LROV2H.js → chunk-NKNMGIIN.js} +0 -1
- package/dist/chunk-OPO5K4DZ.js +241 -0
- package/dist/{chunk-TUWMK62B.js → chunk-PUS54YU6.js} +45 -2
- package/dist/chunk-QKPXHDLR.js +0 -0
- package/dist/{chunk-GZY66SDN.js → chunk-R3KTTOMS.js} +0 -1
- package/dist/{chunk-PXLVXTLW.js → chunk-RS5AP3J4.js} +72 -15
- package/dist/chunk-WV5ARNDA.js +0 -0
- package/dist/{chunk-4X3JQXNM.js → chunk-XOFT65EX.js} +1 -2
- package/dist/{chunk-FVTQSNR7.js → chunk-XRW6P7IF.js} +13 -5
- package/dist/chunk-XWNNA3KE.js +0 -0
- package/dist/chunk-YZNGMV3G.js +0 -0
- package/dist/{chunk-R2YZTCLO.js → chunk-ZQKZSJAX.js} +1 -2
- package/dist/doc/index.d.ts +166 -12
- package/dist/doc/index.js +36 -17
- package/dist/generate/index.d.ts +2 -2
- package/dist/generate/index.js +2 -3
- package/dist/icons/index.js +3 -4
- package/dist/icons/inlineIconMarker.js +1 -2
- package/dist/imageEdit/index.d.ts +48 -17
- package/dist/imageEdit/index.js +3 -4
- package/dist/index.d.ts +13 -12
- package/dist/index.js +118 -33
- package/dist/jsonForm/index.d.ts +10 -3
- package/dist/jsonForm/index.js +8 -7
- package/dist/markdown/index.d.ts +75 -11
- package/dist/markdown/index.js +32 -7
- package/dist/materializePageSection-wSLA2A1g.d.ts +223 -0
- package/dist/narration/index.d.ts +16 -3
- package/dist/narration/index.js +13 -14
- package/dist/random/index.d.ts +11 -2
- package/dist/random/index.js +2 -3
- package/dist/recommend/index.d.ts +1 -1
- package/dist/recommend/index.js +3 -4
- package/dist/schemas/index.d.ts +31 -6
- package/dist/schemas/index.js +43 -6
- package/dist/spatial/index.d.ts +2 -1
- package/dist/spatial/index.js +1 -2
- package/dist/storage/index.d.ts +4 -2
- package/dist/storage/index.js +1 -2
- package/dist/{themeLibrary-RjVgLpUi.d.ts → themeLibrary-DU9mUmVl.d.ts} +1 -1
- package/dist/timing/index.js +3 -4
- package/dist/transform/index.d.ts +9 -10
- package/dist/transform/index.js +6 -7
- package/dist/{types-C4kiRn_k.d.ts → types-8QjefM9J.d.ts} +38 -2
- package/dist/{types-BwMPl2CB.d.ts → types-CUNc9biN.d.ts} +24 -1
- package/dist/versions/index.d.ts +14 -11
- package/dist/versions/index.js +2 -3
- package/package.json +4 -2
- package/dist/chunk-2PWOO4ZE.js.map +0 -1
- package/dist/chunk-2UQOHYE2.js.map +0 -1
- package/dist/chunk-3E5F2XMR.js.map +0 -1
- package/dist/chunk-4X3JQXNM.js.map +0 -1
- package/dist/chunk-5DKBFXPY.js.map +0 -1
- package/dist/chunk-5J4HKRJF.js.map +0 -1
- package/dist/chunk-5UYI3RJB.js.map +0 -1
- package/dist/chunk-66QO7XFB.js.map +0 -1
- package/dist/chunk-AMIR72JP.js +0 -380
- package/dist/chunk-AMIR72JP.js.map +0 -1
- package/dist/chunk-CY2R2VPR.js.map +0 -1
- package/dist/chunk-DBS6RIFL.js.map +0 -1
- package/dist/chunk-DNJKBAI7.js +0 -1
- package/dist/chunk-DNJKBAI7.js.map +0 -1
- package/dist/chunk-ET53IIEP.js +0 -1
- package/dist/chunk-ET53IIEP.js.map +0 -1
- package/dist/chunk-FVJUUTEM.js +0 -74
- package/dist/chunk-FVJUUTEM.js.map +0 -1
- package/dist/chunk-FVTQSNR7.js.map +0 -1
- package/dist/chunk-GZY66SDN.js.map +0 -1
- package/dist/chunk-JOQYPRDZ.js.map +0 -1
- package/dist/chunk-MMPBOUK7.js.map +0 -1
- package/dist/chunk-PGGGKYWG.js +0 -1
- package/dist/chunk-PGGGKYWG.js.map +0 -1
- package/dist/chunk-PXLVXTLW.js.map +0 -1
- package/dist/chunk-Q7LROV2H.js.map +0 -1
- package/dist/chunk-QE7TWGVT.js.map +0 -1
- package/dist/chunk-R2GC6RLD.js +0 -344
- package/dist/chunk-R2GC6RLD.js.map +0 -1
- package/dist/chunk-R2YZTCLO.js.map +0 -1
- package/dist/chunk-S7A5D7ZJ.js +0 -174
- package/dist/chunk-S7A5D7ZJ.js.map +0 -1
- package/dist/chunk-TFJVXUHH.js.map +0 -1
- package/dist/chunk-TUWMK62B.js.map +0 -1
- package/dist/chunk-V543AI2F.js +0 -1
- package/dist/chunk-V543AI2F.js.map +0 -1
- package/dist/chunk-VR7UPJ7C.js.map +0 -1
- package/dist/chunk-W4O2TX5I.js.map +0 -1
- package/dist/chunk-X6DUONGT.js.map +0 -1
- package/dist/chunk-ZLQKNOZQ.js +0 -1
- package/dist/chunk-ZLQKNOZQ.js.map +0 -1
- package/dist/doc/index.js.map +0 -1
- package/dist/generate/index.js.map +0 -1
- package/dist/icons/index.js.map +0 -1
- package/dist/icons/inlineIconMarker.js.map +0 -1
- package/dist/imageEdit/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/jsonForm/index.js.map +0 -1
- package/dist/markdown/index.js.map +0 -1
- package/dist/narration/index.js.map +0 -1
- package/dist/random/index.js.map +0 -1
- package/dist/recommend/index.js.map +0 -1
- package/dist/schemas/index.js.map +0 -1
- package/dist/spatial/index.js.map +0 -1
- package/dist/storage/index.js.map +0 -1
- package/dist/timing/index.js.map +0 -1
- package/dist/transform/index.js.map +0 -1
- package/dist/versions/index.js.map +0 -1
- package/src/__tests__/animationUtils.test.ts +0 -117
- package/src/__tests__/annotationCoercion.test.ts +0 -243
- package/src/__tests__/applyNarrationTiming.test.ts +0 -190
- package/src/__tests__/applyRenderStyle.test.ts +0 -146
- package/src/__tests__/asciiDiagramBattle.test.ts +0 -246
- package/src/__tests__/asciiDiagramDetect.test.ts +0 -162
- package/src/__tests__/asciiDiagramMapping.test.ts +0 -38
- package/src/__tests__/asciiDiagramParse.test.ts +0 -233
- package/src/__tests__/asciiDiagramPipeline.test.ts +0 -273
- package/src/__tests__/asciiDiagramRender.test.ts +0 -162
- package/src/__tests__/asciiDiagramRepair.test.ts +0 -84
- package/src/__tests__/asciiTimelineDetect.test.ts +0 -157
- package/src/__tests__/asciiTimelineParse.test.ts +0 -205
- package/src/__tests__/asciiTimelinePipeline.test.ts +0 -349
- package/src/__tests__/asciiTimelineRender.test.ts +0 -376
- package/src/__tests__/atmosphereLayers.test.ts +0 -108
- package/src/__tests__/attrTokens.test.ts +0 -167
- package/src/__tests__/colorUtils.test.ts +0 -112
- package/src/__tests__/contentContainer.test.ts +0 -325
- package/src/__tests__/contentExtractor.test.ts +0 -243
- package/src/__tests__/coverBlock.test.ts +0 -310
- package/src/__tests__/customTemplateSample.test.ts +0 -144
- package/src/__tests__/customTemplatesFrontmatter.test.ts +0 -221
- package/src/__tests__/customThemesFrontmatter.test.ts +0 -146
- package/src/__tests__/dataTable.test.ts +0 -145
- package/src/__tests__/diagramBlock.test.ts +0 -122
- package/src/__tests__/diagramLayout.test.ts +0 -134
- package/src/__tests__/diagramText.test.ts +0 -26
- package/src/__tests__/docToMarkdownMedia.test.ts +0 -83
- package/src/__tests__/drawing.test.ts +0 -109
- package/src/__tests__/drawingBlock.test.ts +0 -124
- package/src/__tests__/drawingLayout.test.ts +0 -171
- package/src/__tests__/fixtures/asciiDiagramBattle.ts +0 -512
- package/src/__tests__/fixtures/asciiDiagrams.ts +0 -287
- package/src/__tests__/fixtures/asciiTimelines.ts +0 -35
- package/src/__tests__/fixtures/treeviewFixtures.ts +0 -243
- package/src/__tests__/geohash.test.ts +0 -110
- package/src/__tests__/getLayers.test.ts +0 -243
- package/src/__tests__/getLayersFallback.test.ts +0 -103
- package/src/__tests__/haversine.test.ts +0 -63
- package/src/__tests__/iconResolve.test.ts +0 -122
- package/src/__tests__/imageEditExportSvg.test.ts +0 -70
- package/src/__tests__/imageEditState.test.ts +0 -74
- package/src/__tests__/imageEditVersions.test.ts +0 -243
- package/src/__tests__/inferDocumentTitle.test.ts +0 -50
- package/src/__tests__/inlineIconMarker.test.ts +0 -36
- package/src/__tests__/inputDescriptors.test.ts +0 -162
- package/src/__tests__/jsonForm.chooseControl.test.ts +0 -86
- package/src/__tests__/jsonForm.evaluateWhen.test.ts +0 -59
- package/src/__tests__/jsonForm.inferSchema.test.ts +0 -25
- package/src/__tests__/jsonForm.pointer.test.ts +0 -149
- package/src/__tests__/jsonForm.tokens.test.ts +0 -84
- package/src/__tests__/layoutBlock.test.ts +0 -83
- package/src/__tests__/layoutLayout.test.ts +0 -169
- package/src/__tests__/localForageAdapter.test.ts +0 -155
- package/src/__tests__/majorApiTypes.test.ts +0 -18
- package/src/__tests__/markdown.test.ts +0 -1009
- package/src/__tests__/markdownIcons.test.ts +0 -104
- package/src/__tests__/markdownSanitize.test.ts +0 -81
- package/src/__tests__/markdownToDoc.test.ts +0 -957
- package/src/__tests__/matchFontFamily.test.ts +0 -114
- package/src/__tests__/materializeBlockLayers.test.ts +0 -135
- package/src/__tests__/materializeTestUtils.ts +0 -17
- package/src/__tests__/mediaAnnotations.test.ts +0 -91
- package/src/__tests__/mediaSchedule.test.ts +0 -118
- package/src/__tests__/narrationAlign.test.ts +0 -150
- package/src/__tests__/narrationFeatures.test.ts +0 -71
- package/src/__tests__/narrationNuclei.test.ts +0 -45
- package/src/__tests__/narrationPacing.test.ts +0 -189
- package/src/__tests__/narrationScript.test.ts +0 -149
- package/src/__tests__/narrationSessionRepro.test.ts +0 -62
- package/src/__tests__/narrationSidecar.test.ts +0 -88
- package/src/__tests__/narrationSyllables.test.ts +0 -65
- package/src/__tests__/narrationTestSignals.ts +0 -167
- package/src/__tests__/narrationVad.test.ts +0 -66
- package/src/__tests__/pandocAttrParse.test.ts +0 -187
- package/src/__tests__/recommendTemplates.test.ts +0 -183
- package/src/__tests__/resolveDocTheme.test.ts +0 -69
- package/src/__tests__/rootExports.test.ts +0 -61
- package/src/__tests__/scopedContentContainer.test.ts +0 -109
- package/src/__tests__/seededRandom.test.ts +0 -142
- package/src/__tests__/shapeGeometry.test.ts +0 -138
- package/src/__tests__/shapeVocabulary.test.ts +0 -133
- package/src/__tests__/storage.test.ts +0 -60
- package/src/__tests__/structuredData.test.ts +0 -249
- package/src/__tests__/surface.test.ts +0 -68
- package/src/__tests__/templateAnnotationParse.test.ts +0 -160
- package/src/__tests__/templateInputs.test.ts +0 -69
- package/src/__tests__/templateMetadata.test.ts +0 -32
- package/src/__tests__/templates.test.ts +0 -710
- package/src/__tests__/themeCompile.test.ts +0 -225
- package/src/__tests__/themeValidator.test.ts +0 -131
- package/src/__tests__/timing.test.ts +0 -167
- package/src/__tests__/transformProvenance.test.ts +0 -160
- package/src/__tests__/transformV2.test.ts +0 -163
- package/src/__tests__/transitionNormalize.test.ts +0 -61
- package/src/__tests__/treeviewBattle.test.ts +0 -76
- package/src/__tests__/treeviewDetect.test.ts +0 -168
- package/src/__tests__/treeviewParse.test.ts +0 -118
- package/src/__tests__/treeviewPipeline.test.ts +0 -183
- package/src/__tests__/treeviewRender.test.ts +0 -91
- package/src/__tests__/validateDoc.test.ts +0 -260
- package/src/__tests__/versions.test.ts +0 -459
- package/src/doc/annotationBlocks.ts +0 -117
- package/src/doc/applyNarrationTiming.ts +0 -244
- package/src/doc/asciiDiagram/chars.ts +0 -210
- package/src/doc/asciiDiagram/detect.ts +0 -175
- package/src/doc/asciiDiagram/index.ts +0 -38
- package/src/doc/asciiDiagram/mapping.ts +0 -225
- package/src/doc/asciiDiagram/parse.ts +0 -1095
- package/src/doc/asciiDiagram/render.ts +0 -963
- package/src/doc/asciiDiagram/repair.ts +0 -400
- package/src/doc/asciiDiagram/types.ts +0 -65
- package/src/doc/asciiTimeline/detect.ts +0 -138
- package/src/doc/asciiTimeline/index.ts +0 -26
- package/src/doc/asciiTimeline/mapping.ts +0 -43
- package/src/doc/asciiTimeline/parse.ts +0 -870
- package/src/doc/asciiTimeline/render.ts +0 -427
- package/src/doc/asciiTimeline/types.ts +0 -73
- package/src/doc/asciiTimeline/wrappedFlow.ts +0 -427
- package/src/doc/audioMapping.ts +0 -442
- package/src/doc/customTemplatesFrontmatter.ts +0 -273
- package/src/doc/customThemesFrontmatter.ts +0 -95
- package/src/doc/docToMarkdown.ts +0 -284
- package/src/doc/index.ts +0 -127
- package/src/doc/markdownToDoc.ts +0 -1054
- package/src/doc/materializeBlockLayers.ts +0 -304
- package/src/doc/mediaAnnotations.ts +0 -120
- package/src/doc/resolveDocTheme.ts +0 -56
- package/src/doc/standaloneAnnotation.ts +0 -58
- package/src/doc/structuredData.ts +0 -301
- package/src/doc/templateInputs.ts +0 -423
- package/src/doc/templates/__tests__/customTemplate.test.ts +0 -170
- package/src/doc/templates/__tests__/customTemplateRegistry.test.ts +0 -124
- package/src/doc/templates/__tests__/listBlock.test.ts +0 -64
- package/src/doc/templates/accentImage.ts +0 -362
- package/src/doc/templates/captionUtils.ts +0 -56
- package/src/doc/templates/comparisonBar.ts +0 -173
- package/src/doc/templates/coverBlock.ts +0 -255
- package/src/doc/templates/customTemplate.ts +0 -51
- package/src/doc/templates/dataTable.ts +0 -102
- package/src/doc/templates/dateEvent.ts +0 -147
- package/src/doc/templates/definitionCard.ts +0 -140
- package/src/doc/templates/diagramBlock.ts +0 -403
- package/src/doc/templates/diagramLayout.ts +0 -159
- package/src/doc/templates/drawingBlock.ts +0 -325
- package/src/doc/templates/drawingLayout.ts +0 -539
- package/src/doc/templates/factCard.ts +0 -146
- package/src/doc/templates/fallbackBlock.ts +0 -123
- package/src/doc/templates/featureBlock.ts +0 -209
- package/src/doc/templates/fullBleedQuote.ts +0 -83
- package/src/doc/templates/imageWithCaption.ts +0 -186
- package/src/doc/templates/index.ts +0 -642
- package/src/doc/templates/inputDescriptors.ts +0 -451
- package/src/doc/templates/layoutBlock.ts +0 -43
- package/src/doc/templates/layoutLayout.ts +0 -243
- package/src/doc/templates/listBlock.ts +0 -207
- package/src/doc/templates/mapBlock.ts +0 -138
- package/src/doc/templates/metadata.ts +0 -130
- package/src/doc/templates/persistentLayers.ts +0 -526
- package/src/doc/templates/photoGrid.ts +0 -190
- package/src/doc/templates/pullQuote.ts +0 -141
- package/src/doc/templates/quoteBlock.ts +0 -141
- package/src/doc/templates/registry.ts +0 -88
- package/src/doc/templates/sectionHeader.ts +0 -120
- package/src/doc/templates/statHighlight.ts +0 -146
- package/src/doc/templates/templateNames.ts +0 -22
- package/src/doc/templates/timelineBlock.ts +0 -613
- package/src/doc/templates/titleBlock.ts +0 -150
- package/src/doc/templates/tokens/__tests__/resolveTokens.test.ts +0 -487
- package/src/doc/templates/tokens/resolveTokens.ts +0 -453
- package/src/doc/templates/treeBlock.ts +0 -131
- package/src/doc/templates/twoColumn.ts +0 -263
- package/src/doc/templates/videoPullQuote.ts +0 -142
- package/src/doc/templates/videoWithCaption.ts +0 -135
- package/src/doc/treeview/chars.ts +0 -72
- package/src/doc/treeview/detect.ts +0 -145
- package/src/doc/treeview/index.ts +0 -30
- package/src/doc/treeview/mapping.ts +0 -95
- package/src/doc/treeview/parse.ts +0 -201
- package/src/doc/treeview/render.ts +0 -41
- package/src/doc/treeview/types.ts +0 -43
- package/src/doc/utils/animationUtils.ts +0 -399
- package/src/doc/utils/applyRenderStyle.ts +0 -106
- package/src/doc/utils/diagramText.ts +0 -78
- package/src/doc/utils/imageTreatment.ts +0 -70
- package/src/doc/utils/nearest.ts +0 -59
- package/src/doc/utils/shapeGeometry.ts +0 -614
- package/src/doc/utils/themeUtils.ts +0 -243
- package/src/doc/validate.ts +0 -575
- package/src/generate/contentExtractor.ts +0 -921
- package/src/generate/index.ts +0 -18
- package/src/generate/templateMapper.ts +0 -177
- package/src/icons/iconData.ts +0 -31
- package/src/icons/index.ts +0 -26
- package/src/icons/inlineIconMarker.ts +0 -73
- package/src/icons/resolve.ts +0 -139
- package/src/imageEdit/ImageEditVersionManager.ts +0 -73
- package/src/imageEdit/export.ts +0 -410
- package/src/imageEdit/index.ts +0 -72
- package/src/imageEdit/persistence.ts +0 -113
- package/src/imageEdit/state.ts +0 -112
- package/src/imageEdit/versionPaths.ts +0 -44
- package/src/imageEdit/versions.ts +0 -152
- package/src/index.ts +0 -15
- package/src/internal/immutable.ts +0 -58
- package/src/jsonForm/chooseControl.ts +0 -88
- package/src/jsonForm/evaluateWhen.ts +0 -59
- package/src/jsonForm/index.ts +0 -32
- package/src/jsonForm/inferSchema.ts +0 -25
- package/src/jsonForm/pointer.ts +0 -154
- package/src/jsonForm/tokens.ts +0 -78
- package/src/jsonForm/types.ts +0 -167
- package/src/markdown/annotationCoercion.ts +0 -295
- package/src/markdown/attrTokens.ts +0 -243
- package/src/markdown/convert.ts +0 -1353
- package/src/markdown/htmlParse.ts +0 -212
- package/src/markdown/index.ts +0 -152
- package/src/markdown/parse.ts +0 -103
- package/src/markdown/sanitize.ts +0 -318
- package/src/markdown/stringify.ts +0 -207
- package/src/markdown/types.ts +0 -710
- package/src/markdown/utils.ts +0 -459
- package/src/narration/align.ts +0 -514
- package/src/narration/features.ts +0 -231
- package/src/narration/index.ts +0 -86
- package/src/narration/nuclei.ts +0 -118
- package/src/narration/pacing.ts +0 -211
- package/src/narration/script.ts +0 -239
- package/src/narration/session.ts +0 -100
- package/src/narration/sidecar.ts +0 -187
- package/src/narration/syllables.ts +0 -85
- package/src/narration/trace.ts +0 -50
- package/src/narration/types.ts +0 -299
- package/src/narration/vad.ts +0 -131
- package/src/ngeohash.d.ts +0 -11
- package/src/random/SeededRandom.ts +0 -127
- package/src/random/index.ts +0 -1
- package/src/recommend/index.ts +0 -16
- package/src/recommend/numberHighlight.ts +0 -25
- package/src/recommend/templates.ts +0 -393
- package/src/schemas/BlockTemplates.ts +0 -1046
- package/src/schemas/CustomTemplates.ts +0 -126
- package/src/schemas/Doc.ts +0 -1052
- package/src/schemas/ImageEditDoc.ts +0 -102
- package/src/schemas/LayoutStrategy.ts +0 -178
- package/src/schemas/Media.ts +0 -179
- package/src/schemas/MediaProvider.ts +0 -70
- package/src/schemas/Theme.ts +0 -406
- package/src/schemas/Transitions.ts +0 -224
- package/src/schemas/Types.ts +0 -15
- package/src/schemas/Viewport.ts +0 -91
- package/src/schemas/colorUtils.ts +0 -219
- package/src/schemas/fontStacks.ts +0 -339
- package/src/schemas/index.ts +0 -29
- package/src/schemas/themeCompile.ts +0 -237
- package/src/schemas/themeConstants.ts +0 -2
- package/src/schemas/themeLibrary.ts +0 -60
- package/src/schemas/themeValidator.ts +0 -426
- package/src/schemas/themes/bold.json +0 -48
- package/src/schemas/themes/cinematic.json +0 -111
- package/src/schemas/themes/documentary.json +0 -96
- package/src/schemas/themes/gezellig.json +0 -93
- package/src/schemas/themes/index.ts +0 -53
- package/src/schemas/themes/magazine.json +0 -89
- package/src/schemas/themes/minimalist.json +0 -45
- package/src/schemas/themes/morning-light.json +0 -85
- package/src/schemas/themes/standard-dark.json +0 -85
- package/src/schemas/themes/standard.json +0 -74
- package/src/schemas/themes/tech-dark.json +0 -101
- package/src/schemas/themes/warm-earth.json +0 -50
- package/src/spatial/Geohash.ts +0 -196
- package/src/spatial/Haversine.ts +0 -59
- package/src/spatial/index.ts +0 -2
- package/src/storage/ContentContainer.ts +0 -220
- package/src/storage/LocalForageAdapter.ts +0 -103
- package/src/storage/LocalStorageAdapter.ts +0 -57
- package/src/storage/MediaProviderFromContainer.ts +0 -92
- package/src/storage/MemoryStorageAdapter.ts +0 -37
- package/src/storage/ScopedContentContainer.ts +0 -143
- package/src/storage/Storage.ts +0 -28
- package/src/storage/index.ts +0 -9
- package/src/timing/index.ts +0 -17
- package/src/timing/narrationTiming.ts +0 -220
- package/src/timing/readingTime.ts +0 -94
- package/src/transform/applyTransform.ts +0 -122
- package/src/transform/blockAnalyzer.ts +0 -181
- package/src/transform/index.ts +0 -23
- package/src/transform/registry.ts +0 -198
- package/src/transform/styles/dataDriven.ts +0 -17
- package/src/transform/styles/documentary.ts +0 -17
- package/src/transform/styles/index.ts +0 -5
- package/src/transform/styles/magazine.ts +0 -18
- package/src/transform/styles/minimal.ts +0 -17
- package/src/transform/styles/narrative.ts +0 -18
- package/src/transform/templateSelector.ts +0 -389
- package/src/transform/timingAllocator.ts +0 -257
- package/src/transform/types.ts +0 -151
- package/src/versions/DocumentVersionManager.ts +0 -70
- package/src/versions/gitignore.ts +0 -34
- package/src/versions/index.ts +0 -56
- package/src/versions/operations.ts +0 -144
- package/src/versions/paths.ts +0 -51
- package/src/versions/snapshotStore.ts +0 -202
- package/src/versions/timestamp.ts +0 -48
- package/src/versions/types.ts +0 -93
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { parseMarkdown, stringifyMarkdown } from '../markdown/index';
|
|
3
|
-
import { markdownToDoc } from '../doc/markdownToDoc';
|
|
4
|
-
import { docToMarkdown } from '../doc/docToMarkdown';
|
|
5
|
-
import { materializeLayers } from './materializeTestUtils';
|
|
6
|
-
import { profileBlockContents, recommendTemplatesForBlock } from '../recommend/templates';
|
|
7
|
-
import type { Block, Layer } from '../schemas/Doc';
|
|
8
|
-
import type { TreeTemplateItem } from '../schemas/BlockTemplates';
|
|
9
|
-
|
|
10
|
-
const TREE_ART = ['src/', '├── index.ts', '├── components/', '│ └── App.tsx', '└── utils/'].join(
|
|
11
|
-
'\n',
|
|
12
|
-
);
|
|
13
|
-
const fenced = (art: string, lang = ''): string => '```' + lang + '\n' + art + '\n```';
|
|
14
|
-
const AUTO_DOC = ['# Project', '', '## Layout', '', fenced(TREE_ART), ''].join('\n');
|
|
15
|
-
|
|
16
|
-
function convert(md: string, options?: Parameters<typeof markdownToDoc>[1]) {
|
|
17
|
-
return markdownToDoc(parseMarkdown(md), { generateCoverBlock: false, ...options });
|
|
18
|
-
}
|
|
19
|
-
function findBlock(doc: { blocks: Block[] }, title: string): Block | undefined {
|
|
20
|
-
const walk = (blocks: Block[]): Block | undefined => {
|
|
21
|
-
for (const b of blocks) {
|
|
22
|
-
if (b.title === title) return b;
|
|
23
|
-
const inner = b.children ? walk(b.children) : undefined;
|
|
24
|
-
if (inner) return inner;
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
27
|
-
};
|
|
28
|
-
return walk(doc.blocks);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
describe('auto-template conversion of tree fences', () => {
|
|
32
|
-
it('converts a heading with a lone tree fence into an ephemeral tree block', () => {
|
|
33
|
-
const block = findBlock(convert(AUTO_DOC), 'Layout');
|
|
34
|
-
expect(block?.template).toBe('tree');
|
|
35
|
-
expect(block?.autoTemplate).toBe(true);
|
|
36
|
-
const items = block?.templateData?.items as TreeTemplateItem[];
|
|
37
|
-
expect(items?.map((i) => i.label)).toEqual(['src/']);
|
|
38
|
-
expect(items?.[0].children.map((c) => c.label)).toEqual(['index.ts', 'components/', 'utils/']);
|
|
39
|
-
expect(block?.templateData?.title).toBe('Layout');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('round-trips losslessly: fence byte-identical, no annotation injected', () => {
|
|
43
|
-
const output = stringifyMarkdown(docToMarkdown(convert(AUTO_DOC)));
|
|
44
|
-
expect(output).toContain(TREE_ART);
|
|
45
|
-
expect(output).not.toContain('{[tree');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('respects the autoTemplates kill switch', () => {
|
|
49
|
-
expect(findBlock(convert(AUTO_DOC, { autoTemplates: false }), 'Layout')?.template).not.toBe(
|
|
50
|
-
'tree',
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('respects the frontmatter kill switch', () => {
|
|
55
|
-
const md = `---\nsquisq-auto-templates: false\n---\n\n${AUTO_DOC}`;
|
|
56
|
-
expect(findBlock(convert(md), 'Layout')?.template).not.toBe('tree');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('does not convert a real-language fence', () => {
|
|
60
|
-
const md = ['## Layout', '', fenced(TREE_ART, 'bash'), ''].join('\n');
|
|
61
|
-
expect(findBlock(convert(md), 'Layout')?.template).not.toBe('tree');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('does not convert when a table competes with the fence', () => {
|
|
65
|
-
const md = [
|
|
66
|
-
'## Layout',
|
|
67
|
-
'',
|
|
68
|
-
'| a | b |',
|
|
69
|
-
'|---|---|',
|
|
70
|
-
'| 1 | 2 |',
|
|
71
|
-
'',
|
|
72
|
-
fenced(TREE_ART),
|
|
73
|
-
'',
|
|
74
|
-
].join('\n');
|
|
75
|
-
expect(findBlock(convert(md), 'Layout')?.template).not.toBe('tree');
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('does not steal a box-diagram fence (mutual exclusion)', () => {
|
|
79
|
-
const diagram = [
|
|
80
|
-
'┌────────┐',
|
|
81
|
-
'│ Alpha │',
|
|
82
|
-
'└───┬────┘',
|
|
83
|
-
' ▼',
|
|
84
|
-
'┌────────┐',
|
|
85
|
-
'│ Beta │',
|
|
86
|
-
'└────────┘',
|
|
87
|
-
].join('\n');
|
|
88
|
-
const block = findBlock(convert(['## Arch', '', fenced(diagram), ''].join('\n')), 'Arch');
|
|
89
|
-
expect(block?.template).toBe('diagram');
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
describe('explicit `tree`-tagged fence (survives flatten → round-trip)', () => {
|
|
94
|
-
// A flattened tree loses its connector lines, so an untagged fence would no
|
|
95
|
-
// longer auto-detect. The `tree` fence LANGUAGE is the durable "block tag"
|
|
96
|
-
// (it round-trips through markdown ↔ Tiptap as `class="language-tree"`),
|
|
97
|
-
// and explicit-lang detection accepts the flat art.
|
|
98
|
-
const FLAT_ART = ['README.md', 'index.ts', 'package.json'].join('\n');
|
|
99
|
-
const FLAT_DOC = ['# Project', '', '## Files', '', fenced(FLAT_ART, 'tree'), ''].join('\n');
|
|
100
|
-
|
|
101
|
-
it('a bare flat fence does NOT become a tree', () => {
|
|
102
|
-
const md = ['## Files', '', fenced(FLAT_ART), ''].join('\n');
|
|
103
|
-
expect(findBlock(convert(md), 'Files')?.template).not.toBe('tree');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('a `tree`-tagged flat fence DOES become a tree', () => {
|
|
107
|
-
const block = findBlock(convert(FLAT_DOC), 'Files');
|
|
108
|
-
expect(block?.template).toBe('tree');
|
|
109
|
-
expect(block?.autoTemplate).toBe(true);
|
|
110
|
-
const items = block?.templateData?.items as TreeTemplateItem[];
|
|
111
|
-
expect(items?.map((i) => i.label)).toEqual(['README.md', 'index.ts', 'package.json']);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('round-trips losslessly: fence + `tree` lang preserved, no annotation injected', () => {
|
|
115
|
-
const output = stringifyMarkdown(docToMarkdown(convert(FLAT_DOC)));
|
|
116
|
-
expect(output).toContain('```tree');
|
|
117
|
-
expect(output).toContain(FLAT_ART);
|
|
118
|
-
expect(output).not.toContain('{[tree');
|
|
119
|
-
// Re-importing the output keeps it a tree — the identity is sticky.
|
|
120
|
-
expect(findBlock(convert(output), 'Files')?.template).toBe('tree');
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('profiles a `tree`-tagged flat fence as hasTree', () => {
|
|
124
|
-
const md = parseMarkdown(fenced(FLAT_ART, 'tree'));
|
|
125
|
-
const profile = profileBlockContents(md.children as Parameters<typeof profileBlockContents>[0]);
|
|
126
|
-
expect(profile.hasTree).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe('explicit {[tree]} annotation', () => {
|
|
131
|
-
it('derives items even with autoTemplates off', () => {
|
|
132
|
-
const md = ['## Files {[tree]}', '', fenced(TREE_ART), ''].join('\n');
|
|
133
|
-
const block = findBlock(convert(md, { autoTemplates: false }), 'Files');
|
|
134
|
-
expect(block?.template).toBe('tree');
|
|
135
|
-
expect((block?.templateData?.items as TreeTemplateItem[])?.length).toBe(1);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it('converts a nested markdown list under an explicit annotation', () => {
|
|
139
|
-
const md = ['## Files {[tree]}', '', '- src/', ' - index.ts', ' - utils/', ''].join('\n');
|
|
140
|
-
const block = findBlock(convert(md, { autoTemplates: false }), 'Files');
|
|
141
|
-
const items = block?.templateData?.items as TreeTemplateItem[];
|
|
142
|
-
expect(items?.[0].label).toBe('src/');
|
|
143
|
-
expect(items?.[0].children.map((c) => c.label)).toEqual(['index.ts', 'utils/']);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('records a diagnostic when the body does not parse as a tree', () => {
|
|
147
|
-
const md = ['## Files {[tree]}', '', 'just prose, no hierarchy at all', ''].join('\n');
|
|
148
|
-
const doc = convert(md);
|
|
149
|
-
expect(doc.diagnostics?.some((d) => d.code === 'tree-parse')).toBe(true);
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
describe('rendering a derived tree through materializeBlockLayers', () => {
|
|
154
|
-
it('emits a single tree layer with the item hierarchy', () => {
|
|
155
|
-
const block = findBlock(convert(AUTO_DOC), 'Layout') as Block;
|
|
156
|
-
const layers = materializeLayers(block, {});
|
|
157
|
-
const treeLayer = layers.find((l: Layer) => l.type === 'tree');
|
|
158
|
-
expect(treeLayer).toBeDefined();
|
|
159
|
-
if (treeLayer?.type === 'tree') {
|
|
160
|
-
expect(treeLayer.content.items[0].label).toBe('src/');
|
|
161
|
-
expect(treeLayer.content.items[0].isDir).toBe(true);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe('duration/caption hygiene', () => {
|
|
167
|
-
it('excludes the consumed tree fence from captions', () => {
|
|
168
|
-
const doc = convert(AUTO_DOC);
|
|
169
|
-
const captionText = (doc.captions?.phrases ?? []).map((p) => p.text).join(' ');
|
|
170
|
-
expect(captionText).not.toContain('├──');
|
|
171
|
-
expect(captionText).not.toContain('index.ts');
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
describe('template picker recommendation', () => {
|
|
176
|
-
it('surfaces tree for a tree-fence profile', () => {
|
|
177
|
-
const md = parseMarkdown(fenced(TREE_ART));
|
|
178
|
-
const profile = profileBlockContents(md.children as Parameters<typeof profileBlockContents>[0]);
|
|
179
|
-
expect(profile.hasTree).toBe(true);
|
|
180
|
-
const { recommended } = recommendTemplatesForBlock(profile, ['tree', 'list', 'title']);
|
|
181
|
-
expect(recommended).toContain('tree');
|
|
182
|
-
});
|
|
183
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
parseTree,
|
|
4
|
-
renderTree,
|
|
5
|
-
treeFromTemplateData,
|
|
6
|
-
treeToTemplateData,
|
|
7
|
-
type Tree,
|
|
8
|
-
} from '../doc/treeview/index.js';
|
|
9
|
-
import { TREE_FIXTURES } from './fixtures/treeviewFixtures.js';
|
|
10
|
-
|
|
11
|
-
function semantic(t: Tree): string[] {
|
|
12
|
-
const out: string[] = [];
|
|
13
|
-
const walk = (nodes: Tree['roots'], depth: number): void => {
|
|
14
|
-
for (const n of nodes) {
|
|
15
|
-
out.push(`${depth}:${n.label}${n.comment ? ` #${n.comment}` : ''}`);
|
|
16
|
-
walk(n.children, depth + 1);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
walk(t.roots, 0);
|
|
20
|
-
return out;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe('renderTree — output', () => {
|
|
24
|
-
it('renders a clean Unicode tree with connectors', () => {
|
|
25
|
-
const t = parseTree(['a/', '├── b', '└── c/', ' └── d'].join('\n'));
|
|
26
|
-
expect(renderTree(t)).toBe(['a/', '├── b', '└── c/', ' └── d'].join('\n'));
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('renders ASCII vocabulary for ascii-style trees', () => {
|
|
30
|
-
const t = parseTree(['a/', '|-- b', '`-- c'].join('\n'));
|
|
31
|
-
const out = renderTree(t);
|
|
32
|
-
expect(out).toContain('|-- b');
|
|
33
|
-
expect(out).toContain('`-- c');
|
|
34
|
-
expect(out).not.toMatch(/[├└│─]/u);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('honours a style override', () => {
|
|
38
|
-
const t = parseTree(['a/', '├── b', '└── c'].join('\n'));
|
|
39
|
-
expect(renderTree(t, { style: 'ascii' })).toContain('|-- b');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('renders trailing comments', () => {
|
|
43
|
-
const t = parseTree(['p/', '└── a.ts # note'].join('\n'));
|
|
44
|
-
expect(renderTree(t)).toContain('a.ts # note');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('roots carry no connector; children do', () => {
|
|
48
|
-
const t = parseTree(['root/', '└── only'].join('\n'));
|
|
49
|
-
const lines = renderTree(t).split('\n');
|
|
50
|
-
expect(lines[0]).toBe('root/');
|
|
51
|
-
expect(lines[1]).toBe('└── only');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe('renderTree ↔ parseTree fixpoint', () => {
|
|
56
|
-
for (const fx of TREE_FIXTURES) {
|
|
57
|
-
it(`fixpoint + byte-idempotence: ${fx.name}`, () => {
|
|
58
|
-
const d1 = parseTree(fx.art);
|
|
59
|
-
const t1 = renderTree(d1);
|
|
60
|
-
const d2 = parseTree(t1);
|
|
61
|
-
expect(semantic(d2)).toEqual(semantic(d1));
|
|
62
|
-
const t2 = renderTree(d2);
|
|
63
|
-
const t3 = renderTree(parseTree(t2));
|
|
64
|
-
expect(t2).toBe(t1);
|
|
65
|
-
expect(t3).toBe(t1);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
it('anti-churn: a structural edit only changes locally, then is stable', () => {
|
|
70
|
-
const t = parseTree(['a/', '├── b', '└── c'].join('\n'));
|
|
71
|
-
// Rename one node (structure-only edit) via the template-data round-trip.
|
|
72
|
-
const { items } = treeToTemplateData(t);
|
|
73
|
-
items[0].children[0].label = 'renamed';
|
|
74
|
-
const edited = treeFromTemplateData(items);
|
|
75
|
-
const r1 = renderTree(edited);
|
|
76
|
-
expect(r1).toContain('renamed');
|
|
77
|
-
expect(renderTree(parseTree(r1))).toBe(r1);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
describe('templateData mapping round-trip', () => {
|
|
82
|
-
for (const fx of TREE_FIXTURES) {
|
|
83
|
-
it(`grid → items → grid preserves semantics: ${fx.name}`, () => {
|
|
84
|
-
const t = parseTree(fx.art);
|
|
85
|
-
const back = treeFromTemplateData(treeToTemplateData(t).items, { style: t.style });
|
|
86
|
-
expect(semantic(back)).toEqual(semantic(t));
|
|
87
|
-
// And renders identically.
|
|
88
|
-
expect(renderTree(back)).toBe(renderTree(t));
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
});
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { validateMarkdownSource } from '../doc/validate.js';
|
|
3
|
-
import { writeCustomTemplatesToFrontmatter } from '../doc/customTemplatesFrontmatter';
|
|
4
|
-
import type { CustomTemplateDefinition } from '../schemas/CustomTemplates.js';
|
|
5
|
-
|
|
6
|
-
function codes(md: string, options?: Parameters<typeof validateMarkdownSource>[1]): string[] {
|
|
7
|
-
return validateMarkdownSource(md, options).diagnostics.map((d) => d.code);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
describe('validateMarkdownSource — templates', () => {
|
|
11
|
-
it('passes a clean document', () => {
|
|
12
|
-
const result = validateMarkdownSource('# Title\n\nBody.\n\n## Section {[quote]}\n\nA quote.\n');
|
|
13
|
-
expect(result.diagnostics).toEqual([]);
|
|
14
|
-
expect(result.errorCount).toBe(0);
|
|
15
|
-
expect(result.warningCount).toBe(0);
|
|
16
|
-
expect(result.infoCount).toBe(0);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('flags unknown templates with a did-you-mean suggestion', () => {
|
|
20
|
-
const result = validateMarkdownSource('## Gallery {[photGrid columns=3]}');
|
|
21
|
-
expect(result.warningCount).toBe(1);
|
|
22
|
-
const d = result.diagnostics[0];
|
|
23
|
-
expect(d.code).toBe('unknown-template');
|
|
24
|
-
expect(d.message).toContain('photGrid');
|
|
25
|
-
expect(d.message).toContain('Did you mean "photoGrid"?');
|
|
26
|
-
expect(d.line).toBe(1);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('accepts legacy template aliases', () => {
|
|
30
|
-
expect(codes('## X {[titleBlock]}')).toEqual([]);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('accepts extra templates supplied by the host app', () => {
|
|
34
|
-
expect(codes('## X {[hero]}', { extraTemplates: ['hero'] })).toEqual([]);
|
|
35
|
-
expect(codes('## X {[hero]}')).toEqual(['unknown-template']);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('validateMarkdownSource — unparsed annotations', () => {
|
|
40
|
-
it('flags {[…]} text in body content (annotations are heading-only)', () => {
|
|
41
|
-
const result = validateMarkdownSource('## X\n\n- {[imageWithCaption src=photo.jpg]}\n');
|
|
42
|
-
const d = result.diagnostics.find((x) => x.code === 'unparsed-annotation');
|
|
43
|
-
expect(d).toBeDefined();
|
|
44
|
-
expect(d!.message).toContain('headings');
|
|
45
|
-
expect(d!.line).toBe(3);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('flags non-trailing {[…]} text left in a heading', () => {
|
|
49
|
-
const result = validateMarkdownSource('## The {[chart]} section\n');
|
|
50
|
-
expect(result.diagnostics.map((d) => d.code)).toContain('unparsed-annotation');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('does not flag resolved inline icons or code blocks', () => {
|
|
54
|
-
const md = '## X\n\nUse {[github]} for code.\n\n```\nliteral {[notathing]}\n```\n';
|
|
55
|
-
expect(codes(md)).toEqual([]);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe('validateMarkdownSource — attributes and structure', () => {
|
|
60
|
-
it('surfaces malformed heading-attribute values', () => {
|
|
61
|
-
const result = validateMarkdownSource('## X {#a x=abc}');
|
|
62
|
-
const d = result.diagnostics.find((x) => x.code === 'invalid-attribute');
|
|
63
|
-
expect(d).toBeDefined();
|
|
64
|
-
expect(d!.message).toContain('x');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('includes conversion diagnostics (duplicate ids, bad fences)', () => {
|
|
68
|
-
const md = '## A {#dup}\n\n## B {#dup}\n\n```json data\nnot json\n```\n';
|
|
69
|
-
const result = validateMarkdownSource(md);
|
|
70
|
-
const found = result.diagnostics.map((d) => d.code);
|
|
71
|
-
expect(found).toContain('duplicate-id');
|
|
72
|
-
expect(found).toContain('data-fence-parse');
|
|
73
|
-
expect(result.errorCount).toBe(2);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe('validateMarkdownSource — conflicting annotation keys', () => {
|
|
78
|
-
it('flags a block-meta key set differently in both {[…]} and {…}', () => {
|
|
79
|
-
const result = validateMarkdownSource('## X {[sectionHeader duration=8]} {#x duration=10}\n');
|
|
80
|
-
const d = result.diagnostics.find((x) => x.code === 'conflicting-annotation-key');
|
|
81
|
-
expect(d).toBeDefined();
|
|
82
|
-
expect(d!.severity).toBe('info');
|
|
83
|
-
expect(d!.message).toBe(
|
|
84
|
-
'"duration" is set in both {[…]} (8) and {…} (10) — the {…} value wins.',
|
|
85
|
-
);
|
|
86
|
-
expect(d!.blockId).toBe('x');
|
|
87
|
-
expect(d!.line).toBe(1);
|
|
88
|
-
expect(result.infoCount).toBe(1);
|
|
89
|
-
expect(result.errorCount).toBe(0);
|
|
90
|
-
expect(result.warningCount).toBe(0);
|
|
91
|
-
// Precedence itself is unchanged: the Pandoc value is in effect.
|
|
92
|
-
expect(result.doc.blocks[0].duration).toBe(10);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('stays silent when both forms agree', () => {
|
|
96
|
-
expect(codes('## X {[sectionHeader duration=8]} {#x duration=8}\n')).toEqual([]);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('ignores non-block-meta keys (they land in different channels)', () => {
|
|
100
|
-
// `style` goes to templateOverrides ({[…]}) and metadata ({…}) — no conflict.
|
|
101
|
-
expect(codes('## X {[factCard style=minimal]} {#x style=bold}\n')).toEqual([]);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('reports each conflicting key separately', () => {
|
|
105
|
-
const result = validateMarkdownSource(
|
|
106
|
-
'## X {[sectionHeader duration=8 startTime=1]} {#x duration=10 startTime=2}\n',
|
|
107
|
-
);
|
|
108
|
-
const found = result.diagnostics.filter((d) => d.code === 'conflicting-annotation-key');
|
|
109
|
-
expect(found).toHaveLength(2);
|
|
110
|
-
expect(result.infoCount).toBe(2);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
describe('validateMarkdownSource — assets', () => {
|
|
115
|
-
it('flags relative image references missing from the asset set', () => {
|
|
116
|
-
const result = validateMarkdownSource('## X\n\n\n', {
|
|
117
|
-
assets: new Set<string>(),
|
|
118
|
-
});
|
|
119
|
-
const d = result.diagnostics.find((x) => x.code === 'missing-asset');
|
|
120
|
-
expect(d).toBeDefined();
|
|
121
|
-
expect(d!.message).toContain('images/hero.jpg');
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('passes when the asset exists, and skips absolute/external URLs', () => {
|
|
125
|
-
const md =
|
|
126
|
-
'## X\n\n\n\n\n\n\n';
|
|
127
|
-
expect(codes(md, { assets: new Set(['images/hero.jpg']) })).toEqual([]);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('checks media params from {[…]} annotations', () => {
|
|
131
|
-
const result = validateMarkdownSource('## X {[imageWithCaption src=missing.png]}', {
|
|
132
|
-
assets: new Set<string>(),
|
|
133
|
-
});
|
|
134
|
-
expect(result.diagnostics.map((d) => d.code)).toContain('missing-asset');
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('skips asset checks entirely when no asset set is provided', () => {
|
|
138
|
-
expect(codes('## X\n\n\n')).toEqual([]);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
describe('validateMarkdownSource — template inputs', () => {
|
|
143
|
-
it('flags an unknown input with a did-you-mean suggestion', () => {
|
|
144
|
-
const result = validateMarkdownSource('## Where {[map centre="47.6,-122.3"]}');
|
|
145
|
-
const d = result.diagnostics.find((x) => x.code === 'unknown-input');
|
|
146
|
-
expect(d).toBeDefined();
|
|
147
|
-
expect(d!.severity).toBe('warning');
|
|
148
|
-
expect(d!.message).toContain('centre');
|
|
149
|
-
expect(d!.message).toContain('Did you mean "center"?');
|
|
150
|
-
expect(d!.line).toBe(1);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('flags a value outside a closed enum', () => {
|
|
154
|
-
const result = validateMarkdownSource('## Where {[map center="1,2" mapStyle="nope"]}');
|
|
155
|
-
const d = result.diagnostics.find((x) => x.code === 'invalid-input-value');
|
|
156
|
-
expect(d).toBeDefined();
|
|
157
|
-
expect(d!.message).toContain('mapStyle');
|
|
158
|
-
expect(d!.message).toContain('terrain');
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('flags a missing required input', () => {
|
|
162
|
-
const codesFor = codes('## Compare {[twoColumn]}');
|
|
163
|
-
expect(codesFor.filter((c) => c === 'missing-input')).toEqual([
|
|
164
|
-
'missing-input',
|
|
165
|
-
'missing-input',
|
|
166
|
-
]);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it('does not fire missing-input when the value is derivable from the body', () => {
|
|
170
|
-
const md = '## Caption {[imageWithCaption]}\n\n\n';
|
|
171
|
-
// imageSrc is required, but derivable from the body image → no warning.
|
|
172
|
-
expect(codes(md)).not.toContain('missing-input');
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it('does fire missing-input when the value is not derivable and absent', () => {
|
|
176
|
-
// No body image → imageSrc is neither present nor derivable.
|
|
177
|
-
expect(codes('## Caption {[imageWithCaption]}')).toContain('missing-input');
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
it('does not lint blocks that resolve to a doc-declared custom template', () => {
|
|
181
|
-
// A custom template that shadows the built-in "map" name carries its own
|
|
182
|
-
// arbitrary inputs — the built-in descriptors must not be applied to it.
|
|
183
|
-
const custom: CustomTemplateDefinition = {
|
|
184
|
-
name: 'map',
|
|
185
|
-
label: 'My Map',
|
|
186
|
-
description: 'custom',
|
|
187
|
-
viewport: { width: 1920, height: 1080 },
|
|
188
|
-
layers: [
|
|
189
|
-
{
|
|
190
|
-
id: 't',
|
|
191
|
-
type: 'text',
|
|
192
|
-
position: { x: '5%', y: '10%' },
|
|
193
|
-
content: { text: '{title}', style: { fontSize: 40, color: '#000' } },
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
};
|
|
197
|
-
const encoded = writeCustomTemplatesToFrontmatter([custom])!;
|
|
198
|
-
const md = `---\nsquisq-custom-templates: ${encoded}\n---\n\n## Hi {[map foo="bar"]}\n`;
|
|
199
|
-
const codesFor = validateMarkdownSource(md).diagnostics.map((d) => d.code);
|
|
200
|
-
expect(codesFor).not.toContain('unknown-input');
|
|
201
|
-
expect(codesFor).not.toContain('missing-input');
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it('does not lint templates without descriptors', () => {
|
|
205
|
-
// sectionHeader has no input descriptors → arbitrary keys are not flagged.
|
|
206
|
-
expect(codes('## Break {[sectionHeader whatever=5]}')).toEqual([]);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('leaves a clean, fully-specified block with no findings', () => {
|
|
210
|
-
const md = '## Where {[map center="47.6,-122.3" zoom=9 mapStyle="terrain"]}';
|
|
211
|
-
expect(codes(md)).toEqual([]);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
describe('validateMarkdownSource — standalone annotations (S2)', () => {
|
|
216
|
-
it('does not flag a valid standalone template annotation as unparsed', () => {
|
|
217
|
-
const result = validateMarkdownSource('# H\n\n{[quote]}\n\nquoted\n');
|
|
218
|
-
expect(result.diagnostics.find((d) => d.code === 'unparsed-annotation')).toBeUndefined();
|
|
219
|
-
expect(result.diagnostics.find((d) => d.code === 'unknown-template')).toBeUndefined();
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('reports unknown-template for a standalone annotation with a bad name', () => {
|
|
223
|
-
const result = validateMarkdownSource('# H\n\n{[quotte]}\n\nquoted\n');
|
|
224
|
-
const d = result.diagnostics.find((x) => x.code === 'unknown-template');
|
|
225
|
-
expect(d).toBeDefined();
|
|
226
|
-
expect(d!.message).toContain('quotte');
|
|
227
|
-
// Not double-reported as an unparsed annotation.
|
|
228
|
-
expect(result.diagnostics.find((x) => x.code === 'unparsed-annotation')).toBeUndefined();
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it('still flags {[…]} nested inside a list (not a standalone block)', () => {
|
|
232
|
-
const result = validateMarkdownSource('## X\n\n- {[imageWithCaption src=x.jpg]}\n');
|
|
233
|
-
const d = result.diagnostics.find((x) => x.code === 'unparsed-annotation');
|
|
234
|
-
expect(d).toBeDefined();
|
|
235
|
-
expect(d!.message).toContain('standalone paragraphs');
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
describe('validateMarkdownSource — possible-data-fence (S3)', () => {
|
|
240
|
-
const info = (md: string) =>
|
|
241
|
-
validateMarkdownSource(md).diagnostics.filter((d) => d.code === 'possible-data-fence');
|
|
242
|
-
|
|
243
|
-
it('nudges an unmarked json fence inside a template-annotated block', () => {
|
|
244
|
-
const md = '## Numbers {[dataTable]}\n\n```json\n{ "headers": ["A"], "rows": [] }\n```\n';
|
|
245
|
-
const d = info(md);
|
|
246
|
-
expect(d).toHaveLength(1);
|
|
247
|
-
expect(d[0].severity).toBe('info');
|
|
248
|
-
expect(d[0].message).toContain('```json data');
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('does not fire for a code sample in a non-templated prose section', () => {
|
|
252
|
-
const md = '## Notes\n\n```json\n{ "a": 1 }\n```\n';
|
|
253
|
-
expect(info(md)).toHaveLength(0);
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
it('does not fire when the fence already has the data marker', () => {
|
|
257
|
-
const md = '## Numbers {[dataTable]}\n\n```json data\n{ "headers": ["A"], "rows": [] }\n```\n';
|
|
258
|
-
expect(info(md)).toHaveLength(0);
|
|
259
|
-
});
|
|
260
|
-
});
|