velo-text 1.0.0-beta.1
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/CHANGELOG.md +70 -0
- package/LICENSE +21 -0
- package/README.md +122 -0
- package/dist/adapters/backend/index.d.ts +4 -0
- package/dist/adapters/backend/index.d.ts.map +1 -0
- package/dist/adapters/backend/index.js +3 -0
- package/dist/adapters/backend/index.js.map +1 -0
- package/dist/adapters/backend/pdf-http.d.ts +48 -0
- package/dist/adapters/backend/pdf-http.d.ts.map +1 -0
- package/dist/adapters/backend/pdf-http.js +117 -0
- package/dist/adapters/backend/pdf-http.js.map +1 -0
- package/dist/adapters/backend/sinks.d.ts +7 -0
- package/dist/adapters/backend/sinks.d.ts.map +1 -0
- package/dist/adapters/backend/sinks.js +43 -0
- package/dist/adapters/backend/sinks.js.map +1 -0
- package/dist/adapters/browser/index.d.ts +11 -0
- package/dist/adapters/browser/index.d.ts.map +1 -0
- package/dist/adapters/browser/index.js +51 -0
- package/dist/adapters/browser/index.js.map +1 -0
- package/dist/adapters/postgres-contract/index.d.ts +45 -0
- package/dist/adapters/postgres-contract/index.d.ts.map +1 -0
- package/dist/adapters/postgres-contract/index.js +108 -0
- package/dist/adapters/postgres-contract/index.js.map +1 -0
- package/dist/adapters/s3-compatible/index.d.ts +46 -0
- package/dist/adapters/s3-compatible/index.d.ts.map +1 -0
- package/dist/adapters/s3-compatible/index.js +106 -0
- package/dist/adapters/s3-compatible/index.js.map +1 -0
- package/dist/adapters/vanilla.d.ts +5 -0
- package/dist/adapters/vanilla.d.ts.map +1 -0
- package/dist/adapters/vanilla.js +6 -0
- package/dist/adapters/vanilla.js.map +1 -0
- package/dist/assets/dimensions/index.d.ts +12 -0
- package/dist/assets/dimensions/index.d.ts.map +1 -0
- package/dist/assets/dimensions/index.js +46 -0
- package/dist/assets/dimensions/index.js.map +1 -0
- package/dist/assets/hashing/index.d.ts +7 -0
- package/dist/assets/hashing/index.d.ts.map +1 -0
- package/dist/assets/hashing/index.js +21 -0
- package/dist/assets/hashing/index.js.map +1 -0
- package/dist/assets/icons/index.d.ts +25 -0
- package/dist/assets/icons/index.d.ts.map +1 -0
- package/dist/assets/icons/index.js +107 -0
- package/dist/assets/icons/index.js.map +1 -0
- package/dist/assets/png/placeholder.d.ts +4 -0
- package/dist/assets/png/placeholder.d.ts.map +1 -0
- package/dist/assets/png/placeholder.js +13 -0
- package/dist/assets/png/placeholder.js.map +1 -0
- package/dist/assets/sniff/index.d.ts +13 -0
- package/dist/assets/sniff/index.d.ts.map +1 -0
- package/dist/assets/sniff/index.js +41 -0
- package/dist/assets/sniff/index.js.map +1 -0
- package/dist/assets/store/index.d.ts +56 -0
- package/dist/assets/store/index.d.ts.map +1 -0
- package/dist/assets/store/index.js +102 -0
- package/dist/assets/store/index.js.map +1 -0
- package/dist/assets/svg/index.d.ts +7 -0
- package/dist/assets/svg/index.d.ts.map +1 -0
- package/dist/assets/svg/index.js +82 -0
- package/dist/assets/svg/index.js.map +1 -0
- package/dist/core/equation/html.d.ts +3 -0
- package/dist/core/equation/html.d.ts.map +1 -0
- package/dist/core/equation/html.js +138 -0
- package/dist/core/equation/html.js.map +1 -0
- package/dist/core/equation/index.d.ts +19 -0
- package/dist/core/equation/index.d.ts.map +1 -0
- package/dist/core/equation/index.js +107 -0
- package/dist/core/equation/index.js.map +1 -0
- package/dist/core/events/index.d.ts +13 -0
- package/dist/core/events/index.d.ts.map +1 -0
- package/dist/core/events/index.js +18 -0
- package/dist/core/events/index.js.map +1 -0
- package/dist/core/history/history.d.ts +29 -0
- package/dist/core/history/history.d.ts.map +1 -0
- package/dist/core/history/history.js +55 -0
- package/dist/core/history/history.js.map +1 -0
- package/dist/core/history/index.d.ts +2 -0
- package/dist/core/history/index.d.ts.map +1 -0
- package/dist/core/history/index.js +2 -0
- package/dist/core/history/index.js.map +1 -0
- package/dist/core/model/block.d.ts +121 -0
- package/dist/core/model/block.d.ts.map +1 -0
- package/dist/core/model/block.js +2 -0
- package/dist/core/model/block.js.map +1 -0
- package/dist/core/model/document.d.ts +70 -0
- package/dist/core/model/document.d.ts.map +1 -0
- package/dist/core/model/document.js +2 -0
- package/dist/core/model/document.js.map +1 -0
- package/dist/core/model/factories.d.ts +35 -0
- package/dist/core/model/factories.d.ts.map +1 -0
- package/dist/core/model/factories.js +115 -0
- package/dist/core/model/factories.js.map +1 -0
- package/dist/core/model/index.d.ts +4 -0
- package/dist/core/model/index.d.ts.map +1 -0
- package/dist/core/model/index.js +4 -0
- package/dist/core/model/index.js.map +1 -0
- package/dist/core/model/inline.d.ts +43 -0
- package/dist/core/model/inline.d.ts.map +1 -0
- package/dist/core/model/inline.js +2 -0
- package/dist/core/model/inline.js.map +1 -0
- package/dist/core/model/primitives.d.ts +36 -0
- package/dist/core/model/primitives.d.ts.map +1 -0
- package/dist/core/model/primitives.js +3 -0
- package/dist/core/model/primitives.js.map +1 -0
- package/dist/core/model/table-look.d.ts +12 -0
- package/dist/core/model/table-look.d.ts.map +1 -0
- package/dist/core/model/table-look.js +99 -0
- package/dist/core/model/table-look.js.map +1 -0
- package/dist/core/model/types.d.ts +5 -0
- package/dist/core/model/types.d.ts.map +1 -0
- package/dist/core/model/types.js +5 -0
- package/dist/core/model/types.js.map +1 -0
- package/dist/core/normalize/index.d.ts +2 -0
- package/dist/core/normalize/index.d.ts.map +1 -0
- package/dist/core/normalize/index.js +2 -0
- package/dist/core/normalize/index.js.map +1 -0
- package/dist/core/normalize/normalize.d.ts +8 -0
- package/dist/core/normalize/normalize.d.ts.map +1 -0
- package/dist/core/normalize/normalize.js +145 -0
- package/dist/core/normalize/normalize.js.map +1 -0
- package/dist/core/operations/index.d.ts +2 -0
- package/dist/core/operations/index.d.ts.map +1 -0
- package/dist/core/operations/index.js +2 -0
- package/dist/core/operations/index.js.map +1 -0
- package/dist/core/operations/operations.d.ts +53 -0
- package/dist/core/operations/operations.d.ts.map +1 -0
- package/dist/core/operations/operations.js +92 -0
- package/dist/core/operations/operations.js.map +1 -0
- package/dist/core/plugin/index.d.ts +84 -0
- package/dist/core/plugin/index.d.ts.map +1 -0
- package/dist/core/plugin/index.js +137 -0
- package/dist/core/plugin/index.js.map +1 -0
- package/dist/core/schema/canonical.d.ts +6 -0
- package/dist/core/schema/canonical.d.ts.map +1 -0
- package/dist/core/schema/canonical.js +42 -0
- package/dist/core/schema/canonical.js.map +1 -0
- package/dist/core/schema/index.d.ts +3 -0
- package/dist/core/schema/index.d.ts.map +1 -0
- package/dist/core/schema/index.js +3 -0
- package/dist/core/schema/index.js.map +1 -0
- package/dist/core/schema/validator.d.ts +23 -0
- package/dist/core/schema/validator.d.ts.map +1 -0
- package/dist/core/schema/validator.js +276 -0
- package/dist/core/schema/validator.js.map +1 -0
- package/dist/core/selection/index.d.ts +2 -0
- package/dist/core/selection/index.d.ts.map +1 -0
- package/dist/core/selection/index.js +2 -0
- package/dist/core/selection/index.js.map +1 -0
- package/dist/core/selection/selection.d.ts +12 -0
- package/dist/core/selection/selection.d.ts.map +1 -0
- package/dist/core/selection/selection.js +38 -0
- package/dist/core/selection/selection.js.map +1 -0
- package/dist/editor-web/accessibility/index.d.ts +40 -0
- package/dist/editor-web/accessibility/index.d.ts.map +1 -0
- package/dist/editor-web/accessibility/index.js +170 -0
- package/dist/editor-web/accessibility/index.js.map +1 -0
- package/dist/editor-web/clipboard/index.d.ts +52 -0
- package/dist/editor-web/clipboard/index.d.ts.map +1 -0
- package/dist/editor-web/clipboard/index.js +154 -0
- package/dist/editor-web/clipboard/index.js.map +1 -0
- package/dist/editor-web/controller/column-presets.d.ts +9 -0
- package/dist/editor-web/controller/column-presets.d.ts.map +1 -0
- package/dist/editor-web/controller/column-presets.js +11 -0
- package/dist/editor-web/controller/column-presets.js.map +1 -0
- package/dist/editor-web/controller/column-resize.d.ts +6 -0
- package/dist/editor-web/controller/column-resize.d.ts.map +1 -0
- package/dist/editor-web/controller/column-resize.js +119 -0
- package/dist/editor-web/controller/column-resize.js.map +1 -0
- package/dist/editor-web/controller/columns-ui.d.ts +5 -0
- package/dist/editor-web/controller/columns-ui.d.ts.map +1 -0
- package/dist/editor-web/controller/columns-ui.js +107 -0
- package/dist/editor-web/controller/columns-ui.js.map +1 -0
- package/dist/editor-web/controller/commands.d.ts +27 -0
- package/dist/editor-web/controller/commands.d.ts.map +1 -0
- package/dist/editor-web/controller/commands.js +198 -0
- package/dist/editor-web/controller/commands.js.map +1 -0
- package/dist/editor-web/controller/format-commands.d.ts +12 -0
- package/dist/editor-web/controller/format-commands.d.ts.map +1 -0
- package/dist/editor-web/controller/format-commands.js +77 -0
- package/dist/editor-web/controller/format-commands.js.map +1 -0
- package/dist/editor-web/controller/handles.d.ts +7 -0
- package/dist/editor-web/controller/handles.d.ts.map +1 -0
- package/dist/editor-web/controller/handles.js +205 -0
- package/dist/editor-web/controller/handles.js.map +1 -0
- package/dist/editor-web/controller/host.d.ts +8 -0
- package/dist/editor-web/controller/host.d.ts.map +1 -0
- package/dist/editor-web/controller/host.js +48 -0
- package/dist/editor-web/controller/host.js.map +1 -0
- package/dist/editor-web/controller/image-resize.d.ts +9 -0
- package/dist/editor-web/controller/image-resize.d.ts.map +1 -0
- package/dist/editor-web/controller/image-resize.js +163 -0
- package/dist/editor-web/controller/image-resize.js.map +1 -0
- package/dist/editor-web/controller/index.d.ts +6 -0
- package/dist/editor-web/controller/index.d.ts.map +1 -0
- package/dist/editor-web/controller/index.js +190 -0
- package/dist/editor-web/controller/index.js.map +1 -0
- package/dist/editor-web/controller/nesting.d.ts +27 -0
- package/dist/editor-web/controller/nesting.d.ts.map +1 -0
- package/dist/editor-web/controller/nesting.js +218 -0
- package/dist/editor-web/controller/nesting.js.map +1 -0
- package/dist/editor-web/controller/place-overlay.d.ts +6 -0
- package/dist/editor-web/controller/place-overlay.d.ts.map +1 -0
- package/dist/editor-web/controller/place-overlay.js +55 -0
- package/dist/editor-web/controller/place-overlay.js.map +1 -0
- package/dist/editor-web/controller/size-picker.d.ts +28 -0
- package/dist/editor-web/controller/size-picker.d.ts.map +1 -0
- package/dist/editor-web/controller/size-picker.js +177 -0
- package/dist/editor-web/controller/size-picker.js.map +1 -0
- package/dist/editor-web/controller/table-resize.d.ts +14 -0
- package/dist/editor-web/controller/table-resize.d.ts.map +1 -0
- package/dist/editor-web/controller/table-resize.js +178 -0
- package/dist/editor-web/controller/table-resize.js.map +1 -0
- package/dist/editor-web/controller/table-ui.d.ts +5 -0
- package/dist/editor-web/controller/table-ui.d.ts.map +1 -0
- package/dist/editor-web/controller/table-ui.js +214 -0
- package/dist/editor-web/controller/table-ui.js.map +1 -0
- package/dist/editor-web/controller/types.d.ts +95 -0
- package/dist/editor-web/controller/types.d.ts.map +1 -0
- package/dist/editor-web/controller/types.js +4 -0
- package/dist/editor-web/controller/types.js.map +1 -0
- package/dist/editor-web/controller/variable-ui.d.ts +5 -0
- package/dist/editor-web/controller/variable-ui.d.ts.map +1 -0
- package/dist/editor-web/controller/variable-ui.js +75 -0
- package/dist/editor-web/controller/variable-ui.js.map +1 -0
- package/dist/editor-web/images/index.d.ts +9 -0
- package/dist/editor-web/images/index.d.ts.map +1 -0
- package/dist/editor-web/images/index.js +18 -0
- package/dist/editor-web/images/index.js.map +1 -0
- package/dist/editor-web/index.d.ts +10 -0
- package/dist/editor-web/index.d.ts.map +1 -0
- package/dist/editor-web/index.js +10 -0
- package/dist/editor-web/index.js.map +1 -0
- package/dist/editor-web/input/index.d.ts +75 -0
- package/dist/editor-web/input/index.d.ts.map +1 -0
- package/dist/editor-web/input/index.js +151 -0
- package/dist/editor-web/input/index.js.map +1 -0
- package/dist/editor-web/tables/index.d.ts +47 -0
- package/dist/editor-web/tables/index.d.ts.map +1 -0
- package/dist/editor-web/tables/index.js +159 -0
- package/dist/editor-web/tables/index.js.map +1 -0
- package/dist/editor-web/toolbar/index.d.ts +17 -0
- package/dist/editor-web/toolbar/index.d.ts.map +1 -0
- package/dist/editor-web/toolbar/index.js +36 -0
- package/dist/editor-web/toolbar/index.js.map +1 -0
- package/dist/editor-web/ux/attach.d.ts +21 -0
- package/dist/editor-web/ux/attach.d.ts.map +1 -0
- package/dist/editor-web/ux/attach.js +61 -0
- package/dist/editor-web/ux/attach.js.map +1 -0
- package/dist/editor-web/ux/command-palette.d.ts +11 -0
- package/dist/editor-web/ux/command-palette.d.ts.map +1 -0
- package/dist/editor-web/ux/command-palette.js +135 -0
- package/dist/editor-web/ux/command-palette.js.map +1 -0
- package/dist/editor-web/ux/equation-editor.d.ts +11 -0
- package/dist/editor-web/ux/equation-editor.d.ts.map +1 -0
- package/dist/editor-web/ux/equation-editor.js +130 -0
- package/dist/editor-web/ux/equation-editor.js.map +1 -0
- package/dist/editor-web/ux/equation-palette.d.ts +11 -0
- package/dist/editor-web/ux/equation-palette.d.ts.map +1 -0
- package/dist/editor-web/ux/equation-palette.js +90 -0
- package/dist/editor-web/ux/equation-palette.js.map +1 -0
- package/dist/editor-web/ux/find-replace.d.ts +6 -0
- package/dist/editor-web/ux/find-replace.d.ts.map +1 -0
- package/dist/editor-web/ux/find-replace.js +125 -0
- package/dist/editor-web/ux/find-replace.js.map +1 -0
- package/dist/editor-web/ux/find-text.d.ts +10 -0
- package/dist/editor-web/ux/find-text.d.ts.map +1 -0
- package/dist/editor-web/ux/find-text.js +101 -0
- package/dist/editor-web/ux/find-text.js.map +1 -0
- package/dist/editor-web/ux/image-drop.d.ts +7 -0
- package/dist/editor-web/ux/image-drop.d.ts.map +1 -0
- package/dist/editor-web/ux/image-drop.js +198 -0
- package/dist/editor-web/ux/image-drop.js.map +1 -0
- package/dist/editor-web/ux/link-ui.d.ts +6 -0
- package/dist/editor-web/ux/link-ui.d.ts.map +1 -0
- package/dist/editor-web/ux/link-ui.js +50 -0
- package/dist/editor-web/ux/link-ui.js.map +1 -0
- package/dist/editor-web/ux/outline.d.ts +9 -0
- package/dist/editor-web/ux/outline.d.ts.map +1 -0
- package/dist/editor-web/ux/outline.js +48 -0
- package/dist/editor-web/ux/outline.js.map +1 -0
- package/dist/editor-web/ux/page-preview.d.ts +6 -0
- package/dist/editor-web/ux/page-preview.d.ts.map +1 -0
- package/dist/editor-web/ux/page-preview.js +90 -0
- package/dist/editor-web/ux/page-preview.js.map +1 -0
- package/dist/editor-web/ux/selection-bubble.d.ts +6 -0
- package/dist/editor-web/ux/selection-bubble.d.ts.map +1 -0
- package/dist/editor-web/ux/selection-bubble.js +79 -0
- package/dist/editor-web/ux/selection-bubble.js.map +1 -0
- package/dist/editor-web/ux/shortcuts-sheet.d.ts +6 -0
- package/dist/editor-web/ux/shortcuts-sheet.d.ts.map +1 -0
- package/dist/editor-web/ux/shortcuts-sheet.js +58 -0
- package/dist/editor-web/ux/shortcuts-sheet.js.map +1 -0
- package/dist/editor-web/view/index.d.ts +3 -0
- package/dist/editor-web/view/index.d.ts.map +1 -0
- package/dist/editor-web/view/index.js +3 -0
- package/dist/editor-web/view/index.js.map +1 -0
- package/dist/editor-web/view/parse-inlines.d.ts +15 -0
- package/dist/editor-web/view/parse-inlines.d.ts.map +1 -0
- package/dist/editor-web/view/parse-inlines.js +107 -0
- package/dist/editor-web/view/parse-inlines.js.map +1 -0
- package/dist/editor-web/view/parse.d.ts +8 -0
- package/dist/editor-web/view/parse.d.ts.map +1 -0
- package/dist/editor-web/view/parse.js +238 -0
- package/dist/editor-web/view/parse.js.map +1 -0
- package/dist/editor-web/view/reconcile.d.ts +26 -0
- package/dist/editor-web/view/reconcile.d.ts.map +1 -0
- package/dist/editor-web/view/reconcile.js +142 -0
- package/dist/editor-web/view/reconcile.js.map +1 -0
- package/dist/editor-web/view/render.d.ts +14 -0
- package/dist/editor-web/view/render.d.ts.map +1 -0
- package/dist/editor-web/view/render.js +162 -0
- package/dist/editor-web/view/render.js.map +1 -0
- package/dist/export/docx/document-xml.d.ts +3 -0
- package/dist/export/docx/document-xml.d.ts.map +1 -0
- package/dist/export/docx/document-xml.js +218 -0
- package/dist/export/docx/document-xml.js.map +1 -0
- package/dist/export/docx/package-parts.d.ts +9 -0
- package/dist/export/docx/package-parts.d.ts.map +1 -0
- package/dist/export/docx/package-parts.js +91 -0
- package/dist/export/docx/package-parts.js.map +1 -0
- package/dist/export/docx/writer.d.ts +17 -0
- package/dist/export/docx/writer.d.ts.map +1 -0
- package/dist/export/docx/writer.js +48 -0
- package/dist/export/docx/writer.js.map +1 -0
- package/dist/export/images/downsample.d.ts +19 -0
- package/dist/export/images/downsample.d.ts.map +1 -0
- package/dist/export/images/downsample.js +64 -0
- package/dist/export/images/downsample.js.map +1 -0
- package/dist/export/images/png-encode.d.ts +4 -0
- package/dist/export/images/png-encode.d.ts.map +1 -0
- package/dist/export/images/png-encode.js +86 -0
- package/dist/export/images/png-encode.js.map +1 -0
- package/dist/export/images/prepare.d.ts +22 -0
- package/dist/export/images/prepare.d.ts.map +1 -0
- package/dist/export/images/prepare.js +29 -0
- package/dist/export/images/prepare.js.map +1 -0
- package/dist/export/images/rasterize.d.ts +7 -0
- package/dist/export/images/rasterize.d.ts.map +1 -0
- package/dist/export/images/rasterize.js +62 -0
- package/dist/export/images/rasterize.js.map +1 -0
- package/dist/export/index.d.ts +45 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +52 -0
- package/dist/export/index.js.map +1 -0
- package/dist/export/layout/index.d.ts +23 -0
- package/dist/export/layout/index.d.ts.map +1 -0
- package/dist/export/layout/index.js +18 -0
- package/dist/export/layout/index.js.map +1 -0
- package/dist/export/layout/layout-blocks.d.ts +5 -0
- package/dist/export/layout/layout-blocks.d.ts.map +1 -0
- package/dist/export/layout/layout-blocks.js +91 -0
- package/dist/export/layout/layout-blocks.js.map +1 -0
- package/dist/export/layout/layout-flow.d.ts +25 -0
- package/dist/export/layout/layout-flow.d.ts.map +1 -0
- package/dist/export/layout/layout-flow.js +23 -0
- package/dist/export/layout/layout-flow.js.map +1 -0
- package/dist/export/layout/layout-structured.d.ts +4 -0
- package/dist/export/layout/layout-structured.d.ts.map +1 -0
- package/dist/export/layout/layout-structured.js +153 -0
- package/dist/export/layout/layout-structured.js.map +1 -0
- package/dist/export/layout/layout-types.d.ts +35 -0
- package/dist/export/layout/layout-types.d.ts.map +1 -0
- package/dist/export/layout/layout-types.js +2 -0
- package/dist/export/layout/layout-types.js.map +1 -0
- package/dist/export/layout/pagination.d.ts +9 -0
- package/dist/export/layout/pagination.d.ts.map +1 -0
- package/dist/export/layout/pagination.js +38 -0
- package/dist/export/layout/pagination.js.map +1 -0
- package/dist/export/layout/text.d.ts +47 -0
- package/dist/export/layout/text.d.ts.map +1 -0
- package/dist/export/layout/text.js +119 -0
- package/dist/export/layout/text.js.map +1 -0
- package/dist/export/layout/units.d.ts +30 -0
- package/dist/export/layout/units.d.ts.map +1 -0
- package/dist/export/layout/units.js +55 -0
- package/dist/export/layout/units.js.map +1 -0
- package/dist/export/odt/writer.d.ts +24 -0
- package/dist/export/odt/writer.d.ts.map +1 -0
- package/dist/export/odt/writer.js +258 -0
- package/dist/export/odt/writer.js.map +1 -0
- package/dist/export/pdf/assemble.d.ts +9 -0
- package/dist/export/pdf/assemble.d.ts.map +1 -0
- package/dist/export/pdf/assemble.js +105 -0
- package/dist/export/pdf/assemble.js.map +1 -0
- package/dist/export/pdf/diagnostics.d.ts +11 -0
- package/dist/export/pdf/diagnostics.d.ts.map +1 -0
- package/dist/export/pdf/diagnostics.js +88 -0
- package/dist/export/pdf/diagnostics.js.map +1 -0
- package/dist/export/pdf/equation.d.ts +55 -0
- package/dist/export/pdf/equation.d.ts.map +1 -0
- package/dist/export/pdf/equation.js +301 -0
- package/dist/export/pdf/equation.js.map +1 -0
- package/dist/export/pdf/export-pdf.d.ts +33 -0
- package/dist/export/pdf/export-pdf.d.ts.map +1 -0
- package/dist/export/pdf/export-pdf.js +54 -0
- package/dist/export/pdf/export-pdf.js.map +1 -0
- package/dist/export/pdf/fonts.d.ts +7 -0
- package/dist/export/pdf/fonts.d.ts.map +1 -0
- package/dist/export/pdf/fonts.js +15 -0
- package/dist/export/pdf/fonts.js.map +1 -0
- package/dist/export/pdf/image.d.ts +27 -0
- package/dist/export/pdf/image.d.ts.map +1 -0
- package/dist/export/pdf/image.js +271 -0
- package/dist/export/pdf/image.js.map +1 -0
- package/dist/export/pdf/layout-pages.d.ts +9 -0
- package/dist/export/pdf/layout-pages.d.ts.map +1 -0
- package/dist/export/pdf/layout-pages.js +174 -0
- package/dist/export/pdf/layout-pages.js.map +1 -0
- package/dist/export/pdf/layout-table.d.ts +29 -0
- package/dist/export/pdf/layout-table.d.ts.map +1 -0
- package/dist/export/pdf/layout-table.js +216 -0
- package/dist/export/pdf/layout-table.js.map +1 -0
- package/dist/export/pdf/page-metrics.d.ts +11 -0
- package/dist/export/pdf/page-metrics.d.ts.map +1 -0
- package/dist/export/pdf/page-metrics.js +14 -0
- package/dist/export/pdf/page-metrics.js.map +1 -0
- package/dist/export/pdf/pdf-model.d.ts +36 -0
- package/dist/export/pdf/pdf-model.d.ts.map +1 -0
- package/dist/export/pdf/pdf-model.js +4 -0
- package/dist/export/pdf/pdf-model.js.map +1 -0
- package/dist/export/pdf/stream.d.ts +6 -0
- package/dist/export/pdf/stream.d.ts.map +1 -0
- package/dist/export/pdf/stream.js +213 -0
- package/dist/export/pdf/stream.js.map +1 -0
- package/dist/export/pdf/writer.d.ts +26 -0
- package/dist/export/pdf/writer.d.ts.map +1 -0
- package/dist/export/pdf/writer.js +31 -0
- package/dist/export/pdf/writer.js.map +1 -0
- package/dist/export/validate.d.ts +29 -0
- package/dist/export/validate.d.ts.map +1 -0
- package/dist/export/validate.js +127 -0
- package/dist/export/validate.js.map +1 -0
- package/dist/export/xml/writer.d.ts +19 -0
- package/dist/export/xml/writer.d.ts.map +1 -0
- package/dist/export/xml/writer.js +57 -0
- package/dist/export/xml/writer.js.map +1 -0
- package/dist/export/zip/crc32.d.ts +2 -0
- package/dist/export/zip/crc32.d.ts.map +1 -0
- package/dist/export/zip/crc32.js +20 -0
- package/dist/export/zip/crc32.js.map +1 -0
- package/dist/export/zip/deflate.d.ts +15 -0
- package/dist/export/zip/deflate.d.ts.map +1 -0
- package/dist/export/zip/deflate.js +28 -0
- package/dist/export/zip/deflate.js.map +1 -0
- package/dist/export/zip/index.d.ts +3 -0
- package/dist/export/zip/index.d.ts.map +1 -0
- package/dist/export/zip/index.js +3 -0
- package/dist/export/zip/index.js.map +1 -0
- package/dist/export/zip/zipWriter.d.ts +23 -0
- package/dist/export/zip/zipWriter.d.ts.map +1 -0
- package/dist/export/zip/zipWriter.js +123 -0
- package/dist/export/zip/zipWriter.js.map +1 -0
- package/dist/public-api/index.d.ts +46 -0
- package/dist/public-api/index.d.ts.map +1 -0
- package/dist/public-api/index.js +40 -0
- package/dist/public-api/index.js.map +1 -0
- package/dist/template/diagnostics/index.d.ts +8 -0
- package/dist/template/diagnostics/index.d.ts.map +1 -0
- package/dist/template/diagnostics/index.js +4 -0
- package/dist/template/diagnostics/index.js.map +1 -0
- package/dist/template/formatter/index.d.ts +9 -0
- package/dist/template/formatter/index.d.ts.map +1 -0
- package/dist/template/formatter/index.js +27 -0
- package/dist/template/formatter/index.js.map +1 -0
- package/dist/template/index.d.ts +3 -0
- package/dist/template/index.d.ts.map +1 -0
- package/dist/template/index.js +3 -0
- package/dist/template/index.js.map +1 -0
- package/dist/template/parser/parser.d.ts +42 -0
- package/dist/template/parser/parser.d.ts.map +1 -0
- package/dist/template/parser/parser.js +135 -0
- package/dist/template/parser/parser.js.map +1 -0
- package/dist/template/resolver/format.d.ts +11 -0
- package/dist/template/resolver/format.d.ts.map +1 -0
- package/dist/template/resolver/format.js +80 -0
- package/dist/template/resolver/format.js.map +1 -0
- package/dist/template/resolver/resolver.d.ts +31 -0
- package/dist/template/resolver/resolver.d.ts.map +1 -0
- package/dist/template/resolver/resolver.js +218 -0
- package/dist/template/resolver/resolver.js.map +1 -0
- package/dist/theme/index.d.ts +26 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +87 -0
- package/dist/theme/index.js.map +1 -0
- package/package.json +110 -0
- package/schemas/portable-doc-v1.json +250 -0
- package/themes/base.css +71 -0
- package/themes/components.css +135 -0
- package/themes/editor-chrome.css +174 -0
- package/themes/editor-columns.css +121 -0
- package/themes/editor-overlays.css +464 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes follow [Keep a Changelog](https://keepachangelog.com/) and [SemVer](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- (none yet)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## [1.0.0-beta.1] - 2026-08-28
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
-
|
|
15
|
+
|
|
16
|
+
## [1.0.0-beta.0] - 2026-08-28
|
|
17
|
+
|
|
18
|
+
First public **beta** on npm (`velo-text@beta`). Treat it as a trial API: layout, editor chrome, and export can still change before 1.0.0.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- npm package surface: `files`, `exports` (including `./themes/*` and `./backend`), `publishConfig.tag` `beta`, GitHub Action **Publish npm** (`NPM_TOKEN` secret)
|
|
22
|
+
- Playground in VitePress (`docs:dev` → `/playground/`); framework samples (Vanilla, React, Vue, Svelte, Angular, Astro)
|
|
23
|
+
- PDF **keep-together**: images, table rows, and lines move to the next page instead of being split; images scale to the usable page
|
|
24
|
+
- Overlay menus: `placeOverlay` keeps dropdowns inside the viewport (right-side icons open to the left)
|
|
25
|
+
- Editor page preview pushes blocks that would straddle a page band
|
|
26
|
+
- `History` drives editor undo; paste goes through `handlePaste`; shortcuts via `attachInputPipeline` (`nativeTyping`)
|
|
27
|
+
- Table **row height** drag (`heightUm`) and a table actions button beside the table
|
|
28
|
+
- Image **align** (`left`/`center`/`right`) on `ImageBlockNode`
|
|
29
|
+
- PDF: contiguous table rows; PNG **area-average downscale**
|
|
30
|
+
- Playground, examples, and HTTP API export **PDF, ODT, and DOCX**
|
|
31
|
+
- `scripts/soak.js`; property tests in CI
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- Version scheme jumps from `0.1.0` to `1.0.0-beta.0` for a named public trial
|
|
35
|
+
- Source files capped at **250 lines** where split
|
|
36
|
+
- Table cell alignment (`setAlign`) targets the cell paragraph
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- Toolbar dropdowns inheriting VitePress muted colors (looked disabled)
|
|
40
|
+
- Menus clipped by `backdrop-filter` / overflow when still inside the toolbar
|
|
41
|
+
- Typing in table cells; column resize; image resize box
|
|
42
|
+
- PDF table row gaps
|
|
43
|
+
|
|
44
|
+
## [0.1.0] - 2026-08-27
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
- Phase 0–12 initial implementation — Hito A/B/C verticals:
|
|
48
|
+
- Core: PortableDocument envelope, 8 block + 5 inline nodes + equations, factories with injected `IdGenerator`/`Clock`
|
|
49
|
+
- Schema: JSON Schema `schemas/portable-doc-v1.json`, validator with JSON Pointer, canonical `sha256`
|
|
50
|
+
- Normalize: idempotent merge of adjacent texts, table repair
|
|
51
|
+
- Operations: insert/delete/split/join, selection mapping, `History` with coalescing
|
|
52
|
+
- Template: lexer/parser for `{{path | format ?? "fallback"}}`, safe `safeResolve` (blocks `__proto__`), formatters `currency`/`date`/`number`, repeat rows with alias
|
|
53
|
+
- Equation: simple LaTeX subset (`\frac`, `\sqrt`, `^/_`, greek) via `src/core/equation`, atomic nodes, export fallback `$latex$`
|
|
54
|
+
- Icons: 28 inline SVGs via `currentColor` (`src/assets/icons`), recolorable via CSS
|
|
55
|
+
- Editor: `contenteditable` reconciler, `MutationObserver`, IME, `beforeinput` pipeline, keyboard shortcuts, Tab tables, clipboard allowlist (1 MB), a11y toolbar nav & contrast
|
|
56
|
+
- Assets: sniff (PNG/JPEG/WebP/SVG), dimensions, SHA-256, `AssetStore` dedupe/GC, S3 SigV4 presigned URLs
|
|
57
|
+
- Layout: units (µm/pt/twip/EMU), greedy line break, pagination with widows/orphans, diagnostics, deterministic hash
|
|
58
|
+
- Export: `XmlWriter`, `ZipWriter` STORE (+ DEFLATE optional), `PdfWriter`, `OdtWriter`, `DocxWriter`, `exportDocument` pipeline, validators `validatePdf/Odt/Docx`
|
|
59
|
+
- Adapters: `postgres-contract` (jsonb + `001_init.sql`, optimistic concurrency, idempotency, keyset pagination), `s3-compatible`
|
|
60
|
+
- Themes: 4 presets (`light-neutral`, `light-warm`, `dark-slate`, `dark-contrast`) + `themes/components.css`
|
|
61
|
+
- Tests: unit + 99 conformance fixtures × 3 formats, 33 fixtures, golden sample `tests/conformance/golden`, visual HTML `tests/visual/snapshots`
|
|
62
|
+
- CI: `pnpm` 11.24.0, `.github/workflows/ci.yml`, `check:types`/`circular`/`fixtures`/`smoke`/`fuzz`/`benchmark`
|
|
63
|
+
- Docs: `docs/api-report.md`, `docs/threat-model.md`, `docs/perf-budgets.md`, `docs/release-checklist.md`, `docs/matriz-nodos-formatos.md`
|
|
64
|
+
|
|
65
|
+
### Security
|
|
66
|
+
- HTML paste allowlist, `javascript:` blocked, SVG sanitization, Zip bomb limits, S3 scoped keys, tenant isolation
|
|
67
|
+
|
|
68
|
+
[1.0.0-beta.0]: https://github.com/velo-text/velo-text/releases/tag/v1.0.0-beta.0
|
|
69
|
+
[0.1.0]: https://github.com/velo-text/velo-text/releases/tag/v0.1.0
|
|
70
|
+
[1.0.0-beta.1]: https://github.com/velo-text/velo-text/releases/tag/v1.0.0-beta.1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 portable-doc-editor contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# velo-text
|
|
2
|
+
|
|
3
|
+
**1.0.0-beta.1** — public beta. APIs and export layout can still change. Install with the `beta` tag, not as if it were a stable 1.0.
|
|
4
|
+
|
|
5
|
+
Portable document editor with variables `{{name}}`, tables, images, LaTeX equations and deterministic export to **PDF, ODT, and DOCX** — **zero runtime dependencies**, TypeScript strict. LibreOffice/Word CI and full visual parity across Office formats are still open.
|
|
6
|
+
|
|
7
|
+
> Roadmap: `roadmap_editor_documental_portable.md` — implementation follows Phase 0–12 depth 3.
|
|
8
|
+
|
|
9
|
+
## Install (Node.js)
|
|
10
|
+
|
|
11
|
+
Requires **Node >= 18**. Use **pnpm**.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add velo-text@beta
|
|
15
|
+
# exact prerelease
|
|
16
|
+
pnpm add velo-text@1.0.0-beta.1
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Do not run `pnpm add velo-text` expecting a stable `latest` until 1.0.0 is published.
|
|
20
|
+
|
|
21
|
+
CSS for the web editor:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import "velo-text/themes/base.css";
|
|
25
|
+
import "velo-text/themes/components.css";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Publish / GitHub Actions
|
|
29
|
+
|
|
30
|
+
Do **not** put an npm token in the repo. Create GitHub secret **`NPM_TOKEN`**, then push tag `v1.0.0-beta.1`. CI publishes to npm (`beta`) and opens a GitHub Release. Details: [docs/guide/publish.md](docs/guide/publish.md).
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { createDocument, createIdGenerator, exportDocument } from "velo-text";
|
|
36
|
+
import { createBufferSink } from "velo-text/backend";
|
|
37
|
+
|
|
38
|
+
const doc = createDocument({ idGenerator: createIdGenerator("doc"), clock: { nowIso: () => new Date().toISOString() } });
|
|
39
|
+
doc.root.children.push(
|
|
40
|
+
{ type: "paragraph", id: "p1", children: [{ type: "text", id: "t1", text: "Hello " }, { type: "variable", id: "v1", path: "name", source: "{{name}}", valueType: "string" }] },
|
|
41
|
+
{ type: "equation-block", id: "eq1", latex: "\\frac{a}{b}" },
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const { sink, getBuffer } = createBufferSink();
|
|
45
|
+
await exportDocument({
|
|
46
|
+
document: doc,
|
|
47
|
+
data: { name: "World" },
|
|
48
|
+
format: "pdf",
|
|
49
|
+
sink,
|
|
50
|
+
options: { deterministic: true, strict: false },
|
|
51
|
+
});
|
|
52
|
+
const pdfBytes = getBuffer(); // Uint8Array
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Browser (vanilla)
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<link rel="stylesheet" href="node_modules/velo-text/themes/base.css">
|
|
59
|
+
<link rel="stylesheet" href="node_modules/velo-text/themes/components.css">
|
|
60
|
+
<div id="editor" class="pde-root" data-pde-theme="light-neutral" contenteditable="true"></div>
|
|
61
|
+
<script type="module">
|
|
62
|
+
import { createEditor } from "velo-text";
|
|
63
|
+
const editor = createEditor(document.getElementById("editor"), { document: doc, theme: "light-neutral" });
|
|
64
|
+
</script>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
See `examples/` (vanilla, React, Vue, Svelte, Angular, Astro), backend PDF samples, `examples/postgres.mjs`, `examples/s3.mjs`. Interactive playground: `pnpm docs:dev` → `/playground/`.
|
|
68
|
+
|
|
69
|
+
## Features
|
|
70
|
+
|
|
71
|
+
| Area | Status |
|
|
72
|
+
|---|---|
|
|
73
|
+
| Core model, validator, canonical hash, normalize, operations, history | ✅ `src/core` |
|
|
74
|
+
| Variables `{{path}}`, `\| format`, `?? fallback`, repeat rows | ✅ `src/template` |
|
|
75
|
+
| LaTeX simple (`\frac`, `\sqrt`, `^/_`, greek) inline/block | ✅ `src/core/equation` |
|
|
76
|
+
| SVG icons with `currentColor` → recolorable via CSS | ✅ `src/assets/icons` |
|
|
77
|
+
| Web editor: `createEditor`, cell typing/align, image align L/C/R, col/row resize, columns, IME, clipboard allowlist, a11y | ✅ `src/editor-web` |
|
|
78
|
+
| Assets: sniff (PNG/JPEG/WebP/SVG), dimensions, SHA-256, store dedupe & GC | ✅ `src/assets` |
|
|
79
|
+
| S3 presigned URLs SigV4, PG jsonb + revisions + optimistic concurrency | ✅ `src/adapters` |
|
|
80
|
+
| Layout: units (µm/pt/twip/EMU), text line break, pagination widows/orphans | ✅ `src/export/layout` |
|
|
81
|
+
| Export: PDF / ODT / DOCX (`exportDocument`); PDF keep-together for images/rows | ✅ `src/export` |
|
|
82
|
+
| Themes: `light-neutral`, `light-warm`, `dark-slate`, `dark-contrast` + CSS tokens | ✅ `themes/` |
|
|
83
|
+
|
|
84
|
+
## Scripts
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pnpm run check:types # tsc strict
|
|
88
|
+
pnpm run check:zero-deps # 0 runtime deps
|
|
89
|
+
pnpm run check:circular # no circular imports, core isolation
|
|
90
|
+
pnpm run check:fixtures # 33 fixtures validate
|
|
91
|
+
pnpm run check:smoke # PDF/ODT/DOCX magic + deterministic clock
|
|
92
|
+
pnpm run soak # repeated export (SOAK_ITERS)
|
|
93
|
+
pnpm run test # unit + conformance + integration + security
|
|
94
|
+
pnpm run test:security # XSS / prototype / SVG / LaTeX corpus
|
|
95
|
+
pnpm run test:visual # HTML snapshots in tests/visual/snapshots
|
|
96
|
+
pnpm run fuzz -- --iterations=5000
|
|
97
|
+
pnpm run build # tsc → dist/
|
|
98
|
+
pnpm docs:dev # VitePress docs + playground at /playground/
|
|
99
|
+
pnpm version:set 1.0.0-beta.1 # bump version (then tag v1.0.0-beta.1 and push)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Publish is **GitHub Actions only** (push tag `v1.0.0-beta.1` after setting secret `NPM_TOKEN`).
|
|
103
|
+
|
|
104
|
+
## Zero dependencies
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
"dependencies": {}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Verified via `scripts/check-zero-deps.js` and CI. TypeScript, VitePress, and test tools are `devDependencies` only.
|
|
111
|
+
|
|
112
|
+
## Themes
|
|
113
|
+
|
|
114
|
+
All colors/sizes via CSS variables (`--pde-*`). Override any token:
|
|
115
|
+
|
|
116
|
+
```css
|
|
117
|
+
.pde-root { --pde-color-primary: #ff0000; --pde-icon-color: currentColor; }
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT — `LICENSE`.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createFileSink, createBufferSink } from "./sinks.js";
|
|
2
|
+
export { handlePdfExportJson, sendPdfHttpResult, expressPdfHandler, vercelPdfHandler, vitePdfPlugin, } from "./pdf-http.js";
|
|
3
|
+
export type { PdfExportJson, PdfHttpResult } from "./pdf-http.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/backend/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/backend/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fill frontend {{tags}} on the backend and return a PDF.
|
|
3
|
+
* Shared by Express, Vercel, and the Vite dev middleware.
|
|
4
|
+
*/
|
|
5
|
+
import type { PortableDocument } from "../../core/model/types.js";
|
|
6
|
+
export interface PdfExportJson {
|
|
7
|
+
document: PortableDocument;
|
|
8
|
+
data?: Record<string, unknown>;
|
|
9
|
+
assets?: Record<string, {
|
|
10
|
+
id?: string;
|
|
11
|
+
mediaType: string;
|
|
12
|
+
data: string | number[];
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface PdfHttpResult {
|
|
16
|
+
status: number;
|
|
17
|
+
headers: Record<string, string>;
|
|
18
|
+
bytes?: Uint8Array;
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function handlePdfExportJson(input: unknown): Promise<PdfHttpResult>;
|
|
22
|
+
type NodeRes = {
|
|
23
|
+
statusCode?: number;
|
|
24
|
+
status?: (n: number) => NodeRes;
|
|
25
|
+
setHeader?: (k: string, v: string) => void;
|
|
26
|
+
json?: (b: unknown) => unknown;
|
|
27
|
+
send?: (b: unknown) => unknown;
|
|
28
|
+
end?: (b?: unknown) => unknown;
|
|
29
|
+
};
|
|
30
|
+
export declare function sendPdfHttpResult(out: PdfHttpResult, res: NodeRes): Promise<void>;
|
|
31
|
+
export declare function expressPdfHandler(req: {
|
|
32
|
+
method?: string;
|
|
33
|
+
body?: unknown;
|
|
34
|
+
}, res: NodeRes): Promise<void>;
|
|
35
|
+
export declare function vercelPdfHandler(req: {
|
|
36
|
+
method?: string;
|
|
37
|
+
body?: unknown;
|
|
38
|
+
}, res: NodeRes): Promise<void>;
|
|
39
|
+
export declare function vitePdfPlugin(route?: string): {
|
|
40
|
+
name: string;
|
|
41
|
+
configureServer: (s: {
|
|
42
|
+
middlewares: {
|
|
43
|
+
use: (fn: (...a: unknown[]) => void) => void;
|
|
44
|
+
};
|
|
45
|
+
}) => void;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=pdf-http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf-http.d.ts","sourceRoot":"","sources":["../../../src/adapters/backend/pdf-http.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACtF;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MA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,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,IAAI,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAA;CAAE,CA0BnK"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { exportPdf } from "../../export/pdf/export-pdf.js";
|
|
2
|
+
function asBytes(data) {
|
|
3
|
+
if (Array.isArray(data))
|
|
4
|
+
return Uint8Array.from(data);
|
|
5
|
+
const bin = atob(data);
|
|
6
|
+
const out = new Uint8Array(bin.length);
|
|
7
|
+
for (let i = 0; i < bin.length; i++)
|
|
8
|
+
out[i] = bin.charCodeAt(i);
|
|
9
|
+
return out;
|
|
10
|
+
}
|
|
11
|
+
export async function handlePdfExportJson(input) {
|
|
12
|
+
if (!input || typeof input !== "object") {
|
|
13
|
+
return { status: 400, headers: { "content-type": "application/json" }, error: "JSON body required" };
|
|
14
|
+
}
|
|
15
|
+
const body = input;
|
|
16
|
+
if (!body.document || !body.document.root) {
|
|
17
|
+
return { status: 400, headers: { "content-type": "application/json" }, error: "document envelope required" };
|
|
18
|
+
}
|
|
19
|
+
const assets = {};
|
|
20
|
+
for (const [id, a] of Object.entries(body.assets ?? {})) {
|
|
21
|
+
assets[id] = { id: a.id ?? id, mediaType: a.mediaType, data: asBytes(a.data) };
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const pdf = await exportPdf({
|
|
25
|
+
document: body.document,
|
|
26
|
+
data: body.data ?? {},
|
|
27
|
+
assets,
|
|
28
|
+
options: { strict: false, missingVariable: "keep" },
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
status: 200,
|
|
32
|
+
headers: {
|
|
33
|
+
"content-type": "application/pdf",
|
|
34
|
+
"content-disposition": 'attachment; filename="velo-text.pdf"',
|
|
35
|
+
},
|
|
36
|
+
bytes: pdf.bytes,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
return { status: 422, headers: { "content-type": "application/json" }, error: e instanceof Error ? e.message : "export failed" };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export async function sendPdfHttpResult(out, res) {
|
|
44
|
+
if (typeof res.status === "function")
|
|
45
|
+
res.status(out.status);
|
|
46
|
+
else
|
|
47
|
+
res.statusCode = out.status;
|
|
48
|
+
for (const [k, v] of Object.entries(out.headers))
|
|
49
|
+
res.setHeader?.(k, v);
|
|
50
|
+
if (out.error) {
|
|
51
|
+
const payload = { error: out.error };
|
|
52
|
+
if (res.json) {
|
|
53
|
+
res.json(payload);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
res.end?.(JSON.stringify(payload));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const buf = out.bytes ?? new Uint8Array();
|
|
60
|
+
if (res.send) {
|
|
61
|
+
res.send(Buffer.from(buf));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
res.end?.(Buffer.from(buf));
|
|
65
|
+
}
|
|
66
|
+
export async function expressPdfHandler(req, res) {
|
|
67
|
+
if ((req.method ?? "POST").toUpperCase() !== "POST") {
|
|
68
|
+
await sendPdfHttpResult({ status: 405, headers: { "content-type": "application/json" }, error: "POST only" }, res);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
await sendPdfHttpResult(await handlePdfExportJson(req.body), res);
|
|
72
|
+
}
|
|
73
|
+
export async function vercelPdfHandler(req, res) {
|
|
74
|
+
await expressPdfHandler(req, res);
|
|
75
|
+
}
|
|
76
|
+
function readStream(req) {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
const parts = [];
|
|
79
|
+
req.on("data", (c) => { parts.push(Buffer.from(c ?? "")); });
|
|
80
|
+
req.on("end", () => resolve(Buffer.concat(parts).toString("utf8")));
|
|
81
|
+
req.on("error", () => reject(new Error("body")));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export function vitePdfPlugin(route = "/api/pdf") {
|
|
85
|
+
return {
|
|
86
|
+
name: "velo-text-pdf",
|
|
87
|
+
configureServer(server) {
|
|
88
|
+
server.middlewares.use((...a) => {
|
|
89
|
+
const req = a[0];
|
|
90
|
+
const res = a[1];
|
|
91
|
+
const next = a[2];
|
|
92
|
+
const path = (req.url ?? "").split("?")[0];
|
|
93
|
+
if (path !== route) {
|
|
94
|
+
next();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const pending = readStream(req);
|
|
98
|
+
void (async () => {
|
|
99
|
+
if ((req.method ?? "").toUpperCase() !== "POST") {
|
|
100
|
+
await sendPdfHttpResult({ status: 405, headers: { "content-type": "application/json" }, error: "POST only" }, res);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
let json;
|
|
104
|
+
try {
|
|
105
|
+
json = JSON.parse(await pending);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
await sendPdfHttpResult({ status: 400, headers: { "content-type": "application/json" }, error: "invalid json" }, res);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
await sendPdfHttpResult(await handlePdfExportJson(json), res);
|
|
112
|
+
})();
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=pdf-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf-http.js","sourceRoot":"","sources":["../../../src/adapters/backend/pdf-http.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAe3D,SAAS,OAAO,CAAC,IAAuB;IACtC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,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oBACD,IAAI,IAAa,CAAC;oBAClB,IAAI,CAAC;wBAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,OAAO,CAAC,CAAC;oBAAC,CAAC;oBAAC,MAAM,CAAC;wBAC/C,MAAM,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,GAAG,CAAC,CAAC;wBACtH,OAAO;oBACT,CAAC;oBACD,MAAM,iBAAiB,CAAC,MAAM,mBAAmB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;gBAChE,CAAC,CAAC,EAAE,CAAC;YACP,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BinarySink } from "../../core/model/types.js";
|
|
2
|
+
export declare function createFileSink(filePath: string): BinarySink;
|
|
3
|
+
export declare function createBufferSink(): {
|
|
4
|
+
sink: BinarySink;
|
|
5
|
+
getBuffer: () => Uint8Array;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=sinks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sinks.d.ts","sourceRoot":"","sources":["../../../src/adapters/backend/sinks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAkB3D;AAED,wBAAgB,gBAAgB,IAAI;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,UAAU,CAAA;CAAE,CAoBpF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export function createFileSink(filePath) {
|
|
4
|
+
const chunks = [];
|
|
5
|
+
return {
|
|
6
|
+
write(chunk) {
|
|
7
|
+
chunks.push(chunk);
|
|
8
|
+
},
|
|
9
|
+
async close() {
|
|
10
|
+
const total = chunks.reduce((n, c) => n + c.length, 0);
|
|
11
|
+
const out = new Uint8Array(total);
|
|
12
|
+
let off = 0;
|
|
13
|
+
for (const c of chunks) {
|
|
14
|
+
out.set(c, off);
|
|
15
|
+
off += c.length;
|
|
16
|
+
}
|
|
17
|
+
await fs.promises.mkdir(path.dirname(filePath), { recursive: true });
|
|
18
|
+
await fs.promises.writeFile(filePath, out);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function createBufferSink() {
|
|
23
|
+
const chunks = [];
|
|
24
|
+
return {
|
|
25
|
+
sink: {
|
|
26
|
+
write(chunk) {
|
|
27
|
+
chunks.push(chunk);
|
|
28
|
+
},
|
|
29
|
+
close() { },
|
|
30
|
+
},
|
|
31
|
+
getBuffer() {
|
|
32
|
+
const total = chunks.reduce((n, c) => n + c.length, 0);
|
|
33
|
+
const out = new Uint8Array(total);
|
|
34
|
+
let off = 0;
|
|
35
|
+
for (const c of chunks) {
|
|
36
|
+
out.set(c, off);
|
|
37
|
+
off += c.length;
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=sinks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sinks.js","sourceRoot":"","sources":["../../../src/adapters/backend/sinks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,OAAO;QACL,KAAK,CAAC,KAAiB;YACrB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QACD,KAAK,CAAC,KAAK;YACT,MAAM,K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AC,CAAC,MAAM,CAAC;YAClB,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BinarySink, AssetResolver, ResolvedAsset } from "../../core/model/types.js";
|
|
2
|
+
export declare function createBlobSink(): {
|
|
3
|
+
sink: BinarySink;
|
|
4
|
+
getBlob: () => Blob;
|
|
5
|
+
};
|
|
6
|
+
export declare function createMemorySink(): {
|
|
7
|
+
sink: BinarySink;
|
|
8
|
+
getBytes: () => Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
export declare function createBrowserAssetResolver(map: Record<string, ResolvedAsset>): AssetResolver;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1F,wBAAgB,cAAc,IAAI;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAa1E;AAED,wBAAgB,gBAAgB,IAAI;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,UAAU,CAAA;CAAE,CAwBnF;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,aAAa,CAQ5F"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function createBlobSink() {
|
|
2
|
+
const chunks = [];
|
|
3
|
+
return {
|
|
4
|
+
sink: {
|
|
5
|
+
write(chunk) {
|
|
6
|
+
chunks.push(chunk);
|
|
7
|
+
},
|
|
8
|
+
close() { },
|
|
9
|
+
},
|
|
10
|
+
getBlob() {
|
|
11
|
+
return new Blob(chunks, { type: "application/octet-stream" });
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function createMemorySink() {
|
|
16
|
+
const chunks = [];
|
|
17
|
+
let closed = false;
|
|
18
|
+
return {
|
|
19
|
+
sink: {
|
|
20
|
+
write(chunk) {
|
|
21
|
+
if (closed)
|
|
22
|
+
throw new Error("sink closed");
|
|
23
|
+
chunks.push(chunk);
|
|
24
|
+
},
|
|
25
|
+
close() {
|
|
26
|
+
closed = true;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
getBytes() {
|
|
30
|
+
const total = chunks.reduce((n, c) => n + c.length, 0);
|
|
31
|
+
const out = new Uint8Array(total);
|
|
32
|
+
let off = 0;
|
|
33
|
+
for (const c of chunks) {
|
|
34
|
+
out.set(c, off);
|
|
35
|
+
off += c.length;
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function createBrowserAssetResolver(map) {
|
|
42
|
+
return {
|
|
43
|
+
async resolve(assetId) {
|
|
44
|
+
const a = map[assetId];
|
|
45
|
+
if (!a)
|
|
46
|
+
throw new Error(`asset ${assetId} not found`);
|
|
47
|
+
return a;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/browser/index.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc;IAC5B,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,OAAO;QACL,IAAI,EAAE;YACJ,KAAK,CAAC,KAAiB;gBACrB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;YACD,KAAK,KAAU,CAAC;SACjB;QACD,OAAO;YACL,OAAO,IAAI,IAAI,CAAC,MAAoB,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC;QAC9E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get, update, list revisions and restore. Optimistic concurrency.
|
|
4
|
+
*/
|
|
5
|
+
import type { PortableDocument } from "../../core/model/types.js";
|
|
6
|
+
export interface DocumentRecord {
|
|
7
|
+
id: string;
|
|
8
|
+
tenantId: string;
|
|
9
|
+
title: string;
|
|
10
|
+
schemaVersion: number;
|
|
11
|
+
currentRevision: number;
|
|
12
|
+
content: PortableDocument;
|
|
13
|
+
contentHash: Uint8Array;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
}
|
|
17
|
+
export interface DocumentRepository {
|
|
18
|
+
create(doc: PortableDocument, tenantId: string, opts?: {
|
|
19
|
+
idempotencyKey?: string;
|
|
20
|
+
}): Promise<DocumentRecord>;
|
|
21
|
+
get(id: string, tenantId: string): Promise<DocumentRecord | null>;
|
|
22
|
+
update(id: string, tenantId: string, expectedRevision: number, doc: PortableDocument, opts?: {
|
|
23
|
+
idempotencyKey?: string;
|
|
24
|
+
}): Promise<DocumentRecord>;
|
|
25
|
+
listRevisions(id: string, tenantId: string): Promise<DocumentRecord[]>;
|
|
26
|
+
restore(id: string, tenantId: string, revision: number): Promise<DocumentRecord>;
|
|
27
|
+
/** Keyset pagination — Phase 10.1.3 */
|
|
28
|
+
listDocuments(tenantId: string, opts?: {
|
|
29
|
+
limit?: number;
|
|
30
|
+
cursor?: string;
|
|
31
|
+
orderBy?: "updatedAt" | "createdAt";
|
|
32
|
+
}): Promise<{
|
|
33
|
+
documents: DocumentRecord[];
|
|
34
|
+
nextCursor?: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Idempotency support */
|
|
37
|
+
getIdempotency(key: string, tenantId: string): Promise<unknown | null>;
|
|
38
|
+
}
|
|
39
|
+
export declare const SQL_MIGRATION = "\n-- See migrations/001_init.sql\n";
|
|
40
|
+
/**
|
|
41
|
+
* In-memory implementation for tests — respects optimistic concurrency control,
|
|
42
|
+
* idempotency keys, keyset pagination and transaction semantics.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createInMemoryRepository(): DocumentRepository;
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/postgres-contract/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,WAAW,EAAE,UAAU,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7G,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACnJ,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACvE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,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