@bendyline/squisq 1.2.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Doc-BfBhiCNr.d.ts → Doc-BeSeH2iX.d.ts} +141 -33
- package/dist/ImageEditDoc-BTIvw0oq.d.ts +84 -0
- package/dist/__tests__/colorUtils.test.d.ts +2 -0
- package/dist/__tests__/colorUtils.test.d.ts.map +1 -0
- package/dist/__tests__/colorUtils.test.js +94 -0
- package/dist/__tests__/colorUtils.test.js.map +1 -0
- package/dist/__tests__/getLayers.test.js +31 -7
- package/dist/__tests__/getLayers.test.js.map +1 -1
- package/dist/__tests__/iconResolve.test.d.ts +2 -0
- package/dist/__tests__/iconResolve.test.d.ts.map +1 -0
- package/dist/__tests__/iconResolve.test.js +99 -0
- package/dist/__tests__/iconResolve.test.js.map +1 -0
- package/dist/__tests__/imageEditState.test.d.ts +2 -0
- package/dist/__tests__/imageEditState.test.d.ts.map +1 -0
- package/dist/__tests__/imageEditState.test.js +61 -0
- package/dist/__tests__/imageEditState.test.js.map +1 -0
- package/dist/__tests__/imageEditVersions.test.d.ts +2 -0
- package/dist/__tests__/imageEditVersions.test.d.ts.map +1 -0
- package/dist/__tests__/imageEditVersions.test.js +141 -0
- package/dist/__tests__/imageEditVersions.test.js.map +1 -0
- package/dist/__tests__/inferDocumentTitle.test.d.ts +2 -0
- package/dist/__tests__/inferDocumentTitle.test.d.ts.map +1 -0
- package/dist/__tests__/inferDocumentTitle.test.js +42 -0
- package/dist/__tests__/inferDocumentTitle.test.js.map +1 -0
- package/dist/__tests__/jsonForm.chooseControl.test.d.ts +2 -0
- package/dist/__tests__/jsonForm.chooseControl.test.d.ts.map +1 -0
- package/dist/__tests__/jsonForm.chooseControl.test.js +74 -0
- package/dist/__tests__/jsonForm.chooseControl.test.js.map +1 -0
- package/dist/__tests__/jsonForm.evaluateWhen.test.d.ts +2 -0
- package/dist/__tests__/jsonForm.evaluateWhen.test.d.ts.map +1 -0
- package/dist/__tests__/jsonForm.evaluateWhen.test.js +51 -0
- package/dist/__tests__/jsonForm.evaluateWhen.test.js.map +1 -0
- package/dist/__tests__/jsonForm.inferSchema.test.d.ts +2 -0
- package/dist/__tests__/jsonForm.inferSchema.test.d.ts.map +1 -0
- package/dist/__tests__/jsonForm.inferSchema.test.js +23 -0
- package/dist/__tests__/jsonForm.inferSchema.test.js.map +1 -0
- package/dist/__tests__/jsonForm.pointer.test.d.ts +2 -0
- package/dist/__tests__/jsonForm.pointer.test.d.ts.map +1 -0
- package/dist/__tests__/jsonForm.pointer.test.js +94 -0
- package/dist/__tests__/jsonForm.pointer.test.js.map +1 -0
- package/dist/__tests__/markdown.test.js +40 -0
- package/dist/__tests__/markdown.test.js.map +1 -1
- package/dist/__tests__/markdownIcons.test.d.ts +2 -0
- package/dist/__tests__/markdownIcons.test.d.ts.map +1 -0
- package/dist/__tests__/markdownIcons.test.js +93 -0
- package/dist/__tests__/markdownIcons.test.js.map +1 -0
- package/dist/__tests__/markdownToDoc.test.js +15 -4
- package/dist/__tests__/markdownToDoc.test.js.map +1 -1
- package/dist/__tests__/recommendTemplates.test.d.ts +2 -0
- package/dist/__tests__/recommendTemplates.test.d.ts.map +1 -0
- package/dist/__tests__/recommendTemplates.test.js +158 -0
- package/dist/__tests__/recommendTemplates.test.js.map +1 -0
- package/dist/__tests__/scopedContentContainer.test.d.ts +2 -0
- package/dist/__tests__/scopedContentContainer.test.d.ts.map +1 -0
- package/dist/__tests__/scopedContentContainer.test.js +74 -0
- package/dist/__tests__/scopedContentContainer.test.js.map +1 -0
- package/dist/__tests__/slideshowGenerator.test.js +1 -1
- package/dist/__tests__/slideshowGenerator.test.js.map +1 -1
- package/dist/__tests__/surface.test.d.ts +2 -0
- package/dist/__tests__/surface.test.d.ts.map +1 -0
- package/dist/__tests__/surface.test.js +57 -0
- package/dist/__tests__/surface.test.js.map +1 -0
- package/dist/__tests__/templateAnnotationParse.test.d.ts +2 -0
- package/dist/__tests__/templateAnnotationParse.test.d.ts.map +1 -0
- package/dist/__tests__/templateAnnotationParse.test.js +42 -0
- package/dist/__tests__/templateAnnotationParse.test.js.map +1 -0
- package/dist/__tests__/templates.test.js +90 -9
- package/dist/__tests__/templates.test.js.map +1 -1
- package/dist/__tests__/themeCompile.test.d.ts +2 -0
- package/dist/__tests__/themeCompile.test.d.ts.map +1 -0
- package/dist/__tests__/themeCompile.test.js +134 -0
- package/dist/__tests__/themeCompile.test.js.map +1 -0
- package/dist/__tests__/themeValidator.test.d.ts +2 -0
- package/dist/__tests__/themeValidator.test.d.ts.map +1 -0
- package/dist/__tests__/themeValidator.test.js +107 -0
- package/dist/__tests__/themeValidator.test.js.map +1 -0
- package/dist/__tests__/versions.test.d.ts +2 -0
- package/dist/__tests__/versions.test.d.ts.map +1 -0
- package/dist/__tests__/versions.test.js +339 -0
- package/dist/__tests__/versions.test.js.map +1 -0
- package/dist/{chunk-CYQHG27J.js → chunk-2TMAWB4Y.js} +74 -1
- package/dist/chunk-2TMAWB4Y.js.map +1 -0
- package/dist/{chunk-LAZELBON.js → chunk-3K5OG6KI.js} +165 -17
- package/dist/chunk-3K5OG6KI.js.map +1 -0
- package/dist/chunk-57CVQCFX.js +193 -0
- package/dist/chunk-57CVQCFX.js.map +1 -0
- package/dist/{chunk-QM5PKNPW.js → chunk-5WFRKURX.js} +1 -1
- package/dist/chunk-5WFRKURX.js.map +1 -0
- package/dist/chunk-B4EEON3N.js +1317 -0
- package/dist/chunk-B4EEON3N.js.map +1 -0
- package/dist/chunk-DBS6RIFL.js +81 -0
- package/dist/chunk-DBS6RIFL.js.map +1 -0
- package/dist/{chunk-MIBRIRGJ.js → chunk-FR2RBTKO.js} +3 -3
- package/dist/{chunk-MIBRIRGJ.js.map → chunk-FR2RBTKO.js.map} +1 -1
- package/dist/chunk-H3AXU4MJ.js +179 -0
- package/dist/chunk-H3AXU4MJ.js.map +1 -0
- package/dist/chunk-JELIRVDP.js +24 -0
- package/dist/chunk-JELIRVDP.js.map +1 -0
- package/dist/chunk-K32VJONL.js +193 -0
- package/dist/chunk-K32VJONL.js.map +1 -0
- package/dist/{chunk-GAQLMORN.js → chunk-KSWJR66U.js} +248 -44
- package/dist/chunk-KSWJR66U.js.map +1 -0
- package/dist/{chunk-TSG2OSE6.js → chunk-MYIH7FWD.js} +3 -3
- package/dist/chunk-MYIH7FWD.js.map +1 -0
- package/dist/chunk-VLJJHDAC.js +218 -0
- package/dist/chunk-VLJJHDAC.js.map +1 -0
- package/dist/chunk-WMOI7FN3.js +182 -0
- package/dist/chunk-WMOI7FN3.js.map +1 -0
- package/dist/chunk-ZTX4PFFT.js +520 -0
- package/dist/chunk-ZTX4PFFT.js.map +1 -0
- package/dist/doc/audioMapping.d.ts.map +1 -1
- package/dist/doc/audioMapping.js +80 -9
- package/dist/doc/audioMapping.js.map +1 -1
- package/dist/doc/getLayers.d.ts.map +1 -1
- package/dist/doc/getLayers.js +29 -18
- package/dist/doc/getLayers.js.map +1 -1
- package/dist/doc/markdownToDoc.d.ts.map +1 -1
- package/dist/doc/markdownToDoc.js +40 -6
- package/dist/doc/markdownToDoc.js.map +1 -1
- package/dist/doc/templates/featureBlock.d.ts +18 -0
- package/dist/doc/templates/featureBlock.d.ts.map +1 -0
- package/dist/doc/templates/featureBlock.js +180 -0
- package/dist/doc/templates/featureBlock.js.map +1 -0
- package/dist/doc/templates/fullBleedQuote.d.ts +12 -0
- package/dist/doc/templates/fullBleedQuote.d.ts.map +1 -1
- package/dist/doc/templates/fullBleedQuote.js +12 -0
- package/dist/doc/templates/fullBleedQuote.js.map +1 -1
- package/dist/doc/templates/index.d.ts +28 -4
- package/dist/doc/templates/index.d.ts.map +1 -1
- package/dist/doc/templates/index.js +45 -12
- package/dist/doc/templates/index.js.map +1 -1
- package/dist/doc/templates/listBlock.d.ts.map +1 -1
- package/dist/doc/templates/listBlock.js +22 -5
- package/dist/doc/templates/listBlock.js.map +1 -1
- package/dist/doc/templates/statHighlight.d.ts +12 -0
- package/dist/doc/templates/statHighlight.d.ts.map +1 -1
- package/dist/doc/templates/statHighlight.js +12 -0
- package/dist/doc/templates/statHighlight.js.map +1 -1
- package/dist/doc/templates/titleBlock.d.ts +11 -0
- package/dist/doc/templates/titleBlock.d.ts.map +1 -1
- package/dist/doc/templates/titleBlock.js +8 -0
- package/dist/doc/templates/titleBlock.js.map +1 -1
- package/dist/doc/utils/themeUtils.d.ts +4 -4
- package/dist/doc/utils/themeUtils.d.ts.map +1 -1
- package/dist/doc/utils/themeUtils.js +8 -7
- package/dist/doc/utils/themeUtils.js.map +1 -1
- package/dist/generate/slideshowGenerator.js +1 -1
- package/dist/generate/slideshowGenerator.js.map +1 -1
- package/dist/generate/templateMapper.js +2 -2
- package/dist/generate/templateMapper.js.map +1 -1
- package/dist/icons/iconData.d.ts +26 -0
- package/dist/icons/iconData.d.ts.map +1 -0
- package/dist/icons/iconData.js +12 -0
- package/dist/icons/iconData.js.map +1 -0
- package/dist/icons/index.d.ts +12 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +10 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/icons/resolve.d.ts +61 -0
- package/dist/icons/resolve.d.ts.map +1 -0
- package/dist/icons/resolve.js +130 -0
- package/dist/icons/resolve.js.map +1 -0
- package/dist/imageEdit/ImageEditVersionManager.d.ts +31 -0
- package/dist/imageEdit/ImageEditVersionManager.d.ts.map +1 -0
- package/dist/imageEdit/ImageEditVersionManager.js +39 -0
- package/dist/imageEdit/ImageEditVersionManager.js.map +1 -0
- package/dist/imageEdit/export.d.ts +33 -0
- package/dist/imageEdit/export.d.ts.map +1 -0
- package/dist/imageEdit/export.js +253 -0
- package/dist/imageEdit/export.js.map +1 -0
- package/dist/imageEdit/index.d.ts +14 -0
- package/dist/imageEdit/index.d.ts.map +1 -0
- package/dist/imageEdit/index.js +22 -0
- package/dist/imageEdit/index.js.map +1 -0
- package/dist/imageEdit/persistence.d.ts +15 -0
- package/dist/imageEdit/persistence.d.ts.map +1 -0
- package/dist/imageEdit/persistence.js +49 -0
- package/dist/imageEdit/persistence.js.map +1 -0
- package/dist/imageEdit/state.d.ts +42 -0
- package/dist/imageEdit/state.d.ts.map +1 -0
- package/dist/imageEdit/state.js +98 -0
- package/dist/imageEdit/state.js.map +1 -0
- package/dist/imageEdit/versionPaths.d.ts +27 -0
- package/dist/imageEdit/versionPaths.d.ts.map +1 -0
- package/dist/imageEdit/versionPaths.js +57 -0
- package/dist/imageEdit/versionPaths.js.map +1 -0
- package/dist/imageEdit/versions.d.ts +67 -0
- package/dist/imageEdit/versions.d.ts.map +1 -0
- package/dist/imageEdit/versions.js +161 -0
- package/dist/imageEdit/versions.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/jsonForm/chooseControl.d.ts +20 -0
- package/dist/jsonForm/chooseControl.d.ts.map +1 -0
- package/dist/jsonForm/chooseControl.js +82 -0
- package/dist/jsonForm/chooseControl.js.map +1 -0
- package/dist/jsonForm/evaluateWhen.d.ts +12 -0
- package/dist/jsonForm/evaluateWhen.d.ts.map +1 -0
- package/dist/jsonForm/evaluateWhen.js +65 -0
- package/dist/jsonForm/evaluateWhen.js.map +1 -0
- package/dist/jsonForm/index.d.ts +14 -0
- package/dist/jsonForm/index.d.ts.map +1 -0
- package/dist/jsonForm/index.js +12 -0
- package/dist/jsonForm/index.js.map +1 -0
- package/dist/jsonForm/inferSchema.d.ts +12 -0
- package/dist/jsonForm/inferSchema.d.ts.map +1 -0
- package/dist/jsonForm/inferSchema.js +15 -0
- package/dist/jsonForm/inferSchema.js.map +1 -0
- package/dist/jsonForm/pointer.d.ts +26 -0
- package/dist/jsonForm/pointer.d.ts.map +1 -0
- package/dist/jsonForm/pointer.js +102 -0
- package/dist/jsonForm/pointer.js.map +1 -0
- package/dist/jsonForm/types.d.ts +120 -0
- package/dist/jsonForm/types.d.ts.map +1 -0
- package/dist/jsonForm/types.js +10 -0
- package/dist/jsonForm/types.js.map +1 -0
- package/dist/markdown/convert.d.ts +11 -1
- package/dist/markdown/convert.d.ts.map +1 -1
- package/dist/markdown/convert.js +235 -15
- package/dist/markdown/convert.js.map +1 -1
- package/dist/markdown/index.d.ts +2 -2
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/markdown/index.js +1 -1
- package/dist/markdown/index.js.map +1 -1
- package/dist/markdown/types.d.ts +34 -1
- package/dist/markdown/types.d.ts.map +1 -1
- package/dist/markdown/utils.d.ts +40 -0
- package/dist/markdown/utils.d.ts.map +1 -1
- package/dist/markdown/utils.js +155 -0
- package/dist/markdown/utils.js.map +1 -1
- package/dist/recommend/index.d.ts +16 -0
- package/dist/recommend/index.d.ts.map +1 -0
- package/dist/recommend/index.js +15 -0
- package/dist/recommend/index.js.map +1 -0
- package/dist/recommend/templates.d.ts +39 -0
- package/dist/recommend/templates.d.ts.map +1 -0
- package/dist/recommend/templates.js +235 -0
- package/dist/recommend/templates.js.map +1 -0
- package/dist/schemas/BlockTemplates.d.ts +46 -8
- package/dist/schemas/BlockTemplates.d.ts.map +1 -1
- package/dist/schemas/BlockTemplates.js +3 -3
- package/dist/schemas/BlockTemplates.js.map +1 -1
- package/dist/schemas/ImageEditDoc.d.ts +81 -0
- package/dist/schemas/ImageEditDoc.d.ts.map +1 -0
- package/dist/schemas/ImageEditDoc.js +20 -0
- package/dist/schemas/ImageEditDoc.js.map +1 -0
- package/dist/schemas/Theme.d.ts +93 -23
- package/dist/schemas/Theme.d.ts.map +1 -1
- package/dist/schemas/Theme.js +80 -13
- package/dist/schemas/Theme.js.map +1 -1
- package/dist/schemas/colorUtils.d.ts +51 -0
- package/dist/schemas/colorUtils.d.ts.map +1 -0
- package/dist/schemas/colorUtils.js +154 -0
- package/dist/schemas/colorUtils.js.map +1 -0
- package/dist/schemas/fontStacks.d.ts +57 -0
- package/dist/schemas/fontStacks.d.ts.map +1 -0
- package/dist/schemas/fontStacks.js +227 -0
- package/dist/schemas/fontStacks.js.map +1 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +4 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/themeCompile.d.ts +45 -0
- package/dist/schemas/themeCompile.d.ts.map +1 -0
- package/dist/schemas/themeCompile.js +160 -0
- package/dist/schemas/themeCompile.js.map +1 -0
- package/dist/schemas/themeLibrary.d.ts +11 -15
- package/dist/schemas/themeLibrary.d.ts.map +1 -1
- package/dist/schemas/themeLibrary.js +18 -499
- package/dist/schemas/themeLibrary.js.map +1 -1
- package/dist/schemas/themeValidator.d.ts +26 -0
- package/dist/schemas/themeValidator.d.ts.map +1 -0
- package/dist/schemas/themeValidator.js +352 -0
- package/dist/schemas/themeValidator.js.map +1 -0
- package/dist/schemas/themes/bold.json +48 -0
- package/dist/schemas/themes/cinematic.json +54 -0
- package/dist/schemas/themes/documentary.json +49 -0
- package/dist/schemas/themes/gezellig.json +44 -0
- package/dist/schemas/themes/index.d.ts +26 -0
- package/dist/schemas/themes/index.d.ts.map +1 -0
- package/dist/schemas/themes/index.js +49 -0
- package/dist/schemas/themes/index.js.map +1 -0
- package/dist/schemas/themes/magazine.json +44 -0
- package/dist/schemas/themes/minimalist.json +45 -0
- package/dist/schemas/themes/morning-light.json +42 -0
- package/dist/schemas/themes/standard-dark.json +50 -0
- package/dist/schemas/themes/standard.json +42 -0
- package/dist/schemas/themes/tech-dark.json +48 -0
- package/dist/schemas/themes/warm-earth.json +50 -0
- package/dist/storage/ScopedContentContainer.d.ts +44 -0
- package/dist/storage/ScopedContentContainer.d.ts.map +1 -0
- package/dist/storage/ScopedContentContainer.js +94 -0
- package/dist/storage/ScopedContentContainer.js.map +1 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +1 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/story/index.d.ts +53 -13
- package/dist/story/index.js +12 -4
- package/dist/themeLibrary-BHjJ0Qx6.d.ts +40 -0
- package/dist/{types-DYAzisMG.d.ts → types-BdZkdJ3z.d.ts} +35 -2
- package/dist/types-D98li1gV.d.ts +93 -0
- package/dist/versions/DocumentVersionManager.d.ts +31 -0
- package/dist/versions/DocumentVersionManager.d.ts.map +1 -0
- package/dist/versions/DocumentVersionManager.js +33 -0
- package/dist/versions/DocumentVersionManager.js.map +1 -0
- package/dist/versions/index.d.ts +29 -0
- package/dist/versions/index.d.ts.map +1 -0
- package/dist/versions/index.js +28 -0
- package/dist/versions/index.js.map +1 -0
- package/dist/versions/operations.d.ts +44 -0
- package/dist/versions/operations.d.ts.map +1 -0
- package/dist/versions/operations.js +190 -0
- package/dist/versions/operations.js.map +1 -0
- package/dist/versions/paths.d.ts +29 -0
- package/dist/versions/paths.d.ts.map +1 -0
- package/dist/versions/paths.js +66 -0
- package/dist/versions/paths.js.map +1 -0
- package/dist/versions/timestamp.d.ts +22 -0
- package/dist/versions/timestamp.d.ts.map +1 -0
- package/dist/versions/timestamp.js +44 -0
- package/dist/versions/timestamp.js.map +1 -0
- package/dist/versions/types.d.ts +92 -0
- package/dist/versions/types.d.ts.map +1 -0
- package/dist/versions/types.js +11 -0
- package/dist/versions/types.js.map +1 -0
- package/package.json +28 -1
- package/src/__tests__/colorUtils.test.ts +112 -0
- package/src/__tests__/getLayers.test.ts +32 -7
- package/src/__tests__/iconResolve.test.ts +122 -0
- package/src/__tests__/imageEditState.test.ts +74 -0
- package/src/__tests__/imageEditVersions.test.ts +169 -0
- package/src/__tests__/inferDocumentTitle.test.ts +50 -0
- package/src/__tests__/jsonForm.chooseControl.test.ts +86 -0
- package/src/__tests__/jsonForm.evaluateWhen.test.ts +59 -0
- package/src/__tests__/jsonForm.inferSchema.test.ts +25 -0
- package/src/__tests__/jsonForm.pointer.test.ts +103 -0
- package/src/__tests__/markdown.test.ts +44 -0
- package/src/__tests__/markdownIcons.test.ts +104 -0
- package/src/__tests__/markdownToDoc.test.ts +19 -4
- package/src/__tests__/recommendTemplates.test.ts +183 -0
- package/src/__tests__/scopedContentContainer.test.ts +89 -0
- package/src/__tests__/slideshowGenerator.test.ts +1 -1
- package/src/__tests__/surface.test.ts +68 -0
- package/src/__tests__/templateAnnotationParse.test.ts +42 -0
- package/src/__tests__/templates.test.ts +93 -9
- package/src/__tests__/themeCompile.test.ts +156 -0
- package/src/__tests__/themeValidator.test.ts +125 -0
- package/src/__tests__/versions.test.ts +415 -0
- package/src/doc/audioMapping.ts +95 -13
- package/src/doc/getLayers.ts +32 -21
- package/src/doc/markdownToDoc.ts +45 -7
- package/src/doc/templates/featureBlock.ts +202 -0
- package/src/doc/templates/fullBleedQuote.ts +13 -0
- package/src/doc/templates/index.ts +50 -16
- package/src/doc/templates/listBlock.ts +24 -5
- package/src/doc/templates/statHighlight.ts +13 -0
- package/src/doc/templates/titleBlock.ts +9 -0
- package/src/doc/utils/themeUtils.ts +8 -7
- package/src/generate/slideshowGenerator.ts +1 -1
- package/src/generate/templateMapper.ts +2 -2
- package/src/icons/iconData.ts +31 -0
- package/src/icons/index.ts +18 -0
- package/src/icons/resolve.ts +139 -0
- package/src/imageEdit/ImageEditVersionManager.ts +73 -0
- package/src/imageEdit/export.ts +326 -0
- package/src/imageEdit/index.ts +71 -0
- package/src/imageEdit/persistence.ts +62 -0
- package/src/imageEdit/state.ts +112 -0
- package/src/imageEdit/versionPaths.ts +57 -0
- package/src/imageEdit/versions.ts +231 -0
- package/src/index.ts +4 -0
- package/src/jsonForm/chooseControl.ts +88 -0
- package/src/jsonForm/evaluateWhen.ts +59 -0
- package/src/jsonForm/index.ts +22 -0
- package/src/jsonForm/inferSchema.ts +25 -0
- package/src/jsonForm/pointer.ts +109 -0
- package/src/jsonForm/types.ts +167 -0
- package/src/markdown/convert.ts +248 -15
- package/src/markdown/index.ts +4 -0
- package/src/markdown/types.ts +38 -1
- package/src/markdown/utils.ts +159 -0
- package/src/recommend/index.ts +16 -0
- package/src/recommend/templates.ts +273 -0
- package/src/schemas/BlockTemplates.ts +50 -7
- package/src/schemas/ImageEditDoc.ts +95 -0
- package/src/schemas/Theme.ts +152 -23
- package/src/schemas/colorUtils.ts +186 -0
- package/src/schemas/fontStacks.ts +257 -0
- package/src/schemas/index.ts +12 -0
- package/src/schemas/themeCompile.ts +203 -0
- package/src/schemas/themeLibrary.ts +18 -524
- package/src/schemas/themeValidator.ts +388 -0
- package/src/schemas/themes/bold.json +48 -0
- package/src/schemas/themes/cinematic.json +54 -0
- package/src/schemas/themes/documentary.json +49 -0
- package/src/schemas/themes/gezellig.json +44 -0
- package/src/schemas/themes/index.ts +53 -0
- package/src/schemas/themes/magazine.json +44 -0
- package/src/schemas/themes/minimalist.json +45 -0
- package/src/schemas/themes/morning-light.json +42 -0
- package/src/schemas/themes/standard-dark.json +50 -0
- package/src/schemas/themes/standard.json +42 -0
- package/src/schemas/themes/tech-dark.json +48 -0
- package/src/schemas/themes/warm-earth.json +50 -0
- package/src/storage/ScopedContentContainer.ts +113 -0
- package/src/storage/index.ts +1 -0
- package/src/versions/DocumentVersionManager.ts +70 -0
- package/src/versions/index.ts +54 -0
- package/src/versions/operations.ts +230 -0
- package/src/versions/paths.ts +66 -0
- package/src/versions/timestamp.ts +48 -0
- package/src/versions/types.ts +91 -0
- package/dist/chunk-53TZ2UTL.js +0 -470
- package/dist/chunk-53TZ2UTL.js.map +0 -1
- package/dist/chunk-7GF6RDED.js +0 -82
- package/dist/chunk-7GF6RDED.js.map +0 -1
- package/dist/chunk-CYQHG27J.js.map +0 -1
- package/dist/chunk-GAQLMORN.js.map +0 -1
- package/dist/chunk-LAZELBON.js.map +0 -1
- package/dist/chunk-QM5PKNPW.js.map +0 -1
- package/dist/chunk-TSG2OSE6.js.map +0 -1
- package/dist/chunk-XM4WSOHB.js +0 -92
- package/dist/chunk-XM4WSOHB.js.map +0 -1
- package/dist/themeLibrary-IP7EdyRq.d.ts +0 -44
package/dist/story/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LAYOUT,
|
|
3
|
+
TEMPLATE_ALIASES,
|
|
3
4
|
adjustY,
|
|
4
5
|
comparisonBar,
|
|
5
6
|
countBlocks,
|
|
@@ -31,6 +32,7 @@ import {
|
|
|
31
32
|
getTransitionClass,
|
|
32
33
|
hasTemplate,
|
|
33
34
|
imageWithCaption,
|
|
35
|
+
leftFeature,
|
|
34
36
|
listBlock,
|
|
35
37
|
mapBlock,
|
|
36
38
|
markdownToDoc,
|
|
@@ -39,6 +41,8 @@ import {
|
|
|
39
41
|
quoteBlock,
|
|
40
42
|
resolveAudioMapping,
|
|
41
43
|
resolveColorScheme,
|
|
44
|
+
resolveTemplateName,
|
|
45
|
+
rightFeature,
|
|
42
46
|
scaleAnimationDuration,
|
|
43
47
|
scoreTextSimilarity,
|
|
44
48
|
sectionHeader,
|
|
@@ -50,13 +54,13 @@ import {
|
|
|
50
54
|
twoColumn,
|
|
51
55
|
videoPullQuote,
|
|
52
56
|
videoWithCaption
|
|
53
|
-
} from "../chunk-
|
|
57
|
+
} from "../chunk-KSWJR66U.js";
|
|
54
58
|
import {
|
|
55
59
|
DEFAULT_THEME,
|
|
56
60
|
getAvailableThemes,
|
|
57
61
|
getThemeSummaries,
|
|
58
62
|
resolveTheme
|
|
59
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-B4EEON3N.js";
|
|
60
64
|
import {
|
|
61
65
|
VIEWPORT_PRESETS,
|
|
62
66
|
createTemplateContext,
|
|
@@ -66,13 +70,14 @@ import {
|
|
|
66
70
|
getViewportOrientation,
|
|
67
71
|
isTemplateBlock,
|
|
68
72
|
scaledFontSize2 as scaledFontSize
|
|
69
|
-
} from "../chunk-
|
|
70
|
-
import "../chunk-
|
|
73
|
+
} from "../chunk-5WFRKURX.js";
|
|
74
|
+
import "../chunk-H3AXU4MJ.js";
|
|
71
75
|
import "../chunk-4X3JQXNM.js";
|
|
72
76
|
import "../chunk-3E5F2XMR.js";
|
|
73
77
|
export {
|
|
74
78
|
DEFAULT_LAYOUT,
|
|
75
79
|
DEFAULT_THEME,
|
|
80
|
+
TEMPLATE_ALIASES,
|
|
76
81
|
VIEWPORT_PRESETS,
|
|
77
82
|
adjustY,
|
|
78
83
|
comparisonBar,
|
|
@@ -113,6 +118,7 @@ export {
|
|
|
113
118
|
hasTemplate,
|
|
114
119
|
imageWithCaption,
|
|
115
120
|
isTemplateBlock,
|
|
121
|
+
leftFeature,
|
|
116
122
|
listBlock,
|
|
117
123
|
mapBlock,
|
|
118
124
|
markdownToDoc,
|
|
@@ -121,7 +127,9 @@ export {
|
|
|
121
127
|
quoteBlock,
|
|
122
128
|
resolveAudioMapping,
|
|
123
129
|
resolveColorScheme,
|
|
130
|
+
resolveTemplateName,
|
|
124
131
|
resolveTheme,
|
|
132
|
+
rightFeature,
|
|
125
133
|
scaleAnimationDuration,
|
|
126
134
|
scaledFontSize,
|
|
127
135
|
scoreTextSimilarity,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { af as Theme } from './Doc-BeSeH2iX.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Built-in Theme Library
|
|
5
|
+
*
|
|
6
|
+
* Public entry point for theme lookup. Built-in themes live as JSON
|
|
7
|
+
* sidecars in [./themes/](./themes/) — they share the exact same shape
|
|
8
|
+
* as customizer-authored themes (no two-tier distinction).
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { THEMES, resolveTheme } from '@bendyline/squisq/schemas';
|
|
13
|
+
*
|
|
14
|
+
* const theme = resolveTheme('minimalist'); // by id, with registry override
|
|
15
|
+
* const theme = THEMES.documentary; // direct access to a built-in
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** All built-in themes, keyed by id. */
|
|
20
|
+
declare const THEMES: Record<string, Theme>;
|
|
21
|
+
/** The default theme id. */
|
|
22
|
+
declare const DEFAULT_THEME_ID = "standard";
|
|
23
|
+
/** The default theme (standard — safe system fonts, no external dependencies). */
|
|
24
|
+
declare const DEFAULT_THEME: Theme;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a theme by id. Custom themes registered via `registerTheme()`
|
|
27
|
+
* take precedence over built-ins; otherwise built-ins are searched and
|
|
28
|
+
* the default theme is returned for unknown ids.
|
|
29
|
+
*/
|
|
30
|
+
declare function resolveTheme(id: string | undefined): Theme;
|
|
31
|
+
/** Get all built-in theme ids. */
|
|
32
|
+
declare function getAvailableThemes(): string[];
|
|
33
|
+
/** Get a summary of all built-in themes (id + name + description) for theme pickers. */
|
|
34
|
+
declare function getThemeSummaries(): Array<{
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
}>;
|
|
39
|
+
|
|
40
|
+
export { DEFAULT_THEME as D, THEMES as T, DEFAULT_THEME_ID as a, getThemeSummaries as b, getAvailableThemes as g, resolveTheme as r };
|
|
@@ -394,6 +394,21 @@ interface MarkdownInlineMath extends MarkdownNodeBase {
|
|
|
394
394
|
/** Math content (without $ delimiters) */
|
|
395
395
|
value: string;
|
|
396
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Inline FontAwesome icon. Authored as `{[name]}` (bare) or
|
|
399
|
+
* `{[fa-<family>:name]}` (qualified) in markdown source. The parser
|
|
400
|
+
* resolves the token against the FA Free catalog and emits this node;
|
|
401
|
+
* unknown / ambiguous tokens stay as literal text.
|
|
402
|
+
*/
|
|
403
|
+
interface MarkdownInlineIcon extends MarkdownNodeBase {
|
|
404
|
+
type: 'inlineIcon';
|
|
405
|
+
/** Token exactly as authored — e.g. `github` or `fa-solid:user`. */
|
|
406
|
+
token: string;
|
|
407
|
+
/** Resolved icon family. */
|
|
408
|
+
family: 'brands' | 'solid' | 'regular';
|
|
409
|
+
/** Resolved icon name (without the `fa-` prefix). */
|
|
410
|
+
name: string;
|
|
411
|
+
}
|
|
397
412
|
/**
|
|
398
413
|
* A footnote reference [^id]. GFM extension.
|
|
399
414
|
*/
|
|
@@ -444,10 +459,28 @@ interface MarkdownTextDirective extends MarkdownNodeBase {
|
|
|
444
459
|
/** Inline content from [label] */
|
|
445
460
|
children: MarkdownInlineNode[];
|
|
446
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* An @-mention of a named entity such as a user or agent.
|
|
464
|
+
*
|
|
465
|
+
* Wire format: `@[Display Name](scheme:id)` — a regular Markdown link
|
|
466
|
+
* preceded by `@`, with a namespaced URL scheme that identifies what
|
|
467
|
+
* kind of entity is being mentioned. Parsers that don't know about
|
|
468
|
+
* mentions still render it as a link with text "Display Name" pointing
|
|
469
|
+
* at "scheme:id" — graceful fallback.
|
|
470
|
+
*/
|
|
471
|
+
interface MarkdownMention extends MarkdownNodeBase {
|
|
472
|
+
type: 'mention';
|
|
473
|
+
/** Namespace for the mentioned entity (e.g. `"user"`). */
|
|
474
|
+
targetKind: string;
|
|
475
|
+
/** Stable identifier within the namespace. */
|
|
476
|
+
targetId: string;
|
|
477
|
+
/** Text shown to the reader. */
|
|
478
|
+
displayName: string;
|
|
479
|
+
}
|
|
447
480
|
/** Block-level content that can appear as direct children of the document root, blockquotes, list items, etc. */
|
|
448
481
|
type MarkdownBlockNode = MarkdownHeading | MarkdownParagraph | MarkdownBlockquote | MarkdownList | MarkdownCodeBlock | MarkdownThematicBreak | MarkdownTable | MarkdownHtmlBlock | MarkdownMathBlock | MarkdownLinkDefinition | MarkdownFootnoteDefinition | MarkdownContainerDirective | MarkdownLeafDirective | MarkdownDefinitionList;
|
|
449
482
|
/** Inline/phrasing content that appears inside paragraphs, headings, links, etc. */
|
|
450
|
-
type MarkdownInlineNode = MarkdownText | MarkdownEmphasis | MarkdownStrong | MarkdownStrikethrough | MarkdownInlineCode | MarkdownLink | MarkdownImage | MarkdownBreak | MarkdownInlineHtml | MarkdownInlineMath | MarkdownFootnoteReference | MarkdownLinkReference | MarkdownImageReference | MarkdownTextDirective;
|
|
483
|
+
type MarkdownInlineNode = MarkdownText | MarkdownEmphasis | MarkdownStrong | MarkdownStrikethrough | MarkdownInlineCode | MarkdownLink | MarkdownImage | MarkdownBreak | MarkdownInlineHtml | MarkdownInlineMath | MarkdownFootnoteReference | MarkdownLinkReference | MarkdownImageReference | MarkdownTextDirective | MarkdownMention | MarkdownInlineIcon;
|
|
451
484
|
/**
|
|
452
485
|
* Any node in the markdown tree. Includes structural nodes (listItem,
|
|
453
486
|
* tableRow, tableCell, etc.) that only appear as children of specific parents.
|
|
@@ -495,4 +528,4 @@ interface StringifyOptions {
|
|
|
495
528
|
setext?: boolean;
|
|
496
529
|
}
|
|
497
530
|
|
|
498
|
-
export type { MarkdownLinkReference as A, MarkdownList as B, MarkdownListItem as C, MarkdownMathBlock as D,
|
|
531
|
+
export type { MarkdownLinkReference as A, MarkdownList as B, MarkdownListItem as C, MarkdownMathBlock as D, MarkdownMention as E, MarkdownNode as F, MarkdownParagraph as G, HeadingTemplateAnnotation as H, MarkdownPoint as I, MarkdownSourcePosition as J, MarkdownStrikethrough as K, MarkdownStrong as L, MarkdownBlockNode as M, MarkdownTable as N, MarkdownTableCell as O, MarkdownTableRow as P, MarkdownText as Q, MarkdownTextDirective as R, MarkdownThematicBreak as S, ParseOptions as T, StringifyOptions as U, HtmlComment as a, HtmlElement as b, HtmlNode as c, HtmlText as d, MarkdownBlockquote as e, MarkdownBreak as f, MarkdownCodeBlock as g, MarkdownContainerDirective as h, MarkdownDefinitionDescription as i, MarkdownDefinitionList as j, MarkdownDefinitionTerm as k, MarkdownDocument as l, MarkdownEmphasis as m, MarkdownFootnoteDefinition as n, MarkdownFootnoteReference as o, MarkdownHeading as p, MarkdownHtmlBlock as q, MarkdownImage as r, MarkdownImageReference as s, MarkdownInlineCode as t, MarkdownInlineHtml as u, MarkdownInlineMath as v, MarkdownInlineNode as w, MarkdownLeafDirective as x, MarkdownLink as y, MarkdownLinkDefinition as z };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the document version-history feature.
|
|
3
|
+
*
|
|
4
|
+
* Versions are snapshots of the primary markdown document stored alongside
|
|
5
|
+
* the document inside the same {@link ContentContainer}. They live under
|
|
6
|
+
* `.versions/<docBasename>.<sortableTimestamp>.md`. The container is the
|
|
7
|
+
* unit of persistence — when the host serializes the container to a ZIP,
|
|
8
|
+
* a real folder, or anywhere else, the version snapshots ride along.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* A single version snapshot record.
|
|
12
|
+
*/
|
|
13
|
+
interface Version {
|
|
14
|
+
/** Container-relative path, e.g. `.versions/index.20260430T152030Z.md`. */
|
|
15
|
+
path: string;
|
|
16
|
+
/** Document basename without extension, e.g. `index`. */
|
|
17
|
+
basename: string;
|
|
18
|
+
/** Parsed timestamp from the filename, in UTC. */
|
|
19
|
+
timestamp: Date;
|
|
20
|
+
/** Snapshot size in bytes. */
|
|
21
|
+
size: number;
|
|
22
|
+
/**
|
|
23
|
+
* Collision suffix index. `0` for a path with no `-N` suffix, `1` for `-2`,
|
|
24
|
+
* `2` for `-3`, and so on. Used as the tie-break for ordering snapshots
|
|
25
|
+
* that share the same UTC second.
|
|
26
|
+
*/
|
|
27
|
+
collision: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Result of a {@link saveVersion} call.
|
|
31
|
+
*/
|
|
32
|
+
interface SaveVersionResult {
|
|
33
|
+
/** True when a new snapshot file was actually written. */
|
|
34
|
+
saved: boolean;
|
|
35
|
+
/** The newly stamped version (only when `saved` is true). */
|
|
36
|
+
version: Version | null;
|
|
37
|
+
/**
|
|
38
|
+
* Why the save behaved the way it did:
|
|
39
|
+
* - `'saved'` — a new snapshot was written.
|
|
40
|
+
* - `'unchanged'` — current content matches the latest snapshot byte-for-byte.
|
|
41
|
+
* - `'no-document'` — the container has no primary markdown document.
|
|
42
|
+
* - `'empty'` — the resolved content was empty.
|
|
43
|
+
*/
|
|
44
|
+
reason: 'saved' | 'unchanged' | 'no-document' | 'empty';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Options for {@link saveVersion}.
|
|
48
|
+
*/
|
|
49
|
+
interface SaveVersionOptions {
|
|
50
|
+
/** Override the document content; otherwise the container's primary doc is read. */
|
|
51
|
+
content?: string;
|
|
52
|
+
/** Override the timestamp; defaults to `new Date()`. Useful for tests. */
|
|
53
|
+
now?: Date;
|
|
54
|
+
/** Skip the diff-vs-latest check and force a write. */
|
|
55
|
+
force?: boolean;
|
|
56
|
+
/** Override the document basename used to build the version filename. */
|
|
57
|
+
basename?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Pruning policy passed to {@link pruneVersions}.
|
|
61
|
+
*/
|
|
62
|
+
type PrunePolicy = {
|
|
63
|
+
type: 'keep-last-n';
|
|
64
|
+
n: number;
|
|
65
|
+
} | {
|
|
66
|
+
type: 'older-than';
|
|
67
|
+
date: Date;
|
|
68
|
+
} | {
|
|
69
|
+
type: 'predicate';
|
|
70
|
+
keep: (v: Version, all: Version[]) => boolean;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Options for {@link revertToVersion}.
|
|
74
|
+
*/
|
|
75
|
+
interface RevertOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Whether to snapshot the current document content before replacing it.
|
|
78
|
+
* Defaults to `true` so a revert is always recoverable.
|
|
79
|
+
*/
|
|
80
|
+
snapshotCurrent?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Options for {@link coalesceVersions}.
|
|
84
|
+
*/
|
|
85
|
+
interface CoalesceOptions {
|
|
86
|
+
/**
|
|
87
|
+
* Two adjacent snapshots whose timestamps are within `windowMs` collapse
|
|
88
|
+
* to the newer one. Defaults to 60_000 (one minute).
|
|
89
|
+
*/
|
|
90
|
+
windowMs?: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type { CoalesceOptions as C, PrunePolicy as P, RevertOptions as R, SaveVersionOptions as S, Version as V, SaveVersionResult as a };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convenience wrapper around the version operations that captures a
|
|
3
|
+
* {@link ContentContainer} reference and an optional basename override.
|
|
4
|
+
*
|
|
5
|
+
* Hosts that prefer a stable handle (e.g. to pass into a UI component)
|
|
6
|
+
* use this; everything it does is also reachable as a free function.
|
|
7
|
+
*/
|
|
8
|
+
import type { ContentContainer } from '../storage/ContentContainer.js';
|
|
9
|
+
import type { CoalesceOptions, PrunePolicy, RevertOptions, SaveVersionOptions, SaveVersionResult, Version } from './types.js';
|
|
10
|
+
export interface DocumentVersionManagerOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Override the document basename used in version filenames. Defaults to
|
|
13
|
+
* the basename of `container.getDocumentPath()` resolved at call time.
|
|
14
|
+
*/
|
|
15
|
+
basename?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class DocumentVersionManager {
|
|
18
|
+
private readonly container;
|
|
19
|
+
private readonly basename;
|
|
20
|
+
constructor(container: ContentContainer, options?: DocumentVersionManagerOptions);
|
|
21
|
+
saveVersion(options?: SaveVersionOptions): Promise<SaveVersionResult>;
|
|
22
|
+
listVersions(): Promise<Version[]>;
|
|
23
|
+
readVersion(version: Version | string): Promise<string | null>;
|
|
24
|
+
revertToVersion(version: Version | string, options?: RevertOptions): Promise<{
|
|
25
|
+
reverted: boolean;
|
|
26
|
+
snapshotted: Version | null;
|
|
27
|
+
}>;
|
|
28
|
+
pruneVersions(policy: PrunePolicy): Promise<Version[]>;
|
|
29
|
+
coalesceVersions(options?: CoalesceOptions): Promise<Version[]>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=DocumentVersionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentVersionManager.d.ts","sourceRoot":"","sources":["../../src/versions/DocumentVersionManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AASvE,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACR,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;gBAElC,SAAS,EAAE,gBAAgB,EAAE,OAAO,GAAE,6BAAkC;IAKpF,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIzE,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAIlC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI9D,eAAe,CACb,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IAI9D,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAItD,gBAAgB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAGhE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convenience wrapper around the version operations that captures a
|
|
3
|
+
* {@link ContentContainer} reference and an optional basename override.
|
|
4
|
+
*
|
|
5
|
+
* Hosts that prefer a stable handle (e.g. to pass into a UI component)
|
|
6
|
+
* use this; everything it does is also reachable as a free function.
|
|
7
|
+
*/
|
|
8
|
+
import { coalesceVersions, listVersions, pruneVersions, readVersion, revertToVersion, saveVersion, } from './operations.js';
|
|
9
|
+
export class DocumentVersionManager {
|
|
10
|
+
constructor(container, options = {}) {
|
|
11
|
+
this.container = container;
|
|
12
|
+
this.basename = options.basename;
|
|
13
|
+
}
|
|
14
|
+
saveVersion(options = {}) {
|
|
15
|
+
return saveVersion(this.container, { basename: this.basename, ...options });
|
|
16
|
+
}
|
|
17
|
+
listVersions() {
|
|
18
|
+
return listVersions(this.container, this.basename);
|
|
19
|
+
}
|
|
20
|
+
readVersion(version) {
|
|
21
|
+
return readVersion(this.container, version);
|
|
22
|
+
}
|
|
23
|
+
revertToVersion(version, options) {
|
|
24
|
+
return revertToVersion(this.container, version, options);
|
|
25
|
+
}
|
|
26
|
+
pruneVersions(policy) {
|
|
27
|
+
return pruneVersions(this.container, policy, this.basename);
|
|
28
|
+
}
|
|
29
|
+
coalesceVersions(options) {
|
|
30
|
+
return coalesceVersions(this.container, options, this.basename);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=DocumentVersionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentVersionManager.js","sourceRoot":"","sources":["../../src/versions/DocumentVersionManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAkBzB,MAAM,OAAO,sBAAsB;IAIjC,YAAY,SAA2B,EAAE,UAAyC,EAAE;QAClF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,WAAW,CAAC,UAA8B,EAAE;QAC1C,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,YAAY;QACV,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED,WAAW,CAAC,OAAyB;QACnC,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,eAAe,CACb,OAAyB,EACzB,OAAuB;QAEvB,OAAO,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,aAAa,CAAC,MAAmB;QAC/B,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED,gBAAgB,CAAC,OAAyB;QACxC,OAAO,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document version history for Squisq.
|
|
3
|
+
*
|
|
4
|
+
* Snapshots of the primary markdown document live inside the same
|
|
5
|
+
* {@link ContentContainer} at `.versions/<basename>.<timestamp>.md`.
|
|
6
|
+
* Hosts call {@link DocumentVersionManager.saveVersion} (or the
|
|
7
|
+
* underlying {@link saveVersion}) when they want to stamp a new version;
|
|
8
|
+
* the editor's auto-save effect calls it on idle. Either way, snapshots
|
|
9
|
+
* are written only when the document differs from the latest one.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { DocumentVersionManager } from '@bendyline/squisq/versions';
|
|
14
|
+
*
|
|
15
|
+
* const versioning = new DocumentVersionManager(container);
|
|
16
|
+
* const result = await versioning.saveVersion();
|
|
17
|
+
* if (result.saved) console.log('Stamped', result.version);
|
|
18
|
+
*
|
|
19
|
+
* const history = await versioning.listVersions();
|
|
20
|
+
* await versioning.revertToVersion(history[0]);
|
|
21
|
+
* await versioning.pruneVersions({ type: 'keep-last-n', n: 50 });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type { Version, SaveVersionOptions, SaveVersionResult, PrunePolicy, RevertOptions, CoalesceOptions, } from './types.js';
|
|
25
|
+
export { saveVersion, listVersions, readVersion, revertToVersion, pruneVersions, coalesceVersions, } from './operations.js';
|
|
26
|
+
export { DocumentVersionManager, type DocumentVersionManagerOptions, } from './DocumentVersionManager.js';
|
|
27
|
+
export { formatVersionTimestamp, parseVersionTimestamp, VERSION_TIMESTAMP_PATTERN, } from './timestamp.js';
|
|
28
|
+
export { VERSIONS_PREFIX, getDocBasename, buildVersionPath, parseVersionPath } from './paths.js';
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/versions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,YAAY,EACV,OAAO,EACP,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,GACnC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document version history for Squisq.
|
|
3
|
+
*
|
|
4
|
+
* Snapshots of the primary markdown document live inside the same
|
|
5
|
+
* {@link ContentContainer} at `.versions/<basename>.<timestamp>.md`.
|
|
6
|
+
* Hosts call {@link DocumentVersionManager.saveVersion} (or the
|
|
7
|
+
* underlying {@link saveVersion}) when they want to stamp a new version;
|
|
8
|
+
* the editor's auto-save effect calls it on idle. Either way, snapshots
|
|
9
|
+
* are written only when the document differs from the latest one.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { DocumentVersionManager } from '@bendyline/squisq/versions';
|
|
14
|
+
*
|
|
15
|
+
* const versioning = new DocumentVersionManager(container);
|
|
16
|
+
* const result = await versioning.saveVersion();
|
|
17
|
+
* if (result.saved) console.log('Stamped', result.version);
|
|
18
|
+
*
|
|
19
|
+
* const history = await versioning.listVersions();
|
|
20
|
+
* await versioning.revertToVersion(history[0]);
|
|
21
|
+
* await versioning.pruneVersions({ type: 'keep-last-n', n: 50 });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export { saveVersion, listVersions, readVersion, revertToVersion, pruneVersions, coalesceVersions, } from './operations.js';
|
|
25
|
+
export { DocumentVersionManager, } from './DocumentVersionManager.js';
|
|
26
|
+
export { formatVersionTimestamp, parseVersionTimestamp, VERSION_TIMESTAMP_PATTERN, } from './timestamp.js';
|
|
27
|
+
export { VERSIONS_PREFIX, getDocBasename, buildVersionPath, parseVersionPath } from './paths.js';
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/versions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAWH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,sBAAsB,GAEvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure-ish version operations against a {@link ContentContainer}.
|
|
3
|
+
*
|
|
4
|
+
* These functions are the canonical implementation. {@link DocumentVersionManager}
|
|
5
|
+
* is a thin wrapper that captures a container reference for ergonomics.
|
|
6
|
+
*/
|
|
7
|
+
import type { ContentContainer } from '../storage/ContentContainer.js';
|
|
8
|
+
import type { CoalesceOptions, PrunePolicy, RevertOptions, SaveVersionOptions, SaveVersionResult, Version } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* List all snapshots in the container, newest-first.
|
|
11
|
+
*
|
|
12
|
+
* @param basename Optional filter: when set, only versions whose basename
|
|
13
|
+
* matches are returned.
|
|
14
|
+
*/
|
|
15
|
+
export declare function listVersions(container: ContentContainer, basename?: string): Promise<Version[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Read the markdown content of a snapshot. Returns null if the snapshot
|
|
18
|
+
* doesn't exist.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readVersion(container: ContentContainer, version: Version | string): Promise<string | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Save a new snapshot of the document if its content differs from the
|
|
23
|
+
* latest existing snapshot.
|
|
24
|
+
*/
|
|
25
|
+
export declare function saveVersion(container: ContentContainer, options?: SaveVersionOptions): Promise<SaveVersionResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Revert the document to a prior snapshot. By default, the *current*
|
|
28
|
+
* document is snapshotted first so the revert is itself recoverable.
|
|
29
|
+
*/
|
|
30
|
+
export declare function revertToVersion(container: ContentContainer, version: Version | string, options?: RevertOptions): Promise<{
|
|
31
|
+
reverted: boolean;
|
|
32
|
+
snapshotted: Version | null;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Delete snapshots that don't satisfy the policy. Returns the deleted
|
|
36
|
+
* versions in their original (newest-first) order.
|
|
37
|
+
*/
|
|
38
|
+
export declare function pruneVersions(container: ContentContainer, policy: PrunePolicy, basename?: string): Promise<Version[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Collapse adjacent snapshots that occurred close together — keeping the
|
|
41
|
+
* newer one — to keep history readable across rapid edits.
|
|
42
|
+
*/
|
|
43
|
+
export declare function coalesceVersions(container: ContentContainer, options?: CoalesceOptions, basename?: string): Promise<Version[]>;
|
|
44
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/versions/operations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACR,MAAM,YAAY,CAAC;AAsBpB;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,EAAE,CAAC,CAyBpB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,OAAO,GAAG,MAAM,GACxB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKxB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,SAAS,EAAE,gBAAgB,EAC3B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CA0C5B;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,CAAC,CAe7D;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,WAAW,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,EAAE,CAAC,CAsBpB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,gBAAgB,EAC3B,OAAO,GAAE,eAAoB,EAC7B,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,EAAE,CAAC,CAyBpB"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure-ish version operations against a {@link ContentContainer}.
|
|
3
|
+
*
|
|
4
|
+
* These functions are the canonical implementation. {@link DocumentVersionManager}
|
|
5
|
+
* is a thin wrapper that captures a container reference for ergonomics.
|
|
6
|
+
*/
|
|
7
|
+
import { buildVersionPath, getDocBasename, parseVersionPath, VERSIONS_PREFIX } from './paths.js';
|
|
8
|
+
const decoder = new TextDecoder();
|
|
9
|
+
const encoder = new TextEncoder();
|
|
10
|
+
async function resolveBasename(container, override) {
|
|
11
|
+
if (override)
|
|
12
|
+
return override;
|
|
13
|
+
const docPath = await container.getDocumentPath();
|
|
14
|
+
if (!docPath)
|
|
15
|
+
return null;
|
|
16
|
+
return getDocBasename(docPath);
|
|
17
|
+
}
|
|
18
|
+
async function resolveDocPath(container) {
|
|
19
|
+
// Default to `index.md` when the container has no document yet — matches
|
|
20
|
+
// `MemoryContentContainer.writeDocument`'s default.
|
|
21
|
+
const docPath = await container.getDocumentPath();
|
|
22
|
+
return docPath ?? 'index.md';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* List all snapshots in the container, newest-first.
|
|
26
|
+
*
|
|
27
|
+
* @param basename Optional filter: when set, only versions whose basename
|
|
28
|
+
* matches are returned.
|
|
29
|
+
*/
|
|
30
|
+
export async function listVersions(container, basename) {
|
|
31
|
+
const entries = await container.listFiles(VERSIONS_PREFIX);
|
|
32
|
+
const versions = [];
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
const parsed = parseVersionPath(entry.path);
|
|
35
|
+
if (!parsed)
|
|
36
|
+
continue;
|
|
37
|
+
if (basename !== undefined && parsed.basename !== basename)
|
|
38
|
+
continue;
|
|
39
|
+
versions.push({
|
|
40
|
+
path: entry.path,
|
|
41
|
+
basename: parsed.basename,
|
|
42
|
+
timestamp: parsed.timestamp,
|
|
43
|
+
size: entry.size,
|
|
44
|
+
collision: parsed.collision,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// Newest first. Tie-break on collision (higher = newer). Compare the
|
|
48
|
+
// numeric collision rather than the path string: lexicographically a path
|
|
49
|
+
// with no suffix sorts *after* one with `-N`, because `.` (0x2E) is
|
|
50
|
+
// greater than `-` (0x2D), which would invert the order.
|
|
51
|
+
versions.sort((a, b) => {
|
|
52
|
+
const dt = b.timestamp.getTime() - a.timestamp.getTime();
|
|
53
|
+
if (dt !== 0)
|
|
54
|
+
return dt;
|
|
55
|
+
return b.collision - a.collision;
|
|
56
|
+
});
|
|
57
|
+
return versions;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Read the markdown content of a snapshot. Returns null if the snapshot
|
|
61
|
+
* doesn't exist.
|
|
62
|
+
*/
|
|
63
|
+
export async function readVersion(container, version) {
|
|
64
|
+
const path = typeof version === 'string' ? version : version.path;
|
|
65
|
+
const data = await container.readFile(path);
|
|
66
|
+
if (!data)
|
|
67
|
+
return null;
|
|
68
|
+
return decoder.decode(data);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Save a new snapshot of the document if its content differs from the
|
|
72
|
+
* latest existing snapshot.
|
|
73
|
+
*/
|
|
74
|
+
export async function saveVersion(container, options = {}) {
|
|
75
|
+
const content = options.content ?? (await container.readDocument());
|
|
76
|
+
if (content === null || content === undefined) {
|
|
77
|
+
return { saved: false, version: null, reason: 'no-document' };
|
|
78
|
+
}
|
|
79
|
+
if (content.length === 0) {
|
|
80
|
+
return { saved: false, version: null, reason: 'empty' };
|
|
81
|
+
}
|
|
82
|
+
const basename = await resolveBasename(container, options.basename);
|
|
83
|
+
if (!basename) {
|
|
84
|
+
return { saved: false, version: null, reason: 'no-document' };
|
|
85
|
+
}
|
|
86
|
+
const versions = await listVersions(container, basename);
|
|
87
|
+
if (!options.force && versions.length > 0) {
|
|
88
|
+
const latest = versions[0];
|
|
89
|
+
const existing = await readVersion(container, latest);
|
|
90
|
+
if (existing === content) {
|
|
91
|
+
return { saved: false, version: null, reason: 'unchanged' };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const now = options.now ?? new Date();
|
|
95
|
+
let collision = 0;
|
|
96
|
+
let path = buildVersionPath(basename, now, collision);
|
|
97
|
+
while (await container.exists(path)) {
|
|
98
|
+
collision += 1;
|
|
99
|
+
path = buildVersionPath(basename, now, collision);
|
|
100
|
+
}
|
|
101
|
+
const data = encoder.encode(content);
|
|
102
|
+
await container.writeFile(path, data, 'text/markdown');
|
|
103
|
+
const version = {
|
|
104
|
+
path,
|
|
105
|
+
basename,
|
|
106
|
+
timestamp: now,
|
|
107
|
+
size: data.byteLength,
|
|
108
|
+
collision,
|
|
109
|
+
};
|
|
110
|
+
return { saved: true, version, reason: 'saved' };
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Revert the document to a prior snapshot. By default, the *current*
|
|
114
|
+
* document is snapshotted first so the revert is itself recoverable.
|
|
115
|
+
*/
|
|
116
|
+
export async function revertToVersion(container, version, options = {}) {
|
|
117
|
+
const content = await readVersion(container, version);
|
|
118
|
+
if (content === null) {
|
|
119
|
+
return { reverted: false, snapshotted: null };
|
|
120
|
+
}
|
|
121
|
+
let snapshotted = null;
|
|
122
|
+
if (options.snapshotCurrent !== false) {
|
|
123
|
+
const result = await saveVersion(container);
|
|
124
|
+
snapshotted = result.version;
|
|
125
|
+
}
|
|
126
|
+
const docPath = await resolveDocPath(container);
|
|
127
|
+
await container.writeDocument(content, docPath);
|
|
128
|
+
return { reverted: true, snapshotted };
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Delete snapshots that don't satisfy the policy. Returns the deleted
|
|
132
|
+
* versions in their original (newest-first) order.
|
|
133
|
+
*/
|
|
134
|
+
export async function pruneVersions(container, policy, basename) {
|
|
135
|
+
const versions = await listVersions(container, basename);
|
|
136
|
+
const toDelete = [];
|
|
137
|
+
if (policy.type === 'keep-last-n') {
|
|
138
|
+
const n = Math.max(0, Math.floor(policy.n));
|
|
139
|
+
toDelete.push(...versions.slice(n));
|
|
140
|
+
}
|
|
141
|
+
else if (policy.type === 'older-than') {
|
|
142
|
+
const cutoff = policy.date.getTime();
|
|
143
|
+
for (const v of versions) {
|
|
144
|
+
if (v.timestamp.getTime() < cutoff)
|
|
145
|
+
toDelete.push(v);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
for (const v of versions) {
|
|
150
|
+
if (!policy.keep(v, versions))
|
|
151
|
+
toDelete.push(v);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
for (const v of toDelete) {
|
|
155
|
+
await container.removeFile(v.path);
|
|
156
|
+
}
|
|
157
|
+
return toDelete;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Collapse adjacent snapshots that occurred close together — keeping the
|
|
161
|
+
* newer one — to keep history readable across rapid edits.
|
|
162
|
+
*/
|
|
163
|
+
export async function coalesceVersions(container, options = {}, basename) {
|
|
164
|
+
const windowMs = options.windowMs ?? 60000;
|
|
165
|
+
const versions = await listVersions(container, basename);
|
|
166
|
+
const toDelete = [];
|
|
167
|
+
// Walk newest -> oldest, anchored to the last *kept* snapshot. Any
|
|
168
|
+
// candidate within `windowMs` of the anchor is dropped; the first one
|
|
169
|
+
// outside the window becomes the new anchor. Comparing each pair against
|
|
170
|
+
// its previous neighbor instead would chain through deleted snapshots
|
|
171
|
+
// and over-prune any tightly-clustered run (e.g. 30s apart with a 60s
|
|
172
|
+
// window collapses to a single survivor).
|
|
173
|
+
if (versions.length > 0) {
|
|
174
|
+
let anchor = versions[0];
|
|
175
|
+
for (let i = 1; i < versions.length; i++) {
|
|
176
|
+
const candidate = versions[i];
|
|
177
|
+
if (anchor.timestamp.getTime() - candidate.timestamp.getTime() <= windowMs) {
|
|
178
|
+
toDelete.push(candidate);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
anchor = candidate;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
for (const v of toDelete) {
|
|
186
|
+
await container.removeFile(v.path);
|
|
187
|
+
}
|
|
188
|
+
return toDelete;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/versions/operations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAUjG,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,KAAK,UAAU,eAAe,CAC5B,SAA2B,EAC3B,QAA4B;IAE5B,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,eAAe,EAAE,CAAC;IAClD,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,SAA2B;IACvD,yEAAyE;IACzE,oDAAoD;IACpD,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,eAAe,EAAE,CAAC;IAClD,OAAO,OAAO,IAAI,UAAU,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,C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