@fiduswriter/document 0.1.0-alpha.2 → 0.1.0-alpha.4
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/README.md +22 -1
- package/dist/bibliography/common.d.ts +92 -0
- package/dist/bibliography/common.d.ts.map +1 -0
- package/dist/bibliography/common.js +85 -0
- package/dist/bibliography/common.js.map +1 -0
- package/dist/bibliography/csl_bib.d.ts +3 -0
- package/dist/bibliography/csl_bib.d.ts.map +1 -0
- package/dist/bibliography/csl_bib.js +131 -0
- package/dist/bibliography/csl_bib.js.map +1 -0
- package/dist/citations/citeproc_sys.d.ts +13 -0
- package/dist/citations/citeproc_sys.d.ts.map +1 -0
- package/dist/citations/citeproc_sys.js +43 -0
- package/dist/citations/citeproc_sys.js.map +1 -0
- package/dist/citations/format.d.ts +23 -0
- package/dist/citations/format.d.ts.map +1 -0
- package/dist/citations/format.js +161 -0
- package/dist/citations/format.js.map +1 -0
- package/dist/editor/e2ee/encryptor.d.ts +123 -0
- package/dist/editor/e2ee/encryptor.d.ts.map +1 -0
- package/dist/editor/e2ee/encryptor.js +201 -0
- package/dist/editor/e2ee/encryptor.js.map +1 -0
- package/dist/exporter/docx/citations.d.ts +21 -0
- package/dist/exporter/docx/citations.d.ts.map +1 -0
- package/dist/exporter/docx/citations.js +154 -0
- package/dist/exporter/docx/citations.js.map +1 -0
- package/dist/exporter/docx/comments.d.ts +18 -0
- package/dist/exporter/docx/comments.d.ts.map +1 -0
- package/dist/exporter/docx/comments.js +137 -0
- package/dist/exporter/docx/comments.js.map +1 -0
- package/dist/exporter/docx/footnotes.d.ts +42 -0
- package/dist/exporter/docx/footnotes.d.ts.map +1 -0
- package/dist/exporter/docx/footnotes.js +182 -0
- package/dist/exporter/docx/footnotes.js.map +1 -0
- package/dist/exporter/docx/images.d.ts +14 -0
- package/dist/exporter/docx/images.d.ts.map +1 -0
- package/dist/exporter/docx/images.js +86 -0
- package/dist/exporter/docx/images.js.map +1 -0
- package/dist/exporter/docx/index.d.ts +22 -0
- package/dist/exporter/docx/index.d.ts.map +1 -0
- package/dist/exporter/docx/index.js +107 -0
- package/dist/exporter/docx/index.js.map +1 -0
- package/dist/exporter/docx/lists.d.ts +33 -0
- package/dist/exporter/docx/lists.d.ts.map +1 -0
- package/dist/exporter/docx/lists.js +229 -0
- package/dist/exporter/docx/lists.js.map +1 -0
- package/dist/exporter/docx/math.d.ts +13 -0
- package/dist/exporter/docx/math.d.ts.map +1 -0
- package/dist/exporter/docx/math.js +42 -0
- package/dist/exporter/docx/math.js.map +1 -0
- package/dist/exporter/docx/metadata.d.ts +14 -0
- package/dist/exporter/docx/metadata.d.ts.map +1 -0
- package/dist/exporter/docx/metadata.js +239 -0
- package/dist/exporter/docx/metadata.js.map +1 -0
- package/dist/exporter/docx/rels.d.ts +25 -0
- package/dist/exporter/docx/rels.d.ts.map +1 -0
- package/dist/exporter/docx/rels.js +168 -0
- package/dist/exporter/docx/rels.js.map +1 -0
- package/dist/exporter/docx/render.d.ts +20 -0
- package/dist/exporter/docx/render.d.ts.map +1 -0
- package/dist/exporter/docx/render.js +774 -0
- package/dist/exporter/docx/render.js.map +1 -0
- package/dist/exporter/docx/richtext.d.ts +25 -0
- package/dist/exporter/docx/richtext.d.ts.map +1 -0
- package/dist/exporter/docx/richtext.js +1052 -0
- package/dist/exporter/docx/richtext.js.map +1 -0
- package/dist/exporter/docx/tables.d.ts +14 -0
- package/dist/exporter/docx/tables.d.ts.map +1 -0
- package/dist/exporter/docx/tables.js +109 -0
- package/dist/exporter/docx/tables.js.map +1 -0
- package/dist/exporter/docx/tools.d.ts +3 -0
- package/dist/exporter/docx/tools.d.ts.map +1 -0
- package/dist/exporter/docx/tools.js +48 -0
- package/dist/exporter/docx/tools.js.map +1 -0
- package/dist/exporter/epub/index.d.ts +11 -0
- package/dist/exporter/epub/index.d.ts.map +1 -0
- package/dist/exporter/epub/index.js +102 -0
- package/dist/exporter/epub/index.js.map +1 -0
- package/dist/exporter/epub/templates.d.ts +32 -0
- package/dist/exporter/epub/templates.d.ts.map +1 -0
- package/dist/exporter/epub/templates.js +95 -0
- package/dist/exporter/epub/templates.js.map +1 -0
- package/dist/exporter/epub/tools.d.ts +5 -0
- package/dist/exporter/epub/tools.d.ts.map +1 -0
- package/dist/exporter/epub/tools.js +81 -0
- package/dist/exporter/epub/tools.js.map +1 -0
- package/dist/exporter/html/citations.d.ts +27 -0
- package/dist/exporter/html/citations.d.ts.map +1 -0
- package/dist/exporter/html/citations.js +91 -0
- package/dist/exporter/html/citations.js.map +1 -0
- package/dist/exporter/html/convert.d.ts +100 -0
- package/dist/exporter/html/convert.d.ts.map +1 -0
- package/dist/exporter/html/convert.js +718 -0
- package/dist/exporter/html/convert.js.map +1 -0
- package/dist/exporter/html/index.d.ts +61 -0
- package/dist/exporter/html/index.d.ts.map +1 -0
- package/dist/exporter/html/index.js +134 -0
- package/dist/exporter/html/index.js.map +1 -0
- package/dist/exporter/html/templates.d.ts +10 -0
- package/dist/exporter/html/templates.d.ts.map +1 -0
- package/dist/exporter/html/templates.js +21 -0
- package/dist/exporter/html/templates.js.map +1 -0
- package/dist/exporter/html/tools.d.ts +2 -0
- package/dist/exporter/html/tools.d.ts.map +1 -0
- package/dist/exporter/html/tools.js +49 -0
- package/dist/exporter/html/tools.js.map +1 -0
- package/dist/exporter/jats/bibliography.d.ts +2 -0
- package/dist/exporter/jats/bibliography.d.ts.map +1 -0
- package/dist/exporter/jats/bibliography.js +153 -0
- package/dist/exporter/jats/bibliography.js.map +1 -0
- package/dist/exporter/jats/citations.d.ts +14 -0
- package/dist/exporter/jats/citations.d.ts.map +1 -0
- package/dist/exporter/jats/citations.js +83 -0
- package/dist/exporter/jats/citations.js.map +1 -0
- package/dist/exporter/jats/convert.d.ts +45 -0
- package/dist/exporter/jats/convert.d.ts.map +1 -0
- package/dist/exporter/jats/convert.js +799 -0
- package/dist/exporter/jats/convert.js.map +1 -0
- package/dist/exporter/jats/index.d.ts +19 -0
- package/dist/exporter/jats/index.d.ts.map +1 -0
- package/dist/exporter/jats/index.js +66 -0
- package/dist/exporter/jats/index.js.map +1 -0
- package/dist/exporter/jats/templates.d.ts +16 -0
- package/dist/exporter/jats/templates.d.ts.map +1 -0
- package/dist/exporter/jats/templates.js +25 -0
- package/dist/exporter/jats/templates.js.map +1 -0
- package/dist/exporter/jats/text.d.ts +3 -0
- package/dist/exporter/jats/text.d.ts.map +1 -0
- package/dist/exporter/jats/text.js +72 -0
- package/dist/exporter/jats/text.js.map +1 -0
- package/dist/exporter/latex/convert.d.ts +27 -0
- package/dist/exporter/latex/convert.d.ts.map +1 -0
- package/dist/exporter/latex/convert.js +865 -0
- package/dist/exporter/latex/convert.js.map +1 -0
- package/dist/exporter/latex/escape_latex.d.ts +2 -0
- package/dist/exporter/latex/escape_latex.d.ts.map +1 -0
- package/dist/exporter/latex/escape_latex.js +20 -0
- package/dist/exporter/latex/escape_latex.js.map +1 -0
- package/dist/exporter/latex/index.d.ts +23 -0
- package/dist/exporter/latex/index.d.ts.map +1 -0
- package/dist/exporter/latex/index.js +57 -0
- package/dist/exporter/latex/index.js.map +1 -0
- package/dist/exporter/latex/readme.d.ts +2 -0
- package/dist/exporter/latex/readme.d.ts.map +1 -0
- package/dist/exporter/latex/readme.js +23 -0
- package/dist/exporter/latex/readme.js.map +1 -0
- package/dist/exporter/native/shrink.d.ts +21 -0
- package/dist/exporter/native/shrink.d.ts.map +1 -0
- package/dist/exporter/native/shrink.js +115 -0
- package/dist/exporter/native/shrink.js.map +1 -0
- package/dist/exporter/odt/citations.d.ts +18 -0
- package/dist/exporter/odt/citations.d.ts.map +1 -0
- package/dist/exporter/odt/citations.js +87 -0
- package/dist/exporter/odt/citations.js.map +1 -0
- package/dist/exporter/odt/footnotes.d.ts +25 -0
- package/dist/exporter/odt/footnotes.d.ts.map +1 -0
- package/dist/exporter/odt/footnotes.js +112 -0
- package/dist/exporter/odt/footnotes.js.map +1 -0
- package/dist/exporter/odt/images.d.ts +13 -0
- package/dist/exporter/odt/images.d.ts.map +1 -0
- package/dist/exporter/odt/images.js +98 -0
- package/dist/exporter/odt/images.js.map +1 -0
- package/dist/exporter/odt/index.d.ts +23 -0
- package/dist/exporter/odt/index.d.ts.map +1 -0
- package/dist/exporter/odt/index.js +99 -0
- package/dist/exporter/odt/index.js.map +1 -0
- package/dist/exporter/odt/math.d.ts +13 -0
- package/dist/exporter/odt/math.d.ts.map +1 -0
- package/dist/exporter/odt/math.js +48 -0
- package/dist/exporter/odt/math.js.map +1 -0
- package/dist/exporter/odt/metadata.d.ts +14 -0
- package/dist/exporter/odt/metadata.d.ts.map +1 -0
- package/dist/exporter/odt/metadata.js +203 -0
- package/dist/exporter/odt/metadata.js.map +1 -0
- package/dist/exporter/odt/render.d.ts +24 -0
- package/dist/exporter/odt/render.d.ts.map +1 -0
- package/dist/exporter/odt/render.js +644 -0
- package/dist/exporter/odt/render.js.map +1 -0
- package/dist/exporter/odt/richtext.d.ts +22 -0
- package/dist/exporter/odt/richtext.d.ts.map +1 -0
- package/dist/exporter/odt/richtext.js +728 -0
- package/dist/exporter/odt/richtext.js.map +1 -0
- package/dist/exporter/odt/styles.d.ts +33 -0
- package/dist/exporter/odt/styles.d.ts.map +1 -0
- package/dist/exporter/odt/styles.js +348 -0
- package/dist/exporter/odt/styles.js.map +1 -0
- package/dist/exporter/odt/track.d.ts +11 -0
- package/dist/exporter/odt/track.d.ts.map +1 -0
- package/dist/exporter/odt/track.js +59 -0
- package/dist/exporter/odt/track.js.map +1 -0
- package/dist/exporter/pandoc/citations.d.ts +17 -0
- package/dist/exporter/pandoc/citations.d.ts.map +1 -0
- package/dist/exporter/pandoc/citations.js +85 -0
- package/dist/exporter/pandoc/citations.js.map +1 -0
- package/dist/exporter/pandoc/convert.d.ts +38 -0
- package/dist/exporter/pandoc/convert.d.ts.map +1 -0
- package/dist/exporter/pandoc/convert.js +881 -0
- package/dist/exporter/pandoc/convert.js.map +1 -0
- package/dist/exporter/pandoc/index.d.ts +38 -0
- package/dist/exporter/pandoc/index.d.ts.map +1 -0
- package/dist/exporter/pandoc/index.js +67 -0
- package/dist/exporter/pandoc/index.js.map +1 -0
- package/dist/exporter/pandoc/readme.d.ts +2 -0
- package/dist/exporter/pandoc/readme.d.ts.map +1 -0
- package/dist/exporter/pandoc/readme.js +9 -0
- package/dist/exporter/pandoc/readme.js.map +1 -0
- package/dist/exporter/pandoc/tools.d.ts +6 -0
- package/dist/exporter/pandoc/tools.d.ts.map +1 -0
- package/dist/exporter/pandoc/tools.js +52 -0
- package/dist/exporter/pandoc/tools.js.map +1 -0
- package/dist/exporter/print/index.d.ts +9 -0
- package/dist/exporter/print/index.d.ts.map +1 -0
- package/dist/exporter/print/index.js +140 -0
- package/dist/exporter/print/index.js.map +1 -0
- package/dist/exporter/tools/doc_content.d.ts +7 -0
- package/dist/exporter/tools/doc_content.d.ts.map +1 -0
- package/dist/exporter/tools/doc_content.js +129 -0
- package/dist/exporter/tools/doc_content.js.map +1 -0
- package/dist/exporter/tools/file.d.ts +2 -0
- package/dist/exporter/tools/file.d.ts.map +1 -0
- package/dist/exporter/tools/file.js +10 -0
- package/dist/exporter/tools/file.js.map +1 -0
- package/dist/exporter/tools/json.d.ts +7 -0
- package/dist/exporter/tools/json.d.ts.map +1 -0
- package/dist/exporter/tools/json.js +82 -0
- package/dist/exporter/tools/json.js.map +1 -0
- package/dist/exporter/tools/svg.d.ts +2 -0
- package/dist/exporter/tools/svg.d.ts.map +1 -0
- package/dist/exporter/tools/svg.js +26 -0
- package/dist/exporter/tools/svg.js.map +1 -0
- package/dist/exporter/tools/xml.d.ts +41 -0
- package/dist/exporter/tools/xml.d.ts.map +1 -0
- package/dist/exporter/tools/xml.js +440 -0
- package/dist/exporter/tools/xml.js.map +1 -0
- package/dist/exporter/tools/xml_zip.d.ts +20 -0
- package/dist/exporter/tools/xml_zip.d.ts.map +1 -0
- package/dist/exporter/tools/xml_zip.js +86 -0
- package/dist/exporter/tools/xml_zip.js.map +1 -0
- package/dist/exporter/tools/zip.d.ts +21 -0
- package/dist/exporter/tools/zip.d.ts.map +1 -0
- package/dist/exporter/tools/zip.js +71 -0
- package/dist/exporter/tools/zip.js.map +1 -0
- package/dist/exporter/tools/zotero_csl.d.ts +10 -0
- package/dist/exporter/tools/zotero_csl.d.ts.map +1 -0
- package/dist/exporter/tools/zotero_csl.js +78 -0
- package/dist/exporter/tools/zotero_csl.js.map +1 -0
- package/dist/importer/citations.d.ts +25 -0
- package/dist/importer/citations.d.ts.map +1 -0
- package/dist/importer/citations.js +116 -0
- package/dist/importer/citations.js.map +1 -0
- package/dist/importer/docx/citations.d.ts +65 -0
- package/dist/importer/docx/citations.d.ts.map +1 -0
- package/dist/importer/docx/citations.js +106 -0
- package/dist/importer/docx/citations.js.map +1 -0
- package/dist/importer/docx/convert.d.ts +228 -0
- package/dist/importer/docx/convert.d.ts.map +1 -0
- package/dist/importer/docx/convert.js +1226 -0
- package/dist/importer/docx/convert.js.map +1 -0
- package/dist/importer/docx/helpers.d.ts +2 -0
- package/dist/importer/docx/helpers.d.ts.map +1 -0
- package/dist/importer/docx/helpers.js +10 -0
- package/dist/importer/docx/helpers.js.map +1 -0
- package/dist/importer/docx/omml2mathml.d.ts +7 -0
- package/dist/importer/docx/omml2mathml.d.ts.map +1 -0
- package/dist/importer/docx/omml2mathml.js +1239 -0
- package/dist/importer/docx/omml2mathml.js.map +1 -0
- package/dist/importer/docx/parse.d.ts +205 -0
- package/dist/importer/docx/parse.d.ts.map +1 -0
- package/dist/importer/docx/parse.js +663 -0
- package/dist/importer/docx/parse.js.map +1 -0
- package/dist/importer/native/get_images.d.ts +11 -0
- package/dist/importer/native/get_images.d.ts.map +1 -0
- package/dist/importer/native/get_images.js +64 -0
- package/dist/importer/native/get_images.js.map +1 -0
- package/dist/importer/native/update.d.ts +6 -0
- package/dist/importer/native/update.d.ts.map +1 -0
- package/dist/importer/native/update.js +26 -0
- package/dist/importer/native/update.js.map +1 -0
- package/dist/importer/odt/citations.d.ts +47 -0
- package/dist/importer/odt/citations.d.ts.map +1 -0
- package/dist/importer/odt/citations.js +79 -0
- package/dist/importer/odt/citations.js.map +1 -0
- package/dist/importer/odt/convert.d.ts +330 -0
- package/dist/importer/odt/convert.d.ts.map +1 -0
- package/dist/importer/odt/convert.js +1506 -0
- package/dist/importer/odt/convert.js.map +1 -0
- package/dist/importer/pandoc/convert.d.ts +84 -0
- package/dist/importer/pandoc/convert.d.ts.map +1 -0
- package/dist/importer/pandoc/convert.js +777 -0
- package/dist/importer/pandoc/convert.js.map +1 -0
- package/dist/importer/pandoc/helpers.d.ts +4 -0
- package/dist/importer/pandoc/helpers.d.ts.map +1 -0
- package/dist/importer/pandoc/helpers.js +75 -0
- package/dist/importer/pandoc/helpers.js.map +1 -0
- package/dist/importer/zip_analyzer.d.ts +25 -0
- package/dist/importer/zip_analyzer.d.ts.map +1 -0
- package/dist/importer/zip_analyzer.js +84 -0
- package/dist/importer/zip_analyzer.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/mathlive/opf_includes.d.ts +2 -0
- package/dist/mathlive/opf_includes.d.ts.map +1 -0
- package/dist/mathlive/opf_includes.js +25 -0
- package/dist/mathlive/opf_includes.js.map +1 -0
- package/dist/schema/common/annotate.d.ts +59 -0
- package/dist/schema/common/annotate.d.ts.map +1 -0
- package/dist/schema/common/annotate.js +75 -0
- package/dist/schema/common/annotate.js.map +1 -0
- package/dist/schema/common/base.d.ts +109 -0
- package/dist/schema/common/base.d.ts.map +1 -0
- package/dist/schema/common/base.js +109 -0
- package/dist/schema/common/base.js.map +1 -0
- package/dist/schema/common/citation.d.ts +29 -0
- package/dist/schema/common/citation.d.ts.map +1 -0
- package/dist/schema/common/citation.js +62 -0
- package/dist/schema/common/citation.js.map +1 -0
- package/dist/schema/common/equation.d.ts +18 -0
- package/dist/schema/common/equation.d.ts.map +1 -0
- package/dist/schema/common/equation.js +32 -0
- package/dist/schema/common/equation.js.map +1 -0
- package/dist/schema/common/figure.d.ts +108 -0
- package/dist/schema/common/figure.d.ts.map +1 -0
- package/dist/schema/common/figure.js +176 -0
- package/dist/schema/common/figure.js.map +1 -0
- package/dist/schema/common/heading.d.ts +33 -0
- package/dist/schema/common/heading.d.ts.map +1 -0
- package/dist/schema/common/heading.js +41 -0
- package/dist/schema/common/heading.js.map +1 -0
- package/dist/schema/common/index.d.ts +11 -0
- package/dist/schema/common/index.d.ts.map +1 -0
- package/dist/schema/common/index.js +11 -0
- package/dist/schema/common/index.js.map +1 -0
- package/dist/schema/common/list.d.ts +83 -0
- package/dist/schema/common/list.d.ts.map +1 -0
- package/dist/schema/common/list.js +92 -0
- package/dist/schema/common/list.js.map +1 -0
- package/dist/schema/common/reference.d.ts +78 -0
- package/dist/schema/common/reference.d.ts.map +1 -0
- package/dist/schema/common/reference.js +97 -0
- package/dist/schema/common/reference.js.map +1 -0
- package/dist/schema/common/table.d.ts +92 -0
- package/dist/schema/common/table.d.ts.map +1 -0
- package/dist/schema/common/table.js +85 -0
- package/dist/schema/common/table.js.map +1 -0
- package/dist/schema/common/track.d.ts +131 -0
- package/dist/schema/common/track.d.ts.map +1 -0
- package/dist/schema/common/track.js +184 -0
- package/dist/schema/common/track.js.map +1 -0
- package/dist/schema/const.d.ts +3 -0
- package/dist/schema/const.d.ts.map +1 -0
- package/{src → dist}/schema/const.js +3 -3
- package/dist/schema/const.js.map +1 -0
- package/dist/schema/convert.d.ts +3 -0
- package/dist/schema/convert.d.ts.map +1 -0
- package/dist/schema/convert.js +1215 -0
- package/dist/schema/convert.js.map +1 -0
- package/dist/schema/document/content.d.ts +137 -0
- package/dist/schema/document/content.d.ts.map +1 -0
- package/dist/schema/document/content.js +177 -0
- package/dist/schema/document/content.js.map +1 -0
- package/dist/schema/document/index.d.ts +879 -0
- package/dist/schema/document/index.d.ts.map +1 -0
- package/dist/schema/document/index.js +68 -0
- package/dist/schema/document/index.js.map +1 -0
- package/dist/schema/document/structure.d.ts +273 -0
- package/dist/schema/document/structure.d.ts.map +1 -0
- package/dist/schema/document/structure.js +445 -0
- package/dist/schema/document/structure.js.map +1 -0
- package/dist/schema/export.d.ts +880 -0
- package/dist/schema/export.d.ts.map +1 -0
- package/dist/schema/export.js +16 -0
- package/dist/schema/export.js.map +1 -0
- package/dist/schema/footnotes.d.ts +499 -0
- package/dist/schema/footnotes.d.ts.map +1 -0
- package/dist/schema/footnotes.js +88 -0
- package/dist/schema/footnotes.js.map +1 -0
- package/dist/schema/footnotes_convert.d.ts +5 -0
- package/dist/schema/footnotes_convert.d.ts.map +1 -0
- package/dist/schema/footnotes_convert.js +26 -0
- package/dist/schema/footnotes_convert.js.map +1 -0
- package/dist/schema/i18n.d.ts +586 -0
- package/dist/schema/i18n.d.ts.map +1 -0
- package/dist/schema/i18n.js +585 -0
- package/dist/schema/i18n.js.map +1 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +6 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/mini_json.d.ts +5 -0
- package/dist/schema/mini_json.d.ts.map +1 -0
- package/dist/schema/mini_json.js +50 -0
- package/dist/schema/mini_json.js.map +1 -0
- package/dist/schema/text.d.ts +2 -0
- package/dist/schema/text.d.ts.map +1 -0
- package/dist/schema/text.js +23 -0
- package/dist/schema/text.js.map +1 -0
- package/dist/types.d.ts +122 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -16
- package/scripts/export-schema.js +1 -1
- package/src/exporter/tools/{file.js → file.ts} +1 -1
- package/src/exporter/tools/{json.js → json.ts} +30 -19
- package/src/global.d.ts +11 -0
- package/src/schema/const.ts +58 -0
- package/src/types.ts +136 -0
- package/jest.config.js +0 -24
- /package/src/{index.js → index.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mini_json.js","sourceRoot":"","sources":["../../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CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAA;AACjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/schema/text.js"],"names":[],"mappings":"AAAA,+DAqBC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function getNonDeletedTextContent(topNode) {
|
|
2
|
+
let text = "";
|
|
3
|
+
topNode.descendants(node => {
|
|
4
|
+
if (node.marks.find(mark => mark.type.name === "deletion") ||
|
|
5
|
+
(node.attrs &&
|
|
6
|
+
(node.attrs.track?.find(track => track.type === "deletion") ||
|
|
7
|
+
node.attrs.hidden))) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
else if (node.isBlock) {
|
|
11
|
+
text += "\n";
|
|
12
|
+
}
|
|
13
|
+
else if (node.isText) {
|
|
14
|
+
text += node.text;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return text
|
|
18
|
+
.replace(/(^\s*)|(\s*$)/gi, "")
|
|
19
|
+
.replace(/[ ]{2,}/gi, " ")
|
|
20
|
+
.replace(/\n /, "\n")
|
|
21
|
+
.replace(/\n{2,}/gi, "\n");
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/schema/text.js"],"names":[],"mappings":"AAAA,MAAM,UAAU,wBAAwB,CAAC,OAAO;IAC5C,IAAI,IAAI,GAAG,EAAE,CAAA;IACb,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;QACvB,IACI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;YACtD,CAAC,IAAI,CAAC,KAAK;gBACP,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;oBACvD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAC7B,CAAC;YACC,OAAM;QACV,CAAC;aAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACtB,IAAI,IAAI,IAAI,CAAA;QAChB,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACrB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAA;QACrB,CAAC;IACL,CAAC,CAAC,CAAA;IACF,OAAO,IAAI;SACN,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;SAC9B,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;SACzB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;SACpB,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types shared across the @fiduswriter/document package.
|
|
3
|
+
*
|
|
4
|
+
* These types describe the JSON-shaped document tree that Fidus Writer stores
|
|
5
|
+
* and exchanges with its importers/exporters. They intentionally mirror the
|
|
6
|
+
* ProseMirror schema while staying serialisable.
|
|
7
|
+
*/
|
|
8
|
+
/** A generic JSON value. */
|
|
9
|
+
export type JSONValue = string | number | boolean | null | JSONValue[] | {
|
|
10
|
+
[key: string]: JSONValue;
|
|
11
|
+
};
|
|
12
|
+
/** Attributes that every Fidus node may carry. */
|
|
13
|
+
export interface NodeAttrs {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
id?: string;
|
|
16
|
+
track?: Track[];
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** A tracked change entry attached to a node or mark. */
|
|
20
|
+
export interface Track {
|
|
21
|
+
type: "insertion" | "deletion" | "block_change";
|
|
22
|
+
user: number;
|
|
23
|
+
username: string;
|
|
24
|
+
date: number;
|
|
25
|
+
approved?: boolean;
|
|
26
|
+
before?: FidusNode;
|
|
27
|
+
}
|
|
28
|
+
/** A Fidus document mark (inline formatting or annotation). */
|
|
29
|
+
export interface FidusMark {
|
|
30
|
+
type: string;
|
|
31
|
+
attrs?: NodeAttrs;
|
|
32
|
+
}
|
|
33
|
+
/** A node in the Fidus document tree. */
|
|
34
|
+
export interface FidusNode {
|
|
35
|
+
type: string;
|
|
36
|
+
attrs?: NodeAttrs;
|
|
37
|
+
content?: FidusNode[];
|
|
38
|
+
marks?: FidusMark[];
|
|
39
|
+
text?: string;
|
|
40
|
+
}
|
|
41
|
+
/** Top-level document settings stored on the `doc` node. */
|
|
42
|
+
export interface DocSettings {
|
|
43
|
+
documentstyle?: string;
|
|
44
|
+
tracked?: boolean;
|
|
45
|
+
citationstyle?: string;
|
|
46
|
+
citationstyles?: string[];
|
|
47
|
+
language?: string;
|
|
48
|
+
languages?: string[];
|
|
49
|
+
papersize?: string;
|
|
50
|
+
papersizes?: string[];
|
|
51
|
+
footnote_marks?: string[];
|
|
52
|
+
footnote_elements?: string[];
|
|
53
|
+
bibliography_header?: FidusNode;
|
|
54
|
+
metadata?: Record<string, JSONValue>;
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
/** The root Fidus document node. */
|
|
58
|
+
export interface FidusDoc {
|
|
59
|
+
type: "doc";
|
|
60
|
+
attrs?: DocSettings;
|
|
61
|
+
content: FidusNode[];
|
|
62
|
+
}
|
|
63
|
+
/** A fully populated document object passed to exporters. */
|
|
64
|
+
export interface ExportDoc {
|
|
65
|
+
title: string;
|
|
66
|
+
path?: string;
|
|
67
|
+
content: FidusNode[];
|
|
68
|
+
settings: DocSettings;
|
|
69
|
+
comments?: Record<string, CommentData>;
|
|
70
|
+
version?: string;
|
|
71
|
+
}
|
|
72
|
+
/** A single comment thread. */
|
|
73
|
+
export interface CommentData {
|
|
74
|
+
id: number;
|
|
75
|
+
user: number;
|
|
76
|
+
username: string;
|
|
77
|
+
date: number;
|
|
78
|
+
resolved?: boolean;
|
|
79
|
+
comments: Array<{
|
|
80
|
+
user: number;
|
|
81
|
+
username: string;
|
|
82
|
+
date: number;
|
|
83
|
+
comment: string;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
/** A bibliographic database entry (format depends on the CSL engine). */
|
|
87
|
+
export interface BibDBEntry {
|
|
88
|
+
[key: string]: JSONValue | undefined;
|
|
89
|
+
}
|
|
90
|
+
export type BibDB = Record<string, BibDBEntry>;
|
|
91
|
+
/** An entry in the image database. */
|
|
92
|
+
export interface ImageDBEntry {
|
|
93
|
+
id: number;
|
|
94
|
+
title?: string;
|
|
95
|
+
file_type?: string;
|
|
96
|
+
image?: string | ArrayBuffer | Blob;
|
|
97
|
+
copyright?: Record<string, JSONValue>;
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
}
|
|
100
|
+
export type ImageDB = Record<string, ImageDBEntry>;
|
|
101
|
+
/** A CSL/CSL-M stylesheet reference. */
|
|
102
|
+
export interface CSL {
|
|
103
|
+
citationType?: string;
|
|
104
|
+
[key: string]: JSONValue | undefined;
|
|
105
|
+
}
|
|
106
|
+
/** Common constructor options for exporters. */
|
|
107
|
+
export interface ExporterOptions {
|
|
108
|
+
doc: ExportDoc;
|
|
109
|
+
templateUrl?: string;
|
|
110
|
+
bibDB?: BibDB;
|
|
111
|
+
imageDB?: ImageDB;
|
|
112
|
+
csl?: CSL;
|
|
113
|
+
}
|
|
114
|
+
/** JSON representation of a DOM node used by the native exporter. */
|
|
115
|
+
export interface NativeDomNode {
|
|
116
|
+
t?: string;
|
|
117
|
+
co?: string;
|
|
118
|
+
nn?: string;
|
|
119
|
+
a?: Array<[string, string]>;
|
|
120
|
+
c?: NativeDomNode[];
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings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
|
4
|
+
* These types describe the JSON-shaped document tree that Fidus Writer stores
|
|
5
|
+
* and exchanges with its importers/exporters. They intentionally mirror the
|
|
6
|
+
* ProseMirror schema while staying serialisable.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiduswriter/document",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"description": "Fidus Writer document schema, importers and exporters",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,20 +9,43 @@
|
|
|
9
9
|
"license": "AGPL-3.0",
|
|
10
10
|
"author": "Johannes Wilm",
|
|
11
11
|
"type": "module",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
12
14
|
"exports": {
|
|
13
|
-
".":
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"./
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./schema": {
|
|
20
|
+
"types": "./dist/schema/index.d.ts",
|
|
21
|
+
"default": "./dist/schema/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./schema/*": {
|
|
24
|
+
"types": "./dist/schema/*.d.ts",
|
|
25
|
+
"default": "./dist/schema/*.js"
|
|
26
|
+
},
|
|
27
|
+
"./importer/*": {
|
|
28
|
+
"types": "./dist/importer/*.d.ts",
|
|
29
|
+
"default": "./dist/importer/*.js"
|
|
30
|
+
},
|
|
31
|
+
"./exporter/*": {
|
|
32
|
+
"types": "./dist/exporter/*.d.ts",
|
|
33
|
+
"default": "./dist/exporter/*.js"
|
|
34
|
+
},
|
|
35
|
+
"./citations/*": {
|
|
36
|
+
"types": "./dist/citations/*.d.ts",
|
|
37
|
+
"default": "./dist/citations/*.js"
|
|
38
|
+
},
|
|
39
|
+
"./bibliography/*": {
|
|
40
|
+
"types": "./dist/bibliography/*.d.ts",
|
|
41
|
+
"default": "./dist/bibliography/*.js"
|
|
42
|
+
}
|
|
20
43
|
},
|
|
21
|
-
"main": "jest.config.js",
|
|
22
44
|
"directories": {
|
|
23
45
|
"test": "test"
|
|
24
46
|
},
|
|
25
47
|
"files": [
|
|
48
|
+
"dist/",
|
|
26
49
|
"src/",
|
|
27
50
|
"scripts/",
|
|
28
51
|
"schema.json",
|
|
@@ -30,17 +53,20 @@
|
|
|
30
53
|
"LICENSE"
|
|
31
54
|
],
|
|
32
55
|
"scripts": {
|
|
33
|
-
"build
|
|
34
|
-
"
|
|
35
|
-
"
|
|
56
|
+
"build": "tsc",
|
|
57
|
+
"build-schema": "tsx scripts/export-schema.js",
|
|
58
|
+
"prepare": "npm run build && npm run build-schema",
|
|
59
|
+
"prepublishOnly": "npm run build && npm run build-schema",
|
|
60
|
+
"typecheck": "tsc --noEmit",
|
|
36
61
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config jest.config.js"
|
|
37
62
|
},
|
|
38
63
|
"dependencies": {
|
|
39
|
-
"
|
|
64
|
+
"@vivliostyle/print": "^2.42.0",
|
|
40
65
|
"biblatex-csl-converter": "^3.0.0",
|
|
41
66
|
"downloadjs": "^1.4.7",
|
|
42
67
|
"fast-deep-equal": "^3.1.3",
|
|
43
68
|
"fast-xml-parser": "^4.5.0",
|
|
69
|
+
"fwtoolkit": "^0.1.1",
|
|
44
70
|
"jszip": "^3.10.1",
|
|
45
71
|
"mathlive": "^0.104.0",
|
|
46
72
|
"mathml-to-latex": "^1.4.3",
|
|
@@ -49,10 +75,16 @@
|
|
|
49
75
|
"pretty": "^2.0.0",
|
|
50
76
|
"prosemirror-model": "^1.25.0",
|
|
51
77
|
"prosemirror-schema-basic": "^1.2.4",
|
|
52
|
-
"prosemirror-tables": "^1.6.4"
|
|
53
|
-
"@vivliostyle/print": "^2.42.0"
|
|
78
|
+
"prosemirror-tables": "^1.6.4"
|
|
54
79
|
},
|
|
55
80
|
"devDependencies": {
|
|
56
|
-
"
|
|
81
|
+
"@types/node": "^26.0.1",
|
|
82
|
+
"@xmldom/xmldom": "^0.9.10",
|
|
83
|
+
"happy-dom": "^20.10.6",
|
|
84
|
+
"jest": "^29.7.0",
|
|
85
|
+
"ts-jest": "^29.4.11",
|
|
86
|
+
"ts-jest-resolver": "^2.0.1",
|
|
87
|
+
"tsx": "^4.22.4",
|
|
88
|
+
"typescript": "^6.0.3"
|
|
57
89
|
}
|
|
58
90
|
}
|
package/scripts/export-schema.js
CHANGED
|
@@ -4,7 +4,7 @@ import {writeFileSync} from "node:fs"
|
|
|
4
4
|
import {dirname, join} from "node:path"
|
|
5
5
|
import {fileURLToPath} from "node:url"
|
|
6
6
|
|
|
7
|
-
import {SchemaExport} from "../
|
|
7
|
+
import {SchemaExport} from "../dist/schema/export.js"
|
|
8
8
|
|
|
9
9
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
10
10
|
const outPath = join(__dirname, "..", "schema.json")
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type {NativeDomNode} from "../../types.js"
|
|
2
|
+
|
|
3
|
+
/** Same functionality as objToNode/nodeToObj in diffDOM.js, but also offers
|
|
4
|
+
* output in XHTML format (obj2Node) and without form support.
|
|
5
|
+
*/
|
|
6
|
+
export const obj2Node = (
|
|
7
|
+
obj: NativeDomNode | undefined,
|
|
8
|
+
docType?: "xhtml"
|
|
9
|
+
): Node | false => {
|
|
10
|
+
let parser: Document
|
|
4
11
|
if (obj === undefined) {
|
|
5
12
|
return false
|
|
6
13
|
}
|
|
@@ -10,28 +17,28 @@ export const obj2Node = (obj, docType) => {
|
|
|
10
17
|
parser = document
|
|
11
18
|
}
|
|
12
19
|
|
|
13
|
-
function inner(obj, insideSvg) {
|
|
14
|
-
let node
|
|
15
|
-
if (
|
|
16
|
-
node = parser.createTextNode(obj.t)
|
|
17
|
-
} else if (
|
|
18
|
-
node = parser.createComment(obj.co)
|
|
20
|
+
function inner(obj: NativeDomNode, insideSvg = false): Node {
|
|
21
|
+
let node: Node
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(obj, "t")) {
|
|
23
|
+
node = parser.createTextNode(obj.t as string)
|
|
24
|
+
} else if (Object.prototype.hasOwnProperty.call(obj, "co")) {
|
|
25
|
+
node = parser.createComment(obj.co as string)
|
|
19
26
|
} else {
|
|
20
27
|
if (obj.nn === "svg" || insideSvg) {
|
|
21
28
|
node = parser.createElementNS(
|
|
22
29
|
"http://www.w3.org/2000/svg",
|
|
23
|
-
obj.nn
|
|
30
|
+
obj.nn as string
|
|
24
31
|
)
|
|
25
32
|
insideSvg = true
|
|
26
33
|
} else if (obj.nn === "script") {
|
|
27
34
|
// Do not allow scripts
|
|
28
35
|
return parser.createTextNode("")
|
|
29
36
|
} else {
|
|
30
|
-
node = parser.createElement(obj.nn.toLowerCase())
|
|
37
|
+
node = parser.createElement((obj.nn as string).toLowerCase())
|
|
31
38
|
}
|
|
32
39
|
if (obj.a) {
|
|
33
40
|
for (let i = 0; i < obj.a.length; i++) {
|
|
34
|
-
node.setAttribute(obj.a[i][0], obj.a[i][1])
|
|
41
|
+
;(node as Element).setAttribute(obj.a[i][0], obj.a[i][1])
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
44
|
if (obj.c) {
|
|
@@ -45,19 +52,23 @@ export const obj2Node = (obj, docType) => {
|
|
|
45
52
|
return inner(obj)
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
export const node2Obj = node => {
|
|
49
|
-
const obj = {}
|
|
55
|
+
export const node2Obj = (node: Node): NativeDomNode => {
|
|
56
|
+
const obj: NativeDomNode = {}
|
|
50
57
|
|
|
51
58
|
if (node.nodeType === 3) {
|
|
52
|
-
obj.t = node.data
|
|
59
|
+
obj.t = (node as Text).data
|
|
53
60
|
} else if (node.nodeType === 8) {
|
|
54
|
-
obj.co = node.data
|
|
61
|
+
obj.co = (node as Comment).data
|
|
55
62
|
} else {
|
|
56
63
|
obj.nn = node.nodeName
|
|
57
|
-
|
|
64
|
+
const element = node as Element
|
|
65
|
+
if (element.attributes?.length > 0) {
|
|
58
66
|
obj.a = []
|
|
59
|
-
for (let i = 0; i <
|
|
60
|
-
obj.a.push([
|
|
67
|
+
for (let i = 0; i < element.attributes.length; i++) {
|
|
68
|
+
obj.a.push([
|
|
69
|
+
element.attributes[i].name,
|
|
70
|
+
element.attributes[i].value
|
|
71
|
+
])
|
|
61
72
|
}
|
|
62
73
|
}
|
|
63
74
|
if (node.childNodes?.length > 0) {
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global functions provided by Fidus Writer's runtime environment.
|
|
3
|
+
* These are injected by the Django JavaScript catalog and other runtime scripts.
|
|
4
|
+
*/
|
|
5
|
+
declare function gettext(msgid: string): string
|
|
6
|
+
|
|
7
|
+
declare function interpolate(
|
|
8
|
+
fmt: string,
|
|
9
|
+
args: Array<string | number>,
|
|
10
|
+
named?: boolean
|
|
11
|
+
): string
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const LANGUAGES: Array<[string, string, string]> = [
|
|
2
|
+
["af-ZA", gettext("Afrikaans"), "ltr"],
|
|
3
|
+
["sq-AL", gettext("Albanian"), "ltr"],
|
|
4
|
+
["ar", gettext("Arabic"), "rtl"],
|
|
5
|
+
["ast", gettext("Asturian"), "ltr"],
|
|
6
|
+
["be", gettext("Belarusian"), "ltr"],
|
|
7
|
+
["br", gettext("Breton"), "ltr"],
|
|
8
|
+
["bg", gettext("Bulgarian"), "ltr"],
|
|
9
|
+
["ca", gettext("Catalan"), "ltr"],
|
|
10
|
+
["ca-ES-Valencia", gettext("Catalan (Valencia)"), "ltr"],
|
|
11
|
+
["zh-CN", gettext("Chinese (Simplified)"), "ltr"],
|
|
12
|
+
["da", gettext("Danish"), "ltr"],
|
|
13
|
+
["nl", gettext("Dutch"), "ltr"],
|
|
14
|
+
["en-AU", gettext("English (Australia)"), "ltr"],
|
|
15
|
+
["en-CA", gettext("English (Canada)"), "ltr"],
|
|
16
|
+
["en-NZ", gettext("English (New Zealand)"), "ltr"],
|
|
17
|
+
["en-ZA", gettext("English (South Africa)"), "ltr"],
|
|
18
|
+
["en-GB", gettext("English (United Kingdom)"), "ltr"],
|
|
19
|
+
["en-US", gettext("English (United States)"), "ltr"],
|
|
20
|
+
["eo", gettext("Esperanto"), "ltr"],
|
|
21
|
+
["fr", gettext("French"), "ltr"],
|
|
22
|
+
["gl", gettext("Galician"), "ltr"],
|
|
23
|
+
["de-DE", gettext("German (Germany)"), "ltr"],
|
|
24
|
+
["de-AU", gettext("German (Austria)"), "ltr"],
|
|
25
|
+
["de-CH", gettext("German (Switzerland)"), "ltr"],
|
|
26
|
+
["el", gettext("Greek"), "ltr"],
|
|
27
|
+
["he", gettext("Hebrew"), "rtl"],
|
|
28
|
+
["is", gettext("Icelandic"), "ltr"],
|
|
29
|
+
["it", gettext("Italian"), "ltr"],
|
|
30
|
+
["ja", gettext("Japanese"), "ltr"],
|
|
31
|
+
["km", gettext("Khmer"), "ltr"],
|
|
32
|
+
["lt", gettext("Lithuanian"), "ltr"],
|
|
33
|
+
["ml", gettext("Malayalam"), "ltr"],
|
|
34
|
+
["nb-NO", gettext("Norwegian (bokmål)"), "ltr"],
|
|
35
|
+
["nn-NO", gettext("Norwegian (nynorsk)"), "ltr"],
|
|
36
|
+
["fa", gettext("Persian"), "rtl"],
|
|
37
|
+
["pl", gettext("Polish"), "ltr"],
|
|
38
|
+
["pt-BR", gettext("Portuguese (Brazil)"), "ltr"],
|
|
39
|
+
["pt-PT", gettext("Portuguese (Portugal)"), "ltr"],
|
|
40
|
+
["ro", gettext("Romanian"), "ltr"],
|
|
41
|
+
["ru", gettext("Russian"), "ltr"],
|
|
42
|
+
["tr", gettext("Turkish"), "ltr"],
|
|
43
|
+
["sr-SP-Cy", gettext("Serbian (Cyrillic)"), "ltr"],
|
|
44
|
+
["sr-SP-Lt", gettext("Serbian (Latin)"), "ltr"],
|
|
45
|
+
["sk", gettext("Slovak"), "ltr"],
|
|
46
|
+
["sl", gettext("Slovenian"), "ltr"],
|
|
47
|
+
["es", gettext("Spanish"), "ltr"],
|
|
48
|
+
["sv", gettext("Swedish"), "ltr"],
|
|
49
|
+
["ta", gettext("Tamil"), "ltr"],
|
|
50
|
+
["tl", gettext("Tagalog"), "ltr"],
|
|
51
|
+
["uk", gettext("Ukrainian"), "ltr"]
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
export const PAPER_SIZES: Array<[string, string]> = [
|
|
55
|
+
/* [Fidus Writer value, CSS value]*/
|
|
56
|
+
["A4", "A4"],
|
|
57
|
+
["US Letter", "letter"]
|
|
58
|
+
]
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types shared across the @fiduswriter/document package.
|
|
3
|
+
*
|
|
4
|
+
* These types describe the JSON-shaped document tree that Fidus Writer stores
|
|
5
|
+
* and exchanges with its importers/exporters. They intentionally mirror the
|
|
6
|
+
* ProseMirror schema while staying serialisable.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** A generic JSON value. */
|
|
10
|
+
export type JSONValue =
|
|
11
|
+
| string
|
|
12
|
+
| number
|
|
13
|
+
| boolean
|
|
14
|
+
| null
|
|
15
|
+
| JSONValue[]
|
|
16
|
+
| {[key: string]: JSONValue}
|
|
17
|
+
|
|
18
|
+
/** Attributes that every Fidus node may carry. */
|
|
19
|
+
export interface NodeAttrs {
|
|
20
|
+
[key: string]: unknown
|
|
21
|
+
id?: string
|
|
22
|
+
track?: Track[]
|
|
23
|
+
hidden?: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A tracked change entry attached to a node or mark. */
|
|
27
|
+
export interface Track {
|
|
28
|
+
type: "insertion" | "deletion" | "block_change"
|
|
29
|
+
user: number
|
|
30
|
+
username: string
|
|
31
|
+
date: number
|
|
32
|
+
approved?: boolean
|
|
33
|
+
before?: FidusNode
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A Fidus document mark (inline formatting or annotation). */
|
|
37
|
+
export interface FidusMark {
|
|
38
|
+
type: string
|
|
39
|
+
attrs?: NodeAttrs
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** A node in the Fidus document tree. */
|
|
43
|
+
export interface FidusNode {
|
|
44
|
+
type: string
|
|
45
|
+
attrs?: NodeAttrs
|
|
46
|
+
content?: FidusNode[]
|
|
47
|
+
marks?: FidusMark[]
|
|
48
|
+
text?: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Top-level document settings stored on the `doc` node. */
|
|
52
|
+
export interface DocSettings {
|
|
53
|
+
documentstyle?: string
|
|
54
|
+
tracked?: boolean
|
|
55
|
+
citationstyle?: string
|
|
56
|
+
citationstyles?: string[]
|
|
57
|
+
language?: string
|
|
58
|
+
languages?: string[]
|
|
59
|
+
papersize?: string
|
|
60
|
+
papersizes?: string[]
|
|
61
|
+
footnote_marks?: string[]
|
|
62
|
+
footnote_elements?: string[]
|
|
63
|
+
bibliography_header?: FidusNode
|
|
64
|
+
metadata?: Record<string, JSONValue>
|
|
65
|
+
[key: string]: unknown
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The root Fidus document node. */
|
|
69
|
+
export interface FidusDoc {
|
|
70
|
+
type: "doc"
|
|
71
|
+
attrs?: DocSettings
|
|
72
|
+
content: FidusNode[]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** A fully populated document object passed to exporters. */
|
|
76
|
+
export interface ExportDoc {
|
|
77
|
+
title: string
|
|
78
|
+
path?: string
|
|
79
|
+
content: FidusNode[]
|
|
80
|
+
settings: DocSettings
|
|
81
|
+
comments?: Record<string, CommentData>
|
|
82
|
+
version?: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** A single comment thread. */
|
|
86
|
+
export interface CommentData {
|
|
87
|
+
id: number
|
|
88
|
+
user: number
|
|
89
|
+
username: string
|
|
90
|
+
date: number
|
|
91
|
+
resolved?: boolean
|
|
92
|
+
comments: Array<{user: number; username: string; date: number; comment: string}>
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A bibliographic database entry (format depends on the CSL engine). */
|
|
96
|
+
export interface BibDBEntry {
|
|
97
|
+
[key: string]: JSONValue | undefined
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type BibDB = Record<string, BibDBEntry>
|
|
101
|
+
|
|
102
|
+
/** An entry in the image database. */
|
|
103
|
+
export interface ImageDBEntry {
|
|
104
|
+
id: number
|
|
105
|
+
title?: string
|
|
106
|
+
file_type?: string
|
|
107
|
+
image?: string | ArrayBuffer | Blob
|
|
108
|
+
copyright?: Record<string, JSONValue>
|
|
109
|
+
[key: string]: unknown
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type ImageDB = Record<string, ImageDBEntry>
|
|
113
|
+
|
|
114
|
+
/** A CSL/CSL-M stylesheet reference. */
|
|
115
|
+
export interface CSL {
|
|
116
|
+
citationType?: string
|
|
117
|
+
[key: string]: JSONValue | undefined
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Common constructor options for exporters. */
|
|
121
|
+
export interface ExporterOptions {
|
|
122
|
+
doc: ExportDoc
|
|
123
|
+
templateUrl?: string
|
|
124
|
+
bibDB?: BibDB
|
|
125
|
+
imageDB?: ImageDB
|
|
126
|
+
csl?: CSL
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** JSON representation of a DOM node used by the native exporter. */
|
|
130
|
+
export interface NativeDomNode {
|
|
131
|
+
t?: string
|
|
132
|
+
co?: string
|
|
133
|
+
nn?: string
|
|
134
|
+
a?: Array<[string, string]>
|
|
135
|
+
c?: NativeDomNode[]
|
|
136
|
+
}
|
package/jest.config.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
rootDir: ".",
|
|
3
|
-
testEnvironment: "node",
|
|
4
|
-
transform: {},
|
|
5
|
-
moduleDirectories: ["node_modules"],
|
|
6
|
-
moduleNameMapper: {
|
|
7
|
-
"^downloadjs$": "<rootDir>/test/exporter/mocks/downloadjs.js",
|
|
8
|
-
"^mathlive$": "<rootDir>/test/exporter/mocks/mathlive.js",
|
|
9
|
-
"^mathml2omml$": "<rootDir>/test/exporter/mocks/mathml2omml.js",
|
|
10
|
-
"^@vivliostyle/print$": "<rootDir>/test/exporter/mocks/vivliostyle.js",
|
|
11
|
-
"^pretty$": "<rootDir>/test/exporter/mocks/pretty.js",
|
|
12
|
-
"^biblatex-csl-converter$": "<rootDir>/test/exporter/mocks/biblatex-csl-converter.js",
|
|
13
|
-
"^jszip$": "<rootDir>/test/importer/mocks/jszip.js",
|
|
14
|
-
"^mathml-to-latex$": "<rootDir>/test/importer/mocks/mathml-to-latex.js",
|
|
15
|
-
"^fwtoolkit$": "<rootDir>/test/exporter/mocks/common.js",
|
|
16
|
-
"^fwtoolkit/.*": "<rootDir>/test/exporter/mocks/common.js",
|
|
17
|
-
"^@fiduswriter/document/citations/format$": "<rootDir>/test/exporter/mocks/citations-format.js",
|
|
18
|
-
"^@fiduswriter/document/bibliography/csl_bib$": "<rootDir>/test/exporter/mocks/csl-bib-schema.js",
|
|
19
|
-
"^@fiduswriter/document/mathlive/opf_includes$": "<rootDir>/test/exporter/mocks/empty-module.js"
|
|
20
|
-
},
|
|
21
|
-
testMatch: ["<rootDir>/test/**/*.test.js"],
|
|
22
|
-
setupFiles: ["<rootDir>/test/setup.js"],
|
|
23
|
-
moduleFileExtensions: ["js", "mjs", "json"]
|
|
24
|
-
}
|
|
File without changes
|