@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,609 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Theme Validator
|
|
3
|
-
*
|
|
4
|
-
* Hand-rolled validator for `Theme` JSON. No dependencies. Produces a
|
|
5
|
-
* flat list of typed errors with JSON paths, suitable for surfacing in
|
|
6
|
-
* the customizer UI or throwing at module init for built-in themes.
|
|
7
|
-
*
|
|
8
|
-
* Design: walk the candidate object, push errors for each violation.
|
|
9
|
-
* Coverage is exhaustive for required fields and shapes; permissive on
|
|
10
|
-
* forward-compatible fields (unknown keys are ignored, not rejected).
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { Theme, ThemeColorPalette } from './Theme.js';
|
|
14
|
-
import { THEME_SCHEMA_VERSION } from './themeConstants.js';
|
|
15
|
-
import { isHex } from './colorUtils.js';
|
|
16
|
-
import { isTransitionType } from './Transitions.js';
|
|
17
|
-
import {
|
|
18
|
-
PAGE_SECTION_KINDS,
|
|
19
|
-
PAGE_DESIGN_FAMILIES,
|
|
20
|
-
PAGE_SECTION_SPACINGS,
|
|
21
|
-
PAGE_DIVIDERS,
|
|
22
|
-
PAGE_BACKGROUND_RHYTHMS,
|
|
23
|
-
PAGE_HERO_STYLES,
|
|
24
|
-
PAGE_EYEBROWS,
|
|
25
|
-
PAGE_HEADING_SCALES,
|
|
26
|
-
PAGE_HEADING_CASES,
|
|
27
|
-
PAGE_HEADING_UNDERLINES,
|
|
28
|
-
PAGE_IMAGE_FRAMINGS,
|
|
29
|
-
PAGE_SHADOWS,
|
|
30
|
-
PAGE_QUOTE_MARKS,
|
|
31
|
-
PAGE_NUMERAL_STYLES,
|
|
32
|
-
PAGE_PATTERNS,
|
|
33
|
-
PAGE_EMPHASES,
|
|
34
|
-
PAGE_BACKGROUNDS,
|
|
35
|
-
PAGE_ACCENT_STRATEGIES,
|
|
36
|
-
} from './PageStyle.js';
|
|
37
|
-
|
|
38
|
-
export interface ValidationError {
|
|
39
|
-
path: string;
|
|
40
|
-
message: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ValidationResult {
|
|
44
|
-
valid: boolean;
|
|
45
|
-
errors: ValidationError[];
|
|
46
|
-
/** Present only when `valid === true`. The same input typed as `Theme`. */
|
|
47
|
-
theme?: Theme;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const VALID_FALLBACK = new Set(['serif', 'sans-serif', 'monospace', 'system-ui']);
|
|
51
|
-
const VALID_SECTION_KINDS = new Set<string>(PAGE_SECTION_KINDS);
|
|
52
|
-
const VALID_DESIGN_FAMILIES = new Set<string>(PAGE_DESIGN_FAMILIES);
|
|
53
|
-
const VALID_PAGE_EMPHASES = new Set<string>(PAGE_EMPHASES);
|
|
54
|
-
const VALID_PAGE_BACKGROUNDS = new Set<string>(PAGE_BACKGROUNDS);
|
|
55
|
-
const VALID_ACCENT_STRATEGIES = new Set<string>(PAGE_ACCENT_STRATEGIES);
|
|
56
|
-
/** PageTokens enum fields → their allowed values. */
|
|
57
|
-
const PAGE_TOKEN_ENUMS: Record<string, Set<string>> = {
|
|
58
|
-
sectionSpacing: new Set<string>(PAGE_SECTION_SPACINGS),
|
|
59
|
-
divider: new Set<string>(PAGE_DIVIDERS),
|
|
60
|
-
backgroundRhythm: new Set<string>(PAGE_BACKGROUND_RHYTHMS),
|
|
61
|
-
heroStyle: new Set<string>(PAGE_HERO_STYLES),
|
|
62
|
-
imageFraming: new Set<string>(PAGE_IMAGE_FRAMINGS),
|
|
63
|
-
shadow: new Set<string>(PAGE_SHADOWS),
|
|
64
|
-
quoteMark: new Set<string>(PAGE_QUOTE_MARKS),
|
|
65
|
-
numeralStyle: new Set<string>(PAGE_NUMERAL_STYLES),
|
|
66
|
-
};
|
|
67
|
-
const HEADING_TREATMENT_ENUMS: Record<string, { values: Set<string>; required: boolean }> = {
|
|
68
|
-
eyebrow: { values: new Set<string>(PAGE_EYEBROWS), required: true },
|
|
69
|
-
scale: { values: new Set<string>(PAGE_HEADING_SCALES), required: true },
|
|
70
|
-
case: { values: new Set<string>(PAGE_HEADING_CASES), required: false },
|
|
71
|
-
underline: { values: new Set<string>(PAGE_HEADING_UNDERLINES), required: false },
|
|
72
|
-
};
|
|
73
|
-
const VALID_TITLE_WEIGHT = new Set(['normal', 'bold']);
|
|
74
|
-
const VALID_GRADIENT_PRESETS = new Set([
|
|
75
|
-
'dark-vignette',
|
|
76
|
-
'radial-dark',
|
|
77
|
-
'warm-sunset',
|
|
78
|
-
'cool-blue',
|
|
79
|
-
'earth-tones',
|
|
80
|
-
]);
|
|
81
|
-
|
|
82
|
-
class V {
|
|
83
|
-
errors: ValidationError[] = [];
|
|
84
|
-
err(path: string, message: string): void {
|
|
85
|
-
this.errors.push({ path, message });
|
|
86
|
-
}
|
|
87
|
-
isObject(v: unknown): v is Record<string, unknown> {
|
|
88
|
-
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
89
|
-
}
|
|
90
|
-
isString(v: unknown): v is string {
|
|
91
|
-
return typeof v === 'string';
|
|
92
|
-
}
|
|
93
|
-
isNumber(v: unknown): v is number {
|
|
94
|
-
return typeof v === 'number' && Number.isFinite(v);
|
|
95
|
-
}
|
|
96
|
-
isBoolean(v: unknown): v is boolean {
|
|
97
|
-
return typeof v === 'boolean';
|
|
98
|
-
}
|
|
99
|
-
hex(path: string, v: unknown): void {
|
|
100
|
-
if (!this.isString(v)) {
|
|
101
|
-
this.err(path, `expected hex color string, got ${typeof v}`);
|
|
102
|
-
} else if (!isHex(v)) {
|
|
103
|
-
this.err(path, `expected #rgb or #rrggbb hex color, got "${v}"`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
palette(path: string, v: unknown): void {
|
|
108
|
-
if (!this.isObject(v)) {
|
|
109
|
-
this.err(path, 'expected object');
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const required: (keyof ThemeColorPalette)[] = [
|
|
113
|
-
'primary',
|
|
114
|
-
'secondary',
|
|
115
|
-
'background',
|
|
116
|
-
'backgroundLight',
|
|
117
|
-
'text',
|
|
118
|
-
'textMuted',
|
|
119
|
-
'highlight',
|
|
120
|
-
'warning',
|
|
121
|
-
];
|
|
122
|
-
for (const k of required) this.hex(`${path}.${k}`, v[k]);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
colorScheme(path: string, v: unknown): void {
|
|
126
|
-
if (!this.isObject(v)) {
|
|
127
|
-
this.err(path, 'expected object');
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
this.hex(`${path}.bg`, v.bg);
|
|
131
|
-
this.hex(`${path}.text`, v.text);
|
|
132
|
-
this.hex(`${path}.accent`, v.accent);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
colorSchemes(path: string, v: unknown): void {
|
|
136
|
-
if (!this.isObject(v)) {
|
|
137
|
-
this.err(path, 'expected object map');
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
for (const key of Object.keys(v)) {
|
|
141
|
-
this.colorScheme(`${path}.${key}`, v[key]);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
fontFamily(path: string, v: unknown): void {
|
|
146
|
-
if (!this.isObject(v)) {
|
|
147
|
-
this.err(path, 'expected FontFamily object ({ stackId } or { custom })');
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if ('stackId' in v) {
|
|
151
|
-
if (!this.isString(v.stackId) || v.stackId.length === 0) {
|
|
152
|
-
this.err(`${path}.stackId`, 'expected non-empty string');
|
|
153
|
-
}
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if ('custom' in v) {
|
|
157
|
-
const c = v.custom;
|
|
158
|
-
if (!this.isObject(c)) {
|
|
159
|
-
this.err(`${path}.custom`, 'expected { name, fallback } object');
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (!this.isString(c.name) || c.name.length === 0) {
|
|
163
|
-
this.err(`${path}.custom.name`, 'expected non-empty string');
|
|
164
|
-
}
|
|
165
|
-
if (!this.isString(c.fallback) || !VALID_FALLBACK.has(c.fallback)) {
|
|
166
|
-
this.err(
|
|
167
|
-
`${path}.custom.fallback`,
|
|
168
|
-
`expected one of: serif, sans-serif, monospace, system-ui`,
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
this.err(path, 'expected { stackId } or { custom: { name, fallback } }');
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
typography(path: string, v: unknown): void {
|
|
177
|
-
if (!this.isObject(v)) {
|
|
178
|
-
this.err(path, 'expected object');
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
this.fontFamily(`${path}.bodyFont`, v.bodyFont);
|
|
182
|
-
this.fontFamily(`${path}.titleFont`, v.titleFont);
|
|
183
|
-
if (v.monoFont !== undefined) this.fontFamily(`${path}.monoFont`, v.monoFont);
|
|
184
|
-
for (const k of ['titleScale', 'bodyScale', 'lineHeight', 'titleLineHeight']) {
|
|
185
|
-
if (v[k] !== undefined && !this.isNumber(v[k])) {
|
|
186
|
-
this.err(`${path}.${k}`, `expected number, got ${typeof v[k]}`);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
if (v.titleWeight !== undefined) {
|
|
190
|
-
if (!this.isString(v.titleWeight) || !VALID_TITLE_WEIGHT.has(v.titleWeight)) {
|
|
191
|
-
this.err(`${path}.titleWeight`, 'expected "normal" or "bold"');
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
style(path: string, v: unknown): void {
|
|
197
|
-
if (!this.isObject(v)) {
|
|
198
|
-
this.err(path, 'expected object');
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
if (v.borderRadius !== undefined && !this.isNumber(v.borderRadius)) {
|
|
202
|
-
this.err(`${path}.borderRadius`, 'expected number');
|
|
203
|
-
}
|
|
204
|
-
if (v.textShadow !== undefined && !this.isBoolean(v.textShadow)) {
|
|
205
|
-
this.err(`${path}.textShadow`, 'expected boolean');
|
|
206
|
-
}
|
|
207
|
-
for (const k of ['overlayOpacity', 'animationSpeed']) {
|
|
208
|
-
if (v[k] !== undefined && !this.isNumber(v[k])) {
|
|
209
|
-
this.err(`${path}.${k}`, 'expected number');
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
if (v.blockPadding !== undefined && !this.isString(v.blockPadding)) {
|
|
213
|
-
this.err(`${path}.blockPadding`, 'expected string (percentage e.g. "5%")');
|
|
214
|
-
}
|
|
215
|
-
if (v.imageTreatment !== undefined) {
|
|
216
|
-
this.imageTreatment(`${path}.imageTreatment`, v.imageTreatment);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
imageTreatment(path: string, v: unknown): void {
|
|
221
|
-
if (!this.isObject(v)) {
|
|
222
|
-
this.err(path, 'expected object');
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const kinds = ['none', 'mono', 'duotone', 'warm', 'cool'];
|
|
226
|
-
if (!this.isString(v.type) || !kinds.includes(v.type)) {
|
|
227
|
-
this.err(`${path}.type`, `expected one of ${kinds.join('|')}`);
|
|
228
|
-
}
|
|
229
|
-
if (v.strength !== undefined && !this.isNumber(v.strength)) {
|
|
230
|
-
this.err(`${path}.strength`, 'expected number (0..1)');
|
|
231
|
-
}
|
|
232
|
-
if (v.color !== undefined) this.hex(`${path}.color`, v.color);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
renderStyle(path: string, v: unknown): void {
|
|
236
|
-
if (!this.isObject(v)) {
|
|
237
|
-
this.err(path, 'expected object');
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
if (!this.isString(v.name) || v.name.length === 0) {
|
|
241
|
-
this.err(`${path}.name`, 'expected non-empty string');
|
|
242
|
-
}
|
|
243
|
-
if (v.ambientMotion !== undefined && !this.isBoolean(v.ambientMotion)) {
|
|
244
|
-
this.err(`${path}.ambientMotion`, 'expected boolean');
|
|
245
|
-
}
|
|
246
|
-
for (const k of ['defaultTextAnimation', 'defaultImageAnimation']) {
|
|
247
|
-
if (v[k] !== undefined && !this.isString(v[k])) {
|
|
248
|
-
this.err(`${path}.${k}`, 'expected animation type string');
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
if (v.defaultTransition !== undefined) {
|
|
252
|
-
const t = v.defaultTransition;
|
|
253
|
-
if (!this.isObject(t)) {
|
|
254
|
-
this.err(`${path}.defaultTransition`, 'expected object');
|
|
255
|
-
} else {
|
|
256
|
-
if (!this.isString(t.type) || !isTransitionType(t.type)) {
|
|
257
|
-
this.err(`${path}.defaultTransition.type`, 'expected valid transition type');
|
|
258
|
-
}
|
|
259
|
-
if (t.duration !== undefined && !this.isNumber(t.duration)) {
|
|
260
|
-
this.err(`${path}.defaultTransition.duration`, 'expected number');
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
if (v.layoutOverrides !== undefined && !this.isObject(v.layoutOverrides)) {
|
|
265
|
-
this.err(`${path}.layoutOverrides`, 'expected object');
|
|
266
|
-
}
|
|
267
|
-
if (v.templateHints !== undefined) {
|
|
268
|
-
if (!this.isObject(v.templateHints)) {
|
|
269
|
-
this.err(`${path}.templateHints`, 'expected object map');
|
|
270
|
-
} else {
|
|
271
|
-
for (const tplName of Object.keys(v.templateHints)) {
|
|
272
|
-
const hints = v.templateHints[tplName];
|
|
273
|
-
if (!this.isObject(hints)) {
|
|
274
|
-
this.err(`${path}.templateHints.${tplName}`, 'expected object');
|
|
275
|
-
continue;
|
|
276
|
-
}
|
|
277
|
-
for (const key of Object.keys(hints)) {
|
|
278
|
-
const val = hints[key];
|
|
279
|
-
const t = typeof val;
|
|
280
|
-
if (t !== 'string' && t !== 'number' && t !== 'boolean') {
|
|
281
|
-
this.err(
|
|
282
|
-
`${path}.templateHints.${tplName}.${key}`,
|
|
283
|
-
`expected string|number|boolean, got ${t}`,
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
seedColors(path: string, v: unknown): void {
|
|
293
|
-
if (!this.isObject(v)) {
|
|
294
|
-
this.err(path, 'expected object');
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
if (v.primary === undefined) {
|
|
298
|
-
this.err(`${path}.primary`, 'required when seedColors is present');
|
|
299
|
-
} else {
|
|
300
|
-
this.hex(`${path}.primary`, v.primary);
|
|
301
|
-
}
|
|
302
|
-
for (const k of ['secondary', 'accent', 'background', 'text']) {
|
|
303
|
-
if (v[k] !== undefined) this.hex(`${path}.${k}`, v[k]);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
persistentLayer(path: string, v: unknown): void {
|
|
308
|
-
if (!this.isObject(v)) {
|
|
309
|
-
this.err(path, 'expected object');
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
// Either { template, config } or a raw Layer — only validate the template form here
|
|
313
|
-
if ('template' in v) {
|
|
314
|
-
if (!this.isString(v.template)) {
|
|
315
|
-
this.err(`${path}.template`, 'expected string');
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
const cfg = v.config;
|
|
319
|
-
if (!this.isObject(cfg)) {
|
|
320
|
-
this.err(`${path}.config`, 'expected object');
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
if (cfg.type !== v.template) {
|
|
324
|
-
this.err(`${path}.config.type`, `expected "${v.template}", got "${String(cfg.type)}"`);
|
|
325
|
-
}
|
|
326
|
-
if (v.template === 'gradientBackground' && cfg.preset !== undefined) {
|
|
327
|
-
if (!this.isString(cfg.preset) || !VALID_GRADIENT_PRESETS.has(cfg.preset)) {
|
|
328
|
-
this.err(
|
|
329
|
-
`${path}.config.preset`,
|
|
330
|
-
`expected one of: ${Array.from(VALID_GRADIENT_PRESETS).join(', ')}`,
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
if (v.template === 'gradientBackground' && 'gradient' in cfg) {
|
|
335
|
-
this.err(
|
|
336
|
-
`${path}.config.gradient`,
|
|
337
|
-
'raw CSS gradient strings are not allowed in Theme JSON; use a `preset`',
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
if (v.template === 'patternBackground') {
|
|
341
|
-
const patterns = ['dots', 'grid', 'diagonal', 'noise'];
|
|
342
|
-
if (!this.isString(cfg.pattern) || !patterns.includes(cfg.pattern)) {
|
|
343
|
-
this.err(`${path}.config.pattern`, `expected one of ${patterns.join('|')}`);
|
|
344
|
-
}
|
|
345
|
-
for (const k of ['opacity', 'scale']) {
|
|
346
|
-
if (cfg[k] !== undefined && !this.isNumber(cfg[k])) {
|
|
347
|
-
this.err(`${path}.config.${k}`, 'expected number');
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
if (cfg.color !== undefined) this.hex(`${path}.config.color`, cfg.color);
|
|
351
|
-
}
|
|
352
|
-
if (v.template === 'vignette') {
|
|
353
|
-
if (cfg.strength !== undefined && !this.isNumber(cfg.strength)) {
|
|
354
|
-
this.err(`${path}.config.strength`, 'expected number (0..1)');
|
|
355
|
-
}
|
|
356
|
-
if (cfg.color !== undefined) this.hex(`${path}.config.color`, cfg.color);
|
|
357
|
-
}
|
|
358
|
-
if (v.template === 'ambientGradient') {
|
|
359
|
-
if (cfg.duration !== undefined && !this.isNumber(cfg.duration)) {
|
|
360
|
-
this.err(`${path}.config.duration`, 'expected number (seconds)');
|
|
361
|
-
}
|
|
362
|
-
for (const k of ['from', 'to']) {
|
|
363
|
-
if (cfg[k] !== undefined) this.hex(`${path}.config.${k}`, cfg[k]);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
// Raw Layer form is permissive — no schema check here
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
persistentLayers(path: string, v: unknown): void {
|
|
371
|
-
if (!this.isObject(v)) {
|
|
372
|
-
this.err(path, 'expected object');
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
for (const side of ['bottomLayers', 'topLayers']) {
|
|
376
|
-
const arr = v[side];
|
|
377
|
-
if (arr === undefined) continue;
|
|
378
|
-
if (!Array.isArray(arr)) {
|
|
379
|
-
this.err(`${path}.${side}`, 'expected array');
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
arr.forEach((entry, i) => this.persistentLayer(`${path}.${side}[${i}]`, entry));
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
scalarHints(path: string, v: unknown): void {
|
|
387
|
-
if (!this.isObject(v)) {
|
|
388
|
-
this.err(path, 'expected object');
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
for (const key of Object.keys(v)) {
|
|
392
|
-
const t = typeof v[key];
|
|
393
|
-
if (t !== 'string' && t !== 'number' && t !== 'boolean') {
|
|
394
|
-
this.err(`${path}.${key}`, `expected string|number|boolean, got ${t}`);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
pageSectionOverride(path: string, v: unknown): void {
|
|
400
|
-
if (!this.isObject(v)) {
|
|
401
|
-
this.err(path, 'expected object');
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
if (v.kind !== undefined && (!this.isString(v.kind) || !VALID_SECTION_KINDS.has(v.kind))) {
|
|
405
|
-
this.err(`${path}.kind`, `expected one of: ${PAGE_SECTION_KINDS.join(', ')}`);
|
|
406
|
-
}
|
|
407
|
-
if (v.variant !== undefined && !this.isString(v.variant)) {
|
|
408
|
-
this.err(`${path}.variant`, 'expected string');
|
|
409
|
-
}
|
|
410
|
-
if (
|
|
411
|
-
v.emphasis !== undefined &&
|
|
412
|
-
(!this.isString(v.emphasis) || !VALID_PAGE_EMPHASES.has(v.emphasis))
|
|
413
|
-
) {
|
|
414
|
-
this.err(`${path}.emphasis`, `expected one of: ${PAGE_EMPHASES.join(', ')}`);
|
|
415
|
-
}
|
|
416
|
-
if (
|
|
417
|
-
v.background !== undefined &&
|
|
418
|
-
(!this.isString(v.background) || !VALID_PAGE_BACKGROUNDS.has(v.background))
|
|
419
|
-
) {
|
|
420
|
-
this.err(`${path}.background`, `expected one of: ${PAGE_BACKGROUNDS.join(', ')}`);
|
|
421
|
-
}
|
|
422
|
-
if (v.hints !== undefined) this.scalarHints(`${path}.hints`, v.hints);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
pageTokens(path: string, v: unknown): void {
|
|
426
|
-
if (!this.isObject(v)) {
|
|
427
|
-
this.err(path, 'expected object');
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
for (const k of ['contentMaxWidth', 'wideMaxWidth', 'cornerRadius']) {
|
|
431
|
-
if (!this.isNumber(v[k])) {
|
|
432
|
-
this.err(`${path}.${k}`, 'expected number');
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
for (const [k, values] of Object.entries(PAGE_TOKEN_ENUMS)) {
|
|
436
|
-
if (!this.isString(v[k]) || !values.has(v[k] as string)) {
|
|
437
|
-
this.err(`${path}.${k}`, `expected one of: ${Array.from(values).join(', ')}`);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
if (v.pattern !== undefined) {
|
|
441
|
-
if (!this.isString(v.pattern) || !(PAGE_PATTERNS as readonly string[]).includes(v.pattern)) {
|
|
442
|
-
this.err(`${path}.pattern`, `expected one of: ${PAGE_PATTERNS.join(', ')}`);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
const ht = v.headingTreatment;
|
|
446
|
-
if (!this.isObject(ht)) {
|
|
447
|
-
this.err(`${path}.headingTreatment`, 'expected object');
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
for (const [k, spec] of Object.entries(HEADING_TREATMENT_ENUMS)) {
|
|
451
|
-
const val = ht[k];
|
|
452
|
-
if (val === undefined) {
|
|
453
|
-
if (spec.required) this.err(`${path}.headingTreatment.${k}`, 'required');
|
|
454
|
-
continue;
|
|
455
|
-
}
|
|
456
|
-
if (!this.isString(val) || !spec.values.has(val)) {
|
|
457
|
-
this.err(
|
|
458
|
-
`${path}.headingTreatment.${k}`,
|
|
459
|
-
`expected one of: ${Array.from(spec.values).join(', ')}`,
|
|
460
|
-
);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
pageStyle(path: string, v: unknown): void {
|
|
466
|
-
if (!this.isObject(v)) {
|
|
467
|
-
this.err(path, 'expected object');
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
if (!this.isString(v.family) || !VALID_DESIGN_FAMILIES.has(v.family)) {
|
|
471
|
-
this.err(`${path}.family`, `expected one of: ${PAGE_DESIGN_FAMILIES.join(', ')}`);
|
|
472
|
-
}
|
|
473
|
-
if (v.tokens === undefined) {
|
|
474
|
-
this.err(`${path}.tokens`, 'required');
|
|
475
|
-
} else {
|
|
476
|
-
this.pageTokens(`${path}.tokens`, v.tokens);
|
|
477
|
-
}
|
|
478
|
-
if (v.sections !== undefined) {
|
|
479
|
-
if (!this.isObject(v.sections)) {
|
|
480
|
-
this.err(`${path}.sections`, 'expected object map');
|
|
481
|
-
} else {
|
|
482
|
-
for (const key of Object.keys(v.sections)) {
|
|
483
|
-
if (!VALID_SECTION_KINDS.has(key)) {
|
|
484
|
-
this.err(`${path}.sections.${key}`, `unknown section kind`);
|
|
485
|
-
continue;
|
|
486
|
-
}
|
|
487
|
-
this.pageSectionOverride(`${path}.sections.${key}`, v.sections[key]);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
if (v.templates !== undefined) {
|
|
492
|
-
if (!this.isObject(v.templates)) {
|
|
493
|
-
this.err(`${path}.templates`, 'expected object map');
|
|
494
|
-
} else {
|
|
495
|
-
for (const key of Object.keys(v.templates)) {
|
|
496
|
-
this.pageSectionOverride(`${path}.templates.${key}`, v.templates[key]);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
if (v.accentRotation === undefined) {
|
|
501
|
-
this.err(`${path}.accentRotation`, 'required');
|
|
502
|
-
} else if (!this.isObject(v.accentRotation)) {
|
|
503
|
-
this.err(`${path}.accentRotation`, 'expected object');
|
|
504
|
-
} else {
|
|
505
|
-
const rotation = v.accentRotation;
|
|
506
|
-
if (!this.isString(rotation.strategy) || !VALID_ACCENT_STRATEGIES.has(rotation.strategy)) {
|
|
507
|
-
this.err(
|
|
508
|
-
`${path}.accentRotation.strategy`,
|
|
509
|
-
`expected one of: ${PAGE_ACCENT_STRATEGIES.join(', ')}`,
|
|
510
|
-
);
|
|
511
|
-
}
|
|
512
|
-
if (rotation.schemes !== undefined) {
|
|
513
|
-
if (
|
|
514
|
-
!Array.isArray(rotation.schemes) ||
|
|
515
|
-
rotation.schemes.some((s) => typeof s !== 'string')
|
|
516
|
-
) {
|
|
517
|
-
this.err(`${path}.accentRotation.schemes`, 'expected array of strings');
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
export function validateTheme(input: unknown): ValidationResult {
|
|
525
|
-
const v = new V();
|
|
526
|
-
if (!v.isObject(input)) {
|
|
527
|
-
return { valid: false, errors: [{ path: '', message: 'expected object' }] };
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
if (input.schemaVersion !== THEME_SCHEMA_VERSION) {
|
|
531
|
-
v.err(
|
|
532
|
-
'schemaVersion',
|
|
533
|
-
`expected "${THEME_SCHEMA_VERSION}", got "${String(input.schemaVersion)}"`,
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
if (!v.isString(input.id) || input.id.length === 0) {
|
|
537
|
-
v.err('id', 'expected non-empty string');
|
|
538
|
-
}
|
|
539
|
-
if (!v.isString(input.name) || input.name.length === 0) {
|
|
540
|
-
v.err('name', 'expected non-empty string');
|
|
541
|
-
}
|
|
542
|
-
if (input.description !== undefined && !v.isString(input.description)) {
|
|
543
|
-
v.err('description', 'expected string');
|
|
544
|
-
}
|
|
545
|
-
if (input.basedOn !== undefined && !v.isString(input.basedOn)) {
|
|
546
|
-
v.err('basedOn', 'expected string');
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
if (input.seedColors !== undefined) v.seedColors('seedColors', input.seedColors);
|
|
550
|
-
|
|
551
|
-
if (input.colors === undefined) {
|
|
552
|
-
v.err('colors', 'required');
|
|
553
|
-
} else {
|
|
554
|
-
v.palette('colors', input.colors);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
if (input.typography === undefined) {
|
|
558
|
-
v.err('typography', 'required');
|
|
559
|
-
} else {
|
|
560
|
-
v.typography('typography', input.typography);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
if (input.style === undefined) {
|
|
564
|
-
v.err('style', 'required');
|
|
565
|
-
} else {
|
|
566
|
-
v.style('style', input.style);
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
if (input.renderStyle === undefined) {
|
|
570
|
-
v.err('renderStyle', 'required');
|
|
571
|
-
} else {
|
|
572
|
-
v.renderStyle('renderStyle', input.renderStyle);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
if (input.colorSchemes === undefined) {
|
|
576
|
-
v.err('colorSchemes', 'required');
|
|
577
|
-
} else {
|
|
578
|
-
v.colorSchemes('colorSchemes', input.colorSchemes);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
if (input.persistentLayers !== undefined) {
|
|
582
|
-
v.persistentLayers('persistentLayers', input.persistentLayers);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
if (input.pageStyle !== undefined) {
|
|
586
|
-
v.pageStyle('pageStyle', input.pageStyle);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
if (v.errors.length === 0) {
|
|
590
|
-
return { valid: true, errors: [], theme: input as unknown as Theme };
|
|
591
|
-
}
|
|
592
|
-
return { valid: false, errors: v.errors };
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
/** Throws on invalid input. Useful at module init for built-in themes. */
|
|
596
|
-
export function assertTheme(input: unknown, source = 'theme'): Theme {
|
|
597
|
-
const result = validateTheme(input);
|
|
598
|
-
if (!result.valid || !result.theme) {
|
|
599
|
-
const summary = result.errors
|
|
600
|
-
.slice(0, 5)
|
|
601
|
-
.map((e) => ` ${e.path || '<root>'}: ${e.message}`)
|
|
602
|
-
.join('\n');
|
|
603
|
-
const more = result.errors.length > 5 ? `\n ... and ${result.errors.length - 5} more` : '';
|
|
604
|
-
throw new Error(`Invalid ${source}:\n${summary}${more}`);
|
|
605
|
-
}
|
|
606
|
-
return result.theme;
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
// (Theme types are re-exported from `./Theme.js` via the schemas barrel.)
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": "1",
|
|
3
|
-
"id": "bold",
|
|
4
|
-
"name": "Bold",
|
|
5
|
-
"description": "High-contrast black with vivid accents and dramatic animations.",
|
|
6
|
-
"colors": {
|
|
7
|
-
"primary": "#e53e3e",
|
|
8
|
-
"secondary": "#ed8936",
|
|
9
|
-
"background": "#000000",
|
|
10
|
-
"backgroundLight": "#1a1a1a",
|
|
11
|
-
"text": "#ffffff",
|
|
12
|
-
"textMuted": "#cbd5e0",
|
|
13
|
-
"highlight": "#f6e05e",
|
|
14
|
-
"warning": "#fc8181"
|
|
15
|
-
},
|
|
16
|
-
"typography": {
|
|
17
|
-
"bodyFont": { "stackId": "roboto" },
|
|
18
|
-
"titleFont": { "stackId": "oswald" },
|
|
19
|
-
"titleWeight": "bold",
|
|
20
|
-
"titleScale": 1.15,
|
|
21
|
-
"bodyScale": 1.0,
|
|
22
|
-
"titleLineHeight": 1.1
|
|
23
|
-
},
|
|
24
|
-
"style": {
|
|
25
|
-
"textShadow": true,
|
|
26
|
-
"overlayOpacity": 0.6,
|
|
27
|
-
"animationSpeed": 0.8
|
|
28
|
-
},
|
|
29
|
-
"renderStyle": {
|
|
30
|
-
"name": "bold",
|
|
31
|
-
"defaultTextAnimation": "zoomIn",
|
|
32
|
-
"defaultImageAnimation": "slowZoom",
|
|
33
|
-
"ambientMotion": true,
|
|
34
|
-
"defaultTransition": { "type": "dissolve", "duration": 0.5 },
|
|
35
|
-
"templateHints": {
|
|
36
|
-
"statHighlight": { "entrance": "dramatic" },
|
|
37
|
-
"fullBleedQuote": { "entrance": "dramatic" }
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"colorSchemes": {
|
|
41
|
-
"blue": { "bg": "#1a202c", "text": "#63b3ed", "accent": "#90cdf4" },
|
|
42
|
-
"green": { "bg": "#1a202c", "text": "#48bb78", "accent": "#68d391" },
|
|
43
|
-
"purple": { "bg": "#1a202c", "text": "#b794f4", "accent": "#d6bcfa" },
|
|
44
|
-
"red": { "bg": "#1a202c", "text": "#fc8181", "accent": "#feb2b2" },
|
|
45
|
-
"orange": { "bg": "#1a202c", "text": "#f6ad55", "accent": "#fbd38d" },
|
|
46
|
-
"teal": { "bg": "#1a202c", "text": "#4fd1c5", "accent": "#81e6d9" }
|
|
47
|
-
},
|
|
48
|
-
"pageStyle": {
|
|
49
|
-
"family": "brutalist",
|
|
50
|
-
"tokens": {
|
|
51
|
-
"contentMaxWidth": 760,
|
|
52
|
-
"wideMaxWidth": 1200,
|
|
53
|
-
"sectionSpacing": "compact",
|
|
54
|
-
"cornerRadius": 0,
|
|
55
|
-
"divider": "thick-rule",
|
|
56
|
-
"backgroundRhythm": "accent-bands",
|
|
57
|
-
"heroStyle": "oversized-type",
|
|
58
|
-
"headingTreatment": {
|
|
59
|
-
"eyebrow": "kicker",
|
|
60
|
-
"scale": "oversized",
|
|
61
|
-
"case": "uppercase"
|
|
62
|
-
},
|
|
63
|
-
"imageFraming": "bordered",
|
|
64
|
-
"shadow": "heavy",
|
|
65
|
-
"quoteMark": "none",
|
|
66
|
-
"numeralStyle": "oversized"
|
|
67
|
-
},
|
|
68
|
-
"sections": {
|
|
69
|
-
"quote-band": {
|
|
70
|
-
"background": "accent"
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"accentRotation": {
|
|
74
|
-
"strategy": "cycle"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|