{"_id":"surplus","_rev":"28-cbf282215dc6f893900b718a6b4afe7c","name":"surplus","description":"High-performance JSX web views for S.js applications","dist-tags":{"latest":"0.5.3","beta":"0.5.0-beta18"},"versions":{"0.4.0":{"name":"surplus","version":"0.4.0","description":"Javascript pre-processor that converts JSX syntax into inline DOM instructions","keywords":["javascript","html","JSX","DOM","template","templating"],"author":{"name":"Adam Haile"},"license":"MIT","_id":"surplus@0.4.0","scripts":{},"_shasum":"fbc37aa6f29d9dc951d9c6f1f7b8d45c8afc2165","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"shasum":"fbc37aa6f29d9dc951d9c6f1f7b8d45c8afc2165","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.4.0.tgz","integrity":"sha512-soN1BpIz4OZdrQj2mmcjikJyM3u07b0egREt/+/vtpK9/ZihIOuS5nWNSji7QWsWwIP30T+Iyd741vtvg3Kw6w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDeAwTEmvC2/QbJZICdhfh13jCo5tiwl2GCynShEXTyvQIgaYT7q9iUzzOTPlr4ihMLwoPBxB6Q4jQrRYLdzZMhLc4="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/surplus-0.4.0.tgz_1489606483626_0.9347739566583186"},"directories":{}},"0.4.2":{"name":"surplus","version":"0.4.2","module":"es/Surplus.js","description":"Javascript pre-processor that converts JSX syntax into inline DOM instructions","keywords":["javascript","html","JSX","DOM","template","templating"],"author":{"name":"Adam Haile"},"license":"MIT","_id":"surplus@0.4.2","scripts":{},"_shasum":"cfdc7308ec1ac70b99733ff9fbb06e5db6ff4016","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.0","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"shasum":"cfdc7308ec1ac70b99733ff9fbb06e5db6ff4016","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.4.2.tgz","integrity":"sha512-LH+5cSNf/VTSqdB9T7xYX9ldkWQbag1XAYSSu4US5Nh/jYOGpD6aNZIpJAcCoZq9U/oGWLve9vZmRT0/Oc12yw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCVyqWoiWMAAIrXHJQmUeGjNNPm4dcB3TbtLEy3hk0VxgIgIm8jnXx49k85uWGLKetqpcweSoB7+MxJwEwTDenwDwc="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/surplus-0.4.2.tgz_1494878419573_0.6057073080446571"},"directories":{}},"0.4.3":{"name":"surplus","version":"0.4.3","module":"es/Surplus.js","description":"Javascript pre-processor that converts JSX syntax into inline DOM instructions","keywords":["javascript","html","JSX","DOM","template","templating"],"dependencies":{"s-js":"^0.4.3"},"author":{"name":"Adam Haile"},"license":"MIT","_id":"surplus@0.4.3","scripts":{},"_shasum":"5b9be5364778704c53b9c2814fb363c5e681d4af","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.0","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"shasum":"5b9be5364778704c53b9c2814fb363c5e681d4af","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.4.3.tgz","integrity":"sha512-8Sx+GaHg7NsVWYbZqW2hDjQOhnmifYWbsTNMhvoexEGCup8jQL0/+tKNN9L3d3bEyUoWe6xNk62g4KEMerZf6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCYuXJSWZHvQrtJvIK7lgbgRwmb9xB7d7Mjoldn/or3NQIgEXr8MItfcyLHOD5dXi9aLPhNXL2dJdEVjpZIZwrglpQ="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.4.3.tgz_1496110064530_0.08083201921544969"},"directories":{}},"0.5.0-beta1":{"name":"surplus","version":"0.5.0-beta1","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.43.0","typescript":"^2.5.2"},"gitHead":"288ab6affb559b003a0b2a2331096a565a70f13d","_id":"surplus@0.5.0-beta1","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-jgKn21bTNC1XsVCvsnkm9IPeTm5NVvebYg9mf6ELrjI+pKYHis5YJCw5By7mTY+hkiLSGVEEs8DUwN1zS/imrQ==","shasum":"2e18feb58d69cfe6b8dca6a7c972b2ca85168f4d","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNI1k3z6Vn5+Y7cz2OIB+KEFR5KJu0L2a0cpbQDvppHgIhAOqQvh9MRo/SrYH2XPlg/WyzV1iT4CJ7/PoE6thHqgdg"}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta1.tgz_1505779919092_0.9051310869399458"},"directories":{}},"0.5.0-beta2":{"name":"surplus","version":"0.5.0-beta2","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"75ab8ab77ea0e014a4d57355a41fd02d40264e02","_id":"surplus@0.5.0-beta2","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-yBst/eO6Ca4zZzeKTohdvUsuiPxmFfsFRIJ3yjrGOZY/4qhfAv3mmnze80Y4mj4YexHbFjBgorS7zjfCnbmCKg==","shasum":"afb57ae70014bbe0a1b9538f0e23cf5d976a614e","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCdL160Izsf2uSax/VKZu/DDel5scEX5VqJs4G1Ygm/NAIhAJ7O4imMRicHsNfw6nJl3l3XB4U3DCSbyTMDkF6f4hNy"}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta2.tgz_1509933106966_0.8210800490342081"},"directories":{}},"0.5.0-beta3":{"name":"surplus","version":"0.5.0-beta3","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"fd267935cf88e3f8b854f39b05db18faaa06f41f","_id":"surplus@0.5.0-beta3","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-xIvjjbSf/s24+msYcMox9VlElFCRKF1omU5HWKfFoYckZWwFYID2i7+ELREw69KIym28XsTYsR4O6seDP1W7yg==","shasum":"b1ec81824ef3b31baf9dcfbf23e43b87e5ca95dc","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBOExNfl3a8pcZBFEt3TWoW6HlNYKG7qTTFGsGPV8HKpAiEA0XwIwJIZufWpNotu36SsPGHtLvGWpuLd1yMbO73be0k="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta3.tgz_1509933329179_0.6875813053920865"},"directories":{}},"0.5.0-beta4":{"name":"surplus","version":"0.5.0-beta4","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"375635885591e8e482c1ec263ba595b240a537fc","_id":"surplus@0.5.0-beta4","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-MVU+DIWCNpiP5LXovMZ7bozyh2m0m2c5mKtbq7loLj61j25pKDLkh/GCbZtX0r1v921snDt/TZ8TQQ841mXP/A==","shasum":"c1738ee5fc2dff42548acd61edebd5ea03720871","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta4.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGf1JC8xPgGB6+U1u7H9viSCQ09lm4okvBO7Ep4wsCjAAiEA9M8scHxYFeVr3ye8P90NHpU8Yo3uVbQCvqFRwMfYlw4="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta4.tgz_1513305226044_0.22017846629023552"},"directories":{}},"0.5.0-beta5":{"name":"surplus","version":"0.5.0-beta5","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"838938ff66f5bee47d033bff7006b0fe912c37ec","_id":"surplus@0.5.0-beta5","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-P76my2GCadiKY2Nr9WFLNR7tnd4GUa4ot1rWZwGrcGVQAKOVJ9NyIKz6DQSQc2CFYFwMT7Cr+UwPgMF3x9Kk7A==","shasum":"06314cf6d5c190c2a0d415382bc29b335de90450","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta5.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCwnSlw+YAguoIg4PDXbkqHaHcnom0GwEkfyTedDLjZkwIgd5Hvtzqjj+lwN9WR8ytdgnq5YFfcXXCsv8bcNuiZcAc="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta5.tgz_1514333325780_0.944974357727915"},"directories":{}},"0.5.0-beta6":{"name":"surplus","version":"0.5.0-beta6","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"47e889d055a613e2f08b1077e7da3ce9433b05ca","_id":"surplus@0.5.0-beta6","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-qgzMrEvL2gWKn0k2O+L1UahRK/HV2+4UbHCtndgp9nA5ndssNDygaRna0gdszGQx+Eiwr/XSuQcLo95TrMukew==","shasum":"150f6586dfc0b2c0112de7dc58971e00cfcbf3a3","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta6.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEUKZC48QMepwHCgTF2NRY4sBj+nYogPDJzBsYXpL7GsAiB5XTCXH4CcuC3rPL3HpUAdjvYh17K3jyZZg5Kds0GrCA=="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta6.tgz_1514511243235_0.5641867748927325"},"directories":{}},"0.5.0-beta7":{"name":"surplus","version":"0.5.0-beta7","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"1da91a79d25a2c1dfc98aead8a57b923216f1cab","_id":"surplus@0.5.0-beta7","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-7MYM1ARxiI1iNfh/j6moRlbB+MI4VClr5vJolj55eKJwCQo3vtuQsOF0mZn37/pOcGznm77lB7LdYsf3qCIR/Q==","shasum":"60432148c66b9a59998d123cf4d18733fc81d104","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta7.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDGWP9rJAL7T/9EhgdA0bS6LXftU9UmLqsJnPvMKbB+qAiEAkf2J4annAJmtBM1RmjCCDq6Cpk1WVE15PpY1xMWVxwk="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta7.tgz_1514945508430_0.8274838975630701"},"directories":{}},"0.5.0-beta8":{"name":"surplus","version":"0.5.0-beta8","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"006e7f1b873e9f6939f3d5dd6083a51435c2c4b8","_id":"surplus@0.5.0-beta8","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-6eclArBmZAel/4QAI9uOUkhFGuFfsjsg4L0h9v/65PvMR5UvbgrMm4Virywj+ezwcwwlnq+CB/4CWo8NPsc0OA==","shasum":"ebaaf8519551a3622283ce763016c5f501ff16c2","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta8.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFd4BHDFxLf+R4i5rOyBiVnBiaCEgkXqA16Ib+zGofL0AiBtM1Qzh06z6zKmr3DheNi621bp/oRpPZfV0AJG/rlVIQ=="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta8.tgz_1515011179029_0.517834291793406"},"directories":{}},"0.5.0-beta9":{"name":"surplus","version":"0.5.0-beta9","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"8febfd74bb4f1e00890e3482019c1a3893d1a466","_id":"surplus@0.5.0-beta9","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-TUdjxr4WzawC4gwoGz2b7QKc2gcTmKM0vLtYjq+tUU363tKZmD7OO7/f2xxdPP8wUU6+TpwTJ7DZFhwo7zCpzw==","shasum":"c3d759a9358563f7501ecc3d975090ff7658cc0b","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta9.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDICPUgpVqj+QE8evcoVUYyF5AwlZuthljOTbXHkqG0AIhAKGnex998nzJ4tvfxPKcI/Z2bENKSUVsLQurNzfGwS/6"}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta9.tgz_1515209331052_0.8405995841603726"},"directories":{}},"0.5.0-beta10":{"name":"surplus","version":"0.5.0-beta10","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-jasmine":"^1.1.0","karma-chrome-launcher":"^2.1.1","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"2c3f3b51314455c4dd9f1a375885fdea78c001a9","_id":"surplus@0.5.0-beta10","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-jO4b1DPkf+vD6oH+Hg3iGjDBigUdAAV2hiX13z+iNlUgzu8uSVtUuoKIoVWzbtzJ67f/dC9Ykx3lkHvAcKQEpw==","shasum":"c66c3d273d71b4ad3c9bfcbef23b01682e3a1ecb","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta10.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF8W59sX8aOrL34X5WNbIV5RVv0NG7UoNa8Mg5HIs7arAiAcDnrxcvopcqgh+dl94MQpq+voJeyCVb9NuCyKV6lvsQ=="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta10.tgz_1517328538098_0.5735210049897432"},"directories":{}},"0.5.0-beta11":{"name":"surplus","version":"0.5.0-beta11","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"54c8f7ee2e046fa17c5496b736d1f7729a5f866e","_id":"surplus@0.5.0-beta11","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-pu+TyGPhUqEMnUwToYTXjqMu5ZYqJBdz7IIrlh/Np01OqUNba5daybxCLnGPXVT7yoq6r5FreH860lc8VQJxjQ==","shasum":"e119d31580e41766eb265f6e33ebd88711cf42ca","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta11.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIELrsvzzszBhI5x9cTaO9WtwixAKWbKD3m0RkyCjRlQEAiAcW8AAKfv3j2IlT0TiJhtICjvAgB1v0ixAk4ewLquSvw=="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta11.tgz_1517334888585_0.5652063055895269"},"directories":{}},"0.5.0-beta12":{"name":"surplus","version":"0.5.0-beta12","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"a968a7ef60d80a564b77c91f9d30039b37819d3b","_id":"surplus@0.5.0-beta12","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-RfsL6AT9vAtjeHVQr8+02cwhIEEkeKx6G8/82NEQrhmRUWDFlHU1PGW2ZHD/tqabxnJOHG7t80P6br2Dppgfbw==","shasum":"e6cd1d057597b464de8e57ed06b56599a26cfdeb","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta12.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEMHhug/gsvHjnhbQkK5Jgo2uqhRwYn3F+jjvhD5K+IdAiBuKiD5Ruze9R1mWaHOPLujb2029l/V56xhuQ56lSyDrQ=="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta12.tgz_1517454098489_0.34342431044206023"},"directories":{}},"0.5.0-beta13":{"name":"surplus","version":"0.5.0-beta13","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"730b7658f240a1902baef2ba4a3a0d1742c26cc6","_id":"surplus@0.5.0-beta13","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-Hq0HZkoiHLzY1jqaNRyMDTK7AddqdmELs7gCIHeLzfm3CGPXbE9xGJe8se4+k73/uaSRSlVkCx9Seqakf8wjAw==","shasum":"21362d1b577f45ad63b6933bda68dcef93101cde","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta13.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVyBBcuXps2qY+IFywJsouB2RSK7fbT0k4zrB6s71WMAIhANzBkOZvSGqMhOGFwTjj+ZNvmlOP6o/e/xWV4fE5AY1T"}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta13.tgz_1517529589654_0.8131501406896859"},"directories":{}},"0.5.0-beta14":{"name":"surplus","version":"0.5.0-beta14","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"f216e667e1dad6307f46b2c1ca7e691e705d388d","_id":"surplus@0.5.0-beta14","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-8NA8qZy/i3Ob83C2OLJ0u0dIdV9i4pvTBSiffBSqJdhWOIuxmgdlOsb0f9cmkME69aF2+wPiSfGRoQccl8hg+w==","shasum":"cb9f957c88da9ae8928f6cb54e7b97b6813a66e1","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta14.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICm0ZFLXzDK2wEDghrciacoous29nE+lLNxVgKJEVoqwAiBGgcwWZ5svfYUEmJV4XgfD1Z62QVmSwx4vPhh9w0g59g=="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta14.tgz_1517532840963_0.8481628182344139"},"directories":{}},"0.5.0-beta15":{"name":"surplus","version":"0.5.0-beta15","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"586a2e8755047e4d6032deaf834714b2b9bc8266","_id":"surplus@0.5.0-beta15","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-UPbaKjZ2Awc5YFES5OFX701ER/tolOJPhXYMJSDgMKcz9N6k/gKpbWt2ek/1KFZufRaTRmRTNdMUak0u1CYMkQ==","shasum":"437e792d335c51e41b1dbe194d2a1992034380ec","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta15.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDI2usjLi+kpayQli7X0rNmjOzhWA+WgJet0qLJqsdhuwIgAwAQH63fxgSu0Ga/hUJzSzS1O3hSFPPi38sImuxbsgQ="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta15.tgz_1517535740131_0.550727321067825"},"directories":{}},"0.5.0-beta16":{"name":"surplus","version":"0.5.0-beta16","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"b75cfb6e181c8322ff105340b580cd2e7145dc78","_id":"surplus@0.5.0-beta16","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-lmawy8B7pqtp7SK/N5pfYndcNgZRy03tf02GvU5+LdXrEMoC6KR+WPgb3HLuyuvpa4pg7k1sHrIgQD+XA4TsVg==","shasum":"21b373b2e573515aa307dd23db103eb90c6a749c","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta16.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7U7uYwNKSfozrRKm/fytDQtbpwd8DqwphWbbquVG4zgIgHi9w4G/rBj0R0Bq4Xd1Tg6G3HWR+Z47yf4ovg1YrBaQ="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta16.tgz_1517599918570_0.9964324398897588"},"directories":{}},"0.5.0-beta17":{"name":"surplus","version":"0.5.0-beta17","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"afb5760467c8fc7a0b1af56ff772cb4aa81c0a94","_id":"surplus@0.5.0-beta17","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-3ELJEmbn8kQ13xNo/n6esEPU93yeNPPWAvoNm3xL/naUtG+6wdE6CHzycASAYgqGYSyvuNDdrRdQPBP8OSj9nA==","shasum":"ad122ab6ec14f30095da2cf97bc18de05a06792b","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta17.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCi+jIcIpbTTCadCHWEdL+oqCofc4gGMNhDbkql8mI7NAIgU2mFcZ6fE29az3et+UtpeJRHTT/LFQBpOFFJMJajTVY="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus-0.5.0-beta17.tgz_1517696818649_0.4819368787575513"},"directories":{}},"0.5.0-beta18":{"name":"surplus","version":"0.5.0-beta18","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"readme":"# Surplus\n\n```javascript\nvar name = S.data(\"world\"),\n    view = <h1>Hello {name()}!</h1>;\ndocument.body.appendChild(view);\n```\nSurplus is a compiler and runtime to allow [S.js](https://github.com/adamhaile/S) applications to create high-performance web views using JSX.  Thanks to JSX, the views are clear, declarative definitions of your UI.  Thanks to S, they update automatically and efficiently as your data changes.\n\n*Note: these docs are for version 0.5, which is currently in late beta.  If installing from npm, be sure to specify `surplus@beta`.*\n\n## Installation\n\n```sh\n> npm install --save surplus@beta s-js // for 0.5 beta\n> npm install --save surplus s-js // for 0.4.x\n```\n\nLike React, Surplus has two parts, a compiler and a runtime.\n\n### Runtime\nThe Surplus runtime must be imported as `Surplus` into any module using Surplus JSX views.\n\n```javascript\nimport * as Surplus from 'surplus'; // ES2015 modules\nvar Surplus = require('surplus');   // CommonJS modules\n```\n\n### Compiler\n\nThe easiest way to run Surplus' compiler is via a plugin for your build tool:\n\n- Webpack: [surplus-loader](https://github.com/adamhaile/surplus-loader)\n- Rollup: [rollup-plugin-surplus](https://github.com/adamhaile/rollup-plugin-surplus)\n- Gulp: [gulp-surplus](https://github.com/adamhaile/gulp-surplus)\n- Browserify: [surplusify](https://github.com/adamhaile/surplusify)\n\nIf you aren't using one of these tools, or if you want to write your own plugin, see [Calling the surplus compiler](#calling-the-surplus-compiler).\n\n## Example\n\nHere is a minimalist ToDo application, which you can run on [CodePen](https://codepen.io/adamhaile/pen/ppvdGa?editors=0010).\n```jsx\nvar Todo = t => ({               // our Todo constructor\n       title: S.data(t.title),   // properties are S data signals\n       done: S.data(t.done)\n    }),\n    todos = SArray([]),          // our todos, using SArray\n    newTitle = S.data(\"\"),       // title for new todos\n    addTodo = () => {            // push new title onto list\n       todos.push(Todo({ title: newTitle(), done: false }));\n       newTitle(\"\");             // clear new title\n    },\n    view =                       // declarative main view\n       <div>                     \n          <h2>Minimalist ToDos in Surplus</h2>\n          <input type=\"text\" fn={data(newTitle)}/>\n          <a onClick={addTodo}> + </a>\n          {todos.map(todo =>     // insert todo views\n             <div>\n                <input type=\"checkbox\" fn={data(todo.done)}/>\n                <input type=\"text\" fn={data(todo.title)}/>\n                <a onClick={() => todos.remove(todo)}>&times;</a>\n             </div>\n          )}\n       </div>;\n\ndocument.body.appendChild(view); // add view to document\n```\nSome things to note:\n- There is no `.mount()` or `.render()` command: Surplus JSX expressions return real nodes, which can be attached to the page with standard DOM commands, `document.body.appendChild(view)`.\n- There is no `.update()` command: Surplus uses [S](https://github.com/adamhaile/S) computations to build the view, so the view responds automatically to changes in S signals.\n\nFor a slighlty longer example, see the standard [TodoMVC in Surplus](https://github.com/adamhaile/surplus-todomvc), which you can run [here](https://adamhaile.github.io/surplus-todomvc).\n\n## Features\n\n### Real DOM Elements, not Virtual\n\nSurplus JSX expressions create real DOM elements, not virtual elements like React or other vdom libraries.\n\n```javascript\nvar node = <span>foo</span>;\n// since node is a real HTMLSpanElement, we can use its properties\nnode.className = \"bar\";\n```\nFor a longer discussion, see [why real DOM nodes?](#why-real-dom-nodes)\n\nCreating real DOM nodes removes the entire &ldquo;middle layer&rdquo; from Surplus: there are no components, no &ldquo;lifecycle,&rdquo; no mount or diff/patch.  DOM nodes are values like any other, &ldquo;components&rdquo; are plain old functions that return DOM nodes.\n\n### Automatic Updates\n\nIf your Surplus JSX expression references any S signals, then Surplus creates an S computation to keep that part of the DOM up to date:\n\n```javascript\nvar text = S.data(\"foo\"),\n    node = <span>{text()}</span>; \n\n// node starts out equal to <span>foo</span>\n\ntext(\"bar\");\n\n// now it's <span>bar</span>\n```\n\n### JSX\n\nSurplus is not a React &ldquo;work-alike,&rdquo; but it uses the JSX syntax popularized by React to define its views.  This has several advantages:\n\n1. JSX is declarative.  In a reactive system, it's important that we only need to know *what* our data is, not *how* or *when* we got here.\n2. JSX has well-established tooling: syntax highlighters, type checkers (Surplus has full Typescript support), linters, etc. all work with Surplus JSX.\n3. JSX mitigates some of the risk of adopting (or abandoning) Surplus.  Much Surplus JSX code already works as React stateless functional components, and vice versa.  Surplus avoids arbitrary differences with React when feasible.\n\n### Performance\nSurplus apps generally rank at or near the top of most javascript benchmarks.  This has two reasons:\n\n1. Surplus&rsquo; compiler does as much work as it can at compile time, so that the runtime code can focus on the truly dynamic operations.\n\n1. Targetting real DOM nodes removes the cost of the vdom &ldquo;middle layer.&rdquo;  For instance, Surplus can compile property assignments down to direct JIT-friendly statements like `node.type = \"text\"`.\n\n## Documentation\n\n### Creating HTML Elements\n\n```javascript\nvar div       = <div></div>, // an HTMLDivElement\n    input     = <input/>;    // an HTMLInputElement\n    // ... etc\n```\n\nJSX expressions with *lower-cased* tags create elements.  These are HTML elements, unless their tag name or context is known to be SVG (see next entry).  \n\nThere are no unclosed tags in JSX: all elements must either have a closing tag `</...>` or end in `/>`,\n\n### Creating SVG Elements\n\n```javascript\nvar svg       = <svg></svg>, // SVGSVGElement\n    svgCircle = <circle/>,   // SVGCircleElement\n    svgLine   = <line/>;     // SVGLineElement\n    // ... etc\n```\n\nIf the tag name matches a known SVG element, Surplus will create an SVG element instead of an HTML one.  For the small set of tag names that belong to both -- `<a>`, `<font>`, `<title>`, `<script>` and `<style>` -- Surplus creates an HTML element.\n\n```javascript\nvar title = <title></title>; // an HTMLTitleElement\n```\n\nChildren of SVG elements are also SVG elements, unless their parent is the `<foreignObject>` element, in which case they are DOM elements again.\n\n```javascript\nvar svg = \n    <svg>\n        <text>an SVGTextElement</text>\n        <foreignObject>\n            <div>an HTMLDivElement</div>\n        </foreignObject>\n    </svg>;\n```\n\nTo create the SVG version of an ambiguous tag name, put it under a known SVG tag and extract it.\n\n```javascript\nvar svg      = <svg><title>an SVGTitleElement</title></svg>,\n    svgTitle = svg.firstChild;\n```\n\n### Setting properties\n\nJSX allows static, dynamic and spread properties:\n\n```jsx\n// static\nvar input1 = <input type=\"text\" />;\n\n// dynamic\nvar text = \"text\",\n    input2 = <input type={text} />;\n\n// spread\nvar props = { type: \"text\" },\n    input3 = <input {...props} />;\n```\n\nSince Surplus creates DOM elements, the property names generally refer to DOM element properties, although there are a few special cases: \n\n1. If Surplus can tell that the given name belongs to an attribute not a property, it will set the attribute instead.  Currently, the heuristic used to distinguish attributes from properties is &ldquo;does it have a hyphen.&rdquo;  So `<div aria-hidden=\"true\">` will set the `aria-hidden` attribute.\n2. Some properties have aliases.  See below.\n4. The properties `ref` and `fn` are special.  See below.\n\nYou can set a property with an unknown name, and it will be assigned to the node, but it will have no effect on the DOM:\n\n```javascript\nvar input = <input myProperty={true} />;\ninput.myProperty === true;\n```\n\n### Property aliases\n\nIn order to provide greater source compatibility with React and HTML, Surplus allows some properties to be referenced via aliases.\n\n1. For compatibility with React, Surplus allows the React alternate property names as aliases for the corresponding DOM property.  So `onClick` is an alias for the native `onclick`.\n2. For compatibility with HTML, Surplus allows `class` and `for` as aliases for the `className` and `htmlFor` properties.\n\nFor static and dynamic properties, aliases are normalized at compile time, for spread properties at runtime.\n\n### Property precedence\n\nIf the same property is set multiple times on a node, the last one takes precedence:\n\n```javascript\nvar props = { type: \"radio\" },\n    input = <input {...props} type=\"text\" />;\ninput.type === \"text\";\n```\n\n### Special `ref` property\n\nA `ref` property specifies a variable to which the given node is assigned.  This makes it easy to get a reference to internal nodes.\n\n```javascript\nvar input,\n    div = <div>\n            <input ref={input} type=\"text\" />\n          </div>;\ninput.type === \"text\";\n```\n\nThe `ref` property fulfills a very similar role to the `ref` property in React, except that since nodes are created immediately in Surplus, it does not take a function but an assignable expression.\n\n### Special `fn` property\n\nA `fn` property specifies a function to be applied to a node.  It is useful for encapsulating a bit of reusable behavior or properties.\n\n```javascript\nimport { data } from 'surplus-fn-data'; // two-way data binding utility\nvar value = S.data(\"foo\"),\n    input = <input type=\"text\" fn={data(value)} />;\ninput.value === \"foo\";\n// user enters \"bar\" in input\ninput.value === \"bar\";\n```\n\nThe function may take an optional second parameter, which will contain any value returned by the previous invocation, aka a &lsquo;reducing&rsquo; pattern.  In typescript, the full signature looks like:\n\n```typescript\ntype SurplusFn = <N, T>(node : N, state : T | undefined) => T\n```\n\nThe `fn` property may be specified multiple times for a node.  Surplus provides aliases `fn1`, `fn2`, etc., in case your linter complains about the repeated properties.\n\n### Creating Child Elements\n\nJSX defines two kinds of children, static and dynamic.\n\n```javascript\n// static\nvar div = \n    <div>\n        <span>a static child</span>\n        Static child text\n    </div>;\n\n// { dynamic } \nvar span = <span>a dynamic child</span>,\n    div = \n        <div>\n            {span}\n        </div>;\n```\n\nWith a dynamic child, the given expression is evaluated, and its result is inserted into the child nodes according to the following rules:\n\n- `null` or `undefined` -> nothing\n- a DOM node -> the node\n- an array -> all items in array\n- a function -> the value from calling the function\n- a string -> a text node\n- anything else -> convert to string via .toString() and insert that\n\nLike React, Surplus removes all-whitespace nodes, and text nodes are trimmed.\n\n### Embedded function calls, aka &ldquo;Components&rdquo;\n\nJSX expressions with *upper-cased* tag names are syntactic sugar for embedded function calls.  \n\n```jsx\n<div>\n    <Foo bar=\"1\">Bleck</Foo>\n</div>;\n\n// ... is equivalent to ...\n<div>\n    {Foo({ bar: \"1\", children: [ \"Bleck\" ] })}\n</div>\n```\n\nThe function is called with an object of the given properties, including any children, and the return value is embedded in place.\n\nLike with any programming, it is good practice to break a complex DOM view into smaller, re-usable functions.  Upper-cased JSX expressions provide a convenient way to embed these functions into their containing views.\n\nThe special `ref` and `fn` properties work with embedded function calls the same way they do with nodes.  They operate on the return value of the function.\n\n### Update Granularity &mdash; S computations\n\nSurplus detects which parts of your view may change and constructs S computations to keep them up-to-date.\n\n1. Each element with dynamic properties or spreads gets a computation responsible for setting all properties for that node.\n\n2. Each `fn={...}` declaration gets its own computation.  This allows the `fn` to have internal state, if appropriate.\n\n3. Each dynamic children expression `{ ... }` gets a computation.  This includes embedded component calls, since they are an insert of the call's result.\n\n### Surplus.* functions &mdash; not for public use\n\nThe surplus module has several functions which provide runtime support for the code emitted by the compiler.  These functions *can and will change*, even in minor point releases.  You have been warned :).\n\nA corrolary of this is that the runtime only supports code compiled by the same version of the compiler.  Switching to a new version of Surplus requires re-compiling your JSX code.\n\n### Differences from React\n\nMany React Stateless Functional Components can be dropped into Surplus with no or minimal changes.  Beyond that, here is a summary of the differences:\n\n1. The two big differences already stated above: Surplus makes real DOM elements, not virtual, and they update automatically.  This removes most of the React API.  There are no components, no virtual elements, no lifecycle, no setState(), no componentWillReceiveProps(), no diff/patch, etc etc.\n\n2. The `ref` property takes an assignable reference, not a function.\n\n3. Events are native events, not React's synthetic events.\n\n4. Surplus is a little more liberal in the property names it accepts, like `onClick`/`onclick`, `className`/`class`, etc.\n\n### Calling the surplus compiler\n\nIf one of the build tools listed above doesn't work for you, you may need to work the surplus compiler into your build chain on your own.  The compiler has a very small API:\n\n```javascript\nimport { compiler } from 'surplus/compiler';\n\n// simple string -> string translation, no sourcemap\nvar out = compiler.compile(in); \n\n// w/ appended sourcemap\nvar out = compiler.compile(in, { sourcemap: 'append' });\n\n// w/ extracted sourcemap\n// note that output is different, to return map and src\nvar { out, map } = compiler.compile(in, { sourcemap: 'extract' });\n```\n\n## FAQs\n\n### Why real DOM nodes?\n\nVirtual DOM is a powerful and proven approach to building a web framework.  However, Surplus elects to use real DOM elements for two reasons:\n\n#### Virtual DOM solves a problem Surplus solves via [S.js](https://github.com/adamhaile/S)\n\nVirtual DOM is sometimes described as a strategy to make the DOM reactive, but this isn't exactly true.  The DOM is already reactive: browsers have sophisticated dirty-marking and update-scheduling algorithms to propagate changes made via the DOM interface to the pixels on the screen.  That is what allows us to set a property like `input.value = \"foo\"` and maintain the abstraction that we're &ldquo;setting a value directly,&rdquo; when in fact there are many layers and much deferred execution before that change hits the screen.\n\nWhat isn't reactive is Javascript, and virtual DOM is better understood as a strategy for making Javascript more reactive.  Javascript lacks the automatic, differential-update capabilities of a reactive system.  Instead, virtual DOM libraries have apps build and re-build a specification for what the DOM should be, then use diffing and reconciling algorithms to update the real DOM.  Virtual DOM libraries thus build on one of Javascript's strengths &mdash; powerful idioms for object creation &mdash; to address one of its weaknesses &mdash; reactivity.\n\nSurplus is built on [S.js](https://github.com/adamhaile/S), and it takes advantage of S's fine-grained dependency tracking and deterministic update scheduling.  Adding a virtual DOM layer on top of S would stack two reactive strategies with no additional gain.  Ideally, Surplus provides an abstraction much like the DOM: we manipulate the data with the expectation that the downstream layers will update naturally and transparently.\n\n#### Virtual DOM has a cost, in performance, complexity and interop\n\nPerformance: virtual DOM libraries throw away information about what has changed, then reconstruct it in the diff phase.  Some smart engineers have made diffing surprisingly fast, but the cost can never be zero.\n\nComplexity: the separation between a virtual and a real layer brings with it a host of abstractions, such as component &lsquo;lifecycle&rsquo; and &lsquo;refs,&rsquo; which are essentially hooks into the reconciler's work.  The standard programming model of values and functions gets mirrored with a whole abstraction layer of virtual values and function-like components.\n\nInterop: communication between different virtual DOM libraries, or between virtual values and your own code, is complicated by the fact that the common layer upon which they operate, the DOM, is held within the library.  The library only allows access to the DOM at certain moments and through certain ports, like &lsquo;refs.&rsquo;\n\nIn comparison, S's automatic dependency graph tracks exactly which parts of the DOM need to be updated when data changes.  Surplus takes the React claim that it's &ldquo;just Javascript&rdquo; one step further, in that Surplus &ldquo;components&rdquo; are just functions, and its views just DOM nodes.  Interop with them is obvious.\n\nSurplus does have its own tradeoffs, the largest of which is that automatic updates of the DOM require that the changing state be held in S data signals.  The second largest is that declarative reactive programming is unfamiliar to many programmers who are already well versed in a procedural &ldquo;this happens then this happens then ...&rdquo; model of program execution.  Finally, Surplus trades the performance cost of diffing with the performance cost of bookkeeping in the S dependency graph.\n\n### If Surplus doesn't have components, how can views have state?\n\nThe same way functions usually have state, via closures:\n\n```javascript\nconst Counter = init => {\n    const count = S.data(init);\n    return (\n        <div>\n            Count is: {count()}\n            <button onClick={() => count(count() + 1)}>\n                Increment\n            </button>\n        </div>\n    );\n};\n```\n\n### I'm using Surplus with TypeScript, and the compiler is choking\n\nThe Surplus compiler works on javascript, not TypeScript, so be sure to do the TypeScript compilation first, passing the JSX through via the `jsx: 'preserve'` option.  Then run Surplus on the output.\n\n### I'm using Surplus with Typescript, and I'm getting a runtime error &lsquo;Surplus is not defined&rsquo; even though I imported it?\n\nTypescript strips imports that aren't referenced in your code.  Since the references to Surplus haven't been made when Typescript runs (see question above) it removes the import.  The workaround is to add a reference to the symbol somewhere in your code.  I use right after the import:\n\n```javascript\nimport * as Surplus from 'surplus'; Surplus; // <- stops TS from stripping import\n```\n\n### Why isn't the Surplus compiler built on Babel?\n\nMostly for historical reasons: Surplus was originally started about 4 years ago, before Babel had become the swiss army knife of JS extension.  Surplus therefore has its own hand-written compiler, a fairly classic tokenize-parse-transform-compile implementation.  Surplus may switch to Babel in the future.  The current compiler only parses the JSX expressions, not the JS code itself, which limits the optimizations available.  \n\n-----\n&copy; Adam Haile, 2017.  MIT License.\n","readmeFilename":"README.md","gitHead":"2ba5c69599cb4fb6a867985ad31e6bf6f8e979b2","_id":"surplus@0.5.0-beta18","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-jCHCwpVi/f/NtBlk1DT3VIH7ieTwrL8CYHT9ojLcaNaICVy8tmiL0R47AYHqQAQlBs3WJPvvNSnX3PzRu5o1Cw==","shasum":"396883df2140af88b617bd02255dfc39d1dd98f1","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0-beta18.tgz","fileCount":72,"unpackedSize":424653,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxZgYmcOumEb/MYbi6oKUJJX4ICLoVE1+JpZupM1lbGwIge0UKilZkiPH4wEqgiLFhwadTHIjXm6CKRCH/r3v1TI0="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus_0.5.0-beta18_1518409560640_0.47754394188812355"},"_hasShrinkwrap":false},"0.5.0":{"name":"surplus","version":"0.5.0","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"154c1560fc8c6601c3df59d7cf85ddee06c38a95","_id":"surplus@0.5.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-4o5p+kk72gyyXb1oW4ohWLOjUyv3nKey+dnaO69QD0TTBojwboolF9rYBAouV4XH+fIbU7zyBXGUx8hMLgbn2A==","shasum":"753e6c52c632b69d21026499b66b80e846f39149","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.0.tgz","fileCount":72,"unpackedSize":424444,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHhulGDvCljTkHU1FMqv2MKUzBjsnfKcQLH8/+8SdRCaAiAyykO+4P06XG0jG2XAGAUrog6T7MZf0/8UILxjOlRiXw=="}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus_0.5.0_1519266431082_0.1150001581935296"},"_hasShrinkwrap":false},"0.5.1":{"name":"surplus","version":"0.5.1","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"89c8cdace6d032ceeb9ce2b5952e646139710d4c","_id":"surplus@0.5.1","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-NvZ0I32rJ020slbKrKDC1ZuXCN22zbS+Ubw1HrNZgMlU7teICny/poDh0JNnhy8QyViIy8BH7LuAjUhquEe7Kg==","shasum":"dd319565f02183f94649d23c7cabe537fd0565cb","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.1.tgz","fileCount":72,"unpackedSize":429026,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDn8nTMcE9rCjFolRlvGyQ8hlGSpGR9XXdZwjVccRpDaQIhAJTmcq/t82/bulT2QL2hcuz01utY4QQjjxfQuXFwZZIS"}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus_0.5.1_1523038866428_0.9531307847962363"},"_hasShrinkwrap":false},"0.5.2":{"name":"surplus","version":"0.5.2","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.4"},"devDependencies":{"jasmine":"^2.6.0","karma":"^1.7.0","karma-chrome-launcher":"^2.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.0","karma-safari-launcher":"^1.0.0","rollup":"^0.50.0","typescript":"^2.5.2"},"gitHead":"320784b2b956579530721df11484251ee8572288","_id":"surplus@0.5.2","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-UF0+KUCAUhlAxxDe3RtCP7JvuFidbRMOBWBsG6tSesxo6PmKpkL8LdUirBwUl8fx8U7t41H2zy9yApwTbUjqlg==","shasum":"a8186fb429e5a2271c9566f23432946455127748","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.2.tgz","fileCount":72,"unpackedSize":429005,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfWqhhbOdD8UkkJ2t/HwAKq/7+IBDodhUe9/cOgnDF5gIhAIV0MwFt3vzMClxlM5/T8vXCdeFgcKY37XzLfRaQnwiw"}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus_0.5.2_1523077186313_0.6147642423324384"},"_hasShrinkwrap":false},"0.5.3":{"name":"surplus","version":"0.5.3","description":"High-performance JSX web views for S.js applications","keywords":["JSX","html","DOM","template"],"module":"es/index.js","types":"index.d.ts","scripts":{"test":"karma start","build":"cp src/compiler/fieldData.ts src/runtime/fieldData.ts && tsc -p src/runtime/tsconfig.json && tsc -p src/compiler/tsconfig.json && rollup -c src/runtime/rollup.config.js && rollup -c src/compiler/rollup.config.js"},"author":{"name":"Adam Haile"},"homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"},"license":"MIT","peerDependencies":{"s-js":"^0.4.9"},"devDependencies":{"jasmine":"^3.1.0","karma":"^2.0.5","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.2","karma-safari-launcher":"^1.0.0","rollup":"^0.63.4","typescript":"^2.9.2"},"gitHead":"77285471520e76240014f3888073937fa10769ce","_id":"surplus@0.5.3","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"adamhaile","email":"adam.haile@gmail.com"},"dist":{"integrity":"sha512-3Ki9XL9mSLXnx1dtyCtUrFsSYhYCpVAXr0gGiSmIMNDtWpODk6P9D3B+8GpmHAhJQZBmfySaaOg4uZ94XIcbiA==","shasum":"b30a0a9b3b447c9e6224a6c59dc1692f876efa83","tarball":"https://registry.npmjs.org/surplus/-/surplus-0.5.3.tgz","fileCount":73,"unpackedSize":642371,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbW/L8CRA9TVsSAnZWagAAHfgP+QFp5jdwZeI0fnGSlPnS\n05lhfDSwczLimwv7B9baSlM16nv9tOdV4uJb20KxYgQXN9Nv67Z2OL5HgjUP\nvVkiXsLgUmxix0e7eO85eZOVTfrLwXG2325nzT8hVncP8lKO80B37YkUSfHZ\nchBz0CCEmjt3jRfghAPbInhq0eryzCQ7G0tE+sScG85QGpjwyVDzm375wOq1\nvjFuvHGPMGclhd9RxSb9b3sEVUh52wgjcJcxMMmcWqwkRNjGTEiuodxIuTS2\nctHGTKIfOlbPezk0pT36MEWH+UdoN0NZc6vu6m5pj8jk8rP1pPkI7ebem144\n7WODLp7dCzbvxaRKLjNDD3hXa3WdFRhd/LvXGE8XJIu5rdAtTDdbeqm5HUlH\nDzqGUIg4tHueR9XPHmoSYdYEMMFD7AcQ161NPwNtM5Jh06BjnY7nCwFcwjBL\nhLsJIq7mZIz7uZEBbV8UNFyD33nNvrqMIDifxcVjI9ALEf7yJucdl+bsy4Lu\n3GDWKKeAtK81eUZsiLYOja6QjOuessxUphEvCziR0gCVZ9UbofSIH+7DUpvL\nwzPQkRQOZEq+WoipEJSY9Jww4rmqlFfjlAHNOd2U978JHZQZ7TCDbEM8eQFC\nTWMnZeFFtKl/V8Ja6xNAuLXkSUuFPEsyOU/hRLYEZFpufseHzRrJaxERaUpA\nH9lF\r\n=ZvPp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDW5jh/Up0k08S8G2vj9mse3si3lT5AIBA2sckf1yICvAIhAJSvu5rcWUtutm1E6fKNAFsoAJjRcDLlry5eneKirWuo"}]},"maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surplus_0.5.3_1532752636821_0.9506454041339125"},"_hasShrinkwrap":false}},"readme":"# Surplus\r\n\r\n```jsx\r\nconst name = S.data(\"world\"),\r\n      view = <h1>Hello {name()}!</h1>;\r\ndocument.body.appendChild(view);\r\n```\r\n\r\nSurplus is a compiler and runtime to allow [S.js](https://github.com/adamhaile/S) applications to create high-performance web views using JSX.  Thanks to JSX, your views are clear, declarative definitions of your UI.  Thanks to Surplus' compiler, they are converted into direct DOM instructions that run fast.  Thanks to S, they react automatically and efficiently as your data changes.\r\n\r\n## The Gist\r\n\r\nSurplus treats JSX like a macro language for native DOM instructions.\r\n\r\n```jsx\r\nconst div = <div/>;\r\n// ... compiles to ...\r\nconst div = document.createElement(\"div\");\r\n\r\n// more complicated expressions are wrapped in a function\r\nconst input = <input type=\"text\"/>;\r\n// ... compiles to ...\r\nconst input = (() => {\r\n    var __ = document.createElement(\"input\");\r\n    __.type = \"text\";\r\n    return __;\r\n})();\r\n```\r\n\r\nThese DOM instructions create real DOM nodes that match your JSX.  There's no virtual DOM middle layer standing between your JSX and the DOM.\r\n\r\nDOM updates are handled by [S computations](https://github.com/adamhaile/S#computations).\r\n\r\n```jsx\r\nconst className = S.data(\"foo\"),\r\n      div = <div className={className()}/>;\r\n// ... compiles to ...\r\nconst className = S.data(\"foo\"),\r\n      div = (() => {\r\n          var __ = document.createElement(\"div\");\r\n          S(() => {\r\n              __.className = className(); // re-runs if className() changes\r\n          });\r\n          return __;\r\n      })();\r\n```\r\n\r\nThe computations perform direct, fine-grained changes to the DOM nodes.  Updates run fast while keeping the DOM in sync with your JSX.\r\n\r\nFinally, Surplus has a small runtime to help with more complex JSX features, like property spreads and variable children.\r\n\r\n```jsx\r\nimport * as Surplus from 'surplus';\r\n\r\nconst div = <div {...props} />;\r\n// ... compiles to ...\r\nconst div = (() => {\r\n    var __ = document.createElement(\"div\");\r\n    Surplus.spread(__, props);\r\n    return __;\r\n})();\r\n```\r\n\r\n## Installation\r\n\r\n```sh\r\n> npm install --save surplus s-js\r\n```\r\n\r\nLike React, Surplus has two parts, a compiler and a runtime.\r\n\r\n### Runtime\r\nThe Surplus runtime must be imported as `Surplus` into any module using Surplus JSX views.\r\n\r\n```javascript\r\nimport * as Surplus from 'surplus'; // ES2015 modules\r\nconst Surplus = require('surplus');   // CommonJS modules\r\n```\r\n\r\n### Compiler\r\n\r\nThe easiest way to run the Surplus compiler is via a plugin for your build tool:\r\n\r\n- Webpack: [surplus-loader](https://github.com/adamhaile/surplus-loader)\r\n- Rollup: [rollup-plugin-surplus](https://github.com/adamhaile/rollup-plugin-surplus)\r\n- Gulp: [gulp-surplus](https://github.com/adamhaile/gulp-surplus)\r\n- Browserify: [surplusify](https://github.com/adamhaile/surplusify)\r\n- Parcel: [parcel](https://github.com/tinchoz49/parcel-plugin-surplus)\r\n\r\nIf you aren't using one of these tools, or if you want to write your own plugin, see [Calling the surplus compiler](#calling-the-surplus-compiler).\r\n\r\n## Example\r\n\r\nHere is a minimalist ToDo application, with [a demo on CodePen](https://codepen.io/adamhaile/pen/ppvdGa?editors=0010):\r\n```jsx\r\nconst\r\n    Todo = t => ({               // our Todo constructor\r\n       title: S.data(t.title),   // properties are S data signals\r\n       done: S.data(t.done)\r\n    }),\r\n    todos = SArray([]),          // our todos, using SArray\r\n    newTitle = S.data(\"\"),       // title for new todos\r\n    addTodo = () => {            // push new title onto list\r\n       todos.push(Todo({ title: newTitle(), done: false }));\r\n       newTitle(\"\");             // clear new title\r\n    };\r\n\r\nconst view =                     // declarative main view\r\n    <div>\r\n        <h2>Minimalist ToDos in Surplus</h2>\r\n        <input type=\"text\" fn={data(newTitle)}/>\r\n        <a onClick={addTodo}> + </a>\r\n        {todos.map(todo =>       // insert todo views\r\n            <div>\r\n                <input type=\"checkbox\" fn={data(todo.done)}/>\r\n                <input type=\"text\" fn={data(todo.title)}/>\r\n                <a onClick={() => todos.remove(todo)}>&times;</a>\r\n            </div>\r\n        )}\r\n    </div>;\r\n\r\ndocument.body.appendChild(view); // add view to document\r\n```\r\n\r\nNote that there is no `.mount()` or `.render()` command.  Since the JSX returns real nodes, we can attach them to the page with standard DOM commands, `document.body.appendChild(view)`.\r\n\r\nNote also that there's no code to handle updating the application: no `.update()` command, no `.setState()`, no change event subscription.  Other than a liberal sprinkling of `()`'s, this could be static code.  \r\n\r\nThis is because S is designed to enable *declarative programming*, where we focus on defining how things should be and S handles updating the app from one state to the next as our data changes.  \r\n\r\nSurplus lets us extend that model to the DOM.  We write JSX definitions of what the DOM should be, and Surplus generates runtime code to maintain those definitions.\r\n\r\nDeclarative programs aren't just clear, they're also flexible.  Because they aren't written with any specific changes in mind, they can often adapt easily to new behaviors.  For instance, we can add localStorage persistence with zero changes to the code above and only a handful of new lines:\r\n\r\n```javascript\r\nif (localStorage.todos) { // load stored todos on start\r\n    todos(JSON.parse(localStorage.todos).map(Todo));\r\n}\r\n\r\nS(() => {                // store todos whenever they change\r\n    localStorage.todos = JSON.stringify(todos().map(t => \r\n        ({ title: t.title(), done: t.done() })));\r\n});\r\n```\r\n\r\nMore examples of Surplus programs:\r\n- The standard [TodoMVC in Surplus](https://github.com/adamhaile/surplus-todomvc), which you can run [here](https://adamhaile.github.io/surplus-todomvc)\r\n- [Surplus Demos](https://github.com/adamhaile/surplus-demos), a collection of tiny Surplus example apps, from [Hello World](https://github.com/adamhaile/surplus-demos/helloworld.html) to [Asteroids](https://github.com/adamhaile/surplus-demos/asteroids.html).\r\n- The [Realworld Demo in Surplus](https://github.com/adamhaile/surplus-realworld), a full-fledged Medium-like app demonstrating routing, authentication and server interaction, based on the [Realworld spec](https://github.com/gothinkster/realworld).\r\n\r\n## Benchmarks\r\n\r\nDirect DOM instructions plus S.js's highly optimized reactivity means that Surplus apps generally place at or near the top of various performance benchmarks.\r\n\r\nFor example, Surplus is currently the top framework in Stefan Krause's [js-framework-benchmark](https://github.com/krausest/js-framework-benchmark):\r\n\r\n![js-framework-benchmark results](benchmark2.png)\r\n\r\n## Documentation\r\n\r\n### Creating HTML Elements\r\n\r\n```jsx\r\nconst div       = <div></div>, // an HTMLDivElement\r\n      input     = <input/>;    // an HTMLInputElement\r\n      // ... etc\r\n```\r\n\r\nJSX expressions with *lower-cased* tags create elements.  These are HTML elements, unless their tag name or context is known to be SVG (see next entry).\r\n\r\nThere are no unclosed tags in JSX: all elements must either have a closing tag `</...>` or end in `/>`,\r\n\r\n### Creating SVG Elements\r\n\r\n```jsx\r\nconst svg       = <svg></svg>, // SVGSVGElement\r\n      svgCircle = <circle/>,   // SVGCircleElement\r\n      svgLine   = <line/>;     // SVGLineElement\r\n      // ... etc\r\n```\r\n\r\nIf the tag name matches a known SVG element, Surplus will create an SVG element instead of an HTML one.  For the small set of tag names that belong to both -- `<a>`, `<font>`, `<title>`, `<script>` and `<style>` -- Surplus creates an HTML element.\r\n\r\n```jsx\r\nconst title = <title></title>; // an HTMLTitleElement\r\n```\r\n\r\nChildren of SVG elements are also SVG elements, unless their parent is the `<foreignObject>` element, in which case they are DOM elements again.\r\n\r\n```jsx\r\nconst svg =\r\n    <svg>\r\n        <text>an SVGTextElement</text>\r\n        <foreignObject>\r\n            <div>an HTMLDivElement</div>\r\n        </foreignObject>\r\n    </svg>;\r\n```\r\n\r\nTo create the SVG version of an ambiguous tag name, put it under a known SVG tag and extract it.\r\n\r\n```jsx\r\nconst svg      = <svg><title>an SVGTitleElement</title></svg>,\r\n      svgTitle = svg.firstChild;\r\n```\r\n\r\n### Setting properties\r\n\r\nJSX allows static, dynamic and spread properties:\r\n\r\n```jsx\r\n// static\r\nconst input1 = <input type=\"text\" />;\r\n\r\n// dynamic\r\nconst text   = \"text\",\r\n      input2 = <input type={text} />;\r\n\r\n// spread\r\nconst props  = { type: \"text\" },\r\n      input3 = <input {...props} />;\r\n```\r\n\r\nSince Surplus creates DOM elements, the property names generally refer to DOM element properties, although there are a few special cases:\r\n\r\n1. If Surplus can tell that the given name belongs to an attribute not a property, it will set the attribute instead.  Currently, the heuristic used to distinguish attributes from properties is &ldquo;does it have a hyphen.&rdquo;  So `<div aria-hidden=\"true\">` will set the `aria-hidden` attribute.\r\n2. Some properties have aliases.  See below.\r\n4. The properties `ref` and `fn` are special.  See below.\r\n\r\nYou can set a property with an unknown name, and it will be assigned to the node, but it will have no effect on the DOM:\r\n\r\n```jsx\r\nconst input = <input myProperty={true} />;\r\ninput.myProperty === true;\r\n```\r\n\r\n### Property aliases\r\n\r\nIn order to provide greater source compatibility with React and HTML, Surplus allows some properties to be referenced via alternate names.\r\n\r\n1. For compatibility with React, Surplus allows the React alternate property names as aliases for the corresponding DOM property.  So `onClick` is an alias for the native `onclick`.\r\n2. For compatibility with HTML, Surplus allows `class` and `for` as aliases for the `className` and `htmlFor` properties.\r\n\r\nFor static and dynamic properties, aliases are normalized at compile time, for spread properties at runtime.\r\n\r\n### Property precedence\r\n\r\nIf the same property is set multiple times on a node, the last one takes precedence:\r\n\r\n```jsx\r\nconst props = { type: \"radio\" },\r\n      input = <input {...props} type=\"text\" />;\r\ninput.type === \"text\";\r\n```\r\n\r\n### Special `ref` property\r\n\r\nA `ref` property specifies a variable to which the given node is assigned.  This makes it easy to get a reference to internal nodes.\r\n\r\n```jsx\r\nlet input,\r\n    div = <div>\r\n            <input ref={input} type=\"text\" />\r\n          </div>;\r\ninput.type === \"text\";\r\n```\r\n\r\nThe `ref` property fulfills a very similar role to the `ref` property in React, except that since nodes are created immediately in Surplus, it does not take a function but an assignable expression.\r\n\r\n### Special `fn` property\r\n\r\nA `fn` property specifies a function to be applied to a node.  It is useful for encapsulating a bit of reusable behavior or properties.\r\n\r\n```jsx\r\nimport { data } from 'surplus-fn-data'; // two-way data binding utility\r\nconst value = S.data(\"foo\"),\r\n      input = <input type=\"text\" fn={data(value)} />;\r\ninput.value === \"foo\";\r\n// user enters \"bar\" in input\r\ninput.value === \"bar\";\r\n```\r\n\r\nThe function may take an optional second parameter, which will contain any value returned by the previous invocation, aka a &lsquo;reducing&rsquo; pattern.  In typescript, the full signature looks like:\r\n\r\n```typescript\r\ntype SurplusFn = <N, T>(node : N, state : T | undefined) => T\r\n```\r\n\r\nThe `fn` property may be specified multiple times for a node.  Surplus provides aliases `fn1`, `fn2`, etc., in case your linter complains about the repeated properties.\r\n\r\n### Creating Child Elements\r\n\r\nJSX defines two kinds of children, static and dynamic.\r\n\r\n```jsx\r\n// static, created in place, never change\r\nconst div =\r\n    <div>\r\n        <span>a static span created in the div</span>\r\n        Some static text\r\n    </div>;\r\n```\r\n\r\n```jsx\r\n// { dynamic }, inserted into place, can change\r\nconst span = <span>a span to insert in the div</span>,\r\n      text = S.data(\"some text that will change\"),\r\n      div =\r\n        <div>\r\n            {span}\r\n            {text()}\r\n        </div>;\r\ntext(\"the changed text\");\r\n```\r\n\r\nWith a dynamic child, the given expression is evaluated, and its result is inserted into the child nodes according to the following rules:\r\n\r\n- `null`, `undefined` or a boolean -> nothing\r\n- a DOM node -> the node\r\n- an array -> all items in array\r\n- a function -> the value from calling the function\r\n- a string -> a text node\r\n- anything else -> convert to string via .toString() and insert that\r\n\r\nLike React, Surplus removes all-whitespace nodes, and text nodes are trimmed.\r\n\r\n### Embedded function calls, aka &ldquo;Components&rdquo;\r\n\r\nJSX expressions with *upper-cased* tag names are syntactic sugar for embedded function calls.\r\n\r\n```jsx\r\n<div>\r\n    <Foo bar=\"1\">baz</Foo>\r\n</div>;\r\n\r\n// ... is equivalent to ...\r\n<div>\r\n    {Foo({ bar: \"1\", children: \"baz\" })}\r\n</div>\r\n```\r\n\r\nThe function is called with an object of the given properties, including any children, and the return value is embedded in place.\r\n\r\nLike with any programming, it is good practice to break a complex DOM view into smaller, re-usable functions.  Upper-cased JSX expressions provide a convenient way to embed these functions into their containing views.\r\n\r\nThe special `ref` and `fn` properties work with embedded function calls the same way they do with nodes.  They operate on the return value of the function.\r\n\r\n### Update Granularity &mdash; S computations\r\n\r\nSurplus detects which parts of your view may change and constructs S computations to keep them up-to-date.\r\n\r\n1. Each element with dynamic properties or spreads gets a computation responsible for setting all properties for that node.\r\n\r\n2. Each `fn={...}` declaration gets its own computation.  This allows the `fn` to have internal state, if appropriate.\r\n\r\n3. Each dynamic children expression `{ ... }` gets a computation.  This includes embedded component calls, since they are an insert of the call's result.\r\n\r\n### Surplus.* functions &mdash; not for public use\r\n\r\nThe surplus module has several functions which provide runtime support for the code emitted by the compiler.  These functions *can and will change*, even in minor point releases.  You have been warned :).\r\n\r\nA corollary of this is that the runtime only supports code compiled by the same version of the compiler.  Switching to a new version of Surplus requires re-compiling your JSX code.\r\n\r\n### Differences from React\r\n\r\nMany React Stateless Functional Components can be dropped into Surplus with no or minimal changes.  Beyond that, here is a summary of the differences:\r\n\r\n1. The two big differences already stated above: Surplus makes real DOM elements, not virtual, and they update automatically.  This removes most of the React API.  There are no components, no virtual elements, no lifecycle, no setState(), no componentWillReceiveProps(), no diff/patch, etc etc.\r\n\r\n2. The `ref` property takes an assignable reference, not a function.\r\n\r\n3. Events are native events, not React's synthetic events.\r\n\r\n4. Surplus is a little more liberal in the property names it accepts, like `onClick`/`onclick`, `className`/`class`, etc.\r\n\r\n5. If you set an unknown field with a name that doesn't contain a dash, like `<div mycustomfield=\"1\" />`, React will set an attribute while Surplus will set a property.\r\n\r\n### Calling the surplus compiler\r\n\r\nIf one of the build tools listed above doesn't work for you, you may need to work the surplus compiler into your build chain on your own.  The compiler has a very small API:\r\n\r\n```javascript\r\nimport { compiler } from 'surplus/compiler';\r\n\r\n// simple string -> string translation, no sourcemap\r\nconst out = compiler.compile(in);\r\n\r\n// w/ appended sourcemap\r\nconst out = compiler.compile(in, { sourcemap: 'append' });\r\n\r\n// w/ extracted sourcemap\r\n// note that output is different, to return map and src\r\nconst { out, map } = compiler.compile(in, { sourcemap: 'extract' });\r\n```\r\n\r\n## FAQs\r\n\r\n### Can I use the standard Babel or Typescript JSX compilers for Surplus?\r\n\r\nNo. Surplus isn't just the runtime library, it's the library+compiler, which are tightly coupled.  It's not just cosmetic differences.  The standard JSX compilation format was designed for virtual DOM and doesn't have the features Surplus needs.  In particular, Surplus wraps dynamic expressions -- `{ ... }` -- in lambdas, so that it can create S computations that detect when the expressions change and make targeted updates.  The usual format doesn't do that, since it relies on external notification of change (`.setState()`) followed by a diffing phase to detect what changed.\r\n\r\n### Why real DOM nodes?\r\n\r\nVirtual DOM is a powerful and proven approach to building a web framework.  However, Surplus elects to use real DOM elements for two reasons:\r\n\r\n#### Virtual DOM solves a problem Surplus solves via [S.js](https://github.com/adamhaile/S)\r\n\r\nVirtual DOM is sometimes described as a strategy to make the DOM reactive, but this isn't exactly true.  The DOM is already reactive: browsers have sophisticated dirty-marking and update-scheduling algorithms to propagate changes made via the DOM interface to the pixels on the screen.  That is what allows us to set a property like `input.value = \"foo\"` and maintain the abstraction that we're &ldquo;setting a value directly,&rdquo; when in fact there are many layers and much deferred execution before that change hits the screen.\r\n\r\nWhat isn't reactive is Javascript, and virtual DOM is better understood as a strategy for making Javascript more reactive.  Javascript lacks the automatic, differential-update capabilities of a reactive system.  Instead, virtual DOM libraries have apps build and re-build a specification for what the DOM should be, then use diffing and reconciling algorithms to update the real DOM.  Virtual DOM libraries thus build on one of Javascript's strengths &mdash; powerful idioms for object creation &mdash; to address one of its weaknesses &mdash; reactivity.\r\n\r\nSurplus is built on [S.js](https://github.com/adamhaile/S), and it takes advantage of S's fine-grained dependency tracking and deterministic update scheduling.  Adding a virtual DOM layer on top of S would stack two reactive strategies with no additional gain.  Ideally, Surplus provides an abstraction much like the DOM: we manipulate the data with the expectation that the downstream layers will update naturally and transparently.\r\n\r\n#### Virtual DOM has a cost, in performance, complexity and interop\r\n\r\nPerformance: virtual DOM libraries throw away information about what has changed, then reconstruct it in the diff phase.  Some smart engineers have made diffing surprisingly fast, but the cost can never be zero.\r\n\r\nComplexity: the separation between a virtual and a real layer brings with it a host of abstractions, such as component &lsquo;lifecycle&rsquo; and &lsquo;refs,&rsquo; which are essentially hooks into the reconciler's work.  The standard programming model of values and functions gets mirrored with a parallel layer of virtual values and function-like components.\r\n\r\nInterop: communication between different virtual DOM libraries, or between virtual values and your own code, is complicated by the fact that the common layer upon which they operate, the DOM, is held within the library.  The library only allows access to the DOM at certain moments and through certain ports, like &lsquo;refs.&rsquo;\r\n\r\nIn comparison, S's automatic dependency graph tracks exactly which parts of the DOM need to be updated when data changes.  Surplus takes the React claim that it's &ldquo;just Javascript&rdquo; one step further, in that Surplus &ldquo;components&rdquo; are just functions, and its views just DOM nodes.  Interop with them is obvious.\r\n\r\nSurplus does have its own tradeoffs, the largest of which is that automatic updates of the DOM require that the changing state be held in S data signals.  The second largest is that declarative reactive programming is unfamiliar to many programmers who are already well versed in a procedural &ldquo;this happens then this happens then ...&rdquo; model of program execution.  Finally, Surplus trades the performance cost of diffing with the performance cost of bookkeeping in the S dependency graph.\r\n\r\n### If Surplus doesn't have components, how can views have state?\r\n\r\nThe same way functions usually have state, via closures:\r\n\r\n```jsx\r\nconst Counter = init => {\r\n    const count = S.data(init);\r\n    return (\r\n        <div>\r\n            Count is: {count()}\r\n            <button onClick={() => count(count() + 1)}>\r\n                Increment\r\n            </button>\r\n        </div>\r\n    );\r\n};\r\n```\r\n\r\n### I'm using Surplus with TypeScript, and the compiler is choking\r\n\r\nThe Surplus compiler works on javascript, not TypeScript, so be sure to do the TypeScript compilation first, passing the JSX through via the `jsx: 'preserve'` option.  Then run Surplus on the output.\r\n\r\n### I'm using Surplus with Typescript, and I'm getting a runtime error &lsquo;Surplus is not defined&rsquo; even though I imported it?\r\n\r\nTypescript strips imports that aren't referenced in your code.  Since the references to Surplus haven't been made when Typescript runs (see question above) it removes the import.  The workaround is to tell Typescript that Surplus is your `jsxFactory` in your tsconfig.json:\r\n\r\n```json\r\n{\r\n    \"compilerOptions\": {\r\n        ...\r\n        \"jsx\": \"preserve\",\r\n        \"jsxFactory\": \"Surplus\",\r\n    }\r\n}\r\n```\r\nTechnically, we're not asking Typescript to compile our JSX, so the `jsxFactory` setting shouldn't matter, but it has the useful side-effect of letting Typescript know not to strip Surplus from the compiled module.\r\n\r\n### Why isn't the Surplus compiler built on Babel?\r\n\r\nMostly for historical reasons: Surplus was originally started about 4 years ago, before Babel had become the swiss army knife of JS extension.  Surplus therefore has its own hand-written compiler, a fairly classic tokenize-parse-transform-compile implementation.  Surplus may switch to Babel in the future.  The current compiler only parses the JSX expressions, not the JS code itself, which limits the optimizations available.\r\n\r\n-----\r\n&copy; Adam Haile, 2017.  MIT License.\r\n","maintainers":[{"name":"adamhaile","email":"adam.haile@gmail.com"}],"time":{"modified":"2022-06-27T02:27:21.385Z","created":"2017-03-15T19:34:45.587Z","0.4.0":"2017-03-15T19:34:45.587Z","0.4.2":"2017-05-15T20:00:21.615Z","0.4.3":"2017-05-30T02:07:45.533Z","0.5.0-beta1":"2017-09-19T00:12:00.323Z","0.5.0-beta2":"2017-11-06T01:51:48.203Z","0.5.0-beta3":"2017-11-06T01:55:30.319Z","0.5.0-beta4":"2017-12-15T02:33:46.132Z","0.5.0-beta5":"2017-12-27T00:08:46.803Z","0.5.0-beta6":"2017-12-29T01:34:04.539Z","0.5.0-beta7":"2018-01-03T02:11:49.777Z","0.5.0-beta8":"2018-01-03T20:26:20.179Z","0.5.0-beta9":"2018-01-06T03:28:52.206Z","0.5.0-beta10":"2018-01-30T16:08:59.428Z","0.5.0-beta11":"2018-01-30T17:54:50.426Z","0.5.0-beta12":"2018-02-01T03:01:38.607Z","0.5.0-beta13":"2018-02-01T23:59:50.823Z","0.5.0-beta14":"2018-02-02T00:54:02.175Z","0.5.0-beta15":"2018-02-02T01:42:21.304Z","0.5.0-beta16":"2018-02-02T19:31:59.860Z","0.5.0-beta17":"2018-02-03T22:27:00.123Z","0.5.0-beta18":"2018-02-12T04:26:01.674Z","0.5.0":"2018-02-22T02:27:11.265Z","0.5.1":"2018-04-06T18:21:06.565Z","0.5.2":"2018-04-07T04:59:46.385Z","0.5.3":"2018-07-28T04:37:16.953Z"},"keywords":["JSX","html","DOM","template"],"author":{"name":"Adam Haile"},"license":"MIT","readmeFilename":"README.md","homepage":"https://github.com/adamhaile/surplus","repository":{"type":"git","url":"git+https://github.com/adamhaile/surplus.git"},"bugs":{"url":"https://github.com/adamhaile/issues"}}