@bendyline/squisq 2.1.0 → 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-DynJleo-.d.ts → Doc-BubIpWsp.d.ts} +1 -1
- package/dist/{ImageEditDoc-Ca4Tr9uN.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-VWCJ2WXC.js → chunk-2ZWIXGAC.js} +0 -1
- package/dist/{chunk-VYFRI7R6.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-JI77MGAK.js → chunk-7ARJZYQY.js} +159 -120
- 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-JHZWYRSW.js → chunk-C33GTPUZ.js} +11 -4
- package/dist/{chunk-QUUPYOSP.js → chunk-CB45YGAM.js} +2 -3
- package/dist/{chunk-XNLB57UD.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-OTKVFVL6.js → chunk-I2O6W7DX.js} +116 -44
- 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-ILWDXLUK.js → chunk-RS5AP3J4.js} +49 -10
- 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 +27 -12
- package/dist/doc/index.js +16 -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 +11 -11
- package/dist/index.js +60 -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-DDzubQXo.d.ts → materializePageSection-wSLA2A1g.d.ts} +2 -2
- 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 +5 -5
- package/dist/schemas/index.js +5 -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-B72m0W1y.d.ts → themeLibrary-DU9mUmVl.d.ts} +1 -1
- package/dist/timing/index.js +3 -4
- package/dist/transform/index.d.ts +3 -3
- 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-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-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-FVTQSNR7.js.map +0 -1
- package/dist/chunk-GZY66SDN.js.map +0 -1
- package/dist/chunk-ILWDXLUK.js.map +0 -1
- package/dist/chunk-JHZWYRSW.js.map +0 -1
- package/dist/chunk-JI77MGAK.js.map +0 -1
- package/dist/chunk-JOQYPRDZ.js.map +0 -1
- package/dist/chunk-OTKVFVL6.js.map +0 -1
- package/dist/chunk-PGGGKYWG.js +0 -1
- package/dist/chunk-PGGGKYWG.js.map +0 -1
- package/dist/chunk-Q7LROV2H.js.map +0 -1
- package/dist/chunk-QE7TWGVT.js.map +0 -1
- package/dist/chunk-QUUPYOSP.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-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-VWCJ2WXC.js.map +0 -1
- package/dist/chunk-VYFRI7R6.js.map +0 -1
- package/dist/chunk-XNLB57UD.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 -167
- package/src/__tests__/materializePageSections.test.ts +0 -404
- 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__/pageStyle.test.ts +0 -258
- 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 -173
- 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 -161
- package/src/doc/markdownToDoc.ts +0 -1054
- package/src/doc/materializeBlockLayers.ts +0 -465
- package/src/doc/mediaAnnotations.ts +0 -120
- package/src/doc/page/PageSection.ts +0 -174
- package/src/doc/page/materializePageSection.ts +0 -616
- package/src/doc/page/resolvePageBlock.ts +0 -108
- package/src/doc/page/sectionExtractors.ts +0 -466
- package/src/doc/pageCss.ts +0 -628
- 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 -424
- 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 -1073
- 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/PageStyle.ts +0 -213
- package/src/schemas/Theme.ts +0 -413
- 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 -31
- package/src/schemas/pageStyleDefaults.ts +0 -204
- package/src/schemas/themeCompile.ts +0 -244
- package/src/schemas/themeConstants.ts +0 -2
- package/src/schemas/themeLibrary.ts +0 -60
- package/src/schemas/themeValidator.ts +0 -609
- package/src/schemas/themes/bold.json +0 -77
- package/src/schemas/themes/cinematic.json +0 -143
- package/src/schemas/themes/documentary.json +0 -125
- package/src/schemas/themes/gezellig.json +0 -123
- package/src/schemas/themes/index.ts +0 -53
- package/src/schemas/themes/magazine.json +0 -126
- package/src/schemas/themes/minimalist.json +0 -74
- package/src/schemas/themes/morning-light.json +0 -117
- package/src/schemas/themes/standard-dark.json +0 -109
- package/src/schemas/themes/standard.json +0 -98
- package/src/schemas/themes/tech-dark.json +0 -143
- package/src/schemas/themes/warm-earth.json +0 -74
- 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 -217
- package/src/transform/styles/dataDriven.ts +0 -18
- package/src/transform/styles/documentary.ts +0 -18
- package/src/transform/styles/index.ts +0 -5
- package/src/transform/styles/magazine.ts +0 -19
- package/src/transform/styles/minimal.ts +0 -18
- package/src/transform/styles/narrative.ts +0 -19
- package/src/transform/templateSelector.ts +0 -389
- package/src/transform/timingAllocator.ts +0 -257
- package/src/transform/types.ts +0 -158
- 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,710 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
expandDocBlocks,
|
|
4
|
-
getAvailableTemplates,
|
|
5
|
-
hasTemplate,
|
|
6
|
-
templateRegistry,
|
|
7
|
-
createTemplateContext,
|
|
8
|
-
DEFAULT_THEME,
|
|
9
|
-
VIEWPORT_PRESETS,
|
|
10
|
-
} from '../doc/templates/index';
|
|
11
|
-
import type { TemplateBlock } from '../schemas/BlockTemplates';
|
|
12
|
-
import type { Block, Layer, TextLayer } from '../schemas/Doc';
|
|
13
|
-
import type { RuntimeTemplateRegistry } from '../doc/templates/index';
|
|
14
|
-
import { materializeBlockLayersWithRuntime } from '../doc/materializeBlockLayers';
|
|
15
|
-
import { materializeLayers } from './materializeTestUtils';
|
|
16
|
-
import { markdownToDoc } from '../doc/markdownToDoc';
|
|
17
|
-
import { parseMarkdown } from '../markdown/parse';
|
|
18
|
-
|
|
19
|
-
function materializeTemplateForTest(
|
|
20
|
-
block: TemplateBlock,
|
|
21
|
-
context: ReturnType<typeof createTemplateContext>,
|
|
22
|
-
registry: RuntimeTemplateRegistry = templateRegistry as unknown as RuntimeTemplateRegistry,
|
|
23
|
-
): Block {
|
|
24
|
-
const { layers } = materializeBlockLayersWithRuntime(
|
|
25
|
-
block,
|
|
26
|
-
{
|
|
27
|
-
theme: context.theme,
|
|
28
|
-
viewport: context.viewport,
|
|
29
|
-
persistentLayers: false,
|
|
30
|
-
blockIndex: context.blockIndex,
|
|
31
|
-
totalBlocks: context.totalBlocks,
|
|
32
|
-
failureMode: 'empty',
|
|
33
|
-
},
|
|
34
|
-
{ registry, templateContext: context, applyRenderStyle: false },
|
|
35
|
-
);
|
|
36
|
-
return {
|
|
37
|
-
id: block.id,
|
|
38
|
-
startTime: 0,
|
|
39
|
-
duration: block.duration,
|
|
40
|
-
audioSegment: block.audioSegment,
|
|
41
|
-
...(layers.length > 0 ? { layers } : {}),
|
|
42
|
-
transition: block.transition,
|
|
43
|
-
template: block.template,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
describe('templateRegistry', () => {
|
|
48
|
-
it('contains all expected templates', () => {
|
|
49
|
-
const expected = [
|
|
50
|
-
'title',
|
|
51
|
-
'sectionHeader',
|
|
52
|
-
'statHighlight',
|
|
53
|
-
'quote',
|
|
54
|
-
'factCard',
|
|
55
|
-
'twoColumn',
|
|
56
|
-
'dateEvent',
|
|
57
|
-
'imageWithCaption',
|
|
58
|
-
'leftFeature',
|
|
59
|
-
'rightFeature',
|
|
60
|
-
'map',
|
|
61
|
-
'fullBleedQuote',
|
|
62
|
-
'list',
|
|
63
|
-
'photoGrid',
|
|
64
|
-
'definitionCard',
|
|
65
|
-
'comparisonBar',
|
|
66
|
-
'pullQuote',
|
|
67
|
-
'videoWithCaption',
|
|
68
|
-
'videoPullQuote',
|
|
69
|
-
];
|
|
70
|
-
for (const name of expected) {
|
|
71
|
-
expect(templateRegistry).toHaveProperty(name);
|
|
72
|
-
const tpl = (templateRegistry as Record<string, unknown>)[name];
|
|
73
|
-
expect(typeof tpl).toBe('function');
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('getAvailableTemplates', () => {
|
|
79
|
-
it('returns array of template names', () => {
|
|
80
|
-
const templates = getAvailableTemplates();
|
|
81
|
-
expect(templates).toContain('title');
|
|
82
|
-
expect(templates).toContain('sectionHeader');
|
|
83
|
-
expect(templates.length).toBeGreaterThanOrEqual(15);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('hasTemplate', () => {
|
|
88
|
-
it('returns true for existing templates', () => {
|
|
89
|
-
expect(hasTemplate('title')).toBe(true);
|
|
90
|
-
expect(hasTemplate('statHighlight')).toBe(true);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('returns false for unknown templates', () => {
|
|
94
|
-
expect(hasTemplate('nonexistent')).toBe(false);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
describe('canonical template materialization', () => {
|
|
99
|
-
it('expands titleSlide template into layers', () => {
|
|
100
|
-
const block: TemplateBlock = {
|
|
101
|
-
template: 'title',
|
|
102
|
-
id: 'title-1',
|
|
103
|
-
duration: 10,
|
|
104
|
-
audioSegment: 0,
|
|
105
|
-
title: 'Test Title',
|
|
106
|
-
subtitle: 'Test Subtitle',
|
|
107
|
-
};
|
|
108
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 5, VIEWPORT_PRESETS.landscape);
|
|
109
|
-
const result = materializeTemplateForTest(block, context);
|
|
110
|
-
|
|
111
|
-
expect(result.id).toBe('title-1');
|
|
112
|
-
expect(result.duration).toBe(10);
|
|
113
|
-
expect(result.layers ?? []).toBeInstanceOf(Array);
|
|
114
|
-
expect((result.layers ?? []).length).toBeGreaterThan(0);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('expands leftFeature template with image on the left half and left-aligned text right', () => {
|
|
118
|
-
const block: TemplateBlock = {
|
|
119
|
-
template: 'leftFeature',
|
|
120
|
-
id: 'lf-1',
|
|
121
|
-
duration: 6,
|
|
122
|
-
audioSegment: 0,
|
|
123
|
-
imageSrc: 'hero.jpg',
|
|
124
|
-
imageAlt: 'hero',
|
|
125
|
-
title: 'Product Builder',
|
|
126
|
-
body: 'I love building software platforms.',
|
|
127
|
-
};
|
|
128
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 1, VIEWPORT_PRESETS.landscape);
|
|
129
|
-
const result = materializeTemplateForTest(block, context);
|
|
130
|
-
const layers = result.layers ?? [];
|
|
131
|
-
const imageLayer = layers.find((l) => l.type === 'image');
|
|
132
|
-
expect(imageLayer).toBeDefined();
|
|
133
|
-
expect(imageLayer!.position.x).toBe('0');
|
|
134
|
-
expect(imageLayer!.position.width).toBe('50%');
|
|
135
|
-
// Text column sits just past the 50% divider, top-left anchored,
|
|
136
|
-
// so the title and body share a left edge with comfortable padding.
|
|
137
|
-
const textLayers = layers.filter((l) => l.type === 'text');
|
|
138
|
-
expect(textLayers.length).toBeGreaterThanOrEqual(1);
|
|
139
|
-
for (const t of textLayers) {
|
|
140
|
-
expect(t.position.x).toBe('54%');
|
|
141
|
-
expect(t.position.anchor).toBe('top-left');
|
|
142
|
-
expect((t.content as { style: { textAlign?: string } }).style.textAlign).toBe('left');
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('respects explicit image dimensions: contained + padded inside the half', () => {
|
|
147
|
-
// When the user resizes an image in the WYSIWYG editor it round-
|
|
148
|
-
// trips as `<img width …>`. Feature blocks should treat that as a
|
|
149
|
-
// hint to NOT stretch the image — render it centered with padding
|
|
150
|
-
// around it.
|
|
151
|
-
const block: TemplateBlock = {
|
|
152
|
-
template: 'leftFeature',
|
|
153
|
-
id: 'lf-sized',
|
|
154
|
-
duration: 6,
|
|
155
|
-
audioSegment: 0,
|
|
156
|
-
imageSrc: 'hero.jpg',
|
|
157
|
-
imageAlt: 'hero',
|
|
158
|
-
imageWidth: 194,
|
|
159
|
-
title: 'Sized',
|
|
160
|
-
};
|
|
161
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 1, VIEWPORT_PRESETS.landscape);
|
|
162
|
-
const result = materializeTemplateForTest(block, context);
|
|
163
|
-
const imageLayer = (result.layers ?? []).find((l) => l.type === 'image');
|
|
164
|
-
expect(imageLayer).toBeDefined();
|
|
165
|
-
expect((imageLayer!.content as { fit?: string }).fit).toBe('contain');
|
|
166
|
-
// Image is inset from the half's edges rather than filling them.
|
|
167
|
-
expect(imageLayer!.position.x).toBe('5%');
|
|
168
|
-
expect(imageLayer!.position.width).toBe('40%');
|
|
169
|
-
expect(imageLayer!.position.y).toBe('5%');
|
|
170
|
-
expect(imageLayer!.position.height).toBe('90%');
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('expands rightFeature template with image on the right half and left-aligned text on the left', () => {
|
|
174
|
-
const block: TemplateBlock = {
|
|
175
|
-
template: 'rightFeature',
|
|
176
|
-
id: 'rf-1',
|
|
177
|
-
duration: 6,
|
|
178
|
-
audioSegment: 0,
|
|
179
|
-
imageSrc: 'hero.jpg',
|
|
180
|
-
imageAlt: 'hero',
|
|
181
|
-
title: 'Projects',
|
|
182
|
-
body: 'A list of things.',
|
|
183
|
-
};
|
|
184
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 1, VIEWPORT_PRESETS.landscape);
|
|
185
|
-
const result = materializeTemplateForTest(block, context);
|
|
186
|
-
const layers = result.layers ?? [];
|
|
187
|
-
const imageLayer = layers.find((l) => l.type === 'image');
|
|
188
|
-
expect(imageLayer).toBeDefined();
|
|
189
|
-
expect(imageLayer!.position.x).toBe('50%');
|
|
190
|
-
expect(imageLayer!.position.width).toBe('50%');
|
|
191
|
-
const textLayers = layers.filter((l) => l.type === 'text');
|
|
192
|
-
for (const t of textLayers) {
|
|
193
|
-
// The mirror lives in the layout only: the text column occupies the
|
|
194
|
-
// left half, but the running text stays left-aligned for readability.
|
|
195
|
-
expect(t.position.x).toBe('6%');
|
|
196
|
-
expect(t.position.anchor).toBe('top-left');
|
|
197
|
-
expect((t.content as { style: { textAlign?: string } }).style.textAlign).toBe('left');
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('expands statHighlight template', () => {
|
|
202
|
-
const block: TemplateBlock = {
|
|
203
|
-
template: 'statHighlight',
|
|
204
|
-
id: 'stat-1',
|
|
205
|
-
duration: 8,
|
|
206
|
-
audioSegment: 0,
|
|
207
|
-
stat: '89%',
|
|
208
|
-
description: 'drop in salmon',
|
|
209
|
-
};
|
|
210
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 5, VIEWPORT_PRESETS.landscape);
|
|
211
|
-
const result = materializeTemplateForTest(block, context);
|
|
212
|
-
|
|
213
|
-
expect((result.layers ?? []).length).toBeGreaterThan(0);
|
|
214
|
-
// Should have at least a shape background + text layers
|
|
215
|
-
const textLayers = (result.layers ?? []).filter((l) => l.type === 'text');
|
|
216
|
-
expect(textLayers.length).toBeGreaterThan(0);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it('returns empty layers for unknown template', () => {
|
|
220
|
-
const block = {
|
|
221
|
-
template: 'nonexistent',
|
|
222
|
-
id: 'unknown-1',
|
|
223
|
-
duration: 5,
|
|
224
|
-
audioSegment: 0,
|
|
225
|
-
} as unknown as TemplateBlock;
|
|
226
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 1, VIEWPORT_PRESETS.landscape);
|
|
227
|
-
const result = materializeTemplateForTest(block, context);
|
|
228
|
-
expect(result.layers ?? []).toEqual([]);
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it('each registered template returns valid layers', () => {
|
|
232
|
-
const templates = getAvailableTemplates();
|
|
233
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 10, VIEWPORT_PRESETS.landscape);
|
|
234
|
-
|
|
235
|
-
for (const name of templates) {
|
|
236
|
-
// `getAvailableTemplates()` returns string[]; cast when creating a TemplateBlock
|
|
237
|
-
const block = {
|
|
238
|
-
template: name as TemplateBlock['template'],
|
|
239
|
-
id: `test-${name}`,
|
|
240
|
-
duration: 10,
|
|
241
|
-
audioSegment: 0,
|
|
242
|
-
// Provide common props that templates might need
|
|
243
|
-
title: 'Test',
|
|
244
|
-
subtitle: 'Subtitle',
|
|
245
|
-
stat: '42',
|
|
246
|
-
description: 'Description',
|
|
247
|
-
detail: 'Detail',
|
|
248
|
-
quote: 'Quote text',
|
|
249
|
-
attribution: 'Author',
|
|
250
|
-
fact: 'A fact',
|
|
251
|
-
explanation: 'Explanation',
|
|
252
|
-
text: 'Some text',
|
|
253
|
-
date: '1776',
|
|
254
|
-
left: { label: 'Left', sublabel: 'Sub' },
|
|
255
|
-
right: { label: 'Right', sublabel: 'Sub' },
|
|
256
|
-
items: ['one', 'two', 'three'],
|
|
257
|
-
images: [
|
|
258
|
-
{ src: 'test1.jpg', alt: 'Test 1' },
|
|
259
|
-
{ src: 'test2.jpg', alt: 'Test 2' },
|
|
260
|
-
],
|
|
261
|
-
imageSrc: 'test.jpg',
|
|
262
|
-
backgroundImage: { src: 'bg.jpg', alt: 'Background' },
|
|
263
|
-
backgroundVideo: { src: 'test.mp4', alt: 'Video', clipStart: 0, clipEnd: 5 },
|
|
264
|
-
videoSrc: 'test.mp4',
|
|
265
|
-
caption: 'Caption text',
|
|
266
|
-
term: 'Term',
|
|
267
|
-
definition: 'Definition',
|
|
268
|
-
leftLabel: 'A',
|
|
269
|
-
rightLabel: 'B',
|
|
270
|
-
leftValue: 50,
|
|
271
|
-
rightValue: 50,
|
|
272
|
-
} as unknown as TemplateBlock;
|
|
273
|
-
const result = materializeTemplateForTest(block, context);
|
|
274
|
-
expect(result.id).toBe(`test-${name}`);
|
|
275
|
-
expect(result.layers ?? []).toBeInstanceOf(Array);
|
|
276
|
-
// Each template should produce at least 1 layer
|
|
277
|
-
expect((result.layers ?? []).length).toBeGreaterThanOrEqual(1);
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
it('keeps photoGrid media captions compact without placeholder alt labels', () => {
|
|
282
|
-
const block: TemplateBlock = {
|
|
283
|
-
template: 'photoGrid',
|
|
284
|
-
id: 'photo-grid-captions',
|
|
285
|
-
duration: 10,
|
|
286
|
-
audioSegment: 0,
|
|
287
|
-
images: [
|
|
288
|
-
{ src: 'one.jpg', alt: 'A long archival caption for the first image' },
|
|
289
|
-
{ src: 'two.jpg', alt: 'A long archival caption for the second image' },
|
|
290
|
-
{ src: 'three.jpg', alt: 'A long archival caption for the third image' },
|
|
291
|
-
],
|
|
292
|
-
caption:
|
|
293
|
-
'A long Wikimedia description with source notes, place names, dates, and details that should remain compact.',
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 10, VIEWPORT_PRESETS.landscape);
|
|
297
|
-
const result = materializeTemplateForTest(block, context);
|
|
298
|
-
const layers = result.layers ?? [];
|
|
299
|
-
const captionLayer = layers.find(
|
|
300
|
-
(layer): layer is TextLayer => layer.type === 'text' && layer.id === 'caption',
|
|
301
|
-
);
|
|
302
|
-
|
|
303
|
-
expect(layers.some((layer) => layer.id.startsWith('grid-alt-'))).toBe(false);
|
|
304
|
-
expect(captionLayer).toBeDefined();
|
|
305
|
-
expect(captionLayer!.content.style.maxLines).toBe(1);
|
|
306
|
-
expect(captionLayer!.position.width).toBe('78%');
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
it('clamps full-bleed media captions above playback controls', () => {
|
|
310
|
-
const imageBlock: TemplateBlock = {
|
|
311
|
-
template: 'imageWithCaption',
|
|
312
|
-
id: 'image-caption',
|
|
313
|
-
duration: 10,
|
|
314
|
-
audioSegment: 0,
|
|
315
|
-
imageSrc: 'image.jpg',
|
|
316
|
-
imageAlt: 'Image',
|
|
317
|
-
caption:
|
|
318
|
-
'A long Wikimedia description with source notes, place names, dates, and details that should remain compact.',
|
|
319
|
-
};
|
|
320
|
-
const videoBlock: TemplateBlock = {
|
|
321
|
-
template: 'videoWithCaption',
|
|
322
|
-
id: 'video-caption',
|
|
323
|
-
duration: 10,
|
|
324
|
-
audioSegment: 0,
|
|
325
|
-
videoSrc: 'video.mp4',
|
|
326
|
-
videoAlt: 'Video',
|
|
327
|
-
clipStart: 0,
|
|
328
|
-
clipEnd: 10,
|
|
329
|
-
caption: imageBlock.caption,
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
const context = createTemplateContext(DEFAULT_THEME, 0, 10, VIEWPORT_PRESETS.landscape);
|
|
333
|
-
const imageCaption = (materializeTemplateForTest(imageBlock, context).layers ?? []).find(
|
|
334
|
-
(layer): layer is TextLayer => layer.type === 'text' && layer.id === 'caption',
|
|
335
|
-
);
|
|
336
|
-
const videoCaption = (materializeTemplateForTest(videoBlock, context).layers ?? []).find(
|
|
337
|
-
(layer): layer is TextLayer => layer.type === 'text' && layer.id === 'caption',
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
expect(imageCaption).toBeDefined();
|
|
341
|
-
expect(videoCaption).toBeDefined();
|
|
342
|
-
expect(imageCaption!.content.style.maxLines).toBe(2);
|
|
343
|
-
expect(videoCaption!.content.style.maxLines).toBe(2);
|
|
344
|
-
expect(imageCaption!.position.y).toBe('74%');
|
|
345
|
-
expect(videoCaption!.position.y).toBe('74%');
|
|
346
|
-
expect(imageCaption!.position.width).toBe('78%');
|
|
347
|
-
expect(videoCaption!.position.width).toBe('78%');
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
describe('expandDocBlocks', () => {
|
|
352
|
-
it('expands array of template blocks with cumulative timing', () => {
|
|
353
|
-
const blocks: TemplateBlock[] = [
|
|
354
|
-
{ template: 'title', id: 'slide-1', duration: 5, audioSegment: 0, title: 'Hello' },
|
|
355
|
-
{
|
|
356
|
-
template: 'factCard',
|
|
357
|
-
id: 'slide-2',
|
|
358
|
-
duration: 8,
|
|
359
|
-
audioSegment: 0,
|
|
360
|
-
fact: 'A fact',
|
|
361
|
-
explanation: 'Why',
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
template: 'statHighlight',
|
|
365
|
-
id: 'slide-3',
|
|
366
|
-
duration: 6,
|
|
367
|
-
audioSegment: 0,
|
|
368
|
-
stat: '99',
|
|
369
|
-
description: 'percent',
|
|
370
|
-
},
|
|
371
|
-
];
|
|
372
|
-
|
|
373
|
-
const result = expandDocBlocks(blocks);
|
|
374
|
-
expect(result).toHaveLength(3);
|
|
375
|
-
expect(result[0].startTime).toBe(0);
|
|
376
|
-
expect(result[1].startTime).toBe(5);
|
|
377
|
-
expect(result[2].startTime).toBe(13);
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
it('expands with audio segment timing', () => {
|
|
381
|
-
const blocks: TemplateBlock[] = [
|
|
382
|
-
{ template: 'sectionHeader', id: 'header-1', duration: 3, audioSegment: 0, title: 'Intro' },
|
|
383
|
-
{
|
|
384
|
-
template: 'factCard',
|
|
385
|
-
id: 'fact-1',
|
|
386
|
-
duration: 10,
|
|
387
|
-
audioSegment: 0,
|
|
388
|
-
fact: 'F',
|
|
389
|
-
explanation: 'E',
|
|
390
|
-
},
|
|
391
|
-
];
|
|
392
|
-
|
|
393
|
-
const result = expandDocBlocks(blocks, {
|
|
394
|
-
audioSegments: [{ startTime: 0, duration: 30 }],
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
expect(result.length).toBeGreaterThan(0);
|
|
398
|
-
// First slide should start at 0
|
|
399
|
-
expect(result[0].startTime).toBe(0);
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
it('never mutates or aliases raw blocks and persistent layers', () => {
|
|
403
|
-
const rawLayer: Layer = {
|
|
404
|
-
type: 'shape',
|
|
405
|
-
id: 'raw-shape',
|
|
406
|
-
content: { shape: 'rect', fill: '#112233' },
|
|
407
|
-
position: { x: 0, y: 0, width: '100%', height: '100%' },
|
|
408
|
-
};
|
|
409
|
-
const rawBlock: Block = {
|
|
410
|
-
id: 'raw',
|
|
411
|
-
startTime: 99,
|
|
412
|
-
duration: 6,
|
|
413
|
-
audioSegment: 0,
|
|
414
|
-
layers: [rawLayer],
|
|
415
|
-
};
|
|
416
|
-
const persistentLayer: Layer = {
|
|
417
|
-
type: 'shape',
|
|
418
|
-
id: 'persistent',
|
|
419
|
-
content: { shape: 'rect', fill: '#445566' },
|
|
420
|
-
position: { x: 0, y: 0, width: '100%', height: '100%' },
|
|
421
|
-
};
|
|
422
|
-
const beforeBlock = JSON.stringify(rawBlock);
|
|
423
|
-
const beforePersistent = JSON.stringify(persistentLayer);
|
|
424
|
-
|
|
425
|
-
const [expanded] = expandDocBlocks([rawBlock], {
|
|
426
|
-
persistentLayers: { bottomLayers: [persistentLayer] },
|
|
427
|
-
audioSegments: [{ startTime: 10, duration: 6 }],
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
expect(JSON.stringify(rawBlock)).toBe(beforeBlock);
|
|
431
|
-
expect(JSON.stringify(persistentLayer)).toBe(beforePersistent);
|
|
432
|
-
expect(expanded).not.toBe(rawBlock);
|
|
433
|
-
expect(expanded.layers?.[0]).not.toBe(persistentLayer);
|
|
434
|
-
expect(expanded.layers?.[1]).not.toBe(rawLayer);
|
|
435
|
-
|
|
436
|
-
(expanded.layers?.[0] as Layer & { content: { fill: string } }).content.fill = '#ffffff';
|
|
437
|
-
expect(JSON.stringify(persistentLayer)).toBe(beforePersistent);
|
|
438
|
-
expect(expandDocBlocks([rawBlock])[0].layers).toHaveLength(1);
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
it('protects template inputs from mutating registry implementations', () => {
|
|
442
|
-
const source: TemplateBlock = {
|
|
443
|
-
template: 'title',
|
|
444
|
-
id: 'title-safe',
|
|
445
|
-
duration: 5,
|
|
446
|
-
audioSegment: 0,
|
|
447
|
-
title: 'Original',
|
|
448
|
-
};
|
|
449
|
-
const sharedLayer: Layer = {
|
|
450
|
-
type: 'shape',
|
|
451
|
-
id: 'shared-layer',
|
|
452
|
-
content: { shape: 'rect', fill: '#112233' },
|
|
453
|
-
position: { x: 0, y: 0, width: '100%', height: '100%' },
|
|
454
|
-
};
|
|
455
|
-
const registry: RuntimeTemplateRegistry = {
|
|
456
|
-
title: (input) => {
|
|
457
|
-
(input as { title: string }).title = 'Mutated';
|
|
458
|
-
return [sharedLayer];
|
|
459
|
-
},
|
|
460
|
-
};
|
|
461
|
-
const first = materializeTemplateForTest(
|
|
462
|
-
source,
|
|
463
|
-
createTemplateContext(DEFAULT_THEME, 0, 1),
|
|
464
|
-
registry,
|
|
465
|
-
);
|
|
466
|
-
const second = materializeTemplateForTest(
|
|
467
|
-
source,
|
|
468
|
-
createTemplateContext(DEFAULT_THEME, 0, 1),
|
|
469
|
-
registry,
|
|
470
|
-
);
|
|
471
|
-
expect(source.title).toBe('Original');
|
|
472
|
-
expect(first.layers?.[0]).not.toBe(sharedLayer);
|
|
473
|
-
expect(first.layers?.[0]).not.toBe(second.layers?.[0]);
|
|
474
|
-
(first.layers?.[0] as Layer & { content: { fill: string } }).content.fill = '#ffffff';
|
|
475
|
-
expect((sharedLayer as Layer & { content: { fill: string } }).content.fill).toBe('#112233');
|
|
476
|
-
expect((second.layers?.[0] as Layer & { content: { fill: string } }).content.fill).toBe(
|
|
477
|
-
'#112233',
|
|
478
|
-
);
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
it('supports landscape and portrait viewports', () => {
|
|
482
|
-
const blocks: TemplateBlock[] = [
|
|
483
|
-
{ template: 'title', id: 'title-1', duration: 5, audioSegment: 0, title: 'Test' },
|
|
484
|
-
];
|
|
485
|
-
|
|
486
|
-
const landscape = expandDocBlocks(blocks, { viewport: VIEWPORT_PRESETS.landscape });
|
|
487
|
-
const portrait = expandDocBlocks(blocks, { viewport: VIEWPORT_PRESETS.portrait });
|
|
488
|
-
|
|
489
|
-
expect(landscape).toHaveLength(1);
|
|
490
|
-
expect(portrait).toHaveLength(1);
|
|
491
|
-
// Both should produce valid blocks
|
|
492
|
-
expect((landscape[0].layers ?? []).length).toBeGreaterThan(0);
|
|
493
|
-
expect((portrait[0].layers ?? []).length).toBeGreaterThan(0);
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
describe('theme renderStyle wiring', () => {
|
|
497
|
-
const blocks = (): TemplateBlock[] => [
|
|
498
|
-
{ template: 'title', id: 't-1', duration: 5, audioSegment: 0, title: 'One' },
|
|
499
|
-
{
|
|
500
|
-
template: 'imageWithCaption',
|
|
501
|
-
id: 't-2',
|
|
502
|
-
duration: 6,
|
|
503
|
-
audioSegment: 0,
|
|
504
|
-
imageSrc: 'photo.jpg',
|
|
505
|
-
imageAlt: 'photo',
|
|
506
|
-
caption: 'A caption',
|
|
507
|
-
},
|
|
508
|
-
];
|
|
509
|
-
|
|
510
|
-
it('fills the theme default transition on blocks after the first, never block 0', () => {
|
|
511
|
-
const theme = {
|
|
512
|
-
...DEFAULT_THEME,
|
|
513
|
-
renderStyle: {
|
|
514
|
-
...DEFAULT_THEME.renderStyle,
|
|
515
|
-
defaultTransition: { type: 'dissolve' as const, duration: 1.1 },
|
|
516
|
-
},
|
|
517
|
-
};
|
|
518
|
-
const result = expandDocBlocks(blocks(), { theme });
|
|
519
|
-
expect(result[0].transition).toBeUndefined();
|
|
520
|
-
expect(result[1].transition).toEqual({ type: 'dissolve', duration: 1.1 });
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
it('never overrides an authored block transition', () => {
|
|
524
|
-
const theme = {
|
|
525
|
-
...DEFAULT_THEME,
|
|
526
|
-
renderStyle: {
|
|
527
|
-
...DEFAULT_THEME.renderStyle,
|
|
528
|
-
defaultTransition: { type: 'dissolve' as const },
|
|
529
|
-
},
|
|
530
|
-
};
|
|
531
|
-
const authored = blocks();
|
|
532
|
-
authored[1].transition = { type: 'cut' };
|
|
533
|
-
const result = expandDocBlocks(authored, { theme });
|
|
534
|
-
expect(result[1].transition).toEqual({ type: 'cut' });
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
it('scales template animation durations by theme animationSpeed', () => {
|
|
538
|
-
const theme = {
|
|
539
|
-
...DEFAULT_THEME,
|
|
540
|
-
style: { ...DEFAULT_THEME.style, animationSpeed: 2.0 },
|
|
541
|
-
};
|
|
542
|
-
const base = expandDocBlocks(blocks());
|
|
543
|
-
const slowed = expandDocBlocks(blocks(), { theme });
|
|
544
|
-
const baseTitle = base[0].layers?.find((l) => l.id === 'title');
|
|
545
|
-
const slowedTitle = slowed[0].layers?.find((l) => l.id === 'title');
|
|
546
|
-
expect(slowedTitle?.animation?.duration).toBe((baseTitle?.animation?.duration ?? 0) * 2);
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
it('gives full-bleed imagery ambient Ken Burns when the theme opts in', () => {
|
|
550
|
-
const theme = {
|
|
551
|
-
...DEFAULT_THEME,
|
|
552
|
-
renderStyle: { ...DEFAULT_THEME.renderStyle, ambientMotion: true },
|
|
553
|
-
};
|
|
554
|
-
const result = expandDocBlocks(blocks(), { theme });
|
|
555
|
-
const bg = result[1].layers?.find((l) => l.id === 'bg-image');
|
|
556
|
-
expect(bg?.animation?.type).toBe('slowZoom');
|
|
557
|
-
// Standard theme (ambientMotion: false) leaves the image static.
|
|
558
|
-
const plain = expandDocBlocks(blocks());
|
|
559
|
-
const plainBg = plain[1].layers?.find((l) => l.id === 'bg-image');
|
|
560
|
-
expect(plainBg?.animation).toBeUndefined();
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
it('themedEntrance: theme default text animation overrides entrance type, keeps timing', () => {
|
|
564
|
-
const theme = {
|
|
565
|
-
...DEFAULT_THEME,
|
|
566
|
-
renderStyle: { ...DEFAULT_THEME.renderStyle, defaultTextAnimation: 'zoomIn' as const },
|
|
567
|
-
};
|
|
568
|
-
const result = expandDocBlocks(blocks(), { theme });
|
|
569
|
-
const title = result[0].layers?.find((l) => l.id === 'title');
|
|
570
|
-
expect(title?.animation?.type).toBe('zoomIn');
|
|
571
|
-
// Duration authored by the template is preserved (title uses 2s)
|
|
572
|
-
expect(title?.animation?.duration).toBe(2);
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
it('templateHints: dramatic entrance switches statHighlight timing', () => {
|
|
576
|
-
const statBlock: TemplateBlock[] = [
|
|
577
|
-
{
|
|
578
|
-
template: 'statHighlight',
|
|
579
|
-
id: 's-1',
|
|
580
|
-
duration: 5,
|
|
581
|
-
audioSegment: 0,
|
|
582
|
-
stat: '42%',
|
|
583
|
-
description: 'described',
|
|
584
|
-
},
|
|
585
|
-
];
|
|
586
|
-
const theme = {
|
|
587
|
-
...DEFAULT_THEME,
|
|
588
|
-
renderStyle: {
|
|
589
|
-
...DEFAULT_THEME.renderStyle,
|
|
590
|
-
templateHints: { statHighlight: { entrance: 'dramatic' } },
|
|
591
|
-
},
|
|
592
|
-
};
|
|
593
|
-
const hinted = expandDocBlocks(statBlock, { theme });
|
|
594
|
-
const plain = expandDocBlocks(statBlock);
|
|
595
|
-
const hintedStat = hinted[0].layers?.find((l) => l.id === 'stat');
|
|
596
|
-
const plainStat = plain[0].layers?.find((l) => l.id === 'stat');
|
|
597
|
-
expect(hintedStat?.animation?.duration).toBe(0.4);
|
|
598
|
-
expect(plainStat?.animation?.duration).toBe(0.6);
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
it('theme persistentLayers render for docs without their own (wholesale precedence)', () => {
|
|
602
|
-
const theme = {
|
|
603
|
-
...DEFAULT_THEME,
|
|
604
|
-
persistentLayers: {
|
|
605
|
-
bottomLayers: [
|
|
606
|
-
{
|
|
607
|
-
template: 'solidBackground' as const,
|
|
608
|
-
config: { type: 'solidBackground' as const, color: '#112233' },
|
|
609
|
-
},
|
|
610
|
-
],
|
|
611
|
-
},
|
|
612
|
-
};
|
|
613
|
-
const inherited = expandDocBlocks(blocks(), { theme });
|
|
614
|
-
expect(inherited[0].layers?.[0]?.id).toContain('solid');
|
|
615
|
-
|
|
616
|
-
// Doc's own persistent layers win wholesale
|
|
617
|
-
const docOwn = expandDocBlocks(blocks(), {
|
|
618
|
-
theme,
|
|
619
|
-
persistentLayers: {
|
|
620
|
-
bottomLayers: [
|
|
621
|
-
{
|
|
622
|
-
template: 'solidBackground' as const,
|
|
623
|
-
config: { type: 'solidBackground' as const, color: '#445566' },
|
|
624
|
-
},
|
|
625
|
-
],
|
|
626
|
-
},
|
|
627
|
-
});
|
|
628
|
-
const first = docOwn[0].layers?.[0];
|
|
629
|
-
expect(first && 'content' in first && (first.content as { fill?: string }).fill).toBe(
|
|
630
|
-
'#445566',
|
|
631
|
-
);
|
|
632
|
-
});
|
|
633
|
-
});
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
describe('DEFAULT_THEME', () => {
|
|
637
|
-
it('has required color properties', () => {
|
|
638
|
-
expect(DEFAULT_THEME.colors).toHaveProperty('primary');
|
|
639
|
-
expect(DEFAULT_THEME.colors).toHaveProperty('background');
|
|
640
|
-
expect(DEFAULT_THEME.colors).toHaveProperty('text');
|
|
641
|
-
});
|
|
642
|
-
});
|
|
643
|
-
|
|
644
|
-
describe('inline-param coercion → materializeBlockLayers', () => {
|
|
645
|
-
function firstBlock(md: string) {
|
|
646
|
-
return markdownToDoc(parseMarkdown(md), { generateCoverBlock: false }).blocks[0];
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
it('renders a map from pure-inline {[map center=… zoom=…]} annotation', () => {
|
|
650
|
-
const block = firstBlock('# Downtown {[map center="47.6,-122.3" zoom=9 mapStyle="road"]}\n');
|
|
651
|
-
// Raw overrides stay strings for lossless round-trip.
|
|
652
|
-
expect(block.templateOverrides).toEqual({
|
|
653
|
-
center: '47.6,-122.3',
|
|
654
|
-
zoom: '9',
|
|
655
|
-
mapStyle: 'road',
|
|
656
|
-
});
|
|
657
|
-
|
|
658
|
-
const layers = materializeLayers(block, {});
|
|
659
|
-
const mapLayer = layers.find((l) => l.type === 'map');
|
|
660
|
-
expect(mapLayer).toBeDefined();
|
|
661
|
-
// Coerced center/zoom flow into the map layer's content — not empty strings.
|
|
662
|
-
const content = mapLayer!.content as { center: { lat: number; lng: number }; zoom: number };
|
|
663
|
-
expect(content.center).toEqual({ lat: 47.6, lng: -122.3 });
|
|
664
|
-
expect(content.zoom).toBe(9);
|
|
665
|
-
});
|
|
666
|
-
|
|
667
|
-
it('renders a twoColumn from pure-inline labeled-pair annotation', () => {
|
|
668
|
-
const block = firstBlock('# Coffee {[twoColumn left="Espresso|Bold" right="Filter|Smooth"]}\n');
|
|
669
|
-
const layers = materializeLayers(block, {});
|
|
670
|
-
// Guard requires both labels — a non-empty layer set proves coercion worked.
|
|
671
|
-
expect(layers.length).toBeGreaterThan(0);
|
|
672
|
-
const texts = layers
|
|
673
|
-
.filter((l) => l.type === 'text')
|
|
674
|
-
.map((l) => (l.content as { text: string }).text);
|
|
675
|
-
expect(texts).toContain('Espresso');
|
|
676
|
-
expect(texts).toContain('Filter');
|
|
677
|
-
// The sublabels from the "|" split render too.
|
|
678
|
-
expect(texts).toContain('Bold');
|
|
679
|
-
expect(texts).toContain('Smooth');
|
|
680
|
-
});
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
describe('shared template materialization', () => {
|
|
684
|
-
it('keeps on-demand and timed expansion layer output in lockstep', () => {
|
|
685
|
-
const block: TemplateBlock = {
|
|
686
|
-
template: 'title',
|
|
687
|
-
id: 'shared-title',
|
|
688
|
-
duration: 7,
|
|
689
|
-
audioSegment: 0,
|
|
690
|
-
title: 'One materializer',
|
|
691
|
-
subtitle: 'Two orchestration modes',
|
|
692
|
-
};
|
|
693
|
-
|
|
694
|
-
const onDemand = materializeLayers(block, { theme: DEFAULT_THEME });
|
|
695
|
-
const [expanded] = expandDocBlocks([block], { theme: DEFAULT_THEME });
|
|
696
|
-
|
|
697
|
-
expect(expanded.layers).toEqual(onDemand);
|
|
698
|
-
});
|
|
699
|
-
});
|
|
700
|
-
|
|
701
|
-
describe('VIEWPORT_PRESETS', () => {
|
|
702
|
-
it('has landscape and portrait presets', () => {
|
|
703
|
-
expect(VIEWPORT_PRESETS).toHaveProperty('landscape');
|
|
704
|
-
expect(VIEWPORT_PRESETS).toHaveProperty('portrait');
|
|
705
|
-
expect(VIEWPORT_PRESETS.landscape.width).toBe(1920);
|
|
706
|
-
expect(VIEWPORT_PRESETS.landscape.height).toBe(1080);
|
|
707
|
-
expect(VIEWPORT_PRESETS.portrait.width).toBe(1080);
|
|
708
|
-
expect(VIEWPORT_PRESETS.portrait.height).toBe(1920);
|
|
709
|
-
});
|
|
710
|
-
});
|