@lofcz/tikz 0.2.4 → 0.3.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/NOTICE.md +9 -0
- package/README.md +31 -8
- package/dist/THIRD_PARTY_LICENSES.txt +460 -0
- package/dist/browser-worker.js +132 -0
- package/dist/worker.js +26748 -0
- package/package.json +11 -4
- package/runtime/.build-key +1 -1
- package/runtime/dist/bundles/filesystem.json +1 -1
- package/runtime/dist/bundles/tikz-extra/.packages-key +1 -0
- package/runtime/dist/bundles/tikz-extra/chunks/0.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/1.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/2.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/3.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/4.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/5.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/6.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/7.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/8.br +0 -0
- package/runtime/dist/bundles/tikz-extra/chunks/9.br +0 -0
- package/runtime/dist/bundles/tikz-extra/files.index.json +1 -0
- package/runtime/dist/bundles/tikz-extra/manifest.json +1 -0
- package/runtime/dist/bundles-config.js +1 -1
- package/runtime/extra-packages.json +102 -0
- package/src/browser-worker.js +6 -5
- package/src/browser.js +1 -1
- package/src/bundled.js +6 -0
- package/src/deploy.js +7 -4
- package/src/index.js +1 -1
- package/src/recover.js +255 -0
- package/src/source.js +1226 -74
- package/src/tables.js +283 -0
- package/src/worker.js +8 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0d9b15728a0869f606ed81325ee72c73444ebf37dbf6b37f1e4c9d118088ec5c
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"tex/generic/xstring/xstring.sty":["chunks/0.br",0,123],"tex/generic/xstring/xstring.tex":["chunks/0.br",123,49397],"tex/latex/cancel/cancel.sty":["chunks/0.br",49520,7592],"tex/latex/carlisle/dotlessj.sty":["chunks/0.br",57112,3135],"tex/latex/carlisle/ltxtable.sty":["chunks/0.br",60247,3948],"tex/latex/carlisle/plain.sty":["chunks/0.br",64195,7732],"tex/latex/carlisle/remreset.sty":["chunks/0.br",71927,1374],"tex/latex/carlisle/scalefnt.sty":["chunks/0.br",73301,1360],"tex/latex/carlisle/slashed.sty":["chunks/0.br",74661,5327],"tex/latex/chemgreek/chemgreek.sty":["chunks/0.br",79988,47530],"tex/latex/elocalloc/elocalloc.sty":["chunks/0.br",127518,1428],"tex/latex/environ/environ.sty":["chunks/0.br",128946,4378],"tex/latex/etoolbox/etoolbox.def":["chunks/0.br",133324,2379],"tex/latex/etoolbox/etoolbox.sty":["chunks/0.br",135703,46885],"tex/latex/forest/forest-compat.sty":["chunks/0.br",182588,10205],"tex/latex/forest/forest-doc.sty":["chunks/0.br",192793,8576],"tex/latex/forest/forest-index.sty":["chunks/0.br",201369,16270],"tex/latex/forest/forest-lib-edges.sty":["chunks/0.br",217639,2255],"tex/latex/forest/forest-lib-linguistics.sty":["chunks/0.br",219894,4491],"tex/latex/forest/forest.sty":["chunks/1.br",0,350382],"tex/latex/inlinedef/inlinedef.sty":["chunks/1.br",350382,10102],"tex/latex/mhchem/hpstatement.inc/hpstatement-bg.inc.sty":["chunks/1.br",360484,97401],"tex/latex/mhchem/hpstatement.inc/hpstatement-cs.inc.sty":["chunks/2.br",0,85645],"tex/latex/mhchem/hpstatement.inc/hpstatement-da.inc.sty":["chunks/2.br",85645,79049],"tex/latex/mhchem/hpstatement.inc/hpstatement-de.inc.sty":["chunks/2.br",164694,94659],"tex/latex/mhchem/hpstatement.inc/hpstatement-el.inc.sty":["chunks/2.br",259353,100186],"tex/latex/mhchem/hpstatement.inc/hpstatement-en.inc.sty":["chunks/2.br",359539,84984],"tex/latex/mhchem/hpstatement.inc/hpstatement-es.inc.sty":["chunks/3.br",0,82629],"tex/latex/mhchem/hpstatement.inc/hpstatement-et.inc.sty":["chunks/3.br",82629,79468],"tex/latex/mhchem/hpstatement.inc/hpstatement-fi.inc.sty":["chunks/3.br",162097,81043],"tex/latex/mhchem/hpstatement.inc/hpstatement-fr.inc.sty":["chunks/3.br",243140,93867],"tex/latex/mhchem/hpstatement.inc/hpstatement-ga.inc.sty":["chunks/3.br",337007,67781],"tex/latex/mhchem/hpstatement.inc/hpstatement-hr.inc.sty":["chunks/3.br",404788,80993],"tex/latex/mhchem/hpstatement.inc/hpstatement-hu.inc.sty":["chunks/4.br",0,82489],"tex/latex/mhchem/hpstatement.inc/hpstatement-it.inc.sty":["chunks/4.br",82489,80803],"tex/latex/mhchem/hpstatement.inc/hpstatement-lt.inc.sty":["chunks/4.br",163292,80539],"tex/latex/mhchem/hpstatement.inc/hpstatement-lv.inc.sty":["chunks/4.br",243831,80567],"tex/latex/mhchem/hpstatement.inc/hpstatement-mt.inc.sty":["chunks/4.br",324398,81360],"tex/latex/mhchem/hpstatement.inc/hpstatement-nl.inc.sty":["chunks/4.br",405758,79034],"tex/latex/mhchem/hpstatement.inc/hpstatement-pl.inc.sty":["chunks/5.br",0,84102],"tex/latex/mhchem/hpstatement.inc/hpstatement-pt.inc.sty":["chunks/5.br",84102,82473],"tex/latex/mhchem/hpstatement.inc/hpstatement-ro.inc.sty":["chunks/5.br",166575,100832],"tex/latex/mhchem/hpstatement.inc/hpstatement-sk.inc.sty":["chunks/5.br",267407,83538],"tex/latex/mhchem/hpstatement.inc/hpstatement-sl.inc.sty":["chunks/5.br",350945,79755],"tex/latex/mhchem/hpstatement.inc/hpstatement-sv.inc.sty":["chunks/5.br",430700,79025],"tex/latex/mhchem/hpstatement.sty":["chunks/6.br",0,15670],"tex/latex/mhchem/mhchem.sty":["chunks/6.br",15670,133877],"tex/latex/mhchem/rsphrase.sty":["chunks/6.br",149547,142995],"tex/latex/pgf-pie/pgf-pie.sty":["chunks/6.br",292542,235],"tex/latex/pgf-pie/tikzlibrarypie.code.tex":["chunks/6.br",292777,14000],"tex/latex/pgfopts/pgfopts.sty":["chunks/6.br",306777,5540],"tex/latex/physics/physics.sty":["chunks/6.br",312317,29610],"tex/latex/siunitx/siunitx-abbreviations.cfg":["chunks/6.br",341927,4748],"tex/latex/siunitx/siunitx-binary.cfg":["chunks/6.br",346675,1729],"tex/latex/siunitx/siunitx-v2.sty":["chunks/7.br",0,273398],"tex/latex/siunitx/siunitx-version-1.cfg":["chunks/7.br",273398,31739],"tex/latex/siunitx/siunitx.sty":["chunks/8.br",0,344221],"tex/latex/smartdiagram/smartdiagram.sty":["chunks/8.br",344221,3308],"tex/latex/smartdiagram/smartdiagramlibraryadditions.code.tex":["chunks/8.br",347529,7181],"tex/latex/smartdiagram/smartdiagramlibrarycore.commands.code.tex":["chunks/8.br",354710,20826],"tex/latex/smartdiagram/smartdiagramlibrarycore.definitions.code.tex":["chunks/8.br",375536,13946],"tex/latex/smartdiagram/smartdiagramlibrarycore.styles.code.tex":["chunks/8.br",389482,5590],"tex/latex/tikz-qtree/pgfsubpic.sty":["chunks/8.br",395072,54],"tex/latex/tikz-qtree/pgfsubpic.tex":["chunks/8.br",395126,8570],"tex/latex/tikz-qtree/pgftree.sty":["chunks/8.br",403696,103],"tex/latex/tikz-qtree/pgftree.tex":["chunks/8.br",403799,7300],"tex/latex/tikz-qtree/tikz-qtree-compat.sty":["chunks/8.br",411099,2286],"tex/latex/tikz-qtree/tikz-qtree.sty":["chunks/8.br",413385,80],"tex/latex/tikz-qtree/tikz-qtree.tex":["chunks/8.br",413465,7407],"tex/latex/tkz-base/tkz-base.cfg":["chunks/8.br",420872,11218],"tex/latex/tkz-base/tkz-base.sty":["chunks/8.br",432090,3582],"tex/latex/tkz-base/tkz-lib-marks.tex":["chunks/8.br",435672,4368],"tex/latex/tkz-base/tkz-lib-shape.tex":["chunks/8.br",440040,1997],"tex/latex/tkz-base/tkz-obj-axes.tex":["chunks/8.br",442037,18266],"tex/latex/tkz-base/tkz-obj-grids.tex":["chunks/8.br",460303,3468],"tex/latex/tkz-base/tkz-obj-marks.tex":["chunks/8.br",463771,4906],"tex/latex/tkz-base/tkz-obj-points.tex":["chunks/8.br",468677,13315],"tex/latex/tkz-base/tkz-obj-rep.tex":["chunks/8.br",481992,2726],"tex/latex/tkz-base/tkz-tools-BB.tex":["chunks/8.br",484718,1218],"tex/latex/tkz-base/tkz-tools-arith.tex":["chunks/8.br",485936,6482],"tex/latex/tkz-base/tkz-tools-base.tex":["chunks/8.br",492418,3476],"tex/latex/tkz-base/tkz-tools-colors.tex":["chunks/8.br",495894,2258],"tex/latex/tkz-base/tkz-tools-misc.tex":["chunks/8.br",498152,3484],"tex/latex/tkz-base/tkz-tools-modules.tex":["chunks/8.br",501636,2744],"tex/latex/tkz-base/tkz-tools-print.tex":["chunks/8.br",504380,2705],"tex/latex/tkz-base/tkz-tools-text.tex":["chunks/8.br",507085,2980],"tex/latex/tkz-base/tkz-tools-utilities.tex":["chunks/8.br",510065,7780],"tex/latex/tkz-euclide/tkz-draw-eu-angles.tex":["chunks/9.br",0,10791],"tex/latex/tkz-euclide/tkz-draw-eu-arcs.tex":["chunks/9.br",10791,10969],"tex/latex/tkz-euclide/tkz-draw-eu-circles.tex":["chunks/9.br",21760,5299],"tex/latex/tkz-euclide/tkz-draw-eu-compass.tex":["chunks/9.br",27059,3437],"tex/latex/tkz-euclide/tkz-draw-eu-ellipses.tex":["chunks/9.br",30496,433],"tex/latex/tkz-euclide/tkz-draw-eu-lines.tex":["chunks/9.br",30929,9478],"tex/latex/tkz-euclide/tkz-draw-eu-points.tex":["chunks/9.br",40407,5842],"tex/latex/tkz-euclide/tkz-draw-eu-polygons.tex":["chunks/9.br",46249,3439],"tex/latex/tkz-euclide/tkz-draw-eu-protractor.tex":["chunks/9.br",49688,4118],"tex/latex/tkz-euclide/tkz-draw-eu-sectors.tex":["chunks/9.br",53806,11365],"tex/latex/tkz-euclide/tkz-draw-eu-show.tex":["chunks/9.br",65171,13716],"tex/latex/tkz-euclide/tkz-euclide.cfg":["chunks/9.br",78887,11253],"tex/latex/tkz-euclide/tkz-euclide.sty":["chunks/9.br",90140,7254],"tex/latex/tkz-euclide/tkz-lib-eu-marks.tex":["chunks/9.br",97394,3875],"tex/latex/tkz-euclide/tkz-lib-eu-shape.tex":["chunks/9.br",101269,1541],"tex/latex/tkz-euclide/tkz-obj-eu-axesmin.tex":["chunks/9.br",102810,6212],"tex/latex/tkz-euclide/tkz-obj-eu-circles-by.tex":["chunks/9.br",109022,6070],"tex/latex/tkz-euclide/tkz-obj-eu-circles.tex":["chunks/9.br",115092,8445],"tex/latex/tkz-euclide/tkz-obj-eu-grids.tex":["chunks/9.br",123537,2992],"tex/latex/tkz-euclide/tkz-obj-eu-lines.tex":["chunks/9.br",126529,9917],"tex/latex/tkz-euclide/tkz-obj-eu-lua-circles-by.tex":["chunks/9.br",136446,6092],"tex/latex/tkz-euclide/tkz-obj-eu-lua-circles.tex":["chunks/9.br",142538,8452],"tex/latex/tkz-euclide/tkz-obj-eu-lua-points-by.tex":["chunks/9.br",150990,17638],"tex/latex/tkz-euclide/tkz-obj-eu-lua-points-spc.tex":["chunks/9.br",168628,24543],"tex/latex/tkz-euclide/tkz-obj-eu-lua-points-with.tex":["chunks/9.br",193171,10200],"tex/latex/tkz-euclide/tkz-obj-eu-lua-points.tex":["chunks/9.br",203371,6026],"tex/latex/tkz-euclide/tkz-obj-eu-points-by.tex":["chunks/9.br",209397,17853],"tex/latex/tkz-euclide/tkz-obj-eu-points-rnd.tex":["chunks/9.br",227250,4838],"tex/latex/tkz-euclide/tkz-obj-eu-points-spc.tex":["chunks/9.br",232088,22641],"tex/latex/tkz-euclide/tkz-obj-eu-points-with.tex":["chunks/9.br",254729,10013],"tex/latex/tkz-euclide/tkz-obj-eu-points.tex":["chunks/9.br",264742,6308],"tex/latex/tkz-euclide/tkz-obj-eu-polygons.tex":["chunks/9.br",271050,3584],"tex/latex/tkz-euclide/tkz-obj-eu-triangles.tex":["chunks/9.br",274634,17130],"tex/latex/tkz-euclide/tkz-tools-eu-BB.tex":["chunks/9.br",291764,756],"tex/latex/tkz-euclide/tkz-tools-eu-angles.tex":["chunks/9.br",292520,2767],"tex/latex/tkz-euclide/tkz-tools-eu-base.tex":["chunks/9.br",295287,2988],"tex/latex/tkz-euclide/tkz-tools-eu-colors.tex":["chunks/9.br",298275,1790],"tex/latex/tkz-euclide/tkz-tools-eu-intersections.tex":["chunks/9.br",300065,17680],"tex/latex/tkz-euclide/tkz-tools-eu-lua-angles.tex":["chunks/9.br",317745,3887],"tex/latex/tkz-euclide/tkz-tools-eu-lua-base.tex":["chunks/9.br",321632,2987],"tex/latex/tkz-euclide/tkz-tools-eu-lua-intersections.tex":["chunks/9.br",324619,18533],"tex/latex/tkz-euclide/tkz-tools-eu-lua-math.tex":["chunks/9.br",343152,10579],"tex/latex/tkz-euclide/tkz-tools-eu-math.tex":["chunks/9.br",353731,8492],"tex/latex/tkz-euclide/tkz-tools-eu-modules.tex":["chunks/9.br",362223,2271],"tex/latex/tkz-euclide/tkz-tools-eu-text.tex":["chunks/9.br",364494,2482],"tex/latex/tkz-euclide/tkz-tools-eu-utilities.tex":["chunks/9.br",366976,5347],"tex/latex/trimspaces/trimspaces.sty":["chunks/9.br",372323,1380],"tex/latex/xpatch/xpatch.sty":["chunks/9.br",373703,8314]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"tikz-extra","version":"0d9b15728a0869f6","texlive":"2025","files":{"tex/generic/xstring/xstring.sty":{"size":123,"sha":"6b2fdbe2c3a1f873"},"tex/generic/xstring/xstring.tex":{"size":49397,"sha":"5cfb52e795a80a1e"},"tex/latex/cancel/cancel.sty":{"size":7592,"sha":"7fa59d66a2f272b7"},"tex/latex/carlisle/dotlessj.sty":{"size":3135,"sha":"fe66f42bb0a7090f"},"tex/latex/carlisle/ltxtable.sty":{"size":3948,"sha":"5289985ee58b1765"},"tex/latex/carlisle/plain.sty":{"size":7732,"sha":"a4e5d8893bcf42ef"},"tex/latex/carlisle/remreset.sty":{"size":1374,"sha":"b7e9851fd26d7e01"},"tex/latex/carlisle/scalefnt.sty":{"size":1360,"sha":"fbf28cb0d4589c8e"},"tex/latex/carlisle/slashed.sty":{"size":5327,"sha":"5f85b334ca5b82f5"},"tex/latex/chemgreek/chemgreek.sty":{"size":47530,"sha":"76e6544581be92c0"},"tex/latex/elocalloc/elocalloc.sty":{"size":1428,"sha":"586998a195b9bbea"},"tex/latex/environ/environ.sty":{"size":4378,"sha":"2efd7043a5a2ec8d"},"tex/latex/etoolbox/etoolbox.def":{"size":2379,"sha":"bf126728dcf64480"},"tex/latex/etoolbox/etoolbox.sty":{"size":46885,"sha":"e48026fcea59b490"},"tex/latex/forest/forest-compat.sty":{"size":10205,"sha":"39390595e0b9a3c8"},"tex/latex/forest/forest-doc.sty":{"size":8576,"sha":"6bf834eae47db5e7"},"tex/latex/forest/forest-index.sty":{"size":16270,"sha":"992c2ab7ffd0fd60"},"tex/latex/forest/forest-lib-edges.sty":{"size":2255,"sha":"4f62d58df831a324"},"tex/latex/forest/forest-lib-linguistics.sty":{"size":4491,"sha":"52880cb63fc8f815"},"tex/latex/forest/forest.sty":{"size":350382,"sha":"d76fb1da47f5a92e"},"tex/latex/inlinedef/inlinedef.sty":{"size":10102,"sha":"ffa9a672e5fac942"},"tex/latex/mhchem/hpstatement.inc/hpstatement-bg.inc.sty":{"size":97401,"sha":"c34f5f55fa279bdc"},"tex/latex/mhchem/hpstatement.inc/hpstatement-cs.inc.sty":{"size":85645,"sha":"12aa9bf6cf1ef56c"},"tex/latex/mhchem/hpstatement.inc/hpstatement-da.inc.sty":{"size":79049,"sha":"5c84aa3177f82d2d"},"tex/latex/mhchem/hpstatement.inc/hpstatement-de.inc.sty":{"size":94659,"sha":"dd8fb71ae06daa19"},"tex/latex/mhchem/hpstatement.inc/hpstatement-el.inc.sty":{"size":100186,"sha":"b928b7c07ac38718"},"tex/latex/mhchem/hpstatement.inc/hpstatement-en.inc.sty":{"size":84984,"sha":"474aa503e016d632"},"tex/latex/mhchem/hpstatement.inc/hpstatement-es.inc.sty":{"size":82629,"sha":"616e64ef76deb6e3"},"tex/latex/mhchem/hpstatement.inc/hpstatement-et.inc.sty":{"size":79468,"sha":"410305229339adbe"},"tex/latex/mhchem/hpstatement.inc/hpstatement-fi.inc.sty":{"size":81043,"sha":"490ed0835f46e7ad"},"tex/latex/mhchem/hpstatement.inc/hpstatement-fr.inc.sty":{"size":93867,"sha":"593fe174709a536a"},"tex/latex/mhchem/hpstatement.inc/hpstatement-ga.inc.sty":{"size":67781,"sha":"41a9e329cbe1921b"},"tex/latex/mhchem/hpstatement.inc/hpstatement-hr.inc.sty":{"size":80993,"sha":"50eb2b6e7424afba"},"tex/latex/mhchem/hpstatement.inc/hpstatement-hu.inc.sty":{"size":82489,"sha":"5632c0c74e5106f9"},"tex/latex/mhchem/hpstatement.inc/hpstatement-it.inc.sty":{"size":80803,"sha":"76639c5d61f53e08"},"tex/latex/mhchem/hpstatement.inc/hpstatement-lt.inc.sty":{"size":80539,"sha":"8eeca04597f288b3"},"tex/latex/mhchem/hpstatement.inc/hpstatement-lv.inc.sty":{"size":80567,"sha":"a5d40d2331d3cce9"},"tex/latex/mhchem/hpstatement.inc/hpstatement-mt.inc.sty":{"size":81360,"sha":"3907b5cdc2091210"},"tex/latex/mhchem/hpstatement.inc/hpstatement-nl.inc.sty":{"size":79034,"sha":"b35489a1e0f2251e"},"tex/latex/mhchem/hpstatement.inc/hpstatement-pl.inc.sty":{"size":84102,"sha":"f3aaa22eef5c256b"},"tex/latex/mhchem/hpstatement.inc/hpstatement-pt.inc.sty":{"size":82473,"sha":"d68542f60da4d942"},"tex/latex/mhchem/hpstatement.inc/hpstatement-ro.inc.sty":{"size":100832,"sha":"4985e3e367d108f0"},"tex/latex/mhchem/hpstatement.inc/hpstatement-sk.inc.sty":{"size":83538,"sha":"48fe217821ce14f6"},"tex/latex/mhchem/hpstatement.inc/hpstatement-sl.inc.sty":{"size":79755,"sha":"c4d09d4466940d5b"},"tex/latex/mhchem/hpstatement.inc/hpstatement-sv.inc.sty":{"size":79025,"sha":"468ca3a8dea74025"},"tex/latex/mhchem/hpstatement.sty":{"size":15670,"sha":"8b1a74b87e543506"},"tex/latex/mhchem/mhchem.sty":{"size":133877,"sha":"ab1e2c5a3dae5735"},"tex/latex/mhchem/rsphrase.sty":{"size":142995,"sha":"c0d79d0c42495b60"},"tex/latex/pgf-pie/pgf-pie.sty":{"size":235,"sha":"853145e186c50475"},"tex/latex/pgf-pie/tikzlibrarypie.code.tex":{"size":14000,"sha":"b979dfbffb2eb878"},"tex/latex/pgfopts/pgfopts.sty":{"size":5540,"sha":"8aa0cf8d9635876f"},"tex/latex/physics/physics.sty":{"size":29610,"sha":"56e7713ae66810ce"},"tex/latex/siunitx/siunitx-abbreviations.cfg":{"size":4748,"sha":"526bb8393497ad31"},"tex/latex/siunitx/siunitx-binary.cfg":{"size":1729,"sha":"ff0d94b367bdc4ad"},"tex/latex/siunitx/siunitx-v2.sty":{"size":273398,"sha":"b34c55155caee9da"},"tex/latex/siunitx/siunitx-version-1.cfg":{"size":31739,"sha":"6a92987c4168efb1"},"tex/latex/siunitx/siunitx.sty":{"size":344221,"sha":"a27b92e649d44293"},"tex/latex/smartdiagram/smartdiagram.sty":{"size":3308,"sha":"77570fc29a9b2600"},"tex/latex/smartdiagram/smartdiagramlibraryadditions.code.tex":{"size":7181,"sha":"c8c1ea5cf4a70b02"},"tex/latex/smartdiagram/smartdiagramlibrarycore.commands.code.tex":{"size":20826,"sha":"2b9d2c4e17c7ac5f"},"tex/latex/smartdiagram/smartdiagramlibrarycore.definitions.code.tex":{"size":13946,"sha":"69c54c874a01a128"},"tex/latex/smartdiagram/smartdiagramlibrarycore.styles.code.tex":{"size":5590,"sha":"0a15c8d02851cd74"},"tex/latex/tikz-qtree/pgfsubpic.sty":{"size":54,"sha":"bb98e34dd95b078d"},"tex/latex/tikz-qtree/pgfsubpic.tex":{"size":8570,"sha":"e83398c836031d9b"},"tex/latex/tikz-qtree/pgftree.sty":{"size":103,"sha":"8f816e57e992f4f9"},"tex/latex/tikz-qtree/pgftree.tex":{"size":7300,"sha":"b07316f4cca9d536"},"tex/latex/tikz-qtree/tikz-qtree-compat.sty":{"size":2286,"sha":"495f0425133434da"},"tex/latex/tikz-qtree/tikz-qtree.sty":{"size":80,"sha":"af6c183be7dddb00"},"tex/latex/tikz-qtree/tikz-qtree.tex":{"size":7407,"sha":"b9b643cd5089ea14"},"tex/latex/tkz-base/tkz-base.cfg":{"size":11218,"sha":"6b5d5d0add18f7ba"},"tex/latex/tkz-base/tkz-base.sty":{"size":3582,"sha":"de796b7964c00c9b"},"tex/latex/tkz-base/tkz-lib-marks.tex":{"size":4368,"sha":"4c773d6237f5374d"},"tex/latex/tkz-base/tkz-lib-shape.tex":{"size":1997,"sha":"8eea264a36cf5ea5"},"tex/latex/tkz-base/tkz-obj-axes.tex":{"size":18266,"sha":"2ff36dc9f8bd879d"},"tex/latex/tkz-base/tkz-obj-grids.tex":{"size":3468,"sha":"657e0332f4124db0"},"tex/latex/tkz-base/tkz-obj-marks.tex":{"size":4906,"sha":"1eafa6150016423c"},"tex/latex/tkz-base/tkz-obj-points.tex":{"size":13315,"sha":"61f542317438ff60"},"tex/latex/tkz-base/tkz-obj-rep.tex":{"size":2726,"sha":"0385fd2b0798be72"},"tex/latex/tkz-base/tkz-tools-arith.tex":{"size":6482,"sha":"2abe8121fd4c9d8d"},"tex/latex/tkz-base/tkz-tools-base.tex":{"size":3476,"sha":"708847fb30e1fb56"},"tex/latex/tkz-base/tkz-tools-BB.tex":{"size":1218,"sha":"82d396d5b366f138"},"tex/latex/tkz-base/tkz-tools-colors.tex":{"size":2258,"sha":"f1858da1a2bca870"},"tex/latex/tkz-base/tkz-tools-misc.tex":{"size":3484,"sha":"91aa739e124bf834"},"tex/latex/tkz-base/tkz-tools-modules.tex":{"size":2744,"sha":"a1ffd504f5c56422"},"tex/latex/tkz-base/tkz-tools-print.tex":{"size":2705,"sha":"228538b47fb9b67c"},"tex/latex/tkz-base/tkz-tools-text.tex":{"size":2980,"sha":"7bb7ae1d10095430"},"tex/latex/tkz-base/tkz-tools-utilities.tex":{"size":7780,"sha":"2d3df5a61d07accb"},"tex/latex/tkz-euclide/tkz-draw-eu-angles.tex":{"size":10791,"sha":"2cce516a2a47b909"},"tex/latex/tkz-euclide/tkz-draw-eu-arcs.tex":{"size":10969,"sha":"7df81526319bf2e9"},"tex/latex/tkz-euclide/tkz-draw-eu-circles.tex":{"size":5299,"sha":"76055123831e619d"},"tex/latex/tkz-euclide/tkz-draw-eu-compass.tex":{"size":3437,"sha":"78fade4b684e711b"},"tex/latex/tkz-euclide/tkz-draw-eu-ellipses.tex":{"size":433,"sha":"d7921e1277b61d05"},"tex/latex/tkz-euclide/tkz-draw-eu-lines.tex":{"size":9478,"sha":"37440922536baf58"},"tex/latex/tkz-euclide/tkz-draw-eu-points.tex":{"size":5842,"sha":"12d99a0ed54b0361"},"tex/latex/tkz-euclide/tkz-draw-eu-polygons.tex":{"size":3439,"sha":"698a754e0a2d47ce"},"tex/latex/tkz-euclide/tkz-draw-eu-protractor.tex":{"size":4118,"sha":"285de72d3f6c538f"},"tex/latex/tkz-euclide/tkz-draw-eu-sectors.tex":{"size":11365,"sha":"a17fcf331f4c15a8"},"tex/latex/tkz-euclide/tkz-draw-eu-show.tex":{"size":13716,"sha":"11f5eec56376a7b9"},"tex/latex/tkz-euclide/tkz-euclide.cfg":{"size":11253,"sha":"e9e7fac49a7faa3c"},"tex/latex/tkz-euclide/tkz-euclide.sty":{"size":7254,"sha":"696fef2c3030f103"},"tex/latex/tkz-euclide/tkz-lib-eu-marks.tex":{"size":3875,"sha":"03a17b4c10412f8d"},"tex/latex/tkz-euclide/tkz-lib-eu-shape.tex":{"size":1541,"sha":"6b2359d64fd8dd53"},"tex/latex/tkz-euclide/tkz-obj-eu-axesmin.tex":{"size":6212,"sha":"02fb08fd70c3c412"},"tex/latex/tkz-euclide/tkz-obj-eu-circles-by.tex":{"size":6070,"sha":"e676e6d525e957cf"},"tex/latex/tkz-euclide/tkz-obj-eu-circles.tex":{"size":8445,"sha":"98723178d6b51196"},"tex/latex/tkz-euclide/tkz-obj-eu-grids.tex":{"size":2992,"sha":"043a8d656d5e97cb"},"tex/latex/tkz-euclide/tkz-obj-eu-lines.tex":{"size":9917,"sha":"e4477c41008a309c"},"tex/latex/tkz-euclide/tkz-obj-eu-lua-circles-by.tex":{"size":6092,"sha":"3dcde7a3310f1988"},"tex/latex/tkz-euclide/tkz-obj-eu-lua-circles.tex":{"size":8452,"sha":"3ee7cb12630a985d"},"tex/latex/tkz-euclide/tkz-obj-eu-lua-points-by.tex":{"size":17638,"sha":"982553bad0bfd545"},"tex/latex/tkz-euclide/tkz-obj-eu-lua-points-spc.tex":{"size":24543,"sha":"6ed797ac7f93defa"},"tex/latex/tkz-euclide/tkz-obj-eu-lua-points-with.tex":{"size":10200,"sha":"115b12ce3935b3d2"},"tex/latex/tkz-euclide/tkz-obj-eu-lua-points.tex":{"size":6026,"sha":"2307cee60de363cb"},"tex/latex/tkz-euclide/tkz-obj-eu-points-by.tex":{"size":17853,"sha":"20bd9d189b434595"},"tex/latex/tkz-euclide/tkz-obj-eu-points-rnd.tex":{"size":4838,"sha":"6b769d85827bb057"},"tex/latex/tkz-euclide/tkz-obj-eu-points-spc.tex":{"size":22641,"sha":"3600366d6c166f59"},"tex/latex/tkz-euclide/tkz-obj-eu-points-with.tex":{"size":10013,"sha":"e08450dfdd3dab21"},"tex/latex/tkz-euclide/tkz-obj-eu-points.tex":{"size":6308,"sha":"73c874f05e791023"},"tex/latex/tkz-euclide/tkz-obj-eu-polygons.tex":{"size":3584,"sha":"b03fc8a569eca083"},"tex/latex/tkz-euclide/tkz-obj-eu-triangles.tex":{"size":17130,"sha":"31eae98f4bd0e6b6"},"tex/latex/tkz-euclide/tkz-tools-eu-angles.tex":{"size":2767,"sha":"9b263ef0e25fde79"},"tex/latex/tkz-euclide/tkz-tools-eu-base.tex":{"size":2988,"sha":"bd47c7b691001715"},"tex/latex/tkz-euclide/tkz-tools-eu-BB.tex":{"size":756,"sha":"89d4c9b40cd2ae6c"},"tex/latex/tkz-euclide/tkz-tools-eu-colors.tex":{"size":1790,"sha":"b2f9a7ce91a70bdd"},"tex/latex/tkz-euclide/tkz-tools-eu-intersections.tex":{"size":17680,"sha":"41aa4e276e058017"},"tex/latex/tkz-euclide/tkz-tools-eu-lua-angles.tex":{"size":3887,"sha":"acfa58bcc824337f"},"tex/latex/tkz-euclide/tkz-tools-eu-lua-base.tex":{"size":2987,"sha":"ffa254efd1c13fce"},"tex/latex/tkz-euclide/tkz-tools-eu-lua-intersections.tex":{"size":18533,"sha":"2edd1ae9b4af429b"},"tex/latex/tkz-euclide/tkz-tools-eu-lua-math.tex":{"size":10579,"sha":"c4e7d7685ec5d6fa"},"tex/latex/tkz-euclide/tkz-tools-eu-math.tex":{"size":8492,"sha":"6dd5eafe0d51143a"},"tex/latex/tkz-euclide/tkz-tools-eu-modules.tex":{"size":2271,"sha":"84faa4843183e139"},"tex/latex/tkz-euclide/tkz-tools-eu-text.tex":{"size":2482,"sha":"254b67874c1070db"},"tex/latex/tkz-euclide/tkz-tools-eu-utilities.tex":{"size":5347,"sha":"2f32ee2a2940b387"},"tex/latex/trimspaces/trimspaces.sty":{"size":1380,"sha":"8e9907a5787d1193"},"tex/latex/xpatch/xpatch.sty":{"size":8314,"sha":"1ef00dcd1657efdc"}},"dirs":["tex","tex/generic","tex/generic/xstring","tex/latex","tex/latex/cancel","tex/latex/carlisle","tex/latex/chemgreek","tex/latex/elocalloc","tex/latex/environ","tex/latex/etoolbox","tex/latex/forest","tex/latex/inlinedef","tex/latex/mhchem","tex/latex/mhchem/hpstatement.inc","tex/latex/pgf-pie","tex/latex/pgfopts","tex/latex/physics","tex/latex/siunitx","tex/latex/smartdiagram","tex/latex/tikz-qtree","tex/latex/tkz-base","tex/latex/tkz-euclide","tex/latex/trimspaces","tex/latex/xpatch"],"storage":"brotli-chunks-v1","filesystemKey":"a3c1d3e65dcb91f932f94e44ab8dedd38cbee3466228a0441056a406205588a6"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// Latin Modern text family, and one for the maths font (unicode-math):
|
|
8
8
|
// MetaPost.create({ bundles: [...DEFAULT_BUNDLES, 'opentype'] })
|
|
9
9
|
// MetaPost.create({ bundles: [...DEFAULT_BUNDLES, 'opentype', 'otf-fonts'] })
|
|
10
|
-
export const DEFAULT_BUNDLES = ['core', 'cm-tfm', 'cm-type1', 'lm-fonts', 'ps-fonts', 'tex-plain', 'latex-core', 'latex-extra', 'tikz-snapshot', 'luatex'];
|
|
10
|
+
export const DEFAULT_BUNDLES = ['core', 'cm-tfm', 'cm-type1', 'lm-fonts', 'ps-fonts', 'tex-plain', 'latex-core', 'latex-extra', 'tikz-snapshot', 'luatex', 'tikz-extra'];
|
|
11
11
|
export function resolveBundleSpecs(bundles, base) {
|
|
12
12
|
if (!base.endsWith('/'))
|
|
13
13
|
base += '/';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "tkz-euclide",
|
|
4
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/tkz-euclide.tar.xz",
|
|
5
|
+
"sha256": "33a6a1796099a1557c9441346763a7a22c6f81604b039b0ce92cc28468f73d1e"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "tkz-base",
|
|
9
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/tkz-base.tar.xz",
|
|
10
|
+
"sha256": "12c0a36b36259cbf1045f07f6d5b335ce8a20023bd775ea5c19fda16a571e1b3"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "siunitx",
|
|
14
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/siunitx.tar.xz",
|
|
15
|
+
"sha256": "4d086f43a39f82d5281ec7bdf45ea1d8e274910a9f46dda44c90424cde020076"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "pgf-pie",
|
|
19
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/pgf-pie.tar.xz",
|
|
20
|
+
"sha256": "9e86c0ecdb260bb02d38a0078f2208ef9d285a624da70c7e12f583600106ebea"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "tikz-qtree",
|
|
24
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/tikz-qtree.tar.xz",
|
|
25
|
+
"sha256": "9126513993d5f61e8cf2b97b58dc39c14d1b0452386bf504b529b6e2d41bd6ae"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "forest",
|
|
29
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/forest.tar.xz",
|
|
30
|
+
"sha256": "cb0c9e112301fb9bdd35b9322fe12ac7217af30799dd7352de250cd076568097"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "pgfopts",
|
|
34
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/pgfopts.tar.xz",
|
|
35
|
+
"sha256": "a75a8f4700be214cadf02e269bea91d4f935c6b149a4f27ca6780d5319c71153"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "etoolbox",
|
|
39
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/etoolbox.tar.xz",
|
|
40
|
+
"sha256": "12977cb9635da42257ad2b984b5bf8b7c2542ab70a6353dbfef47a61dc9ed7af"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "elocalloc",
|
|
44
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/elocalloc.tar.xz",
|
|
45
|
+
"sha256": "022b91cb41e49670d030704e07d3223b0ff60756269c3c83ea386a30fd66b153"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "environ",
|
|
49
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/environ.tar.xz",
|
|
50
|
+
"sha256": "752b2b4e2dcb0630e0fcb25e9fdc95e6acf93b292dd0b0398eb2ba2e83988475"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "trimspaces",
|
|
54
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/trimspaces.tar.xz",
|
|
55
|
+
"sha256": "7fef322711a6d50b787a3db74f639256a63ccdf67a89aefbfb8c3377ad053d1b"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "inlinedef",
|
|
59
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/inlinedef.tar.xz",
|
|
60
|
+
"sha256": "6c45a584c413e7f6d0255749e3001b1d11c4ea08f1b0d655717e4c901c7418ef"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "smartdiagram",
|
|
64
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/smartdiagram.tar.xz",
|
|
65
|
+
"sha256": "2795a15408427a989b8cd031c37360fa68ab4f2a21be3cb422d2a5bedd357095"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "xstring",
|
|
69
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/xstring.tar.xz",
|
|
70
|
+
"sha256": "02f71cefc2bc50481f6aac7ef2faf60eeb6656cc19f9dff000e8f559b5635e85"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "mhchem",
|
|
74
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/mhchem.tar.xz",
|
|
75
|
+
"sha256": "8470ea93def54cc9ab86d9792a4c2991934803de8f79df98466d77943360e200"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "chemgreek",
|
|
79
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/chemgreek.tar.xz",
|
|
80
|
+
"sha256": "316a61d7410a564026973bd895d9bcb6dda5cbd61a8497f54831170814c1a0d8"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "cancel",
|
|
84
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/cancel.tar.xz",
|
|
85
|
+
"sha256": "cafcfd7cd2474146d44c56d14bf075acf59c5745d0cafe09e873c0bb36f79c64"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "physics",
|
|
89
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/physics.tar.xz",
|
|
90
|
+
"sha256": "f68d3c7af9989d448e87e49525358c7b9ae0c32376e8f3e71be9c73b0bca040f"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "xpatch",
|
|
94
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/xpatch.tar.xz",
|
|
95
|
+
"sha256": "4c92477703e1ea016422bcab2cd355d9b05fee9e5981c30964bd90d8e83c6e95"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "carlisle",
|
|
99
|
+
"url": "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final/archive/carlisle.tar.xz",
|
|
100
|
+
"sha256": "5b93192b5e5ca7f41e23a1ec1ff2ef59d5d54fb158201d374cbea4f46c19cc9f"
|
|
101
|
+
}
|
|
102
|
+
]
|
package/src/browser-worker.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { MetaPost } from '../runtime/dist/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { describeTikzFailure, prepareTikzDocument } from './source.js';
|
|
3
3
|
|
|
4
4
|
try {
|
|
5
5
|
const engine = await MetaPost.create({ worker: false, lazy: true, snapshot: 'auto', logLevel: 'silent' });
|
|
6
6
|
self.onmessage = async ({ data: { source: code, maxOutputBytes } }) => {
|
|
7
7
|
try {
|
|
8
|
-
const
|
|
8
|
+
const prepared = prepareTikzDocument(code);
|
|
9
|
+
const result = await engine.latex(prepared.source, { engine: 'auto', fonts: 'paths' });
|
|
9
10
|
if (result.status === 'error' || result.status === 'fatal' || result.pages?.length !== 1)
|
|
10
|
-
throw new Error(
|
|
11
|
+
throw new Error(describeTikzFailure(result, prepared));
|
|
11
12
|
const svg = result.pages[0], bytes = new TextEncoder().encode(svg);
|
|
12
13
|
if (bytes.length > maxOutputBytes) throw new Error('TikZ output too large; simplify the picture.');
|
|
13
14
|
const dimensions = svg.match(/viewBox=['"]([^'"]+)['"]/)?.[1].trim().split(/[ ,]+/).map(Number);
|
|
@@ -16,7 +17,7 @@ try {
|
|
|
16
17
|
let binary = '';
|
|
17
18
|
for (let start = 0; start < bytes.length; start += 8192) binary += String.fromCharCode(...bytes.subarray(start, start + 8192));
|
|
18
19
|
self.postMessage({ image: { svg, width: dimensions[2], height: dimensions[3], dataUrl: `data:image/svg+xml;base64,${btoa(binary)}` } });
|
|
19
|
-
} catch (error) { self.postMessage({ error: String(error).slice(0, 3000) }); }
|
|
20
|
+
} catch (error) { self.postMessage({ error: String(error?.message ?? error).slice(0, 3000) }); }
|
|
20
21
|
};
|
|
21
22
|
self.postMessage({ ready: true });
|
|
22
|
-
} catch (error) { self.postMessage({ error: String(error).slice(0, 3000) }); }
|
|
23
|
+
} catch (error) { self.postMessage({ error: String(error?.message ?? error).slice(0, 3000) }); }
|
package/src/browser.js
CHANGED
|
@@ -29,7 +29,7 @@ export function createTikzRenderer(options) {
|
|
|
29
29
|
if (ready) { execute(); return; }
|
|
30
30
|
active.timer = setTimeout(() => finish(new Error('TikZ runtime loading timed out.')), loadTimeoutMs);
|
|
31
31
|
try {
|
|
32
|
-
worker = new Worker(new URL('
|
|
32
|
+
worker = new Worker(new URL('dist/browser-worker.js', new URL(assetBaseUrl, location.href)), { type: 'module', name: 'tikz' });
|
|
33
33
|
worker.onmessage = ({ data }) => {
|
|
34
34
|
if (data.ready) { ready = true; execute(); }
|
|
35
35
|
else if (data.error) finish(new Error(data.error));
|
package/src/bundled.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Generated by scripts/generate-bundled.mjs from runtime/dist/bundles — do not edit.
|
|
2
|
+
// What the bundled TeX tree can load; source normalization drops everything else.
|
|
3
|
+
export const BUNDLED_PACKAGES = new Set(["afterpage","alltt","amsbooka","amsbsy","amscd","amsfonts","amsgen","amsmath","amsmidx","amsopn","amssymb","amstex","amstext","amsthm","amsxtra","array","article","atbegshi","atbegshi-ltx","atveryend","atveryend-ltx","auxhook","avant","backref","bezier","bigintcalc","bitset","bm","book","bookman","booktabs","bugtracker","calc","cancel","chancery","charter","chemfig","chemgreek","circuitikz","cmmib57","color","courier","currfile","currfile-abspath","dcolumn","defpattern","delarray","doc","dotlessj","elocalloc","empheq","enumerate","environ","epsfig","epstopdf","epstopdf-base","etexcmds","etoolbox","eucal","eufrak","euscript","expl3","exscale","figureversions","filehook","filehook-2019","filehook-2020","filehook-fink","filehook-listings","filehook-ltx","filehook-memoir","filehook-scrlfile","fix-cm","fixltx2e","flafter","fleqn","fltrace","fontaxes","fontaxes-v1","fontenc","fontsmpl","forest","forest-compat","forest-doc","forest-index","forest-lib-edges","forest-lib-linguistics","fp","fp-addons","fp-basic","fp-eqn","fp-eval","fp-exp","fp-pas","fp-random","fp-snap","fp-trigo","fp-upn","ftnright","geometry","gettitlestring","graphics","graphicx","graphpap","grfext","helvet","hhline","hpstatement","hpstatement-bg.inc","hpstatement-cs.inc","hpstatement-da.inc","hpstatement-de.inc","hpstatement-el.inc","hpstatement-en.inc","hpstatement-es.inc","hpstatement-et.inc","hpstatement-fi.inc","hpstatement-fr.inc","hpstatement-ga.inc","hpstatement-hr.inc","hpstatement-hu.inc","hpstatement-it.inc","hpstatement-lt.inc","hpstatement-lv.inc","hpstatement-mt.inc","hpstatement-nl.inc","hpstatement-pl.inc","hpstatement-pt.inc","hpstatement-ro.inc","hpstatement-sk.inc","hpstatement-sl.inc","hpstatement-sv.inc","hycolor","hyperref","hyperref-patches","ifetex","ifluatex","ifpdf","iftex","ifthen","ifvtex","ifxetex","imakeidx","indentfirst","infwarerr","inlinedef","inputenc","intcalc","keyval","kvdefinekeys","kvoptions","kvoptions-patch","kvsetkeys","l3keys2e","l3sys-query","latexrelease","latexsym","layout","leqno","letltxmacro","letter","lfp","listings","lmodern","longtable","lscape","lstdoc","lstlang1","lstlang2","lstlang3","lstmisc","lstpatch","ltxcmds","ltxtable","luatex85","makeidx","mathpazo","mathpple","mathptm","mathptmx","mathtools","mhchem","mhsetup","minitoc-hyper","multicol","nameref","newcent","newlfont","nohyperref","ntheorem-hyper","oldlfont","openbib","palatino","pdfescape","pdftexcmds","pgf","pgf-filehook","pgf-pie","pgfarrows","pgfautomata","pgfbaseimage","pgfbaselayers","pgfbasematrix","pgfbasepatterns","pgfbaseplot","pgfbaseshapes","pgfbasesnakes","pgfcalendar","pgfcomp-version-0-65","pgfcomp-version-1-18","pgfcore","pgffor","pgfheaps","pgfkeys","pgflibraryarrows","pgflibraryautomata","pgflibraryplothandlers","pgflibraryplotmarks","pgflibraryshapes","pgflibrarysnakes","pgflibrarytikzbackgrounds","pgflibrarytikztrees","pgfmanual","pgfmath","pgfnodes","pgfopts","pgfpages","pgfparser","pgfpict2e","pgfplots","pgfplots.assert","pgfplotsoldpgfsupp_tikzexternal","pgfplotstable","pgfrcs","pgfregressiontest","pgfshade","pgfsubpic","pgfsys","pgftree","physics","pifont","plain","preview","proc","pst-xkey","rawfonts","refcount","remreset","report","rerunfilecheck","rotating","rsphrase","scalefnt","shellesc","shortvrb","showidx","showkeys","simplekv","siunitx","siunitx-v2","slashed","slides","smartdiagram","somedefs","spath3","standalone","stringenc","structuredlog","syntonly","t1enc","tabularx","textcomp","thb","thc","thcb","theorem","thm","thmb","thp","tikz","tikz-3dplot","tikz-cd","tikz-qtree","tikz-qtree-compat","tikzexternal","times","tkz-base","tkz-euclide","todonotes","trace","tracefnt","trig","trimspaces","underscore-ltx","uniquecounter","upref","url","utopia","varioref","varwidth","verbatim","xcolor","xcolor-patch","xfp","xkeyval","xkvltxp","xkvview","xparse","xpatch","xr","xr-hyper","xspace","xstring","xtemplate","xxcolor"]);
|
|
4
|
+
export const BUNDLED_CLASSES = new Set(["amsart","amsbook","amsdtx","amsldoc","amsproc","article","book","l3doc","letter","ltnews","ltxdoc","ltxguide","minimal","proc","report","slides","source2edoc","standalone"]);
|
|
5
|
+
export const BUNDLED_TIKZ_LIBRARIES = new Set(["3d","angles","animations","arrows","arrows.meta","arrows.spaced","automata","babel","backgrounds","bending","calc","calendar","calligraphy","cd","chains","circuits","circuits.ee","circuits.ee.IEC","circuits.logic","circuits.logic.CDH","circuits.logic.IEC","circuits.logic.US","colorbrewer","colortol","curvilinear","datavisualization","datavisualization.3d","datavisualization.barcharts","datavisualization.formats.functions","datavisualization.polar","datavisualization.sparklines","dateplot","decorations","decorations.footprints","decorations.fractals","decorations.markings","decorations.pathmorphing","decorations.pathreplacing","decorations.shapes","decorations.softclip","decorations.text","er","external","fadings","fillbetween","fit","fixedpointarithmetic","folding","fpu","graphdrawing","graphdrawing.circular","graphdrawing.evolving","graphdrawing.examples","graphdrawing.force","graphdrawing.layered","graphdrawing.trees","graphs","graphs.standard","intersections","knots","lindenmayersystems","luamath","math","matrix","mindmap","patterns","patterns.meta","perspective","petri","pgfplots.colorbrewer","pgfplots.colortol","pgfplots.surfshading","pgfplotsclickable","pie","plothandlers","plotmarks","positioning","profiler","quotes","rdf","scopes","shadings","shadows","shapes","shapes.arrows","shapes.callouts","shapes.gates.ee","shapes.gates.ee.IEC","shapes.gates.logic","shapes.gates.logic.IEC","shapes.gates.logic.US","shapes.geometric","shapes.misc","shapes.multipart","shapes.symbols","snakes","spath3","spy","svg.attributes","svg.path","through","timelines","topaths","trees","turtle","views"]);
|
|
6
|
+
export const BUNDLED_PGFPLOTS_LIBRARIES = new Set(["clickable","colormaps","contourlua","dateplot","decorations.softclip","external","fillbetween","groupplots","patchplots","polar","smithchart","statistics","ternary","units"]);
|
package/src/deploy.js
CHANGED
|
@@ -11,7 +11,7 @@ export async function copyTikzAssets(functionDirectory) {
|
|
|
11
11
|
throw new Error('TikZ deployment destination must differ from the installed package');
|
|
12
12
|
await mkdir(destination, { recursive: true });
|
|
13
13
|
const manifest = JSON.parse(await readFile(join(source, 'package.json'), 'utf8'));
|
|
14
|
-
for (const entry of ['src', 'runtime', 'LICENSE', 'NOTICE.md', 'upstream.json', 'package.json'])
|
|
14
|
+
for (const entry of ['src', 'dist', 'runtime', 'LICENSE', 'NOTICE.md', 'upstream.json', 'package.json'])
|
|
15
15
|
await cp(join(source, entry), join(destination, entry), { recursive: true, dereference: true });
|
|
16
16
|
// Validate resolution from the output, never accidentally use the developer's install.
|
|
17
17
|
const resolved = createRequire(join(resolve(functionDirectory), 'handler.mjs')).resolve('@lofcz/tikz/package.json');
|
|
@@ -27,13 +27,16 @@ export async function copyTikzBrowserAssets(directory) {
|
|
|
27
27
|
if (destination === source || destination.startsWith(source + '/'))
|
|
28
28
|
throw new Error('TikZ browser assets must be outside the installed package');
|
|
29
29
|
await mkdir(join(destination, 'src'), { recursive: true });
|
|
30
|
+
await mkdir(join(destination, 'dist'), { recursive: true });
|
|
30
31
|
await cp(join(source, 'runtime'), join(destination, 'runtime'), { recursive: true });
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
await cp(join(source, 'src', 'browser.js'), join(destination, 'src', 'browser.js'));
|
|
33
|
+
// The worker is self-contained (parser included); only the engine stays separate.
|
|
34
|
+
await cp(join(source, 'dist', 'browser-worker.js'), join(destination, 'dist', 'browser-worker.js'));
|
|
35
|
+
await cp(join(source, 'dist', 'THIRD_PARTY_LICENSES.txt'), join(destination, 'dist', 'THIRD_PARTY_LICENSES.txt'));
|
|
33
36
|
for (const name of ['LICENSE', 'NOTICE.md', 'upstream.json'])
|
|
34
37
|
await cp(join(source, name), join(destination, name));
|
|
35
38
|
const pin = JSON.parse(await readFile(join(source, 'upstream.json'), 'utf8'));
|
|
36
|
-
for (const name of pin.bundles) {
|
|
39
|
+
for (const name of [...pin.bundles, 'tikz-extra']) {
|
|
37
40
|
const base = join(destination, 'runtime/dist/bundles', name);
|
|
38
41
|
const index = JSON.parse(await readFile(join(base, 'files.index.json'), 'utf8'));
|
|
39
42
|
const chunks = new Map();
|
package/src/index.js
CHANGED
|
@@ -50,7 +50,7 @@ export function createTikzRenderer(options = {}) {
|
|
|
50
50
|
return new Promise((resolve, reject) => {
|
|
51
51
|
if (signal?.aborted) { reject(abortError()); return; }
|
|
52
52
|
const root = packageRoot();
|
|
53
|
-
const child = spawn(settings.nodeExecutable, ['--max-old-space-size=512', join(root, '
|
|
53
|
+
const child = spawn(settings.nodeExecutable, ['--max-old-space-size=512', join(root, 'dist/worker.js')], {
|
|
54
54
|
env: {}, cwd: root, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
|
|
55
55
|
});
|
|
56
56
|
const chunks = [];
|
package/src/recover.js
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// Conservative repairs of generated TikZ syntax, using the LaTeX lexer before
|
|
2
|
+
// argument attachment. Never invent coordinates, lengths, or missing geometry.
|
|
3
|
+
import { parseMinimal } from '@unified-latex/unified-latex-util-parse';
|
|
4
|
+
import { printRaw } from '@unified-latex/unified-latex-util-print-raw';
|
|
5
|
+
import { parsePgfkeys } from '@unified-latex/unified-latex-util-pgfkeys';
|
|
6
|
+
|
|
7
|
+
const string = content => ({ type: 'string', content });
|
|
8
|
+
const group = content => ({ type: 'group', content });
|
|
9
|
+
const is = (node, text) => node?.type === 'string' && node.content === text;
|
|
10
|
+
const space = node => node?.type === 'whitespace' || node?.type === 'parbreak';
|
|
11
|
+
const skip = (nodes, i) => { while (space(nodes[i])) i++; return i; };
|
|
12
|
+
function walk(nodes, visit) {
|
|
13
|
+
visit(nodes);
|
|
14
|
+
for (const node of nodes) if (Array.isArray(node.content)) walk(node.content, visit);
|
|
15
|
+
}
|
|
16
|
+
function closeAt(nodes, start, open, close) {
|
|
17
|
+
let depth = 0;
|
|
18
|
+
for (let i = start; i < nodes.length; i++) {
|
|
19
|
+
if (is(nodes[i], open)) depth++;
|
|
20
|
+
else if (is(nodes[i], close) && --depth === 0) return i;
|
|
21
|
+
}
|
|
22
|
+
return -1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const DEFINITIONS = new Set(['def', 'gdef', 'edef', 'xdef', 'let', 'newcommand', 'renewcommand', 'providecommand', 'pgfmathsetmacro', 'pgfmathtruncatemacro', 'pgfmathsetlengthmacro']);
|
|
26
|
+
function extendedIdentifiers(root, source) {
|
|
27
|
+
const bindings = new Map();
|
|
28
|
+
const names = new Set();
|
|
29
|
+
walk(root, nodes => { for (const node of nodes) if (node.type === 'macro') names.add(node.content); });
|
|
30
|
+
walk(root, nodes => {
|
|
31
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
32
|
+
if (nodes[i].type !== 'macro' || !DEFINITIONS.has(nodes[i].content)) continue;
|
|
33
|
+
const at = skip(nodes, i + 1);
|
|
34
|
+
const target = nodes[at]?.type === 'group' ? nodes[at].content : nodes.slice(at, at + 3);
|
|
35
|
+
const [macro, tail, end] = target;
|
|
36
|
+
if (macro?.type !== 'macro' || tail?.type !== 'string' || !/^(?:_[A-Za-z0-9_]+|[0-9][A-Za-z0-9_]*)$/.test(tail.content)) continue;
|
|
37
|
+
if (end && end.type !== 'group' && !(nodes[i].content === 'let' && end.type === 'macro')) continue; // keep real delimited/parameter macros
|
|
38
|
+
if (macro.position?.end.offset !== tail.position?.start.offset) continue;
|
|
39
|
+
const key = macro.content + tail.content;
|
|
40
|
+
if (bindings.has(key)) continue;
|
|
41
|
+
let name = 'tikzRecoveredVariable';
|
|
42
|
+
let n = bindings.size;
|
|
43
|
+
do { name += String.fromCharCode(65 + n % 26); n = Math.floor(n / 26); } while (n);
|
|
44
|
+
while (names.has(name)) name += 'X';
|
|
45
|
+
names.add(name);
|
|
46
|
+
bindings.set(key, { base: macro.content, suffix: tail.content, name });
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (!bindings.size) return;
|
|
50
|
+
walk(root, nodes => {
|
|
51
|
+
for (let i = 0; i + 1 < nodes.length; i++) {
|
|
52
|
+
const node = nodes[i];
|
|
53
|
+
if (node.type !== 'macro') continue;
|
|
54
|
+
for (const binding of bindings.values()) {
|
|
55
|
+
const offset = node.position?.end.offset;
|
|
56
|
+
if (node.content !== binding.base || !source.startsWith(binding.suffix, offset)) continue;
|
|
57
|
+
const end = offset + binding.suffix.length;
|
|
58
|
+
if (/[A-Za-z0-9_]/.test(source[end] ?? '')) continue;
|
|
59
|
+
let j = i + 1;
|
|
60
|
+
while (j < nodes.length && nodes[j].position?.end.offset <= end) j++;
|
|
61
|
+
if (nodes[j - 1]?.position?.end.offset !== end) continue;
|
|
62
|
+
node.content = binding.name; nodes.splice(i + 1, j - i - 1);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// >=Latex[length=3mm,width=2mm] needs braces around the complete arrow value;
|
|
70
|
+
// TeX's optional argument scanner otherwise stops at the inner closing bracket.
|
|
71
|
+
function nestedOptions(nodes) {
|
|
72
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
73
|
+
if (!is(nodes[i], '[')) continue;
|
|
74
|
+
let close = closeAt(nodes, i, '[', ']');
|
|
75
|
+
if (close < 0) continue;
|
|
76
|
+
for (let j = i + 1; j < close; j++) {
|
|
77
|
+
if (!is(nodes[j], '[')) continue;
|
|
78
|
+
const end = closeAt(nodes, j, '[', ']');
|
|
79
|
+
let start = j - 1;
|
|
80
|
+
while (start > i && !is(nodes[start], '=') && !is(nodes[start], ',')) start--;
|
|
81
|
+
if (end < 0 || !is(nodes[start], '=')) continue;
|
|
82
|
+
const value = nodes.slice(start + 1, end + 1);
|
|
83
|
+
nodes.splice(start + 1, end - start, group(value));
|
|
84
|
+
close -= end - start - 1;
|
|
85
|
+
j = start + 1;
|
|
86
|
+
}
|
|
87
|
+
i = close;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function coordinateComponent(nodes, alreadyGrouped = false) {
|
|
92
|
+
const significant = nodes.filter(node => !space(node));
|
|
93
|
+
if (significant.length === 1 && significant[0].type === 'group') {
|
|
94
|
+
significant[0].content = coordinateComponent(significant[0].content, true);
|
|
95
|
+
return nodes;
|
|
96
|
+
}
|
|
97
|
+
let unitStart = significant.length - 1;
|
|
98
|
+
let unit = significant[unitStart]?.type === 'string' ? significant[unitStart].content : '';
|
|
99
|
+
if (unit.length === 1 && significant[unitStart - 1]?.type === 'string') { unitStart--; unit = significant[unitStart].content + unit; }
|
|
100
|
+
if (!/^(?:cm|mm|pt|bp|in|em|ex)$/.test(unit)) unit = null;
|
|
101
|
+
if (unit && significant.length > 1 && (significant[0].type === 'group' || significant.some(node => is(node, '(')))) {
|
|
102
|
+
const expr = significant.slice(0, unitStart).flatMap(node => node.type === 'group' ? [string('('), ...node.content, string(')')] : [node]);
|
|
103
|
+
const repaired = [string('('), ...expr, string(')*1' + unit)];
|
|
104
|
+
return alreadyGrouped ? repaired : [group(repaired)];
|
|
105
|
+
}
|
|
106
|
+
if (!alreadyGrouped && nodes.some(node => is(node, '('))) return [group(nodes)];
|
|
107
|
+
return nodes;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function coordinates(nodes) {
|
|
111
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
112
|
+
if (nodes[i].type === 'inlinemath') { coordinates(nodes[i].content); continue; }
|
|
113
|
+
if (!is(nodes[i], '(')) continue;
|
|
114
|
+
const end = closeAt(nodes, i, '(', ')');
|
|
115
|
+
if (end < 0) continue;
|
|
116
|
+
const inside = nodes.slice(i + 1, end);
|
|
117
|
+
// Calc expressions have their own coordinate parentheses inside $...$.
|
|
118
|
+
if (inside.some(node => node.type === 'inlinemath')) { for (const node of inside) if (node.type === 'inlinemath') coordinates(node.content); i = end; continue; }
|
|
119
|
+
let depth = 0, start = 0;
|
|
120
|
+
const segments = [], delimiters = [];
|
|
121
|
+
for (let j = 0; j < inside.length; j++) {
|
|
122
|
+
if (is(inside[j], '(')) depth++;
|
|
123
|
+
else if (is(inside[j], ')')) depth--;
|
|
124
|
+
else if (!depth && (is(inside[j], ',') || is(inside[j], ':') || is(inside[j], 'and'))) {
|
|
125
|
+
segments.push(inside.slice(start, j)); delimiters.push(is(inside[j], 'and') ? string(' and ') : inside[j]); start = j + 1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
segments.push(inside.slice(start));
|
|
129
|
+
// Do not reinterpret named nodes, explicit coordinate systems or projections.
|
|
130
|
+
if (inside.some(node => is(node, '=') || is(node, '|') || is(node, 'cs'))) { i = end; continue; }
|
|
131
|
+
const rebuilt = segments.flatMap((part, j) => [...coordinateComponent(part), ...(delimiters[j] ? [delimiters[j]] : [])]);
|
|
132
|
+
nodes.splice(i + 1, end - i - 1, ...rebuilt);
|
|
133
|
+
i += rebuilt.length + 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const PATHS = new Set(['draw', 'fill', 'filldraw', 'shade', 'shadedraw', 'path', 'coordinate', 'node', 'clip', 'pic']);
|
|
138
|
+
|
|
139
|
+
function delimited(nodes, at, open, close) {
|
|
140
|
+
at = skip(nodes, at);
|
|
141
|
+
if (!is(nodes[at], open)) return null;
|
|
142
|
+
const end = closeAt(nodes, at, open, close);
|
|
143
|
+
return end < 0 ? null : { start: at, end: end + 1, content: nodes.slice(at + 1, end) };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Adapt old/shorthand tkz calls to the bundled package's explicit results. */
|
|
147
|
+
function tkzCommands(nodes) {
|
|
148
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
149
|
+
const node = nodes[i];
|
|
150
|
+
if (node.type !== 'macro' || !node.content.startsWith('tkz')) continue;
|
|
151
|
+
const options = delimited(nodes, i + 1, '[', ']');
|
|
152
|
+
const point = delimited(nodes, options?.end ?? i + 1, '(', ')');
|
|
153
|
+
if (!point) continue;
|
|
154
|
+
if (node.content === 'tkzDefLine' && options) {
|
|
155
|
+
const first = skip(options.content, 0);
|
|
156
|
+
const through = skip(options.content, first + 1);
|
|
157
|
+
if (['orthogonal', 'perpendicular', 'parallel'].some(key => is(options.content[first], key)) && is(options.content[through], 'through')) {
|
|
158
|
+
nodes.splice(options.start + 1 + first + 1, 0, string('='));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (node.content === 'tkzMidPoint') node.content = 'tkzDefMidPoint';
|
|
162
|
+
if (['tkzDefMidPoint', 'tkzDefPointBy', 'tkzDefPointWith'].includes(node.content)) {
|
|
163
|
+
const out = skip(nodes, point.end);
|
|
164
|
+
if (nodes[out]?.type === 'group') nodes.splice(out, 0, { type: 'macro', content: 'tkzGetPoint' });
|
|
165
|
+
if (node.content === 'tkzDefPointBy' && options) {
|
|
166
|
+
const onto = options.content.findIndex(token => is(token, 'onto'));
|
|
167
|
+
const line = skip(options.content, onto + 1);
|
|
168
|
+
if (onto >= 0 && is(options.content[line], 'line')) {
|
|
169
|
+
options.content.splice(line, 1);
|
|
170
|
+
nodes.splice(options.start + 1, options.end - options.start - 2, ...options.content);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (node.content === 'tkzInter' && options && printRaw(options.content).trim() === 'R' && delimited(nodes, point.end, '(', ')')) node.content = 'tkzInterCC';
|
|
175
|
+
if (node.content === 'tkzDrawCircle' && options) {
|
|
176
|
+
const keys = parsePgfkeys(options.content).map(item => (item.itemParts ?? []).map(part => printRaw(part).trim()).join('='));
|
|
177
|
+
const mode = keys.find(key => ['circum', 'in', 'diameter', 'R'].includes(key));
|
|
178
|
+
const count = point.content.filter(token => is(token, ',')).length + 1;
|
|
179
|
+
if (!mode || count !== (['circum', 'in'].includes(mode) ? 3 : 2)) continue;
|
|
180
|
+
const rest = keys.filter(key => key !== mode).join(',');
|
|
181
|
+
if (mode === 'R') {
|
|
182
|
+
const comma = point.content.findIndex(token => is(token, ','));
|
|
183
|
+
nodes.splice(i, point.end - i, string(String.raw`\draw[circle style,${rest}] (${printRaw(point.content.slice(0, comma))}) circle (${printRaw(point.content.slice(comma + 1))});`));
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
// tkzDefCircle supplies both center and a point on the circle. Drawing
|
|
187
|
+
// from those results preserves the construction rather than guessing a radius.
|
|
188
|
+
const replacement = String.raw`{\tkzDefCircle[${mode}](${printRaw(point.content)})\tkzGetPoints{tikzRecoveredCircleCenter}{tikzRecoveredCirclePoint}\tkzDrawCircle[${rest}](tikzRecoveredCircleCenter,tikzRecoveredCirclePoint)}`;
|
|
189
|
+
nodes.splice(i, point.end - i, string(replacement));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** PGF prints numbers, not expressions; evaluate explicit arithmetic first. */
|
|
195
|
+
function numberExpressions(nodes) {
|
|
196
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
197
|
+
const node = nodes[i];
|
|
198
|
+
if (node.type !== 'macro') continue;
|
|
199
|
+
if (['pgfmathparse', 'pgfmathsetmacro', 'pgfmathtruncatemacro'].includes(node.content)) {
|
|
200
|
+
let at = skip(nodes, i + 1);
|
|
201
|
+
if (node.content !== 'pgfmathparse') at = skip(nodes, at + 1);
|
|
202
|
+
const expr = nodes[at];
|
|
203
|
+
if (expr?.type !== 'group') continue;
|
|
204
|
+
const mod = expr.content.findIndex(token => is(token, 'mod'));
|
|
205
|
+
const atom = tokens => { const value = tokens.filter(token => !space(token)); return value.length === 1 && (value[0].type === 'macro' || value[0].type === 'group' || (value[0].type === 'string' && /^-?\d+(?:\.\d+)?$/.test(value[0].content))); };
|
|
206
|
+
if (mod > 0 && atom(expr.content.slice(0, mod)) && atom(expr.content.slice(mod + 1))) expr.content = [string('mod('), ...expr.content.slice(0, mod), string(','), ...expr.content.slice(mod + 1), string(')')];
|
|
207
|
+
}
|
|
208
|
+
if (node.content !== 'pgfmathprintnumber') continue;
|
|
209
|
+
const options = delimited(nodes, i + 1, '[', ']');
|
|
210
|
+
const at = skip(nodes, options?.end ?? i + 1);
|
|
211
|
+
const expr = nodes[at];
|
|
212
|
+
if (expr?.type !== 'group' || !expr.content.some(token => token.type === 'string' && ['*', '/', '+', '('].includes(token.content))) continue;
|
|
213
|
+
nodes.splice(i, at - i + 1, string(String.raw`{\pgfmathparse{${printRaw(expr.content)}}\pgfmathprintnumber${options ? `[${printRaw(options.content)}]` : ''}{\pgfmathresult}}`));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** A node position is one coordinate, not a path with a trailing ++ step. */
|
|
218
|
+
function relativeNodePosition(nodes) {
|
|
219
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
220
|
+
if (nodes[i].type !== 'macro' || nodes[i].content !== 'node') continue;
|
|
221
|
+
let at = i + 1;
|
|
222
|
+
while (at < nodes.length && !is(nodes[at], 'at') && !is(nodes[at], ';')) at++;
|
|
223
|
+
if (!is(nodes[at], 'at')) continue;
|
|
224
|
+
const base = delimited(nodes, at + 1, '(', ')');
|
|
225
|
+
if (!base) continue;
|
|
226
|
+
let plus = skip(nodes, base.end);
|
|
227
|
+
if (!is(nodes[plus], '+')) continue;
|
|
228
|
+
plus++;
|
|
229
|
+
if (is(nodes[plus], '+')) plus++;
|
|
230
|
+
const offset = delimited(nodes, plus, '(', ')');
|
|
231
|
+
if (!offset) continue;
|
|
232
|
+
nodes.splice(base.start, offset.end - base.start, string(`($(${printRaw(base.content)})+(${printRaw(offset.content)})$)`));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function recoverGeneratedSyntax(source) {
|
|
237
|
+
const root = parseMinimal(source).content;
|
|
238
|
+
extendedIdentifiers(root, source);
|
|
239
|
+
walk(root, nestedOptions);
|
|
240
|
+
walk(root, tkzCommands);
|
|
241
|
+
walk(root, numberExpressions);
|
|
242
|
+
walk(root, relativeNodePosition);
|
|
243
|
+
walk(root, nodes => {
|
|
244
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
245
|
+
if (nodes[i].type !== 'macro' || !PATHS.has(nodes[i].content)) continue;
|
|
246
|
+
let end = i + 1;
|
|
247
|
+
while (end < nodes.length && !is(nodes[end], ';')) end++;
|
|
248
|
+
const tokens = nodes.slice(i + 1, end);
|
|
249
|
+
coordinates(tokens);
|
|
250
|
+
nodes.splice(i + 1, end - i - 1, ...tokens);
|
|
251
|
+
i += tokens.length;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
return printRaw(root);
|
|
255
|
+
}
|