{"_id":"@cormacrelf/citeproc-wasm","_rev":"14-569bdd1dc485f3abb383c235325960a7","name":"@cormacrelf/citeproc-wasm","dist-tags":{"canary":"0.0.0-canary-0ea624e","latest":"0.0.0-canary-029407d"},"versions":{"0.0.0-canary-029407d":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-029407d","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-029407d","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-IGcWN8U+hAK2no8xydsRcs5afMS6BVt8bK8mBZY4S7Qv6DHjR+fYh+cta1umlpsDlch+HpsDxnYobnegDmSiug==","shasum":"814a1d181ec3e3cffc6f2d7744331f20fe29be3a","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-029407d.tgz","fileCount":15,"unpackedSize":12503716,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZRJSCRA9TVsSAnZWagAA7TYP/2FIwY99x1fg2/njnQ/b\n2Wi5/fuAIsprCuvjXDr0skZ4gdkgrtCg5/IcKghvJHdZn1ARM67xCjwDbQYZ\njSFuCwKjAOeMiZX09LbxRg8JDx/NBzHAhly+UY2dAy1WKv15sZPNw3Zi7PD+\n1ARk+SuWzBIElnAu/jPvrmT2y02Hm5G2zOOeUiz9mcBJy3Z2cmxbBnDg3oh0\nuu9OgyrcQN9vn06qZxgdC/zDmqj3joy/eJImYmpXiJQ4p2qimTnCGALex/J7\nFOhKsTpPqNCR1EMzaRU2ZTTLWPgTTro3C228anGlDRh6Js3G/bHtDTr+wg3B\nH5d0eVJZLk4JR9PzKDbyUqNMR5lme5BFKiKCXTU5Qdb9ZP2PsbdvTp3e0R97\nViptG0SVFh+UzI+LgIuMqX211zd9wLtfQ9KGkzAB5EeWUf2JL9hzOgvVQR3E\nSapCojBCHew9OqMj5nBc5LGqrN7tb3fQjXXKWzkHClQx/A65NX/2mDb8xS0Z\nWD/LX+gEQ16R4yvqazkIIpNz7A4vxN5Xc3SRp8K8gWla8+pDV8nGpcZ019Pq\nsPlWI9VofCiLHTIrz9E6vdxQZF1gV3zpJD6M6H/y+rCYPcoHZfkFW1mQ3fHs\naZNBxUIH/BNIAomWB+ysUzWSy7XDjq/MoBYDAzGLTUlpYPUCjWEO3gd9pnz9\nQV+x\r\n=eREw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBoOASr2mrwqPshyTuyVhBb0rdu1MbNe8IJudKMxxOIHAiEA2LMhZE/wf/QYFP0ctAUUShz/8IXx3xzg2U3Qt9tO30U="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-029407d_1600459345451_0.690431389484446"},"_hasShrinkwrap":false},"0.0.0-canary-ec9b385":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-ec9b385","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a build of `citeproc` that is suitable for use in Node.js, a browser or \na Firefox/Chromium-based application like Zotero. It consists of a WebAssembly \n(WASM) binary, and a fairly lightweight JavaScript wrapper for that binary. \n\nREADME for newer version of the API forthcoming.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-ec9b385","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-e89Eq/kRZMfgF2WbDRYGIxa5DgGGC2Ejbsp9gb939Edrz1KjN6ZMPRZownbvw/3gFm968UVSiCCJBIDJX0vxhg==","shasum":"b107f9ee780324681230f44123ae09affa613902","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-ec9b385.tgz","fileCount":15,"unpackedSize":12751423,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZRhYCRA9TVsSAnZWagAA24YP/0E32f9r/gVIsQwH7fMO\nNuwVzVp4vClmHV5+uHR/NG7Ujvx2N31Lzlf6Xd4IQ8bOz2niiBKlaM/PdUsK\n62ECExBFJP1d+kHLgKgb9D4tCZZBA2cdlAS5C7h6AI95EL6eGktmgmUAFVYo\nj45cnoPPbhIpBjTmK79fKdZP+eaAwUXtN3/i2/jqbQnVkEj7Q12Bp15xv45M\nLFpchrzPQ2p2baoHN1iAKDB9ZntJFEUdZZjsjn2JfIjGwZp+h2cOwYra/Nb5\nqOKvH2JA/g3wEObtkFItnrpSHduGlgw/7fsFDIcq51igdSvERYfhB4DPu5hN\nSdrf/x/K2qEuT2BXB7nWNPPwT1TTbyuSGxzNHvzmTqFYDrYUqnpfwN6hv6of\nDgm1AhhXqDK0SpNjqPied2+Ub6jDvo1BoG8u6/C8sCoLL8A3Jn2vjURFzJ5X\n8z3lyqfE8cgX8TK15xWVNWZdyWdl4dcZA3RRF9Qlg+8UJ6ZgKHvqPENgKVdz\nsbLHEq4toMDB5wVwXFtU3vrvLH9neya02i086PwfTXdcSCi8jJQRB8Ulb1OS\n4W1fmvIXb0nDrpKQoRGpfUcUig5Ly0NcZcqeeWf7VbsBY33C/DrBW+/l8zW8\nDSBOnx8pORJaeXCmFlhPqo866hN1Ufj93Q2FboG/80hP08X3loFPa9stHidw\n2tkp\r\n=hzCr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbAX4x5fe2mWBuWQksLMHLu0ESmdfHpuXeV9j9zLhKZgIgfL4Bd2gdCqVXznyF/6XXRnsvqBmmHpcqSQrJIGS4KjY="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-ec9b385_1600460888168_0.9637808844698004"},"_hasShrinkwrap":false},"0.0.0-canary-289a710":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-289a710","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a build of `citeproc` that is suitable for use in Node.js, a browser or \na Firefox/Chromium-based application like Zotero. It consists of a WebAssembly \n(WASM) binary, and a fairly lightweight JavaScript wrapper for that binary. \n\nREADME for newer version of the API forthcoming.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-289a710","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-HVGXKY59cmClyHna2P7vS/CW8Y3/UH+R3AqUS2R3kj/4OZC2uos2dLjTal6nTKgaYRrZkUHx45anSESpOHvp1Q==","shasum":"ce6f102857b0ce3d54f63ef36691b7d8e7311610","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-289a710.tgz","fileCount":15,"unpackedSize":12905269,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZR0vCRA9TVsSAnZWagAA9uIP/RmSsvyjDvbTbRjugRMT\ngt+60tqpRZXCEp0sUCSGm6ex4bHnG0P0Tcn6p+Q9rJppOQCiXJGZDPlrCHfo\n6tbAEa5TM6vI+vpHRvq1dzs6OagrnM+mVtEo07EC/LzrTOhiQokDCFWrBNmW\nMWgFvhxNr1u9AIxaPqfSzPaoYwk11pF3uyVLeJUD55+Ln83B6dI4LiqDCBXY\nPUfUpDRcqVp5J2823e1atxex4XbCdogvyonTqGqqJPwbGHltUxQOofbM0+Ff\n7czEuwr4oatyaGzaHPpdKk1d2owSH1P0GuvisFGjJk/xXzIcP16QmI/hyfcN\nbz9xTQJzRHwcSLX3sRFTCIrxTv/yINs+R+yErLKCw9uK+jnFq50WqYTlU3oB\n3gk8IRwzBSimjjeH/vOww5XEi7uhud+qH5kg0KZ6pf3H2Vm3U41vb54dCVXa\n0H3AQQwf8yKgEaqzETicTfWnkpsmOnnags3T6IyssN8zA5XI1l4r7ukUYGE6\nGTAIJBEPkAZAdAwTWOUjpBBL8+bVOoYNGYaTnzsVuWkiYWV1EiM2ldBq61Ye\ntbpP+K7prOrLgPTByjTzd/QpVk5v88tzRgfDoJ8NqjejxkRTgKi3UGqMM4o6\nRGdWbrOzjpHHDrGfUx0iV1qHd/dWE1Kjmw7riebhYiEKKzSpBeSJIbmJkuvH\nKQop\r\n=qGbp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDlfqUZqW8jsq58p/2kLdmnr9UwrO3rlZv+4wFZB+iYXAiBYeKi+ye4t0D0Els0cO1Ijn8goyKOK6tgBwTsEyOWDQA=="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-289a710_1600462126703_0.8710023231701605"},"_hasShrinkwrap":false},"0.0.0-canary-e088424":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-e088424","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a build of `citeproc` that is suitable for use in Node.js, a browser or \na Firefox/Chromium-based application like Zotero. It consists of a WebAssembly \n(WASM) binary, and a fairly lightweight JavaScript wrapper for that binary. \n\nREADME for newer version of the API forthcoming.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-e088424","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-PwB2rUnSo8/ZeFDTaoy19gM/fosh+jTHGMtYeupWX+epznmiS5xZt4i92+Zo9yro1i/V+/kbYPG9KesBZNx8xA==","shasum":"ad451da243de10f394bf083ef5060fe5b5091e1a","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-e088424.tgz","fileCount":15,"unpackedSize":11717338,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZSSJCRA9TVsSAnZWagAA3M8P/j23edn6vEs9iovR/OhM\nUZAMx5Bgmg930xvz1yt3CQK+XEo2fZMKBZaczxipW1ETUZP/FBz6NAbfHrSh\nP/g/p27+OqVE7iA+Gi8MqQBh4BwawkKGhQ/3QHGwouOQZfJsMQwsl6OgxUZj\nvTQEF8+SLuUJr0/qUN27+/D6SvhFlc7oAu0yP2eyYQVUWp1KNK5a7LAZ3f79\nHfzZJF+fQB0MJJnBjbMfy1fnfqnCDskFvaINVvoJIFxoaLIDiHlQbYG5Ai3s\n7ngPi2J3KGwvvPUgnn8lZL6Y9P5X3WGZp4nSK6bbPbDteyASOfrIUEe+U23u\nI/e8Do+TD7B/M+GhZaqXppFjgG+HisZJSCLXkL+4bE2XQqzyljX3bsgcZux6\n4IsUrh0/NND2QJPqdacNI+VX6zHE2NB2bzE6rvS9ljTgukYoNcVS+JXRNn8j\n4oePl5BSzCqOLwO34YMkhI8qAuzF4PdQqFyVLK9g5Stk+96UeIa7Cfxqvc6a\n/APyzY4IWsiRrrTTfwygfTvSdyKOOwAIElny01GUI5Y+Il2k4LnV9TT+7eCb\nbFw1rdF/bxnCf3y0jn1pU8okBSGVouj/UQQYBMNjNT8/kl6mVYY3/4kzCOHP\nc2rraaSWgsv3nb0buawdmjTnsbeBdqdVPuA6p6dWgXikYJrtLFiSSl8GrYCa\nN3oI\r\n=nwbq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC02lMlwzmf0psnwjiOsqFKxtZdTsmtGpsHT7R9ifQQfQIgJj1mwT4LzHJ1m/FGXWznRuScEQ4LAzwF+mlUfoWKJ30="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-e088424_1600464008781_0.4311672160934146"},"_hasShrinkwrap":false},"0.0.0-canary-6024e27":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-6024e27","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a build of `citeproc` that is suitable for use in Node.js, a browser or \na Firefox/Chromium-based application like Zotero. It consists of a WebAssembly \n(WASM) binary, and a fairly lightweight JavaScript wrapper for that binary. \n\nREADME for newer version of the API forthcoming.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-6024e27","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-OG9lsAeKDQ7RT/tmg5jZpugWlileaojUZCHxYKmLVg5YyafYHD0Be5a5v7jC33QDAGIO3Gaps+LiMecVRqXmaw==","shasum":"d674613e4c92fae7166f5bb9eb0f9958e3ef98ba","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-6024e27.tgz","fileCount":15,"unpackedSize":11763234,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZTkPCRA9TVsSAnZWagAA0MAP/j+YsAVBQzbKRFOzSjuO\nOLtGH6I5yYQTvYSnb987mMfjgmQSrw91Y4SoZzUp0J+wq9xqlKeNyeax/tFS\nYIz67S5bUgJ/ZAJkdEvjRWEjPBtzo/cqSdM7L0dqMWqG8hY09miwZu9XiQdS\nFePlwHOpZvje5grrPmQo6Vbpy5yo+lShTdezykY9sKNp/3Mwn38t9S5Uc8bc\nWvCzobXej2RHI+MDWNozUGnhjhqOlChC9RPwqyf3x1A4zVMGt2cexhxbOBN8\nrwFcWpNSbznHt9XaKrkm1CkG9Igj+QxroiQZAXC3oPh07wqPtJQXzpfuRZKu\nPvVBxL6wu2jvHKjYfp4662ucFxRQS0fDiKGUkhpmDv2gaUb3YaQ4KCeZxGB6\nE5KHs1/2ahp8GIiMlOHFZGMAQ1wXcB1HL/Eh1vneMwioB5luk54myOTOmB3c\niYc5CeyryMtxRDgip7eySvXgGJFANDajBNrWpJMN0Iz9hq8WaVfE/YRS86Q9\noDcshpbhZsTFcae+MfB/FLGmCv4hItbMl3f8O/NzCJcg0QSNwbQFCQZkPQsB\nquLqw8afiak6hi89AbmjL0OcT6hRL/5IgD2cj/hU6vMfZAu4e/cxy6V7XRJ8\nARmDsoTnfvYIOyg+iYSOOXubK8Qkmstmhk65xq18y2DdFOOZGFCtS/AtFWnY\ngKcK\r\n=fYeZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFWT5s5w25zbPt/O7UUbbwgznKsy7XH8ARWqoKPH59FRAiBVWCwgKfg3pEdROjBjjL39K6qf4IVyqGKpnr3nlUPUeQ=="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-6024e27_1600469262674_0.7592611456202374"},"_hasShrinkwrap":false},"0.0.0-canary-7bb4807":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-7bb4807","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a build of `citeproc` that is suitable for use in Node.js, a browser or \na Firefox/Chromium-based application like Zotero. It consists of a WebAssembly \n(WASM) binary, and a fairly lightweight JavaScript wrapper for that binary. \n\nREADME for newer version of the API forthcoming.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-7bb4807","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-6dHqN3pnlhm4FMFB/MgJyzcmcm3QgZDUot2rySrzU2+7W7yw9YfkJn8notCV5++GoE5h5yjLqCq+/tnNLifxXQ==","shasum":"a84e1032850de1621e9fc0a4b9d71b4c379c2da3","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-7bb4807.tgz","fileCount":15,"unpackedSize":11763282,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZTybCRA9TVsSAnZWagAAN8wP/iDrn9o02hkSL9yzlBWq\n0AH7IQQu6GeGGulf2QaAVpauKtDA+njPkkPn/8nosWrge7mYGx4G3Ic1rzwK\nBsuWJarrNnRxor0wU76j3VJXINewBCPSgOiV9fLaAh0XK+CSXUv21nAGIcAv\nqvfGW4LFqctYq0GI+t13Gjt6E0JMOSr+U7XTz8kdznGl2Uwib0ltbuoKVTUv\nsnoylB2redqNl0dp8ZcBg+aI55JtlEl5SjiOI5VYYLA/eJ98Lf0HuxdtlrR4\nsmMbCCjND5xxkaf9M05tAe96O5PTDNF/6WCc4Os6VWOoda6zoRmWxR1x/c/T\nuAajX4TV1CxF28CTWQPKEqPK+IykrAOdKcTqLrkTdCPuUoICuMSmzYW1hvUv\n9eP2OFt+q0Iu7qsszHyKGXCDAPFoxzSMYDtBXA7nAqOBjBQLBW0EfslGkaaQ\nzwO1r/sxKUEOoUYE6VT9y9SyvntZ69aeHUkgq4dGiR7U2b6JXEiAOdazlGUE\np+Sg9xnZ/TTAfpur8OOwnDCUxHEhC3bQJkU/chqDsJSL2nTcOZrkB4w7enhD\nNixmRoyuARYBSooB6qxGFaA22Xr8ZvQWHr2lXvYorvEJDha66HCQ3OZSdSdy\nV1vEySxL1A/gtAwhEhgg1Z6Lw4sQZ/hlI3oVXipe2ZKspRLLs/g7oXnVu66b\nu6M9\r\n=a5D/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDByyhL+bvXru+/gBzp+yHBzEm79HSxvylMf/KzD7y34wIgJxpOKgkgSRkz0Isln4HkoUgkaNesoFBTY2RgPoARH9k="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-7bb4807_1600470170794_0.8245087816857037"},"_hasShrinkwrap":false},"0.0.0-canary-8d2904e":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-8d2904e","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a front-end to \n[`citeproc-rs`](https://github.com/cormacrelf/citeproc-rs), a citation \nprocessor written in Rust and compiled to WebAssembly.\n\nIt contains builds appropriate for:\n\n- Node.js\n- Browsers, using a bundler like Webpack.js\n- Browsers directly importing an ES Module from a webserver\n\n## Installation / Release channels\n\nThere are two release channels:\n\n**Stable** is each versioned release. (*At the time of writing, there are no \nversioned releases.*) Install with:\n\n```sh\nyarn add @citeproc-rs/wasm\n```\n\n**Canary** tracks the master branch [on \nGitHub](https://github.com/cormacrelf/citeproc-rs). Its version numbers follow \nthe format `0.0.0-canary-GIT_COMMIT_SHA`, so version ranges in your \n`package.json` are not meaningful. But you can install the latest one with:\n\n```sh\nyarn add @citeproc-rs/wasm@canary\n# alternatively, a specific commit\nyarn add @citeproc-rs/wasm@0.0.0-canary-COMMIT_SHA\n```\n\nIf you use NPM, replace `yarn add` with `npm install`.\n\n### Including in your project\n\nFor Node.js or Webpack, simply import the package as normal. Typescript \ndefinitions are provided, though parts of the API that cannot have \nauto-generated type definitions are alluded to in doc comments with an \naccompanying type you can import.\n\n```\n// Node.js\nconst { Driver } = require(\"@citeproc-rs/wasm\");\n\n// Webpack, anything using compiled ES Modules\nimport { Driver } from \"@citeproc-rs/wasm\";\n```\n\nTo directly import it in a (modern) web browser, you must:\n\n1. Make the `_web` subdirectory of the published NPM package available in a \n   content directory on your webserver, or use a CDN like [unpkg](unpkg.com).\n2. Include a `<script type=\"module\">` tag on your page, like so:\n\n```html\n<script type=\"module\">\n    import init, { Driver } from './path/to/_web/citeproc_rs_wasm.js';\n    async function run() {\n        await init();\n        // use Driver\n    }\n    run()\n</script>\n```\n\n## Usage\n\n\n### Overview\n\nThe basic pattern of interactive use is:\n\n1. Create a driver instance with your style\n2. Edit the references or the citation clusters as you please\n3. **Call `driver.batchedUpdates()`**\n4. Apply the updates to your document (e.g. GUI)\n5. Go to step 2 when a user makes a change\n\nStep three is the important one. Each time you edit a cluster or a reference, \nit is common for only one or two visible modifications to result. Therefore, \nthe driver only gives you those clusters or bibliography entries that have \nchanged, or have been caused to change by an edit elsewhere. You can submit any \nnumber of edits between each call.\n\nThe API also allows for non-interactive use. See below.\n\n\n### 1. Creating a driver instance\n\nFirst, create a driver. Note that for now, you must also call `.free()` on the \nDriver when you are finished with it to deallocate its memory, but [there is a TC39 \nproposal](https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html) \nin the implementation phase that will make this unnecessary.\n\nA driver needs an XML style string, a fetcher (below), and an output format \n(one of `\"html\"`, `\"rtf\"` or `\"plain\"`).\n\n```javascript\nlet driver = Driver.new(cslStyleTextAsXML, fetcher, \"html\");\n// ... use the driver ...\ndriver.free()\n```\n\nThe library parses and validates the CSL style input. Any validation errors are \nreported, with line/column positions, the text at that location, a descriptive \nand useful message (only in English at the moment) and sometimes even a hint \nfor how to fix it. This is thrown as an error, which you can catch in a `try {} \ncatch (e) {}` block.\n\n#### Fetcher\n\nThere are hundreds of locales, and the locales you need change depending on the \nreferences that are active in your document, so the procedure for retrieving \none is asynchronous to allow for fetching one over HTTP. There's not much more \nto it than this:\n\n```javascript\nclass Fetcher {\n    async fetchLocale(lang) {\n        return fetch(\"https://some-cdn-with-locales.com/locales-${lang}.xml\")\n            .then(res => res.text());\n\n        // or just\n        // return \"<locale> ... </locale>\";\n        // return LOCALES_PRELOADED[lang];\n\n        // or if you don't support locales other than the bundled en-US!\n        // return null;\n    }\n}\n\nlet fetcher = new Fetcher(); // Pass to Driver.new()\n```\n\nUnless you don't have `async` syntax, in which case, return a `Promise` \ndirectly, e.g. `return Promise.resolve(\"<locale> ... </locale>\")`.\n\n### 2. Edit the references or the citation clusters\n\n\n#### References\n\nYou can insert a reference like so. This is a [CSL-JSON][schema] object.\n\n[schema]: https://github.com/citation-style-language/schema\n\n```javascript\ndriver.insertReference({ id: \"citekey\", type: \"book\", title: \"Title\" });\ndriver.insertReferences([ ... many references ... ]);\ndriver.resetReferences([ ... deletes any others ... ]);\ndriver.removeReference(\"citekey\");\n```\n\nWhen you do insert a reference, it may have locale information in it. This \nshould be done after updating the references, so any new locales can be \nfetched.\n\n```javascript\n// May call your Fetcher instance.\nawait driver.fetchAll();\n```\n\n#### Citation Clusters and their Cites\n\nA document consists of a series of clusters, each with a series of cites. Each \ncluster has an `id`, which is any integer except zero.\n\n```javascript\n// initClusters is like booting up an existing document and getting up to speed\ndriver.initClusters([\n    { id: 1, cites: [ {id: \"citekey\"} ] },\n    { id: 2, cites: [ {id: \"citekey\", locator: \"56\", label: \"page\" } ] },\n]);\n// Update or insert any one of them like so\ndriver.insertCluster({ id: 1, cites: [ { id: \"updated_citekey\" } ] });\ndriver.insertCluster({ id: 3, cites: [ { id: \"new_cluster_here\" } ] });\n```\n\nThese clusters do not contain position information, so reordering is a separate \nprocedure. **Without calling setClusterOrder, the driver considers the document \nto be empty.**\n\nSo, `setClusterOrder` expresses the ordering of the clusters within the \ndocument. Each one in the document should appear in this list. You can skip \nnote numbers, which means there were non-citing footnotes in between. Omitting \n`note` means it's an in-text reference. Note numbers must be monotonic, but you \ncan have more than one cluster in the same footnote.\n\n```javascript\ndriver.setClusterOrder([ { id: 1, note: 1 }, { id: 2, note: 4 } ]);\n```\n\nYou will notice that if an interactive user cuts and pastes a paragraph \ncontaining citation clusters, the whole reordering operation can be expressed \nin two calls, one after the cut (with some clusters omitted) and one after the \npaste (with those same clusters placed somewhere else). No calls to \n`insertCluster` need be made.\n\n#### Uncited items\n\nSometimes a user wishes to include references in the bibliography even though \nthey are not mentioned in a citation anywhere in the document.\n\n```javascript\ndriver.includeUncited(\"None\"); // Default\ndriver.includeUncited(\"All\");\ndriver.includeUncited({ Specific: [\"citekeyA\", \"citekeyB\"] });\n```\n\n### 3. Call `driver.batchedUpdates()` and apply the diff\n\nThis gets you a diff to apply to your document UI. It includes both clusters \nthat have changed, and bibliography entries that have changed.\n\n```javascript\nimport { UpdateSummary } from \"@citeproc-rs/wasm\"; // typescript users, annotate with this\n\nlet diff = driver.batchedUpdates();\n\n// apply to the UI\ndiff.clusters.forEach(changedCluster => {\n    let [id, html] = changedCluster;\n    myDocument.updateCluster(id, html);\n});\ndiff.bibliography.entryIds.forEach(citekey => {\n    let html = diff.updatedEntries[citekey];\n    myDocument.updateBibEntry(citekey, html);\n});\n```\n\nNote, for some intuition, if you call `batchedUpdates()` again immediately, the \ndiff will be empty.\n\n\n### Preview citation clusters\n\nSometimes, a user wants to see how a cluster will look while they are editing \nit, before confirming the change.\n\n```javascript\nlet cites = [ { id: \"citekey\", locator: \"45\" }, { ... } ];\nlet positions = [ ... before, { id: 0, note: 34 }, ... after ];\nlet preview = driver.previewCitationCluster(cites, positions, \"html\");\n```\n\nThe positions array is exactly like a call to `setClusterOrder`, except exactly \none of the positions has an id of 0. This could either:\n\n- Replace an existing cluster's position, and preview a cluster replacement; or\n- Represent the position a cluster is hypothetically inserted.\n\nIf you passed only one position, it would be like previewing an operation like \n\"delete the entire document and replace it with this one cluster\". **That would \nmean you would never see \"ibid\" in a preview.** So for maximum utility, \nassemble the positions array as you would a call to `setClusterOrder` with \nexactly the operation you're previewing applied.\n\n\n\n### Non-Interactive use, or re-hydrating a previously created document\n\nIf you are working non-interactively, or re-hydrating a previously created \ndocument for interactive use, you may want to do one pass over all the clusters \nin the document, so that each cluster and bibliography entry reflects the \ncorrect value.\n\n```javascript\n// Get the clusters from your document (example)\nlet allNotes = myDocument.footnotes.map(fn => {\n    return { cluster: getCluster(fn), number: fn.number }\n});\n\n// Re-hydrate the entire document\ndriver.resetReferences(allReferences);\ndriver.initClusters(allNotes.map(fn => fn.cluster));\ndriver.setClusterOrder(allNotes.map(fn => { id: note.cluster.id, note: note.number }));\n\n// Build every cluster, only after the driver knows about all of them\nallNotes.forEach(fn => {\n    fn.renderedHtml = driver.builtCluster(fn.cluster.id);\n});\n\nlet bibliography = driver.makeBibliography();\n\n// Drain the update queue, so the driver knows you're up to date and won't send \n// you a whole-document diff\ndriver.drain();\n\n// Update the UI\nupdateUserInterface(allNotes, bibliography);\n```\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-8d2904e","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-2AU9I13zmkmzVv7rzGkjAXtT1QlD3CvXbxaADdpzyFFwRaosZcEtXv1ad5Cw/Cc1t9B5btL93BIeQLlpv8LsHQ==","shasum":"ab40f9aa298750f8aebd0dd766a1b4a6f4408b9d","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-8d2904e.tgz","fileCount":15,"unpackedSize":11772813,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZT1NCRA9TVsSAnZWagAAEN0QAJtFsoexXtaFS5dP32nY\nPqEBOEXKp4XgKMpWYiU6Fu0050hV+blSvVzv3+dokyVEOj2rnMJKpqQZn90r\nX2igRfKtDnRFG9PCDPgOr0Mqs+dbGw2ALTlMkzP9WucmiCsb+TDv64yxoFoP\nxtVMmVMoTmEbV+CaEsOmwicpbUvEfm9PCTExgqZaTk3oC4mZoqs62Vh6Pail\nULRrNlV5PirF20k8dbts7/2GOnoi82BQWiyu7e+CP3nzcfSf9GXvCWdHtJpa\nnR4wMLZi4rdyf8CIjWyOTFtJASnaWaui48ad+W3XtJTj3viUitNx+0To91vU\nIbaW5c7Xo1koI6EX91pRXxKJ3MLmnsBbx2UyfNR87TXE+wr05viEYKQqt/cW\n4Kory8me91pDSK8p5AhW0LR+OxG2iKXurLDT4NRQKeDkO1HFovj4/2kla57r\nN3wyOEvZWy5BZHzLy/erzAkOJteq1ibIOaKgxiIglV9Jnv7k7y+imGj+0wQx\nNuq+r/1o63GLJipe8XVU0PwhSlrx82+KRSHKrXChQs1UAGdv/cht4NQ40CSn\nqcYEihQTekyIcLFvEsD72aag8wjZ8zybTT6ThFvYWOccEb/4VmVveCInTDsO\n9b1pWpyQY7LC5kx+9k71lKHiJnfzs1P/XTUxF8M1Dh0Y+1y9EGVQ0d+gHYZY\noAZh\r\n=aLcP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAU4jAswD5BYOWEIxEOpIZTA/fnKyzcn9ZvCKBYURp1iAiEA10vz/gsERpemhMNMjAhVSnHiXAqwLHhQ743O1HDeMXQ="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-8d2904e_1600470348703_0.3301949440682319"},"_hasShrinkwrap":false},"0.0.0-canary-dd68e65":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-dd68e65","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a front-end to \n[`citeproc-rs`](https://github.com/cormacrelf/citeproc-rs), a citation \nprocessor written in Rust and compiled to WebAssembly.\n\nIt contains builds appropriate for:\n\n- Node.js\n- Browsers, using a bundler like Webpack.js\n- Browsers directly importing an ES Module from a webserver\n\n## Installation / Release channels\n\nThere are two release channels:\n\n**Stable** is each versioned release. (*At the time of writing, there are no \nversioned releases.*) Install with:\n\n```sh\nyarn add @citeproc-rs/wasm\n```\n\n**Canary** tracks the master branch [on \nGitHub](https://github.com/cormacrelf/citeproc-rs). Its version numbers follow \nthe format `0.0.0-canary-GIT_COMMIT_SHA`, so version ranges in your \n`package.json` are not meaningful. But you can install the latest one with:\n\n```sh\nyarn add @citeproc-rs/wasm@canary\n# alternatively, a specific commit\nyarn add @citeproc-rs/wasm@0.0.0-canary-COMMIT_SHA\n```\n\nIf you use NPM, replace `yarn add` with `npm install`.\n\n### Including in your project\n\nFor Node.js or Webpack, simply import the package as normal. Typescript \ndefinitions are provided, though parts of the API that cannot have \nauto-generated type definitions are alluded to in doc comments with an \naccompanying type you can import.\n\n```\n// Node.js\nconst { Driver } = require(\"@citeproc-rs/wasm\");\n\n// Webpack, anything using compiled ES Modules\nimport { Driver } from \"@citeproc-rs/wasm\";\n```\n\nTo directly import it in a (modern) web browser, you must:\n\n1. Make the `_web` subdirectory of the published NPM package available in a \n   content directory on your webserver, or use a CDN like [unpkg](unpkg.com).\n2. Include a `<script type=\"module\">` tag on your page, like so:\n\n```html\n<script type=\"module\">\n    import init, { Driver } from './path/to/_web/citeproc_rs_wasm.js';\n    async function run() {\n        await init();\n        // use Driver\n    }\n    run()\n</script>\n```\n\n## Usage\n\n\n### Overview\n\nThe basic pattern of interactive use is:\n\n1. Create a driver instance with your style\n2. Edit the references or the citation clusters as you please\n3. **Call `driver.batchedUpdates()`**\n4. Apply the updates to your document (e.g. GUI)\n5. Go to step 2 when a user makes a change\n\nStep three is the important one. Each time you edit a cluster or a reference, \nit is common for only one or two visible modifications to result. Therefore, \nthe driver only gives you those clusters or bibliography entries that have \nchanged, or have been caused to change by an edit elsewhere. You can submit any \nnumber of edits between each call.\n\nThe API also allows for non-interactive use. See below.\n\n\n### 1. Creating a driver instance\n\nFirst, create a driver. Note that for now, you must also call `.free()` on the \nDriver when you are finished with it to deallocate its memory, but [there is a TC39 \nproposal](https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html) \nin the implementation phase that will make this unnecessary.\n\nA driver needs an XML style string, a fetcher (below), and an output format \n(one of `\"html\"`, `\"rtf\"` or `\"plain\"`).\n\n```javascript\nlet driver = Driver.new(cslStyleTextAsXML, fetcher, \"html\");\n// ... use the driver ...\ndriver.free()\n```\n\nThe library parses and validates the CSL style input. Any validation errors are \nreported, with line/column positions, the text at that location, a descriptive \nand useful message (only in English at the moment) and sometimes even a hint \nfor how to fix it. This is thrown as an error, which you can catch in a `try {} \ncatch (e) {}` block.\n\n#### Fetcher\n\nThere are hundreds of locales, and the locales you need change depending on the \nreferences that are active in your document, so the procedure for retrieving \none is asynchronous to allow for fetching one over HTTP. There's not much more \nto it than this:\n\n```javascript\nclass Fetcher {\n    async fetchLocale(lang) {\n        return fetch(\"https://some-cdn-with-locales.com/locales-${lang}.xml\")\n            .then(res => res.text());\n\n        // or just\n        // return \"<locale> ... </locale>\";\n        // return LOCALES_PRELOADED[lang];\n\n        // or if you don't support locales other than the bundled en-US!\n        // return null;\n    }\n}\n\nlet fetcher = new Fetcher(); // Pass to Driver.new()\n```\n\nUnless you don't have `async` syntax, in which case, return a `Promise` \ndirectly, e.g. `return Promise.resolve(\"<locale> ... </locale>\")`.\n\n### 2. Edit the references or the citation clusters\n\n\n#### References\n\nYou can insert a reference like so. This is a [CSL-JSON][schema] object.\n\n[schema]: https://github.com/citation-style-language/schema\n\n```javascript\ndriver.insertReference({ id: \"citekey\", type: \"book\", title: \"Title\" });\ndriver.insertReferences([ ... many references ... ]);\ndriver.resetReferences([ ... deletes any others ... ]);\ndriver.removeReference(\"citekey\");\n```\n\nWhen you do insert a reference, it may have locale information in it. This \nshould be done after updating the references, so any new locales can be \nfetched.\n\n```javascript\n// May call your Fetcher instance.\nawait driver.fetchAll();\n```\n\n#### Citation Clusters and their Cites\n\nA document consists of a series of clusters, each with a series of cites. Each \ncluster has an `id`, which is any integer except zero.\n\n```javascript\n// initClusters is like booting up an existing document and getting up to speed\ndriver.initClusters([\n    { id: 1, cites: [ {id: \"citekey\"} ] },\n    { id: 2, cites: [ {id: \"citekey\", locator: \"56\", label: \"page\" } ] },\n]);\n// Update or insert any one of them like so\ndriver.insertCluster({ id: 1, cites: [ { id: \"updated_citekey\" } ] });\ndriver.insertCluster({ id: 3, cites: [ { id: \"new_cluster_here\" } ] });\n```\n\nThese clusters do not contain position information, so reordering is a separate \nprocedure. **Without calling setClusterOrder, the driver considers the document \nto be empty.**\n\nSo, `setClusterOrder` expresses the ordering of the clusters within the \ndocument. Each one in the document should appear in this list. You can skip \nnote numbers, which means there were non-citing footnotes in between. Omitting \n`note` means it's an in-text reference. Note numbers must be monotonic, but you \ncan have more than one cluster in the same footnote.\n\n```javascript\ndriver.setClusterOrder([ { id: 1, note: 1 }, { id: 2, note: 4 } ]);\n```\n\nYou will notice that if an interactive user cuts and pastes a paragraph \ncontaining citation clusters, the whole reordering operation can be expressed \nin two calls, one after the cut (with some clusters omitted) and one after the \npaste (with those same clusters placed somewhere else). No calls to \n`insertCluster` need be made.\n\n#### Uncited items\n\nSometimes a user wishes to include references in the bibliography even though \nthey are not mentioned in a citation anywhere in the document.\n\n```javascript\ndriver.includeUncited(\"None\"); // Default\ndriver.includeUncited(\"All\");\ndriver.includeUncited({ Specific: [\"citekeyA\", \"citekeyB\"] });\n```\n\n### 3. Call `driver.batchedUpdates()` and apply the diff\n\nThis gets you a diff to apply to your document UI. It includes both clusters \nthat have changed, and bibliography entries that have changed.\n\n```javascript\nimport { UpdateSummary } from \"@citeproc-rs/wasm\"; // typescript users, annotate with this\n\nlet diff = driver.batchedUpdates();\n\n// apply to the UI\ndiff.clusters.forEach(changedCluster => {\n    let [id, html] = changedCluster;\n    myDocument.updateCluster(id, html);\n});\ndiff.bibliography.entryIds.forEach(citekey => {\n    let html = diff.updatedEntries[citekey];\n    myDocument.updateBibEntry(citekey, html);\n});\n```\n\nNote, for some intuition, if you call `batchedUpdates()` again immediately, the \ndiff will be empty.\n\n\n### Preview citation clusters\n\nSometimes, a user wants to see how a cluster will look while they are editing \nit, before confirming the change.\n\n```javascript\nlet cites = [ { id: \"citekey\", locator: \"45\" }, { ... } ];\nlet positions = [ ... before, { id: 0, note: 34 }, ... after ];\nlet preview = driver.previewCitationCluster(cites, positions, \"html\");\n```\n\nThe positions array is exactly like a call to `setClusterOrder`, except exactly \none of the positions has an id of 0. This could either:\n\n- Replace an existing cluster's position, and preview a cluster replacement; or\n- Represent the position a cluster is hypothetically inserted.\n\nIf you passed only one position, it would be like previewing an operation like \n\"delete the entire document and replace it with this one cluster\". **That would \nmean you would never see \"ibid\" in a preview.** So for maximum utility, \nassemble the positions array as you would a call to `setClusterOrder` with \nexactly the operation you're previewing applied.\n\n\n\n### Non-Interactive use, or re-hydrating a previously created document\n\nIf you are working non-interactively, or re-hydrating a previously created \ndocument for interactive use, you may want to do one pass over all the clusters \nin the document, so that each cluster and bibliography entry reflects the \ncorrect value.\n\n```javascript\n// Get the clusters from your document (example)\nlet allNotes = myDocument.footnotes.map(fn => {\n    return { cluster: getCluster(fn), number: fn.number }\n});\n\n// Re-hydrate the entire document\ndriver.resetReferences(allReferences);\ndriver.initClusters(allNotes.map(fn => fn.cluster));\ndriver.setClusterOrder(allNotes.map(fn => { id: note.cluster.id, note: note.number }));\n\n// Build every cluster, only after the driver knows about all of them\nallNotes.forEach(fn => {\n    fn.renderedHtml = driver.builtCluster(fn.cluster.id);\n});\n\nlet bibliography = driver.makeBibliography();\n\n// Drain the update queue, so the driver knows you're up to date and won't send \n// you a whole-document diff\ndriver.drain();\n\n// Update the UI\nupdateUserInterface(allNotes, bibliography);\n```\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-dd68e65","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-lrmRGnLIXdFGXIVDOzoTn0LweHKD4wXtXd9rffePCYrbmWP7t/anAS8ddtoPFET2nlnL6tdH2XdAfNjHLfPNYw==","shasum":"7fbc4d3ef36f37dbde7fe6742922148ed865c7a7","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-dd68e65.tgz","fileCount":15,"unpackedSize":11772954,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZUhpCRA9TVsSAnZWagAAH3kQAJinQPm+XfAafz9M8XBa\nUcl8nysvMMWSKLTYTyllq9iDfDCCfr6+pPTA4gRVMC2N7/nCgjxGBIyYabgK\nk/kmOopyHC7dho8YN6yQ8nzmnJXHUqXwoK1pn5rrjPElixalQJi6M1Iyyfch\nLLnBtEXPdSRwjh2Xw7z+tkxtq/4hdX0rMZNmHsiH6UZnY3y9ALPVT08suqvT\nVxVyhUg3x+i6XMDi8I5EhNRp3aoeC8t0pJViTEtnFDYmA2JhE1+sqZtbSoOW\n86PHQlcr160NP/+u+ndyLNOBKQWBLbzRKFgFc5S2bM2yZBgIN8SYj0THjcRh\nvHQOliYw746sBuOwNgjsNKkUN9v9qCeiI6DygoCRqzzg6QQZjUIbpULjW7Vk\nNMvomnIoOu0oIoX/5G3u9tondK3rqLUZPWG6UPR0YAp3Vf/T6jR35r7aXr4E\n5JKhtmxEVIrlB700FvDrBuRjfNPbGHd0sa8xRLhTFhbqh52MZyKNq1XVH7VY\n7lJY03PmkkZyj64z2oDjZX0oH6C1dun3wmm7RWWsOqK31+ecDS5ZTWfYV4ha\nwZo39otaX8eOyfYdGm2O1WQd0le622TljKxKbe45oIo/0SPouBUGvjMt8z6G\nvarYH/LhAiSolX7UUq+q3S/2jHpivvgnpwstYStA/hiO4DdGt5tgHw/bI2/h\nD5NE\r\n=Y81x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICB2QzPlVqv3XRGIkRz2K9kwQnMxljpkwnelnkmCF483AiEAl/SAS+p9iVpxCM0+J2zax+eP1rpRX60wM2aiQZv0RDE="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-dd68e65_1600473192772_0.9827315180494212"},"_hasShrinkwrap":false},"0.0.0-canary-d96c205":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-d96c205","license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a front-end to \n[`citeproc-rs`](https://github.com/cormacrelf/citeproc-rs), a citation \nprocessor written in Rust and compiled to WebAssembly.\n\nIt contains builds appropriate for:\n\n- Node.js\n- Browsers, using a bundler like Webpack.js\n- Browsers directly importing an ES Module from a webserver\n\n## Installation / Release channels\n\nThere are two release channels:\n\n**Stable** is each versioned release. (*At the time of writing, there are no \nversioned releases.*) Install with:\n\n```sh\nyarn add @citeproc-rs/wasm\n```\n\n**Canary** tracks the master branch [on \nGitHub](https://github.com/cormacrelf/citeproc-rs). Its version numbers follow \nthe format `0.0.0-canary-GIT_COMMIT_SHA`, so version ranges in your \n`package.json` are not meaningful. But you can install the latest one with:\n\n```sh\nyarn add @citeproc-rs/wasm@canary\n# alternatively, a specific commit\nyarn add @citeproc-rs/wasm@0.0.0-canary-COMMIT_SHA\n```\n\nIf you use NPM, replace `yarn add` with `npm install`.\n\n### Including in your project\n\nFor Node.js or Webpack, simply import the package as normal. Typescript \ndefinitions are provided, though parts of the API that cannot have \nauto-generated type definitions are alluded to in doc comments with an \naccompanying type you can import.\n\n```\n// Node.js\nconst { Driver } = require(\"@citeproc-rs/wasm\");\n\n// Webpack, anything using compiled ES Modules\nimport { Driver } from \"@citeproc-rs/wasm\";\n```\n\nTo directly import it in a (modern) web browser, you must:\n\n1. Make the `_web` subdirectory of the published NPM package available in a \n   content directory on your webserver, or use a CDN like [unpkg](unpkg.com).\n2. Include a `<script type=\"module\">` tag on your page, like so:\n\n```html\n<script type=\"module\">\n    import init, { Driver } from './path/to/_web/citeproc_rs_wasm.js';\n    async function run() {\n        await init();\n        // use Driver\n    }\n    run()\n</script>\n```\n\n## Usage\n\n\n### Overview\n\nThe basic pattern of interactive use is:\n\n1. Create a driver instance with your style\n2. Edit the references or the citation clusters as you please\n3. **Call `driver.batchedUpdates()`**\n4. Apply the updates to your document (e.g. GUI)\n5. Go to step 2 when a user makes a change\n\nStep three is the important one. Each time you edit a cluster or a reference, \nit is common for only one or two visible modifications to result. Therefore, \nthe driver only gives you those clusters or bibliography entries that have \nchanged, or have been caused to change by an edit elsewhere. You can submit any \nnumber of edits between each call.\n\nThe API also allows for non-interactive use. See below.\n\n\n### 1. Creating a driver instance\n\nFirst, create a driver. Note that for now, you must also call `.free()` on the \nDriver when you are finished with it to deallocate its memory, but [there is a TC39 \nproposal](https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html) \nin the implementation phase that will make this unnecessary.\n\nA driver needs an XML style string, a fetcher (below), and an output format \n(one of `\"html\"`, `\"rtf\"` or `\"plain\"`).\n\n```javascript\nlet driver = Driver.new(cslStyleTextAsXML, fetcher, \"html\");\n// ... use the driver ...\ndriver.free()\n```\n\nThe library parses and validates the CSL style input. Any validation errors are \nreported, with line/column positions, the text at that location, a descriptive \nand useful message (only in English at the moment) and sometimes even a hint \nfor how to fix it. This is thrown as an error, which you can catch in a `try {} \ncatch (e) {}` block.\n\n#### Fetcher\n\nThere are hundreds of locales, and the locales you need change depending on the \nreferences that are active in your document, so the procedure for retrieving \none is asynchronous to allow for fetching one over HTTP. There's not much more \nto it than this:\n\n```javascript\nclass Fetcher {\n    async fetchLocale(lang) {\n        return fetch(\"https://some-cdn-with-locales.com/locales-${lang}.xml\")\n            .then(res => res.text());\n\n        // or just\n        // return \"<locale> ... </locale>\";\n        // return LOCALES_PRELOADED[lang];\n\n        // or if you don't support locales other than the bundled en-US!\n        // return null;\n    }\n}\n\nlet fetcher = new Fetcher(); // Pass to Driver.new()\n```\n\nUnless you don't have `async` syntax, in which case, return a `Promise` \ndirectly, e.g. `return Promise.resolve(\"<locale> ... </locale>\")`.\n\n### 2. Edit the references or the citation clusters\n\n\n#### References\n\nYou can insert a reference like so. This is a [CSL-JSON][schema] object.\n\n[schema]: https://github.com/citation-style-language/schema\n\n```javascript\ndriver.insertReference({ id: \"citekey\", type: \"book\", title: \"Title\" });\ndriver.insertReferences([ ... many references ... ]);\ndriver.resetReferences([ ... deletes any others ... ]);\ndriver.removeReference(\"citekey\");\n```\n\nWhen you do insert a reference, it may have locale information in it. This \nshould be done after updating the references, so any new locales can be \nfetched.\n\n```javascript\n// May call your Fetcher instance.\nawait driver.fetchAll();\n```\n\n#### Citation Clusters and their Cites\n\nA document consists of a series of clusters, each with a series of cites. Each \ncluster has an `id`, which is any integer except zero.\n\n```javascript\n// initClusters is like booting up an existing document and getting up to speed\ndriver.initClusters([\n    { id: 1, cites: [ {id: \"citekey\"} ] },\n    { id: 2, cites: [ {id: \"citekey\", locator: \"56\", label: \"page\" } ] },\n]);\n// Update or insert any one of them like so\ndriver.insertCluster({ id: 1, cites: [ { id: \"updated_citekey\" } ] });\ndriver.insertCluster({ id: 3, cites: [ { id: \"new_cluster_here\" } ] });\n```\n\nThese clusters do not contain position information, so reordering is a separate \nprocedure. **Without calling setClusterOrder, the driver considers the document \nto be empty.**\n\nSo, `setClusterOrder` expresses the ordering of the clusters within the \ndocument. Each one in the document should appear in this list. You can skip \nnote numbers, which means there were non-citing footnotes in between. Omitting \n`note` means it's an in-text reference. Note numbers must be monotonic, but you \ncan have more than one cluster in the same footnote.\n\n```javascript\ndriver.setClusterOrder([ { id: 1, note: 1 }, { id: 2, note: 4 } ]);\n```\n\nYou will notice that if an interactive user cuts and pastes a paragraph \ncontaining citation clusters, the whole reordering operation can be expressed \nin two calls, one after the cut (with some clusters omitted) and one after the \npaste (with those same clusters placed somewhere else). No calls to \n`insertCluster` need be made.\n\n#### Uncited items\n\nSometimes a user wishes to include references in the bibliography even though \nthey are not mentioned in a citation anywhere in the document.\n\n```javascript\ndriver.includeUncited(\"None\"); // Default\ndriver.includeUncited(\"All\");\ndriver.includeUncited({ Specific: [\"citekeyA\", \"citekeyB\"] });\n```\n\n### 3. Call `driver.batchedUpdates()` and apply the diff\n\nThis gets you a diff to apply to your document UI. It includes both clusters \nthat have changed, and bibliography entries that have changed.\n\n```javascript\nimport { UpdateSummary } from \"@citeproc-rs/wasm\"; // typescript users, annotate with this\n\nlet diff = driver.batchedUpdates();\n\n// apply to the UI\ndiff.clusters.forEach(changedCluster => {\n    let [id, html] = changedCluster;\n    myDocument.updateCluster(id, html);\n});\ndiff.bibliography.entryIds.forEach(citekey => {\n    let html = diff.updatedEntries[citekey];\n    myDocument.updateBibEntry(citekey, html);\n});\n```\n\nNote, for some intuition, if you call `batchedUpdates()` again immediately, the \ndiff will be empty.\n\n\n### Preview citation clusters\n\nSometimes, a user wants to see how a cluster will look while they are editing \nit, before confirming the change.\n\n```javascript\nlet cites = [ { id: \"citekey\", locator: \"45\" }, { ... } ];\nlet positions = [ ... before, { id: 0, note: 34 }, ... after ];\nlet preview = driver.previewCitationCluster(cites, positions, \"html\");\n```\n\nThe positions array is exactly like a call to `setClusterOrder`, except exactly \none of the positions has an id of 0. This could either:\n\n- Replace an existing cluster's position, and preview a cluster replacement; or\n- Represent the position a cluster is hypothetically inserted.\n\nIf you passed only one position, it would be like previewing an operation like \n\"delete the entire document and replace it with this one cluster\". **That would \nmean you would never see \"ibid\" in a preview.** So for maximum utility, \nassemble the positions array as you would a call to `setClusterOrder` with \nexactly the operation you're previewing applied.\n\n\n\n### Non-Interactive use, or re-hydrating a previously created document\n\nIf you are working non-interactively, or re-hydrating a previously created \ndocument for interactive use, you may want to do one pass over all the clusters \nin the document, so that each cluster and bibliography entry reflects the \ncorrect value.\n\n```javascript\n// Get the clusters from your document (example)\nlet allNotes = myDocument.footnotes.map(fn => {\n    return { cluster: getCluster(fn), number: fn.number }\n});\n\n// Re-hydrate the entire document\ndriver.resetReferences(allReferences);\ndriver.initClusters(allNotes.map(fn => fn.cluster));\ndriver.setClusterOrder(allNotes.map(fn => { id: note.cluster.id, note: note.number }));\n\n// Build every cluster, only after the driver knows about all of them\nallNotes.forEach(fn => {\n    fn.renderedHtml = driver.builtCluster(fn.cluster.id);\n});\n\nlet bibliography = driver.makeBibliography();\n\n// Drain the update queue, so the driver knows you're up to date and won't send \n// you a whole-document diff\ndriver.drain();\n\n// Update the UI\nupdateUserInterface(allNotes, bibliography);\n```\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-d96c205","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-brUzY9p7vUjw3Ve/2fd6m8AT/W1m7deZUBbasgtmSl/WZJwg+jw91SkVHNN9JG4lPwCiyH/5SDYuFt6+zdKlaw==","shasum":"087bd53ee5cd5fbe70a84e778c3efb2afe9ff64e","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-d96c205.tgz","fileCount":15,"unpackedSize":11751825,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZVJwCRA9TVsSAnZWagAAKwUP/0YQFHZy8p6r84aFqKsC\nX4ERdQnpgxKHuCjNIAYvsS4g2Tl6aCkHSDgGg3W5FfzeP3wYO/zcsFzWWmFt\na88kYaqkZdip5XNKI71lRd1QKseIy1RLdmvOxH2nIS8GPOR+BiH+bTUiV6/1\nA1wwdzhm3XrjltwiBlpUMZGHFjoYra3J8RHe4cOw5ftm8CVKRTInTTNlQp4R\nhcvJEos3JVe5PAIBE5y8wj7bYF+Xy6eo/zatS59oW594mcfaQ4t6obyj35U9\n9TOzL0Syf0yIU2cSmPbBjpkopLOmW2ym6nVMvOpFHWadQx7uZB+rtVz1lKIr\nNoLKz+hyh4S6AwpIt8cxnjxrYZB00ELflV7GO44RLW0A+uJPKKKkvoAdpeKD\nrmepEQ4M4bmIRy4KeDpX5WlqdHLC+ysW6Jd1Sq+bN+8/uUvpiQelfa0FjsR7\nr36VDs9TkE3PSuimSZIT38+u6H8jLOBEv+7mdYokRvvhG50h5GbC2Q8aIqbz\nvcJVW0QVuKNtK/ZpZ9IikXtGKJo59rP3W2/DMwuogaPeNUPpUF7gEjTyRjWs\nJlOJ7UTznAHSGWiCm4RMWKd8vMh2R8Xi9r7U0s3+rUMWCyHgANutMT8L4h7A\namnBMUYRu2vzXwUbKLaBZT1V8tYIABQkx+AH4TFIMZWvh22D70/Z2eDBNeoJ\nUJww\r\n=9l07\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFsQPznSbpgk+xQ+1KV5HjK9WlJHoMW0Z68qjtquBPkWAiEAiONlsym6wVSqVt0t+cPKTtXsoezLZ7+bTChdrdmuol0="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-d96c205_1600475760010_0.43216581664316855"},"_hasShrinkwrap":false},"0.0.0-canary-36a6745":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-36a6745","license":"MPL-2.0","repository":{"type":"git","url":"git+ssh://git@github.com/cormacrelf/citeproc-rs.git","directory":"packages/citeproc-wasm"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a front-end to \n[`citeproc-rs`](https://github.com/cormacrelf/citeproc-rs), a citation \nprocessor written in Rust and compiled to WebAssembly.\n\nIt contains builds appropriate for:\n\n- Node.js\n- Browsers, using a bundler like Webpack.js\n- Browsers directly importing an ES Module from a webserver\n\n## Installation / Release channels\n\nThere are two release channels:\n\n**Stable** is each versioned release. (*At the time of writing, there are no \nversioned releases.*) Install with:\n\n```sh\nyarn add @citeproc-rs/wasm\n```\n\n**Canary** tracks the master branch [on \nGitHub](https://github.com/cormacrelf/citeproc-rs). Its version numbers follow \nthe format `0.0.0-canary-GIT_COMMIT_SHA`, so version ranges in your \n`package.json` are not meaningful. But you can install the latest one with:\n\n```sh\nyarn add @citeproc-rs/wasm@canary\n# alternatively, a specific commit\nyarn add @citeproc-rs/wasm@0.0.0-canary-COMMIT_SHA\n```\n\nIf you use NPM, replace `yarn add` with `npm install`.\n\n### Including in your project\n\nFor Node.js, simply import the package as normal. Typescript definitions are \nprovided, though parts of the API that cannot have auto-generated type \ndefinitions are alluded to in doc comments with an accompanying type you can \nimport.\n\n```\n// Node.js\nconst { Driver } = require(\"@citeproc-rs/wasm\");\n```\n\n#### Using Webpack\n\nWhen loading on the web, for technical reasons and because the compiled \nWebAssembly is large, you must load the package asynchronously. Webpack comes \nwith the ability to import packages asynchronously like so:\n\n```javascript\n// Webpack\nimport(\"@citeproc-rs/wasm\")\n    .then(go)\n    .catch(console.error);\n\nfunction go(wasm) {\n    const { Driver } = wasm;\n    // use Driver\n}\n```\n\nWhen you do this, your code will trigger a download (and streaming parse) of \nthe binary, and when that is complete, your `go` function will be called. The \ndownload can of course be cached if your web server is set up correctly, making \nthe whole process very quick.\n\nYou can use the regular-import Driver as a TypeScript type anywhere, just don't \nuse it to call `.new()`.\n\nNote the caveats in around Microsoft Edge's TextEncoder/TextDecoder support in \n[the wasm-bindgen \ntutorial](https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html).\n\n```typescript\nimport { Driver } from \"@citeproc-rs/wasm\";\n\nfunction doSomethingWithDriver(driver: Driver) {\n    // ...\n}\n```\n\n#### Importing it in a script tag (`web` target)\n\nTo directly import it without a bundler in a (modern) web browser with ES \nmodules support, the procedure is different. You must:\n\n1. Make the `_web` subdirectory of the published NPM package available in a \n   content directory on your webserver, or use a CDN like [unpkg](unpkg.com).\n2. Include a `<script type=\"module\">` tag in your page's `<body>`, like so:\n\n```html\n<script type=\"module\">\n    import init, { Driver } from './path/to/_web/citeproc_rs_wasm.js';\n    async function run() {\n        await init();\n        // use Driver\n    }\n    run()\n</script>\n```\n\n#### Importing it in a script tag (`no-modules` target)\n\nThis replicates the [wasm-bindgen guide \nentry](https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html?highlight=no-modules#using-the-older---target-no-modules), \nnoting the caveats. You will, similarly to the `web` target, need to make the \ncontents of the `_no_modules` subdirectory of the published NPM package \navailable on a webserver or via a CDN.\n\n```\n<html>\n  <head>\n    <meta content=\"text/html;charset=utf-8\" http-equiv=\"Content-Type\"/>\n  </head>\n  <body>\n    <!-- Include the JS generated by `wasm-pack build` -->\n    <script src='path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm.js'></script>\n\n    <script>\n      // Like with the `--target web` output the exports are immediately\n      // available but they won't work until we initialize the module. Unlike\n      // `--target web`, however, the globals are all stored on a\n      // `wasm_bindgen` global. The global itself is the initialization\n      // function and then the properties of the global are all the exported\n      // functions.\n      //\n      // Note that the name `wasm_bindgen` will at some point be configurable with the\n      // `--no-modules-global` CLI flag (https://github.com/rustwasm/wasm-pack/issues/729)\n      const { Driver } = wasm_bindgen;\n\n      async function run() {\n        // Note the _bg.wasm ending\n        await wasm_bindgen('path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm_bg.wasm');\n\n        // Use Driver\n      }\n\n      run();\n\n    </script>\n  </body>\n</html>\n```\n\n\n## Usage\n\n\n### Overview\n\nThe basic pattern of interactive use is:\n\n1. Create a driver instance with your style\n2. Edit the references or the citation clusters as you please\n3. **Call `driver.batchedUpdates()`**\n4. Apply the updates to your document (e.g. GUI)\n5. Go to step 2 when a user makes a change\n\nStep three is the important one. Each time you edit a cluster or a reference, \nit is common for only one or two visible modifications to result. Therefore, \nthe driver only gives you those clusters or bibliography entries that have \nchanged, or have been caused to change by an edit elsewhere. You can submit any \nnumber of edits between each call.\n\nThe API also allows for non-interactive use. See below.\n\n\n### 1. Creating a driver instance\n\nFirst, create a driver. Note that for now, you must also call `.free()` on the \nDriver when you are finished with it to deallocate its memory, but [there is a TC39 \nproposal](https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html) \nin the implementation phase that will make this unnecessary.\n\nA driver needs an XML style string, a fetcher (below), and an output format \n(one of `\"html\"`, `\"rtf\"` or `\"plain\"`).\n\n```javascript\nlet driver = Driver.new(cslStyleTextAsXML, fetcher, \"html\");\n// ... use the driver ...\ndriver.free()\n```\n\nThe library parses and validates the CSL style input. Any validation errors are \nreported, with line/column positions, the text at that location, a descriptive \nand useful message (only in English at the moment) and sometimes even a hint \nfor how to fix it. This is thrown as an error, which you can catch in a `try {} \ncatch (e) {}` block.\n\n#### Fetcher\n\nThere are hundreds of locales, and the locales you need change depending on the \nreferences that are active in your document, so the procedure for retrieving \none is asynchronous to allow for fetching one over HTTP. There's not much more \nto it than this:\n\n```javascript\nclass Fetcher {\n    async fetchLocale(lang) {\n        return fetch(\"https://some-cdn-with-locales.com/locales-${lang}.xml\")\n            .then(res => res.text());\n\n        // or just\n        // return \"<locale> ... </locale>\";\n        // return LOCALES_PRELOADED[lang];\n\n        // or if you don't support locales other than the bundled en-US!\n        // return null;\n    }\n}\n\nlet fetcher = new Fetcher(); // Pass to Driver.new()\n```\n\nUnless you don't have `async` syntax, in which case, return a `Promise` \ndirectly, e.g. `return Promise.resolve(\"<locale> ... </locale>\")`.\n\n### 2. Edit the references or the citation clusters\n\n\n#### References\n\nYou can insert a reference like so. This is a [CSL-JSON][schema] object.\n\n[schema]: https://github.com/citation-style-language/schema\n\n```javascript\ndriver.insertReference({ id: \"citekey\", type: \"book\", title: \"Title\" });\ndriver.insertReferences([ ... many references ... ]);\ndriver.resetReferences([ ... deletes any others ... ]);\ndriver.removeReference(\"citekey\");\n```\n\nWhen you do insert a reference, it may have locale information in it. This \nshould be done after updating the references, so any new locales can be \nfetched.\n\n```javascript\n// May call your Fetcher instance.\nawait driver.fetchAll();\n```\n\n#### Citation Clusters and their Cites\n\nA document consists of a series of clusters, each with a series of cites. Each \ncluster has an `id`, which is any integer except zero.\n\n```javascript\n// initClusters is like booting up an existing document and getting up to speed\ndriver.initClusters([\n    { id: 1, cites: [ {id: \"citekey\"} ] },\n    { id: 2, cites: [ {id: \"citekey\", locator: \"56\", label: \"page\" } ] },\n]);\n// Update or insert any one of them like so\ndriver.insertCluster({ id: 1, cites: [ { id: \"updated_citekey\" } ] });\ndriver.insertCluster({ id: 3, cites: [ { id: \"new_cluster_here\" } ] });\n```\n\nThese clusters do not contain position information, so reordering is a separate \nprocedure. **Without calling setClusterOrder, the driver considers the document \nto be empty.**\n\nSo, `setClusterOrder` expresses the ordering of the clusters within the \ndocument. Each one in the document should appear in this list. You can skip \nnote numbers, which means there were non-citing footnotes in between. Omitting \n`note` means it's an in-text reference. Note numbers must be monotonic, but you \ncan have more than one cluster in the same footnote.\n\n```javascript\ndriver.setClusterOrder([ { id: 1, note: 1 }, { id: 2, note: 4 } ]);\n```\n\nYou will notice that if an interactive user cuts and pastes a paragraph \ncontaining citation clusters, the whole reordering operation can be expressed \nin two calls, one after the cut (with some clusters omitted) and one after the \npaste (with those same clusters placed somewhere else). No calls to \n`insertCluster` need be made.\n\n#### Uncited items\n\nSometimes a user wishes to include references in the bibliography even though \nthey are not mentioned in a citation anywhere in the document.\n\n```javascript\ndriver.includeUncited(\"None\"); // Default\ndriver.includeUncited(\"All\");\ndriver.includeUncited({ Specific: [\"citekeyA\", \"citekeyB\"] });\n```\n\n### 3. Call `driver.batchedUpdates()` and apply the diff\n\nThis gets you a diff to apply to your document UI. It includes both clusters \nthat have changed, and bibliography entries that have changed.\n\n```javascript\nimport { UpdateSummary } from \"@citeproc-rs/wasm\"; // typescript users, annotate with this\n\nlet diff = driver.batchedUpdates();\n\n// apply to the UI\ndiff.clusters.forEach(changedCluster => {\n    let [id, html] = changedCluster;\n    myDocument.updateCluster(id, html);\n});\ndiff.bibliography.entryIds.forEach(citekey => {\n    let html = diff.updatedEntries[citekey];\n    myDocument.updateBibEntry(citekey, html);\n});\n```\n\nNote, for some intuition, if you call `batchedUpdates()` again immediately, the \ndiff will be empty.\n\n\n### Preview citation clusters\n\nSometimes, a user wants to see how a cluster will look while they are editing \nit, before confirming the change.\n\n```javascript\nlet cites = [ { id: \"citekey\", locator: \"45\" }, { ... } ];\nlet positions = [ ... before, { id: 0, note: 34 }, ... after ];\nlet preview = driver.previewCitationCluster(cites, positions, \"html\");\n```\n\nThe positions array is exactly like a call to `setClusterOrder`, except exactly \none of the positions has an id of 0. This could either:\n\n- Replace an existing cluster's position, and preview a cluster replacement; or\n- Represent the position a cluster is hypothetically inserted.\n\nIf you passed only one position, it would be like previewing an operation like \n\"delete the entire document and replace it with this one cluster\". **That would \nmean you would never see \"ibid\" in a preview.** So for maximum utility, \nassemble the positions array as you would a call to `setClusterOrder` with \nexactly the operation you're previewing applied.\n\n\n\n### Non-Interactive use, or re-hydrating a previously created document\n\nIf you are working non-interactively, or re-hydrating a previously created \ndocument for interactive use, you may want to do one pass over all the clusters \nin the document, so that each cluster and bibliography entry reflects the \ncorrect value.\n\n```javascript\n// Get the clusters from your document (example)\nlet allNotes = myDocument.footnotes.map(fn => {\n    return { cluster: getCluster(fn), number: fn.number }\n});\n\n// Re-hydrate the entire document\ndriver.resetReferences(allReferences);\ndriver.initClusters(allNotes.map(fn => fn.cluster));\ndriver.setClusterOrder(allNotes.map(fn => { id: note.cluster.id, note: note.number }));\n\n// Build every cluster, only after the driver knows about all of them\nallNotes.forEach(fn => {\n    fn.renderedHtml = driver.builtCluster(fn.cluster.id);\n});\n\nlet bibliography = driver.makeBibliography();\n\n// Drain the update queue, so the driver knows you're up to date and won't send \n// you a whole-document diff\ndriver.drain();\n\n// Update the UI\nupdateUserInterface(allNotes, bibliography);\n```\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-36a6745","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-lRxLPLsoLNQ7Weha2XbT73DB5f209yrDOEHmgxYPwWCCiIMcAQnesuoY8cUfAvgRv4tcpCe1+JeUdtdcFCLdGw==","shasum":"8ecd8f37ae71ce0276ed1aad3236dbf193064d3b","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-36a6745.tgz","fileCount":15,"unpackedSize":11753950,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfaAFfCRA9TVsSAnZWagAAKuoP/3OFKWC5/7OyvcetmMzG\nXfM2nA4u2E4iX1w3ZMzarnIoe+TaDaIxFLPka1LAWt3P1CET+u9O9a/IeauS\n+FGXWv3vDsUiIS2LdQ52lQxNtBS5BuPVaT10z/u8G6swh9EVhFn5heP4l0Me\njaXDzYqNWvIXTtynMk2n1ggX6sJCVnqJ8of+MrhmzfGSitTMG2s/fexPzNIu\nQl45Q6JMHanh4/2eE85vtmRVt5J48VJj7oKKTXgdbuLyeaLhQzACHvVA5qM5\nx+JWu5D878x7dxFTjCkMJKYAxjSSd7KXMoDGBRcotQowiMagwmx8D9/i5Bti\nr+Vcv/wt8U3qFaLDtJ5ysAyFgEPBmHKX3oJv0fjrT5fWuGnvqbUM1nk7re4m\nC3L2c/XkEzAeHhe4BJ7QTemxAz0sKuHAajaQOx5gZPZaVtTUSUoOTabfxcui\nVhJXSGqD9PkBKsqhsxby/GPpP7YB3ebXZAquunLEdaegX7W0WrehVy0zx3Hd\npMmyBLyonNCaFOWGGvxOhzJf6qXTR3ObC9M4iWUBVkdlhrYlA6k1rCZABLGa\nigm+GDacXp6dL6Q2t45xk94nzycGmgL7CTw2i59TL1od7xbqjahiSckJz55z\nRGJUtA6ojgQRcRioL50HMfZnibQBIH0SD38b+Uv6BicIFxA39nuLNTuF8T7w\n5rwL\r\n=MB3M\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDpMdvUs4XpxvMCWtDd8eE9xvmr6kvy2VJeoH1awWpGxgIgIPq3XvQD1U2J/i1OEQnXWt500w/hTmvF+Gm8+NJ2Kjc="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-36a6745_1600651615090_0.5091409463431464"},"_hasShrinkwrap":false},"0.0.0-canary-108a426":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-108a426","license":"MPL-2.0","repository":{"type":"git","url":"git+ssh://git@github.com/cormacrelf/citeproc-rs.git","directory":"packages/citeproc-wasm"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a front-end to \n[`citeproc-rs`](https://github.com/cormacrelf/citeproc-rs), a citation \nprocessor written in Rust and compiled to WebAssembly.\n\nIt contains builds appropriate for:\n\n- Node.js\n- Browsers, using a bundler like Webpack.js\n- Browsers directly importing an ES Module from a webserver\n\n## Installation / Release channels\n\nThere are two release channels:\n\n**Stable** is each versioned release. (*At the time of writing, there are no \nversioned releases.*) Install with:\n\n```sh\nyarn add @citeproc-rs/wasm\n```\n\n**Canary** tracks the master branch [on \nGitHub](https://github.com/cormacrelf/citeproc-rs). Its version numbers follow \nthe format `0.0.0-canary-GIT_COMMIT_SHA`, so version ranges in your \n`package.json` are not meaningful. But you can install the latest one with:\n\n```sh\nyarn add @citeproc-rs/wasm@canary\n# alternatively, a specific commit\nyarn add @citeproc-rs/wasm@0.0.0-canary-COMMIT_SHA\n```\n\nIf you use NPM, replace `yarn add` with `npm install`.\n\n### Including in your project\n\nFor Node.js, simply import the package as normal. Typescript definitions are \nprovided, though parts of the API that cannot have auto-generated type \ndefinitions are alluded to in doc comments with an accompanying type you can \nimport.\n\n```\n// Node.js\nconst { Driver } = require(\"@citeproc-rs/wasm\");\n```\n\n#### Using Webpack\n\nWhen loading on the web, for technical reasons and because the compiled \nWebAssembly is large, you must load the package asynchronously. Webpack comes \nwith the ability to import packages asynchronously like so:\n\n```javascript\n// Webpack\nimport(\"@citeproc-rs/wasm\")\n    .then(go)\n    .catch(console.error);\n\nfunction go(wasm) {\n    const { Driver } = wasm;\n    // use Driver\n}\n```\n\nWhen you do this, your code will trigger a download (and streaming parse) of \nthe binary, and when that is complete, your `go` function will be called. The \ndownload can of course be cached if your web server is set up correctly, making \nthe whole process very quick.\n\nYou can use the regular-import Driver as a TypeScript type anywhere, just don't \nuse it to call `.new()`.\n\nNote the caveats in around Microsoft Edge's TextEncoder/TextDecoder support in \n[the wasm-bindgen \ntutorial](https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html).\n\n```typescript\nimport { Driver } from \"@citeproc-rs/wasm\";\n\nfunction doSomethingWithDriver(driver: Driver) {\n    // ...\n}\n```\n\n#### Importing it in a script tag (`web` target)\n\nTo directly import it without a bundler in a (modern) web browser with ES \nmodules support, the procedure is different. You must:\n\n1. Make the `_web` subdirectory of the published NPM package available in a \n   content directory on your webserver, or use a CDN like [unpkg](unpkg.com).\n2. Include a `<script type=\"module\">` tag in your page's `<body>`, like so:\n\n```html\n<script type=\"module\">\n    import init, { Driver } from './path/to/_web/citeproc_rs_wasm.js';\n    async function run() {\n        await init();\n        // use Driver\n    }\n    run()\n</script>\n```\n\n#### Importing it in a script tag (`no-modules` target)\n\nThis replicates the [wasm-bindgen guide \nentry](https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html?highlight=no-modules#using-the-older---target-no-modules), \nnoting the caveats. You will, similarly to the `web` target, need to make the \ncontents of the `_no_modules` subdirectory of the published NPM package \navailable on a webserver or via a CDN.\n\n```\n<html>\n  <head>\n    <meta content=\"text/html;charset=utf-8\" http-equiv=\"Content-Type\"/>\n  </head>\n  <body>\n    <!-- Include the JS generated by `wasm-pack build` -->\n    <script src='path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm.js'></script>\n\n    <script>\n      // Like with the `--target web` output the exports are immediately\n      // available but they won't work until we initialize the module. Unlike\n      // `--target web`, however, the globals are all stored on a\n      // `wasm_bindgen` global. The global itself is the initialization\n      // function and then the properties of the global are all the exported\n      // functions.\n      //\n      // Note that the name `wasm_bindgen` will at some point be configurable with the\n      // `--no-modules-global` CLI flag (https://github.com/rustwasm/wasm-pack/issues/729)\n      const { Driver } = wasm_bindgen;\n\n      async function run() {\n        // Note the _bg.wasm ending\n        await wasm_bindgen('path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm_bg.wasm');\n\n        // Use Driver\n      }\n\n      run();\n\n    </script>\n  </body>\n</html>\n```\n\n\n## Usage\n\n\n### Overview\n\nThe basic pattern of interactive use is:\n\n1. Create a driver instance with your style\n2. Edit the references or the citation clusters as you please\n3. **Call `driver.batchedUpdates()`**\n4. Apply the updates to your document (e.g. GUI)\n5. Go to step 2 when a user makes a change\n\nStep three is the important one. Each time you edit a cluster or a reference, \nit is common for only one or two visible modifications to result. Therefore, \nthe driver only gives you those clusters or bibliography entries that have \nchanged, or have been caused to change by an edit elsewhere. You can submit any \nnumber of edits between each call.\n\nThe API also allows for non-interactive use. See below.\n\n\n### 1. Creating a driver instance\n\nFirst, create a driver. Note that for now, you must also call `.free()` on the \nDriver when you are finished with it to deallocate its memory, but [there is a TC39 \nproposal](https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html) \nin the implementation phase that will make this unnecessary.\n\nA driver needs an XML style string, a fetcher (below), and an output format \n(one of `\"html\"`, `\"rtf\"` or `\"plain\"`).\n\n```javascript\nlet driver = Driver.new(cslStyleTextAsXML, fetcher, \"html\");\n// ... use the driver ...\ndriver.free()\n```\n\nThe library parses and validates the CSL style input. Any validation errors are \nreported, with line/column positions, the text at that location, a descriptive \nand useful message (only in English at the moment) and sometimes even a hint \nfor how to fix it. This is thrown as an error, which you can catch in a `try {} \ncatch (e) {}` block.\n\n#### Fetcher\n\nThere are hundreds of locales, and the locales you need change depending on the \nreferences that are active in your document, so the procedure for retrieving \none is asynchronous to allow for fetching one over HTTP. There's not much more \nto it than this:\n\n```javascript\nclass Fetcher {\n    async fetchLocale(lang) {\n        return fetch(\"https://some-cdn-with-locales.com/locales-${lang}.xml\")\n            .then(res => res.text());\n\n        // or just\n        // return \"<locale> ... </locale>\";\n        // return LOCALES_PRELOADED[lang];\n\n        // or if you don't support locales other than the bundled en-US!\n        // return null;\n    }\n}\n\nlet fetcher = new Fetcher(); // Pass to Driver.new()\n```\n\nUnless you don't have `async` syntax, in which case, return a `Promise` \ndirectly, e.g. `return Promise.resolve(\"<locale> ... </locale>\")`.\n\n### 2. Edit the references or the citation clusters\n\n\n#### References\n\nYou can insert a reference like so. This is a [CSL-JSON][schema] object.\n\n[schema]: https://github.com/citation-style-language/schema\n\n```javascript\ndriver.insertReference({ id: \"citekey\", type: \"book\", title: \"Title\" });\ndriver.insertReferences([ ... many references ... ]);\ndriver.resetReferences([ ... deletes any others ... ]);\ndriver.removeReference(\"citekey\");\n```\n\nWhen you do insert a reference, it may have locale information in it. This \nshould be done after updating the references, so any new locales can be \nfetched.\n\n```javascript\n// May call your Fetcher instance.\nawait driver.fetchAll();\n```\n\n#### Citation Clusters and their Cites\n\nA document consists of a series of clusters, each with a series of cites. Each \ncluster has an `id`, which is any integer except zero.\n\n```javascript\n// initClusters is like booting up an existing document and getting up to speed\ndriver.initClusters([\n    { id: 1, cites: [ {id: \"citekey\"} ] },\n    { id: 2, cites: [ {id: \"citekey\", locator: \"56\", label: \"page\" } ] },\n]);\n// Update or insert any one of them like so\ndriver.insertCluster({ id: 1, cites: [ { id: \"updated_citekey\" } ] });\ndriver.insertCluster({ id: 3, cites: [ { id: \"new_cluster_here\" } ] });\n```\n\nThese clusters do not contain position information, so reordering is a separate \nprocedure. **Without calling setClusterOrder, the driver considers the document \nto be empty.**\n\nSo, `setClusterOrder` expresses the ordering of the clusters within the \ndocument. Each one in the document should appear in this list. You can skip \nnote numbers, which means there were non-citing footnotes in between. Omitting \n`note` means it's an in-text reference. Note numbers must be monotonic, but you \ncan have more than one cluster in the same footnote.\n\n```javascript\ndriver.setClusterOrder([ { id: 1, note: 1 }, { id: 2, note: 4 } ]);\n```\n\nYou will notice that if an interactive user cuts and pastes a paragraph \ncontaining citation clusters, the whole reordering operation can be expressed \nin two calls, one after the cut (with some clusters omitted) and one after the \npaste (with those same clusters placed somewhere else). No calls to \n`insertCluster` need be made.\n\n#### Uncited items\n\nSometimes a user wishes to include references in the bibliography even though \nthey are not mentioned in a citation anywhere in the document.\n\n```javascript\ndriver.includeUncited(\"None\"); // Default\ndriver.includeUncited(\"All\");\ndriver.includeUncited({ Specific: [\"citekeyA\", \"citekeyB\"] });\n```\n\n### 3. Call `driver.batchedUpdates()` and apply the diff\n\nThis gets you a diff to apply to your document UI. It includes both clusters \nthat have changed, and bibliography entries that have changed.\n\n```javascript\nimport { UpdateSummary } from \"@citeproc-rs/wasm\"; // typescript users, annotate with this\n\nlet diff = driver.batchedUpdates();\n\n// apply to the UI\ndiff.clusters.forEach(changedCluster => {\n    let [id, html] = changedCluster;\n    myDocument.updateCluster(id, html);\n});\ndiff.bibliography.entryIds.forEach(citekey => {\n    let html = diff.updatedEntries[citekey];\n    myDocument.updateBibEntry(citekey, html);\n});\n```\n\nNote, for some intuition, if you call `batchedUpdates()` again immediately, the \ndiff will be empty.\n\n\n### Preview citation clusters\n\nSometimes, a user wants to see how a cluster will look while they are editing \nit, before confirming the change.\n\n```javascript\nlet cites = [ { id: \"citekey\", locator: \"45\" }, { ... } ];\nlet positions = [ ... before, { id: 0, note: 34 }, ... after ];\nlet preview = driver.previewCitationCluster(cites, positions, \"html\");\n```\n\nThe positions array is exactly like a call to `setClusterOrder`, except exactly \none of the positions has an id of 0. This could either:\n\n- Replace an existing cluster's position, and preview a cluster replacement; or\n- Represent the position a cluster is hypothetically inserted.\n\nIf you passed only one position, it would be like previewing an operation like \n\"delete the entire document and replace it with this one cluster\". **That would \nmean you would never see \"ibid\" in a preview.** So for maximum utility, \nassemble the positions array as you would a call to `setClusterOrder` with \nexactly the operation you're previewing applied.\n\n\n\n### Non-Interactive use, or re-hydrating a previously created document\n\nIf you are working non-interactively, or re-hydrating a previously created \ndocument for interactive use, you may want to do one pass over all the clusters \nin the document, so that each cluster and bibliography entry reflects the \ncorrect value.\n\n```javascript\n// Get the clusters from your document (example)\nlet allNotes = myDocument.footnotes.map(fn => {\n    return { cluster: getCluster(fn), number: fn.number }\n});\n\n// Re-hydrate the entire document\ndriver.resetReferences(allReferences);\ndriver.initClusters(allNotes.map(fn => fn.cluster));\ndriver.setClusterOrder(allNotes.map(fn => { id: note.cluster.id, note: note.number }));\n\n// Build every cluster, only after the driver knows about all of them\nallNotes.forEach(fn => {\n    fn.renderedHtml = driver.builtCluster(fn.cluster.id);\n});\n\nlet bibliography = driver.makeBibliography();\n\n// Drain the update queue, so the driver knows you're up to date and won't send \n// you a whole-document diff\ndriver.drain();\n\n// Update the UI\nupdateUserInterface(allNotes, bibliography);\n```\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-108a426","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-+iIEYUhCEpA/NrPF5RitA5uZQ6m6Z8NaFbR/quUPnH1P7MxVuYdQhXl2rDRUeiDW9ObllftrhEhg/x22EB+SAg==","shasum":"3e37409d899f18eaa23236f91207dfb4750e982f","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-108a426.tgz","fileCount":15,"unpackedSize":11872205,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfaCluCRA9TVsSAnZWagAAEJoP/iCyhbHGD5n0Uk8FqYcn\nA95td8EajLYPOHdh5o2Qpgt0PBylkYKm84hWBUlkI1gQHTQias1vhFf3En9d\nNJypjISY1bRHP+IQN0zFq7lNIIvBrRKkAcA5I9+CcorwH/SgcM2KTQa3xeUO\nKqg1TdEESl83gYXpdq682sw7Mjs0h8pbkS530fQpGu6ZDMehXJoB5lK/old2\n4bVSEGvIXAzRAGVjC4m7w/mJck9TgMSMQmdzDvs0Kfs9Dfa4KmzFar3iZstz\nyWLlq28RLykcaVrE4gxpAmfUvfKPKpECxRdiFo7T3e62n/TdYVXUnkiLj96l\n5zskr9BuzIBfVlAje0JKS6u7vnWjiRfPAIz9v0pZZ90dJGmYZmpP7e0C+vKe\n50EFAXELfoH/IicjFo62dWhzll7aXBzmBx5PmUdZ24+dc/z3X8kP8u52822V\n5XC8FZBiUGFJ3DCnzAJ8nai6oOMv+nB2BNqKujjd8nQ/zWo+B7afmHs3IHue\nccljlNYl5MCjIPEDxHJfNezT9vVzZmXg1uTQcOAR8CwbJssu9Gp1tV3KsvhS\nDWOuoBOLij25HEInbh7YllnMbUj+XrsgQnz3QX+wBGlxzDEyyBQUYM85+2lh\nT/l79ecVIjLwdVCgEROWlyrxfftzbJU4JJKkvx8F1mNWQkEV28/OLo4zjlZo\nJ+hW\r\n=icZY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD8m8TzgpaGzeoQHrFDwlezvws4io2QGeSn71MrYt7w1wIgIgoo/VdjNm7fjOeBChNvwJTpEAatXV7eJvn/j4P5BtA="}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-108a426_1600661869824_0.32549208790018147"},"_hasShrinkwrap":false},"0.0.0-canary-b724318":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-b724318","license":"MPL-2.0","repository":{"type":"git","url":"git+ssh://git@github.com/cormacrelf/citeproc-rs.git","directory":"packages/citeproc-wasm"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a front-end to \n[`citeproc-rs`](https://github.com/cormacrelf/citeproc-rs), a citation \nprocessor written in Rust and compiled to WebAssembly.\n\nIt contains builds appropriate for:\n\n- Node.js\n- Browsers, using a bundler like Webpack.js\n- Browsers directly importing an ES Module from a webserver\n\n## Installation / Release channels\n\nThere are two release channels:\n\n**Stable** is each versioned release. (*At the time of writing, there are no \nversioned releases.*) Install with:\n\n```sh\nyarn add @citeproc-rs/wasm\n```\n\n**Canary** tracks the master branch [on \nGitHub](https://github.com/cormacrelf/citeproc-rs). Its version numbers follow \nthe format `0.0.0-canary-GIT_COMMIT_SHA`, so version ranges in your \n`package.json` are not meaningful. But you can install the latest one with:\n\n```sh\nyarn add @citeproc-rs/wasm@canary\n# alternatively, a specific commit\nyarn add @citeproc-rs/wasm@0.0.0-canary-COMMIT_SHA\n```\n\nIf you use NPM, replace `yarn add` with `npm install`.\n\n### Including in your project\n\nFor Node.js, simply import the package as normal. Typescript definitions are \nprovided, though parts of the API that cannot have auto-generated type \ndefinitions are alluded to in doc comments with an accompanying type you can \nimport.\n\n```\n// Node.js\nconst { Driver } = require(\"@citeproc-rs/wasm\");\n```\n\n#### Using Webpack\n\nWhen loading on the web, for technical reasons and because the compiled \nWebAssembly is large, you must load the package asynchronously. Webpack comes \nwith the ability to import packages asynchronously like so:\n\n```javascript\n// Webpack\nimport(\"@citeproc-rs/wasm\")\n    .then(go)\n    .catch(console.error);\n\nfunction go(wasm) {\n    const { Driver } = wasm;\n    // use Driver\n}\n```\n\nWhen you do this, your code will trigger a download (and streaming parse) of \nthe binary, and when that is complete, your `go` function will be called. The \ndownload can of course be cached if your web server is set up correctly, making \nthe whole process very quick.\n\nYou can use the regular-import Driver as a TypeScript type anywhere, just don't \nuse it to call `.new()`.\n\nNote the caveats in around Microsoft Edge's TextEncoder/TextDecoder support in \n[the wasm-bindgen \ntutorial](https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html).\n\n```typescript\nimport { Driver } from \"@citeproc-rs/wasm\";\n\nfunction doSomethingWithDriver(driver: Driver) {\n    // ...\n}\n```\n\n#### Importing it in a script tag (`web` target)\n\nTo directly import it without a bundler in a (modern) web browser with ES \nmodules support, the procedure is different. You must:\n\n1. Make the `_web` subdirectory of the published NPM package available in a \n   content directory on your webserver, or use a CDN like [unpkg](unpkg.com).\n2. Include a `<script type=\"module\">` tag in your page's `<body>`, like so:\n\n```html\n<script type=\"module\">\n    import init, { Driver } from './path/to/_web/citeproc_rs_wasm.js';\n    async function run() {\n        await init();\n        // use Driver\n    }\n    run()\n</script>\n```\n\n#### Importing it in a script tag (`no-modules` target)\n\nThis replicates the [wasm-bindgen guide \nentry](https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html?highlight=no-modules#using-the-older---target-no-modules), \nnoting the caveats. You will, similarly to the `web` target, need to make the \ncontents of the `_no_modules` subdirectory of the published NPM package \navailable on a webserver or via a CDN.\n\n```\n<html>\n  <head>\n    <meta content=\"text/html;charset=utf-8\" http-equiv=\"Content-Type\"/>\n  </head>\n  <body>\n    <!-- Include the JS generated by `wasm-pack build` -->\n    <script src='path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm.js'></script>\n\n    <script>\n      // Like with the `--target web` output the exports are immediately\n      // available but they won't work until we initialize the module. Unlike\n      // `--target web`, however, the globals are all stored on a\n      // `wasm_bindgen` global. The global itself is the initialization\n      // function and then the properties of the global are all the exported\n      // functions.\n      //\n      // Note that the name `wasm_bindgen` will at some point be configurable with the\n      // `--no-modules-global` CLI flag (https://github.com/rustwasm/wasm-pack/issues/729)\n      const { Driver } = wasm_bindgen;\n\n      async function run() {\n        // Note the _bg.wasm ending\n        await wasm_bindgen('path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm_bg.wasm');\n\n        // Use Driver\n      }\n\n      run();\n\n    </script>\n  </body>\n</html>\n```\n\n\n## Usage\n\n\n### Overview\n\nThe basic pattern of interactive use is:\n\n1. Create a driver instance with your style\n2. Edit the references or the citation clusters as you please\n3. **Call `driver.batchedUpdates()`**\n4. Apply the updates to your document (e.g. GUI)\n5. Go to step 2 when a user makes a change\n\nStep three is the important one. Each time you edit a cluster or a reference, \nit is common for only one or two visible modifications to result. Therefore, \nthe driver only gives you those clusters or bibliography entries that have \nchanged, or have been caused to change by an edit elsewhere. You can submit any \nnumber of edits between each call.\n\nThe API also allows for non-interactive use. See below.\n\n\n### 1. Creating a driver instance\n\nFirst, create a driver. Note that for now, you must also call `.free()` on the \nDriver when you are finished with it to deallocate its memory, but [there is a TC39 \nproposal](https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html) \nin the implementation phase that will make this unnecessary.\n\nA driver needs an XML style string, a fetcher (below), and an output format \n(one of `\"html\"`, `\"rtf\"` or `\"plain\"`).\n\n```javascript\nlet driver = Driver.new(cslStyleTextAsXML, fetcher, \"html\");\n// ... use the driver ...\ndriver.free()\n```\n\nThe library parses and validates the CSL style input. Any validation errors are \nreported, with line/column positions, the text at that location, a descriptive \nand useful message (only in English at the moment) and sometimes even a hint \nfor how to fix it. This is thrown as an error, which you can catch in a `try {} \ncatch (e) {}` block.\n\n#### Fetcher\n\nThere are hundreds of locales, and the locales you need change depending on the \nreferences that are active in your document, so the procedure for retrieving \none is asynchronous to allow for fetching one over HTTP. There's not much more \nto it than this:\n\n```javascript\nclass Fetcher {\n    async fetchLocale(lang) {\n        return fetch(\"https://some-cdn-with-locales.com/locales-${lang}.xml\")\n            .then(res => res.text());\n\n        // or just\n        // return \"<locale> ... </locale>\";\n        // return LOCALES_PRELOADED[lang];\n\n        // or if you don't support locales other than the bundled en-US!\n        // return null;\n    }\n}\n\nlet fetcher = new Fetcher(); // Pass to Driver.new()\n```\n\nUnless you don't have `async` syntax, in which case, return a `Promise` \ndirectly, e.g. `return Promise.resolve(\"<locale> ... </locale>\")`.\n\n### 2. Edit the references or the citation clusters\n\n\n#### References\n\nYou can insert a reference like so. This is a [CSL-JSON][schema] object.\n\n[schema]: https://github.com/citation-style-language/schema\n\n```javascript\ndriver.insertReference({ id: \"citekey\", type: \"book\", title: \"Title\" });\ndriver.insertReferences([ ... many references ... ]);\ndriver.resetReferences([ ... deletes any others ... ]);\ndriver.removeReference(\"citekey\");\n```\n\nWhen you do insert a reference, it may have locale information in it. This \nshould be done after updating the references, so any new locales can be \nfetched.\n\n```javascript\n// May call your Fetcher instance.\nawait driver.fetchAll();\n```\n\n#### Citation Clusters and their Cites\n\nA document consists of a series of clusters, each with a series of cites. Each \ncluster has an `id`, which is any integer except zero.\n\n```javascript\n// initClusters is like booting up an existing document and getting up to speed\ndriver.initClusters([\n    { id: 1, cites: [ {id: \"citekey\"} ] },\n    { id: 2, cites: [ {id: \"citekey\", locator: \"56\", label: \"page\" } ] },\n]);\n// Update or insert any one of them like so\ndriver.insertCluster({ id: 1, cites: [ { id: \"updated_citekey\" } ] });\ndriver.insertCluster({ id: 3, cites: [ { id: \"new_cluster_here\" } ] });\n```\n\nThese clusters do not contain position information, so reordering is a separate \nprocedure. **Without calling setClusterOrder, the driver considers the document \nto be empty.**\n\nSo, `setClusterOrder` expresses the ordering of the clusters within the \ndocument. Each one in the document should appear in this list. You can skip \nnote numbers, which means there were non-citing footnotes in between. Omitting \n`note` means it's an in-text reference. Note numbers must be monotonic, but you \ncan have more than one cluster in the same footnote.\n\n```javascript\ndriver.setClusterOrder([ { id: 1, note: 1 }, { id: 2, note: 4 } ]);\n```\n\nYou will notice that if an interactive user cuts and pastes a paragraph \ncontaining citation clusters, the whole reordering operation can be expressed \nin two calls, one after the cut (with some clusters omitted) and one after the \npaste (with those same clusters placed somewhere else). No calls to \n`insertCluster` need be made.\n\n#### Uncited items\n\nSometimes a user wishes to include references in the bibliography even though \nthey are not mentioned in a citation anywhere in the document.\n\n```javascript\ndriver.includeUncited(\"None\"); // Default\ndriver.includeUncited(\"All\");\ndriver.includeUncited({ Specific: [\"citekeyA\", \"citekeyB\"] });\n```\n\nThe \"All\" is based on which references your driver knows about. If you have\nthis set to \"All\", simply calling `driver.insertReference()` with a new\nreference ID will result in an entry being added to the bibliography. Entries\nin Specific mode do not have to exist when they are provided here; they can be,\nfor instance, the citekeys of collection of references in a reference library\nwhich are subsequently provided in full to the driver, at which point they\nappear in the bibliography, but not items from elsewhere in the library.\n\n### 3. Call `driver.batchedUpdates()` and apply the diff\n\nThis gets you a diff to apply to your document UI. It includes both clusters \nthat have changed, and bibliography entries that have changed.\n\n```javascript\n// Get the diff since last time batchedUpdates, fullRender or drain was called.\nlet diff = driver.batchedUpdates();\n\n// apply cluster changes to the UI.\nfor (let changedCluster of diff.clusters) {\n    let [id, html] = changedCluster;\n    myDocument.updateCluster(id, html);\n}\n\n// Null? No change to the bibliography.\nif (diff.bibliography != null) {\n    let bib = diff.bibliography;\n    // Save the entries that have actually changed\n    for (let key of Object.keys(bib.updatedEntries)) {\n        let rendered = bib.updatedEntries[key];\n        myDocument.updateBibEntry(key, rendered);\n    }\n    // entryIds is the full list of entries in the bibliography.\n    // If a citekey isn't in there, it should be removed.\n    // It is non-null when it has changed.\n    if (bib.entryIds != null) {\n        myDocument.setBibliographyOrder(bib.entryIds);\n    }\n}\n```\n\nNote, for some intuition, if you call `batchedUpdates()` again immediately, the \ndiff will be empty.\n\n### Bibliographies\n\nBeyond the interactive batchedUpdates method, there are two functions for\nproducing a bibliography statically.\n\n```javascript\n// returns BibliographyMeta, with information about how a library consumer should\n// lay out the bibliography. There is a similar API in citeproc-js.\nlet meta = driver.bibliographyMeta();\n\n// This is an array of BibEntry\nlet bibliography = driver.makeBibliography();\nfor (let entry of bibliography) {\n    console.log(entry.id, entry.value);\n}\n```\n\n### Preview citation clusters\n\nSometimes, a user wants to see how a cluster will look while they are editing \nit, before confirming the change.\n\n```javascript\nlet cites = [ { id: \"citekey\", locator: \"45\" }, { ... } ];\nlet positions = [ ... before, { id: 0, note: 34 }, ... after ];\nlet preview = driver.previewCitationCluster(cites, positions, \"html\");\n```\n\nThe positions array is exactly like a call to `setClusterOrder`, except exactly \none of the positions has an id of 0. This could either:\n\n- Replace an existing cluster's position, and preview a cluster replacement; or\n- Represent the position a cluster is hypothetically inserted.\n\nIf you passed only one position, it would be like previewing an operation like \n\"delete the entire document and replace it with this one cluster\". **That would \nmean you would never see \"ibid\" in a preview.** So for maximum utility, \nassemble the positions array as you would a call to `setClusterOrder` with \nexactly the operation you're previewing applied.\n\n\n\n### Non-Interactive use, or re-hydrating a previously created document\n\nIf you are working non-interactively, or re-hydrating a previously created \ndocument for interactive use, you may want to do one pass over all the clusters \nin the document, so that each cluster and bibliography entry reflects the \ncorrect value.\n\n```javascript\n// Get the clusters from your document (example)\nlet allNotes = myDocument.footnotes.map(fn => {\n    return { cluster: getCluster(fn), number: fn.number }\n});\n\n// Re-hydrate the entire document based on the reference library and your\n// document's clusters\ndriver.resetReferences(myDocument.allReferences);\ndriver.initClusters(allNotes.map(fn => fn.cluster));\ndriver.setClusterOrder(allNotes.map(fn => { id: fn.cluster.id, note: fn.number }));\n\n// Render every cluster and bibliography item.\n// It then drains the update queue, leaving the diff empty for the next edit.\n// see the FullRender typescript type\nlet render = driver.fullRender();\n\n// Write out the rendered clusters into the doc\nfor (let fn of allNotes) {\n    fn.renderedHtml = render.allClusters[fn.cluster.id];\n}\n\n// Write out the bibliography entries as well\nlet allBibKeys = render.bibEntries.map(entry => entry.id);\nfor (let bibEntry of render.bibEntries) {\n    myDocument.bibliographyMap[entry.id] = entry.value;\n}\n\n// Update your (example) UI\nupdateUserInterface(allNotes, myDocument, whatever);\n```\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-b724318","_nodeVersion":"12.18.3","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Z4ZSjtesd8WGPVwNXP50LuQwDTrlEp27x19XOyhKPkP20xgEa3tYH7v794BDTdIznEkQsmGFhgxAbA+U9BG/cA==","shasum":"0373707af423b0dbda44a2fe7a566e1a82e90c37","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-b724318.tgz","fileCount":15,"unpackedSize":11900090,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfaNqACRA9TVsSAnZWagAAK6sQAIzEjY0aq/DB6fTkpdVz\nIFrMee4Z/n3bmdbdMW0sL3dxn6ZD9WeVLE6GL/lvrBoQuHVU6breFGDgTM3b\n5pv5Ym3LwqnkhDFKvPZs0cTohYEhlThLOylT4ufEiqVjuxrxrFNuIwiKtAhO\nzJvDkyD7Lsau7wcho31R3YKJD3YyL8kJjXRikbw8xIGZ6sEYXxC3DoCdHIc6\nXbiByUPHKtOhQVzIh7vzhJwcpFyC8GteFm8lDipzNXzt6f2bmlAVZj2Vzvr6\nr0TltMaQkYLDidWmEFxFOJBJkkY5q1Ly9ui/ao9mkvRXMkdEjLGPebN9xdk8\nAMMxWpez3ni2VLdS7fKQHchyvEzxcldejq4RraPwA/cojecgF5dcXoLIbkEA\nDatIml2eRrZlJQigc/kSGr4zAc8U2iRX65WmyLWsOUF1ckzFzOsWYCDlFY+N\nZMY6JcqunenAs11h8ezLUBgMIf/aDn26EVPwIei3xAse5leZgYPkJt3J4sYL\nU7870Wn8iqj7OI+ijVoTBQz+FNfZUgMmmhQ8YIOa8t8a/3byLObIUGko0xq7\nzXV6Q2esSFmrCCSbT6c0qgE0/W5tQw/GDWWtskROJoAxOKfNc9mj3WRnA3aW\n6xZuaHwmgMGlPi76vt1adFD4mJa/Dv3nqik2yxAzHAVJj2SnlsCq/hOoKMW3\nPziv\r\n=AYaw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCyq9NBks+bjdnAN17Ga1TOsmvC9uyVj3qYQ+9WkiZihgIhANjvrL+XcK7sc5KY+wFmIriMlHobWQFSsjLw//ItVnc5"}]},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-b724318_1600707200068_0.9890549302638225"},"_hasShrinkwrap":false},"0.0.0-canary-3f5d731":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-3f5d731","license":"MPL-2.0","repository":{"type":"git","url":"git+ssh://git@github.com/cormacrelf/citeproc-rs.git","directory":"packages/citeproc-wasm"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a front-end to \n[`citeproc-rs`](https://github.com/cormacrelf/citeproc-rs), a citation \nprocessor written in Rust and compiled to WebAssembly.\n\nIt contains builds appropriate for:\n\n- Node.js\n- Browsers, using a bundler like Webpack.js\n- Browsers directly importing an ES Module from a webserver\n\n## Installation / Release channels\n\nThere are two release channels:\n\n**Stable** is each versioned release. (*At the time of writing, there are no \nversioned releases.*) Install with:\n\n```sh\nyarn add @citeproc-rs/wasm\n```\n\n**Canary** tracks the master branch [on \nGitHub](https://github.com/cormacrelf/citeproc-rs). Its version numbers follow \nthe format `0.0.0-canary-GIT_COMMIT_SHA`, so version ranges in your \n`package.json` are not meaningful. But you can install the latest one with:\n\n```sh\nyarn add @citeproc-rs/wasm@canary\n# alternatively, a specific commit\nyarn add @citeproc-rs/wasm@0.0.0-canary-COMMIT_SHA\n```\n\nIf you use NPM, replace `yarn add` with `npm install`.\n\n### Including in your project\n\nFor Node.js, simply import the package as normal. Typescript definitions are \nprovided, though parts of the API that cannot have auto-generated type \ndefinitions are alluded to in doc comments with an accompanying type you can \nimport.\n\n```\n// Node.js\nconst { Driver } = require(\"@citeproc-rs/wasm\");\n```\n\n#### Using Webpack\n\nWhen loading on the web, for technical reasons and because the compiled \nWebAssembly is large, you must load the package asynchronously. Webpack comes \nwith the ability to import packages asynchronously like so:\n\n```javascript\n// Webpack\nimport(\"@citeproc-rs/wasm\")\n    .then(go)\n    .catch(console.error);\n\nfunction go(wasm) {\n    const { Driver } = wasm;\n    // use Driver\n}\n```\n\nWhen you do this, your code will trigger a download (and streaming parse) of \nthe binary, and when that is complete, your `go` function will be called. The \ndownload can of course be cached if your web server is set up correctly, making \nthe whole process very quick.\n\nYou can use the regular-import Driver as a TypeScript type anywhere, just don't \nuse it to call `.new()`.\n\nNote the caveats in around Microsoft Edge's TextEncoder/TextDecoder support in \n[the wasm-bindgen \ntutorial](https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html).\n\n```typescript\nimport { Driver } from \"@citeproc-rs/wasm\";\n\nfunction doSomethingWithDriver(driver: Driver) {\n    // ...\n}\n```\n\n#### Importing it in a script tag (`web` target)\n\nTo directly import it without a bundler in a (modern) web browser with ES \nmodules support, the procedure is different. You must:\n\n1. Make the `_web` subdirectory of the published NPM package available in a \n   content directory on your webserver, or use a CDN like [unpkg](unpkg.com).\n2. Include a `<script type=\"module\">` tag in your page's `<body>`, like so:\n\n```html\n<script type=\"module\">\n    import init, { Driver } from './path/to/_web/citeproc_rs_wasm.js';\n    async function run() {\n        await init();\n        // use Driver\n    }\n    run()\n</script>\n```\n\n#### Importing it in a script tag (`no-modules` target)\n\nThis replicates the [wasm-bindgen guide \nentry](https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html?highlight=no-modules#using-the-older---target-no-modules), \nnoting the caveats. You will, similarly to the `web` target, need to make the \ncontents of the `_no_modules` subdirectory of the published NPM package \navailable on a webserver or via a CDN.\n\n```\n<html>\n  <head>\n    <meta content=\"text/html;charset=utf-8\" http-equiv=\"Content-Type\"/>\n  </head>\n  <body>\n    <!-- Include the JS generated by `wasm-pack build` -->\n    <script src='path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm.js'></script>\n\n    <script>\n      // Like with the `--target web` output the exports are immediately\n      // available but they won't work until we initialize the module. Unlike\n      // `--target web`, however, the globals are all stored on a\n      // `wasm_bindgen` global. The global itself is the initialization\n      // function and then the properties of the global are all the exported\n      // functions.\n      //\n      // Note that the name `wasm_bindgen` will at some point be configurable with the\n      // `--no-modules-global` CLI flag (https://github.com/rustwasm/wasm-pack/issues/729)\n      const { Driver } = wasm_bindgen;\n\n      async function run() {\n        // Note the _bg.wasm ending\n        await wasm_bindgen('path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm_bg.wasm');\n\n        // Use Driver\n      }\n\n      run();\n\n    </script>\n  </body>\n</html>\n```\n\n\n## Usage\n\n\n### Overview\n\nThe basic pattern of interactive use is:\n\n1. Create a driver instance with your style\n2. Edit the references or the citation clusters as you please\n3. **Call `driver.batchedUpdates()`**\n4. Apply the updates to your document (e.g. GUI)\n5. Go to step 2 when a user makes a change\n\nStep three is the important one. Each time you edit a cluster or a reference, \nit is common for only one or two visible modifications to result. Therefore, \nthe driver only gives you those clusters or bibliography entries that have \nchanged, or have been caused to change by an edit elsewhere. You can submit any \nnumber of edits between each call.\n\nThe API also allows for non-interactive use. See below.\n\n\n### 1. Creating a driver instance\n\nFirst, create a driver. Note that for now, you must also call `.free()` on the \nDriver when you are finished with it to deallocate its memory, but [there is a TC39 \nproposal](https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html) \nin the implementation phase that will make this unnecessary.\n\nA driver needs an XML style string, a fetcher (below), and an output format \n(one of `\"html\"`, `\"rtf\"` or `\"plain\"`).\n\n```javascript\nlet driver = Driver.new(cslStyleTextAsXML, fetcher, \"html\");\n// ... use the driver ...\ndriver.free()\n```\n\nThe library parses and validates the CSL style input. Any validation errors are \nreported, with line/column positions, the text at that location, a descriptive \nand useful message (only in English at the moment) and sometimes even a hint \nfor how to fix it. This is thrown as an error, which you can catch in a `try {} \ncatch (e) {}` block.\n\n#### Fetcher\n\nThere are hundreds of locales, and the locales you need change depending on the \nreferences that are active in your document, so the procedure for retrieving \none is asynchronous to allow for fetching one over HTTP. There's not much more \nto it than this:\n\n```javascript\nclass Fetcher {\n    async fetchLocale(lang) {\n        return fetch(\"https://some-cdn-with-locales.com/locales-${lang}.xml\")\n            .then(res => res.text());\n\n        // or just\n        // return \"<locale> ... </locale>\";\n        // return LOCALES_PRELOADED[lang];\n\n        // or if you don't support locales other than the bundled en-US!\n        // return null;\n    }\n}\n\nlet fetcher = new Fetcher(); // Pass to Driver.new()\n```\n\nUnless you don't have `async` syntax, in which case, return a `Promise` \ndirectly, e.g. `return Promise.resolve(\"<locale> ... </locale>\")`.\n\n### 2. Edit the references or the citation clusters\n\n\n#### References\n\nYou can insert a reference like so. This is a [CSL-JSON][schema] object.\n\n[schema]: https://github.com/citation-style-language/schema\n\n```javascript\ndriver.insertReference({ id: \"citekey\", type: \"book\", title: \"Title\" });\ndriver.insertReferences([ ... many references ... ]);\ndriver.resetReferences([ ... deletes any others ... ]);\ndriver.removeReference(\"citekey\");\n```\n\nWhen you do insert a reference, it may have locale information in it. This \nshould be done after updating the references, so any new locales can be \nfetched.\n\n```javascript\n// May call your Fetcher instance.\nawait driver.fetchAll();\n```\n\n#### Citation Clusters and their Cites\n\nA document consists of a series of clusters, each with a series of cites. Each \ncluster has an `id`, which is any integer except zero.\n\n```javascript\n// initClusters is like booting up an existing document and getting up to speed\ndriver.initClusters([\n    { id: 1, cites: [ {id: \"citekey\"} ] },\n    { id: 2, cites: [ {id: \"citekey\", locator: \"56\", label: \"page\" } ] },\n]);\n// Update or insert any one of them like so\ndriver.insertCluster({ id: 1, cites: [ { id: \"updated_citekey\" } ] });\ndriver.insertCluster({ id: 3, cites: [ { id: \"new_cluster_here\" } ] });\n```\n\nThese clusters do not contain position information, so reordering is a separate \nprocedure. **Without calling setClusterOrder, the driver considers the document \nto be empty.**\n\nSo, `setClusterOrder` expresses the ordering of the clusters within the \ndocument. Each one in the document should appear in this list. You can skip \nnote numbers, which means there were non-citing footnotes in between. Omitting \n`note` means it's an in-text reference. Note numbers must be monotonic, but you \ncan have more than one cluster in the same footnote.\n\n```javascript\ndriver.setClusterOrder([ { id: 1, note: 1 }, { id: 2, note: 4 } ]);\n```\n\nYou will notice that if an interactive user cuts and pastes a paragraph \ncontaining citation clusters, the whole reordering operation can be expressed \nin two calls, one after the cut (with some clusters omitted) and one after the \npaste (with those same clusters placed somewhere else). No calls to \n`insertCluster` need be made.\n\n#### Uncited items\n\nSometimes a user wishes to include references in the bibliography even though \nthey are not mentioned in a citation anywhere in the document.\n\n```javascript\ndriver.includeUncited(\"None\"); // Default\ndriver.includeUncited(\"All\");\ndriver.includeUncited({ Specific: [\"citekeyA\", \"citekeyB\"] });\n```\n\nThe \"All\" is based on which references your driver knows about. If you have\nthis set to \"All\", simply calling `driver.insertReference()` with a new\nreference ID will result in an entry being added to the bibliography. Entries\nin Specific mode do not have to exist when they are provided here; they can be,\nfor instance, the citekeys of collection of references in a reference library\nwhich are subsequently provided in full to the driver, at which point they\nappear in the bibliography, but not items from elsewhere in the library.\n\n### 3. Call `driver.batchedUpdates()` and apply the diff\n\nThis gets you a diff to apply to your document UI. It includes both clusters \nthat have changed, and bibliography entries that have changed.\n\n```javascript\n// Get the diff since last time batchedUpdates, fullRender or drain was called.\nlet diff = driver.batchedUpdates();\n\n// apply cluster changes to the UI.\nfor (let changedCluster of diff.clusters) {\n    let [id, html] = changedCluster;\n    myDocument.updateCluster(id, html);\n}\n\n// Null? No change to the bibliography.\nif (diff.bibliography != null) {\n    let bib = diff.bibliography;\n    // Save the entries that have actually changed\n    for (let key of Object.keys(bib.updatedEntries)) {\n        let rendered = bib.updatedEntries[key];\n        myDocument.updateBibEntry(key, rendered);\n    }\n    // entryIds is the full list of entries in the bibliography.\n    // If a citekey isn't in there, it should be removed.\n    // It is non-null when it has changed.\n    if (bib.entryIds != null) {\n        myDocument.setBibliographyOrder(bib.entryIds);\n    }\n}\n```\n\nNote, for some intuition, if you call `batchedUpdates()` again immediately, the \ndiff will be empty.\n\n### Bibliographies\n\nBeyond the interactive batchedUpdates method, there are two functions for\nproducing a bibliography statically.\n\n```javascript\n// returns BibliographyMeta, with information about how a library consumer should\n// lay out the bibliography. There is a similar API in citeproc-js.\nlet meta = driver.bibliographyMeta();\n\n// This is an array of BibEntry\nlet bibliography = driver.makeBibliography();\nfor (let entry of bibliography) {\n    console.log(entry.id, entry.value);\n}\n```\n\n### Preview citation clusters\n\nSometimes, a user wants to see how a cluster will look while they are editing \nit, before confirming the change.\n\n```javascript\nlet cites = [ { id: \"citekey\", locator: \"45\" }, { ... } ];\nlet positions = [ ... before, { id: 0, note: 34 }, ... after ];\nlet preview = driver.previewCitationCluster(cites, positions, \"html\");\n```\n\nThe positions array is exactly like a call to `setClusterOrder`, except exactly \none of the positions has an id of 0. This could either:\n\n- Replace an existing cluster's position, and preview a cluster replacement; or\n- Represent the position a cluster is hypothetically inserted.\n\nIf you passed only one position, it would be like previewing an operation like \n\"delete the entire document and replace it with this one cluster\". **That would \nmean you would never see \"ibid\" in a preview.** So for maximum utility, \nassemble the positions array as you would a call to `setClusterOrder` with \nexactly the operation you're previewing applied.\n\n\n\n### Non-Interactive use, or re-hydrating a previously created document\n\nIf you are working non-interactively, or re-hydrating a previously created \ndocument for interactive use, you may want to do one pass over all the clusters \nin the document, so that each cluster and bibliography entry reflects the \ncorrect value.\n\n```javascript\n// Get the clusters from your document (example)\nlet allNotes = myDocument.footnotes.map(fn => {\n    return { cluster: getCluster(fn), number: fn.number }\n});\n\n// Re-hydrate the entire document based on the reference library and your\n// document's clusters\ndriver.resetReferences(myDocument.allReferences);\ndriver.initClusters(allNotes.map(fn => fn.cluster));\ndriver.setClusterOrder(allNotes.map(fn => { id: fn.cluster.id, note: fn.number }));\n\n// Render every cluster and bibliography item.\n// It then drains the update queue, leaving the diff empty for the next edit.\n// see the FullRender typescript type\nlet render = driver.fullRender();\n\n// Write out the rendered clusters into the doc\nfor (let fn of allNotes) {\n    fn.renderedHtml = render.allClusters[fn.cluster.id];\n}\n\n// Write out the bibliography entries as well\nlet allBibKeys = render.bibEntries.map(entry => entry.id);\nfor (let bibEntry of render.bibEntries) {\n    myDocument.bibliographyMap[entry.id] = entry.value;\n}\n\n// Update your (example) UI\nupdateUserInterface(allNotes, myDocument, whatever);\n```\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-3f5d731","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-hwoMkkzdlcAvVgUHQA68q/UEHQ8QkGq8BUcD9oDeC9pFKDu8AZgBKAMO87K1ez6aprne4o0c9y4u4EtQ/Be8IQ==","shasum":"be90147585573803f3fc1e4c71028afe0fb64b40","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-3f5d731.tgz","fileCount":15,"unpackedSize":12011975,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJftsFGCRA9TVsSAnZWagAAX24QAJq2hpWWkFqILnBqSoyt\nQWjYfIf1cTgzT0T74bdf1LvP+NajxXgX9Io+JWtnE9UxHBiG0Ii0gGbK16/K\n7SYopxs4R6HZYUYfgHcnercjU254DxHNkp32EriqaYVg/trBSYeAWvRIUTo6\n0BIXFEm8lpX4RCGIbiV5Zn6JjGdKl8+Xyzv978Str9r67bUXkdXO4am7YnI/\nzhn19O4J1iKEl/TUTNupNHL6YHYQZ1+IOsMcLB5QIICz0B03UfQmuvfq+S+2\nRr/9wYpgmUHgqgOhfqLSf+3GXGiODIDzlSa9aRnCNkFBt3syMG8oYjf4q2LB\nLE2ygN5YrkXPuQwonrpk+Oo3IOoKja4q+D2Y2reYNRTK0+YLAHST8o2xOlCZ\ngBogkelxr7ZYkeIvyzD47VEXOcVTF9MQtzZ1TtZ4VETVmKXTVvMCoZLxs9Zs\nkCjZz6aX9YxqDGH39XYssKTs72mKffM53/435tKgMQZvOmLFCKSG7vsxU02F\ntxJqXzAXEC2kOo64/g4+0YeIDU4VpVvSXVTNkHgj+NckFYbkJ20PcEmZRz0e\nrT8QENsHjTCYUBdLFoKMp6f2YvfgxFzkrfYtMoG4nNawF53AtD5sQvLpy9LW\ng0iKTSiKINgN1LlhShxOnLtUWZhKs8Y9pTcPCmh2lrXmvZN478pf6XVlPsEV\ninLu\r\n=bzJh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7gGGQd/40MQb2DVdptbq1cFkNBizMk5nSRJvyplj7SQIgJOBFHYajWXc9CbNmDJH0g8ixY5XyJide4WAAKdqb+Jc="}]},"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-3f5d731_1605812549533_0.4018744855472258"},"_hasShrinkwrap":false},"0.0.0-canary-0ea624e":{"name":"@cormacrelf/citeproc-wasm","collaborators":["Cormac Relf <web@cormacrelf.net>"],"description":"citeproc-rs, compiled to WebAssembly","version":"0.0.0-canary-0ea624e","license":"MPL-2.0","repository":{"type":"git","url":"git+ssh://git@github.com/cormacrelf/citeproc-rs.git","directory":"packages/citeproc-wasm"},"main":"_cjs/citeproc_rs_wasm.js","browser":"_esm/citeproc_rs_wasm.js","types":"_esm/citeproc_rs_wasm.d.ts","sideEffects":false,"publishConfig":{"repository":"https://npm.pkg.github.com"},"readme":"# `@citeproc-rs/wasm`\n\nThis is a front-end to \n[`citeproc-rs`](https://github.com/cormacrelf/citeproc-rs), a citation \nprocessor written in Rust and compiled to WebAssembly.\n\nIt contains builds appropriate for:\n\n- Node.js\n- Browsers, using a bundler like Webpack.js\n- Browsers directly importing an ES Module from a webserver\n\n## Installation / Release channels\n\nThere are two release channels:\n\n**Stable** is each versioned release. (*At the time of writing, there are no \nversioned releases.*) Install with:\n\n```sh\nyarn add @citeproc-rs/wasm\n```\n\n**Canary** tracks the master branch [on \nGitHub](https://github.com/cormacrelf/citeproc-rs). Its version numbers follow \nthe format `0.0.0-canary-GIT_COMMIT_SHA`, so version ranges in your \n`package.json` are not meaningful. But you can install the latest one with:\n\n```sh\nyarn add @citeproc-rs/wasm@canary\n# alternatively, a specific commit\nyarn add @citeproc-rs/wasm@0.0.0-canary-COMMIT_SHA\n```\n\nIf you use NPM, replace `yarn add` with `npm install`.\n\n### Including in your project\n\nFor Node.js, simply import the package as normal. Typescript definitions are \nprovided, though parts of the API that cannot have auto-generated type \ndefinitions are alluded to in doc comments with an accompanying type you can \nimport.\n\n```\n// Node.js\nconst { Driver } = require(\"@citeproc-rs/wasm\");\n```\n\n#### Using Webpack\n\nWhen loading on the web, for technical reasons and because the compiled \nWebAssembly is large, you must load the package asynchronously. Webpack comes \nwith the ability to import packages asynchronously like so:\n\n```javascript\n// Webpack\nimport(\"@citeproc-rs/wasm\")\n    .then(go)\n    .catch(console.error);\n\nfunction go(wasm) {\n    const { Driver } = wasm;\n    // use Driver\n}\n```\n\nWhen you do this, your code will trigger a download (and streaming parse) of \nthe binary, and when that is complete, your `go` function will be called. The \ndownload can of course be cached if your web server is set up correctly, making \nthe whole process very quick.\n\nYou can use the regular-import Driver as a TypeScript type anywhere, just don't \nuse it to call `.new()`.\n\nNote the caveats in around Microsoft Edge's TextEncoder/TextDecoder support in \n[the wasm-bindgen \ntutorial](https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html).\n\n```typescript\nimport { Driver } from \"@citeproc-rs/wasm\";\n\nfunction doSomethingWithDriver(driver: Driver) {\n    // ...\n}\n```\n\n#### Importing it in a script tag (`web` target)\n\nTo directly import it without a bundler in a (modern) web browser with ES \nmodules support, the procedure is different. You must:\n\n1. Make the `_web` subdirectory of the published NPM package available in a \n   content directory on your webserver, or use a CDN like [unpkg](unpkg.com).\n2. Include a `<script type=\"module\">` tag in your page's `<body>`, like so:\n\n```html\n<script type=\"module\">\n    import init, { Driver } from './path/to/_web/citeproc_rs_wasm.js';\n    async function run() {\n        await init();\n        // use Driver\n    }\n    run()\n</script>\n```\n\n#### Importing it in a script tag (`no-modules` target)\n\nThis replicates the [wasm-bindgen guide \nentry](https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html?highlight=no-modules#using-the-older---target-no-modules), \nnoting the caveats. You will, similarly to the `web` target, need to make the \ncontents of the `_no_modules` subdirectory of the published NPM package \navailable on a webserver or via a CDN.\n\n```\n<html>\n  <head>\n    <meta content=\"text/html;charset=utf-8\" http-equiv=\"Content-Type\"/>\n  </head>\n  <body>\n    <!-- Include the JS generated by `wasm-pack build` -->\n    <script src='path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm.js'></script>\n\n    <script>\n      // Like with the `--target web` output the exports are immediately\n      // available but they won't work until we initialize the module. Unlike\n      // `--target web`, however, the globals are all stored on a\n      // `wasm_bindgen` global. The global itself is the initialization\n      // function and then the properties of the global are all the exported\n      // functions.\n      //\n      // Note that the name `wasm_bindgen` will at some point be configurable with the\n      // `--no-modules-global` CLI flag (https://github.com/rustwasm/wasm-pack/issues/729)\n      const { Driver } = wasm_bindgen;\n\n      async function run() {\n        // Note the _bg.wasm ending\n        await wasm_bindgen('path/to/@citeproc-rs/wasm/_no_modules/citeproc_rs_wasm_bg.wasm');\n\n        // Use Driver\n      }\n\n      run();\n\n    </script>\n  </body>\n</html>\n```\n\n\n## Usage\n\n\n### Overview\n\nThe basic pattern of interactive use is:\n\n1. Create a driver instance with your style\n2. Edit the references or the citation clusters as you please\n3. **Call `driver.batchedUpdates()`**\n4. Apply the updates to your document (e.g. GUI)\n5. Go to step 2 when a user makes a change\n\nStep three is the important one. Each time you edit a cluster or a reference, \nit is common for only one or two visible modifications to result. Therefore, \nthe driver only gives you those clusters or bibliography entries that have \nchanged, or have been caused to change by an edit elsewhere. You can submit any \nnumber of edits between each call.\n\nThe API also allows for non-interactive use. See below.\n\n\n### 1. Creating a driver instance\n\nFirst, create a driver. Note that for now, you must also call `.free()` on the \nDriver when you are finished with it to deallocate its memory, but [there is a TC39 \nproposal](https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html) \nin the implementation phase that will make this unnecessary.\n\nA driver needs an XML style string, a fetcher (below), and an output format \n(one of `\"html\"`, `\"rtf\"` or `\"plain\"`).\n\n```javascript\nlet driver = Driver.new(cslStyleTextAsXML, fetcher, \"html\");\n// ... use the driver ...\ndriver.free()\n```\n\nThe library parses and validates the CSL style input. Any validation errors are \nreported, with line/column positions, the text at that location, a descriptive \nand useful message (only in English at the moment) and sometimes even a hint \nfor how to fix it. This is thrown as an error, which you can catch in a `try {} \ncatch (e) {}` block.\n\n#### Fetcher\n\nThere are hundreds of locales, and the locales you need change depending on the \nreferences that are active in your document, so the procedure for retrieving \none is asynchronous to allow for fetching one over HTTP. There's not much more \nto it than this:\n\n```javascript\nclass Fetcher {\n    async fetchLocale(lang) {\n        return fetch(\"https://some-cdn-with-locales.com/locales-${lang}.xml\")\n            .then(res => res.text());\n\n        // or just\n        // return \"<locale> ... </locale>\";\n        // return LOCALES_PRELOADED[lang];\n\n        // or if you don't support locales other than the bundled en-US!\n        // return null;\n    }\n}\n\nlet fetcher = new Fetcher(); // Pass to Driver.new()\n```\n\nUnless you don't have `async` syntax, in which case, return a `Promise` \ndirectly, e.g. `return Promise.resolve(\"<locale> ... </locale>\")`.\n\n### 2. Edit the references or the citation clusters\n\n\n#### References\n\nYou can insert a reference like so. This is a [CSL-JSON][schema] object.\n\n[schema]: https://github.com/citation-style-language/schema\n\n```javascript\ndriver.insertReference({ id: \"citekey\", type: \"book\", title: \"Title\" });\ndriver.insertReferences([ ... many references ... ]);\ndriver.resetReferences([ ... deletes any others ... ]);\ndriver.removeReference(\"citekey\");\n```\n\nWhen you do insert a reference, it may have locale information in it. This \nshould be done after updating the references, so any new locales can be \nfetched.\n\n```javascript\n// May call your Fetcher instance.\nawait driver.fetchAll();\n```\n\n#### Citation Clusters and their Cites\n\nA document consists of a series of clusters, each with a series of cites. Each \ncluster has an `id`, which is any old string.\n\n```javascript\n// initClusters is like booting up an existing document and getting up to speed\ndriver.initClusters([\n    { id: \"one\", cites: [ {id: \"citekey\"} ] },\n    { id: \"two\", cites: [ {id: \"citekey\", locator: \"56\", label: \"page\" } ] },\n]);\n// Update or insert any one of them like so\ndriver.insertCluster({ id: \"one\", cites: [ { id: \"updated_citekey\" } ] });\n// (You can use `driver.randomClusterId()` to generate a new one at random.)\nlet three = driver.randomClusterId();\ndriver.insertCluster({ id: three, cites: [ { id: \"new_cluster_here\" } ] });\n```\n\nThese clusters do not contain position information, so reordering is a separate \nprocedure. **Without calling setClusterOrder, the driver considers the document \nto be empty.**\n\nSo, `setClusterOrder` expresses the ordering of the clusters within the \ndocument. Each one in the document should appear in this list. You can skip \nnote numbers, which means there were non-citing footnotes in between. Omitting \n`note` means it's an in-text reference. Note numbers must be monotonic, but you \ncan have more than one cluster in the same footnote.\n\n```javascript\ndriver.setClusterOrder([ { id: \"one\", note: 1 }, { id: \"two\", note: 4 } ]);\n```\n\nYou will notice that if an interactive user cuts and pastes a paragraph \ncontaining citation clusters, the whole reordering operation can be expressed \nin two calls, one after the cut (with some clusters omitted) and one after the \npaste (with those same clusters placed somewhere else). No calls to \n`insertCluster` need be made.\n\n#### Uncited items\n\nSometimes a user wishes to include references in the bibliography even though \nthey are not mentioned in a citation anywhere in the document.\n\n```javascript\ndriver.includeUncited(\"None\"); // Default\ndriver.includeUncited(\"All\");\ndriver.includeUncited({ Specific: [\"citekeyA\", \"citekeyB\"] });\n```\n\nThe \"All\" is based on which references your driver knows about. If you have\nthis set to \"All\", simply calling `driver.insertReference()` with a new\nreference ID will result in an entry being added to the bibliography. Entries\nin Specific mode do not have to exist when they are provided here; they can be,\nfor instance, the citekeys of collection of references in a reference library\nwhich are subsequently provided in full to the driver, at which point they\nappear in the bibliography, but not items from elsewhere in the library.\n\n### 3. Call `driver.batchedUpdates()` and apply the diff\n\nThis gets you a diff to apply to your document UI. It includes both clusters \nthat have changed, and bibliography entries that have changed.\n\n```javascript\n// Get the diff since last time batchedUpdates, fullRender or drain was called.\nlet diff = driver.batchedUpdates();\n\n// apply cluster changes to the UI.\nfor (let changedCluster of diff.clusters) {\n    let [id, html] = changedCluster;\n    myDocument.updateCluster(id, html);\n}\n\n// Null? No change to the bibliography.\nif (diff.bibliography != null) {\n    let bib = diff.bibliography;\n    // Save the entries that have actually changed\n    for (let key of Object.keys(bib.updatedEntries)) {\n        let rendered = bib.updatedEntries[key];\n        myDocument.updateBibEntry(key, rendered);\n    }\n    // entryIds is the full list of entries in the bibliography.\n    // If a citekey isn't in there, it should be removed.\n    // It is non-null when it has changed.\n    if (bib.entryIds != null) {\n        myDocument.setBibliographyOrder(bib.entryIds);\n    }\n}\n```\n\nNote, for some intuition, if you call `batchedUpdates()` again immediately, the \ndiff will be empty.\n\n### Bibliographies\n\nBeyond the interactive batchedUpdates method, there are two functions for\nproducing a bibliography statically.\n\n```javascript\n// returns BibliographyMeta, with information about how a library consumer should\n// lay out the bibliography. There is a similar API in citeproc-js.\nlet meta = driver.bibliographyMeta();\n\n// This is an array of BibEntry\nlet bibliography = driver.makeBibliography();\nfor (let entry of bibliography) {\n    console.log(entry.id, entry.value);\n}\n```\n\n### Preview citation clusters\n\nSometimes, a user wants to see how a cluster will look while they are editing \nit, before confirming the change.\n\n```javascript\nlet cites = [ { id: \"citekey\", locator: \"45\" }, { ... } ];\nlet positions = [ ... before, { note: 34 }, ... after ];\nlet preview = driver.previewCitationCluster(cites, positions, \"html\");\n```\n\nThe positions array is exactly like a call to `setClusterOrder`, except exactly \none of the positions omits the id field. This could either:\n\n- Replace an existing cluster's position, and preview a cluster replacement; or\n- Represent the position a cluster is hypothetically inserted.\n\nIf you passed only one position, it would be like previewing an operation like \n\"delete the entire document and replace it with this one cluster\". **That would \nmean you would never see \"ibid\" in a preview.** So for maximum utility, \nassemble the positions array as you would a call to `setClusterOrder` with \nexactly the operation you're previewing applied.\n\n\n\n### Non-Interactive use, or re-hydrating a previously created document\n\nIf you are working non-interactively, or re-hydrating a previously created \ndocument for interactive use, you may want to do one pass over all the clusters \nin the document, so that each cluster and bibliography entry reflects the \ncorrect value.\n\n```javascript\n// Get the clusters from your document (example)\nlet allNotes = myDocument.footnotes.map(fn => {\n    return { cluster: getCluster(fn), number: fn.number }\n});\n\n// Re-hydrate the entire document based on the reference library and your\n// document's clusters\ndriver.resetReferences(myDocument.allReferences);\ndriver.initClusters(allNotes.map(fn => fn.cluster));\ndriver.setClusterOrder(allNotes.map(fn => { id: fn.cluster.id, note: fn.number }));\n\n// Render every cluster and bibliography item.\n// It then drains the update queue, leaving the diff empty for the next edit.\n// see the FullRender typescript type\nlet render = driver.fullRender();\n\n// Write out the rendered clusters into the doc\nfor (let fn of allNotes) {\n    fn.renderedHtml = render.allClusters[fn.cluster.id];\n}\n\n// Write out the bibliography entries as well\nlet allBibKeys = render.bibEntries.map(entry => entry.id);\nfor (let bibEntry of render.bibEntries) {\n    myDocument.bibliographyMap[entry.id] = entry.value;\n}\n\n// Update your (example) UI\nupdateUserInterface(allNotes, myDocument, whatever);\n```\n\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"homepage":"https://github.com/cormacrelf/citeproc-rs#readme","_id":"@cormacrelf/citeproc-wasm@0.0.0-canary-0ea624e","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-9YR2Qnmw02rqF6kagIZDUjy/v/EssEImnPpVrr+WGFF8D9Rt7dcq7LUKMWL7wjTGwhB9bgLU4wZyB3EvgQ2jnA==","shasum":"c33d9cbe2d03add4973a30bfbc18ed255599e86e","tarball":"https://registry.npmjs.org/@cormacrelf/citeproc-wasm/-/citeproc-wasm-0.0.0-canary-0ea624e.tgz","fileCount":15,"unpackedSize":12669335,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJft36DCRA9TVsSAnZWagAAHBIQAI+AuJYc8mScE8//MOEQ\nd7uIVVCZlQq9znIAeSMQn4SzsGiLxZ1O8yP65TaIB+Z77ccuuIGfUYfi44Ww\nJbPufd0BsHRFDGKLfblECCfigr4yXVoA1UrPp/cVCJtKIAx2HaUnxI14XNKE\nceHJr15VLuP1xMiqEnWQt2ZxgUoHWNi6LKHvZVV3SAwvcjMIYNwnBNy4PxVy\nOVhf+nEojgg5trqNHKC6zRMrgrBWLCFkFUlo9r8XR5/utO71sBeatjubLIQu\nQiYPl0N9wqEpVVDB184DGR4GRuyEjB+cNazSlqXWv6//ttSF3DrAsX9IyR2F\nvaboMqCzY4roPlKHMv6C5iyY4dYa3IwJwEY8ojpI7g7oIWwcncFA3ks46nzC\nnVDAApzkB6YhOZsk9NyhSGv7k8MZNofAN0xUn9yzjB0E+O48rn1wKWOg+zQw\nNtfJtgxMg35NQKIEIjmlZrnQ2SxqdYt+j71/qiHnKeRwn2p8yzALiw4unXuo\nO3pmGwyhj4W+dpIjwpW3FYtnDCaMXXiFmcrmDj93N6TeRuVoEnmDg6kHmn17\nUkzI/otulz011BvlgYTj9a4gtw66FxypzW8UdWkkOBInsEDgSBsAmo5Xsank\nayIXBQRr+Isy+qMQBSaowbKprlQ10n1JFpIpwKUweHNR7LbhCC0D9DQr1U7S\nbFTg\r\n=uTGE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1uEDMhtxzUc350KPJ7+J4CcqAWcmftKw9IQkOoyZY7AIgIgrgylPtsdZ9kOtpC+MTZBYA29rTBF/32w9d3S/RBCU="}]},"_npmUser":{"name":"cormacrelf","email":"web@cormacrelf.net"},"directories":{},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/citeproc-wasm_0.0.0-canary-0ea624e_1605860994895_0.24966599723745686"},"_hasShrinkwrap":false}},"time":{"created":"2020-09-18T20:02:25.401Z","0.0.0-canary-029407d":"2020-09-18T20:02:25.742Z","modified":"2022-04-05T01:24:24.332Z","0.0.0-canary-ec9b385":"2020-09-18T20:28:08.373Z","0.0.0-canary-289a710":"2020-09-18T20:48:46.973Z","0.0.0-canary-e088424":"2020-09-18T21:20:09.109Z","0.0.0-canary-6024e27":"2020-09-18T22:47:42.928Z","0.0.0-canary-7bb4807":"2020-09-18T23:02:51.091Z","0.0.0-canary-8d2904e":"2020-09-18T23:05:48.986Z","0.0.0-canary-dd68e65":"2020-09-18T23:53:13.093Z","0.0.0-canary-d96c205":"2020-09-19T00:36:00.209Z","0.0.0-canary-36a6745":"2020-09-21T01:26:55.357Z","0.0.0-canary-108a426":"2020-09-21T04:17:50.031Z","0.0.0-canary-b724318":"2020-09-21T16:53:20.298Z","0.0.0-canary-3f5d731":"2020-11-19T19:02:29.858Z","0.0.0-canary-0ea624e":"2020-11-20T08:29:55.309Z"},"maintainers":[{"name":"cormacrelf","email":"web@cormacrelf.net"}],"description":"citeproc-rs, compiled to WebAssembly","homepage":"https://github.com/cormacrelf/citeproc-rs#readme","repository":{"type":"git","url":"git+https://github.com/cormacrelf/citeproc-rs.git"},"bugs":{"url":"https://github.com/cormacrelf/citeproc-rs/issues"},"license":"MPL-2.0","readme":"","readmeFilename":""}