{"_id":"@domchristie/composite","_rev":"4-d14a754c6548be6e63889b636e009815","name":"@domchristie/composite","description":"A hybrid client-side/server-side approach to generating dynamic HTML.","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@domchristie/composite","version":"0.1.0","keywords":["html","template"],"author":{"name":"Dom Christie"},"license":"MIT","_id":"@domchristie/composite@0.1.0","maintainers":[{"name":"domchristie","email":"christiedom@gmail.com"}],"dist":{"shasum":"bd9138e7ad1e8befc177470d468f42df9f51a8fa","tarball":"https://registry.npmjs.org/@domchristie/composite/-/composite-0.1.0.tgz","fileCount":6,"integrity":"sha512-ccKjHOC91wFeJa/jwhd5CNFVaPsYqBXJ+pfnZp0tul9paulctuhB7cULqFROrWlZwaJKJFUh4Vh9KHk2dILrsA==","signatures":[{"sig":"MEUCIC+6Oe2BFDiDCCIe9iCU4NW6QItlVMfeCGynB00WhCJZAiEArRrTQy5DkVkUj9S87W/Hj274oeMmzK9h3GRaCwZAlsE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5909},"main":"composite.js","gitHead":"24e9ea8dde298d370f7a65263251aad7a477986f","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"domchristie","email":"christiedom@gmail.com"},"_npmVersion":"8.18.0","description":"A hybrid client-side/server-side approach to generating dynamic HTML.","directories":{},"_nodeVersion":"18.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/composite_0.1.0_1718054203499_0.12264768915673407","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@domchristie/composite","version":"0.1.1","keywords":["html","template"],"author":{"name":"Dom Christie"},"license":"MIT","_id":"@domchristie/composite@0.1.1","maintainers":[{"name":"domchristie","email":"christiedom@gmail.com"}],"dist":{"shasum":"e88042efdd2eb8350e4ccb2cfcc6d0457952ee5c","tarball":"https://registry.npmjs.org/@domchristie/composite/-/composite-0.1.1.tgz","fileCount":6,"integrity":"sha512-Eh7NNSXHaR2vOSShBUFosBazjFKwOhiqeoWMXWrPdkqcyDmImNMNtnJbPf/fmncqk690Vy/8WpN3LXenm0vAqQ==","signatures":[{"sig":"MEYCIQCLg5VIJxC4LDKKTH2M1DJX81SGze3yJZL9D0VggGQYqAIhALxpSjOOWq02vwcgJFDBcS+FF5dDhXN/lIBP1w9LBibv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5953},"main":"composite.js","gitHead":"5347e8f09bc971dc1a95f22604355c5eaca1c318","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"domchristie","email":"christiedom@gmail.com"},"_npmVersion":"8.18.0","description":"A hybrid client-side/server-side approach to generating dynamic HTML.","directories":{},"_nodeVersion":"18.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/composite_0.1.1_1718054325857_0.3466674284859921","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"@domchristie/composite","version":"0.3.0","keywords":["html","template"],"author":{"name":"Dom Christie"},"license":"MIT","_id":"@domchristie/composite@0.3.0","maintainers":[{"name":"domchristie","email":"christiedom@gmail.com"}],"dist":{"shasum":"ac9f066797db3c072d2a494b91b5dde9a36717f1","tarball":"https://registry.npmjs.org/@domchristie/composite/-/composite-0.3.0.tgz","fileCount":6,"integrity":"sha512-8M/T/3ousZ3K0c/RjhG6Pz8qsC2K+B2FD2x+NjzUTuigqDg1kX0AedPZsV1BPxFE1TIXik1Ef3MXTPFq/Afq6w==","signatures":[{"sig":"MEQCIEABMMZ885+xjXN/IuOzC9/FOCiNDolpNd2OXHcnLucJAiB0gNMdTylFZQVOy9C+dMWS3QdUkTO0/qCdalNgOdtFWw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6583},"main":"composite.js","gitHead":"cc83c844c060f80626cf42f012677469cd71a099","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"domchristie","email":"christiedom@gmail.com"},"_npmVersion":"8.18.0","description":"A hybrid client-side/server-side approach to generating dynamic HTML.","directories":{},"_nodeVersion":"18.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/composite_0.3.0_1718304371267_0.23406189397879307","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"@domchristie/composite","version":"0.4.0","keywords":["html","template"],"author":{"name":"Dom Christie"},"license":"MIT","_id":"@domchristie/composite@0.4.0","maintainers":[{"name":"domchristie","email":"christiedom@gmail.com"}],"dist":{"shasum":"d93fd9778917fb681fe4c33b2d0b7f27903efdd4","tarball":"https://registry.npmjs.org/@domchristie/composite/-/composite-0.4.0.tgz","fileCount":6,"integrity":"sha512-wX9qtZzsKHT282SM5MYHUvmHNyTv9O2b3q5BdZ6g9Rd21OPdtg94d5/xZIYDUBdgGeC2M3oU0+9bZAmxWfKdkw==","signatures":[{"sig":"MEYCIQCuWk74RZCqwxags1hZ5TtCf7pVfgXRdY72X2bFe/wuugIhAI0e1kO3GNBVTkAkihH2oKW52/82NijYPmKC3hx3CNOG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6760},"main":"composite.js","gitHead":"d7bf6d72821644d649e346a0b7b2553f67f4b281","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"domchristie","email":"christiedom@gmail.com"},"_npmVersion":"8.18.0","description":"A hybrid client-side/server-side approach to generating dynamic HTML.","directories":{},"_nodeVersion":"18.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/composite_0.4.0_1718398807704_0.6537102194819635","host":"s3://npm-registry-packages"}},"0.5.0":{"name":"@domchristie/composite","version":"0.5.0","description":"A hybrid client-side/server-side approach to generating dynamic HTML.","main":"composite.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","docs":"npx documentation readme composite.js -s \"API Docs\" --github"},"keywords":["html","template"],"author":{"name":"Dom Christie"},"license":"MIT","devDependencies":{"documentation":"^14.0.3"},"gitHead":"88cb3b86c92b739e052564d873a4e1792ee7b902","_id":"@domchristie/composite@0.5.0","_nodeVersion":"18.4.0","_npmVersion":"8.18.0","dist":{"integrity":"sha512-dPlwMugnLcQFQ1CkMulUAbSyZE3J/PbNLWTbgyeIpAyJB1HgA7OgBLW3/5/UINxr+yM9QLp5jvdrUsamysziyw==","shasum":"82be449d9c15fd7bade49100d3a974e2ba14378f","tarball":"https://registry.npmjs.org/@domchristie/composite/-/composite-0.5.0.tgz","fileCount":6,"unpackedSize":10250,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBZuA5vKRjfhfJ+evn2rOzTKunDttEF5468h3quKCKx5AiEAlYE6XyONXfhb44eDcODC1bn/f6LHjcFHRTYqiCiV+Tk="}]},"_npmUser":{"name":"domchristie","email":"christiedom@gmail.com"},"directories":{},"maintainers":[{"name":"domchristie","email":"christiedom@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/composite_0.5.0_1718531103968_0.8028713567125974"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-10T21:16:43.399Z","modified":"2024-06-16T09:45:04.309Z","0.1.0":"2024-06-10T21:16:43.687Z","0.1.1":"2024-06-10T21:18:46.030Z","0.3.0":"2024-06-13T18:46:11.429Z","0.4.0":"2024-06-14T21:00:07.889Z","0.5.0":"2024-06-16T09:45:04.135Z"},"maintainers":[{"name":"domchristie","email":"christiedom@gmail.com"}],"author":{"name":"Dom Christie"},"keywords":["html","template"],"license":"MIT","readme":"# 🦷 Composite\n\nA tiny web template system for the browser.\n\nCompose your HTML in `<template>` elements. Use placeholders (`${…}`) to mark dynamic content. Call `fill` to generate a new HTML string which interpolates the template's content with the given properties.\n\n## Usage\n\n```sh\nnpm install @domchristie/composite\n```\n\n```html\n/* rendered somewhere in the DOM */\n<template id=\"hello\">\n  <h1>${greeting}, ${name}!</h1>\n</template>\n```\n\n```js\nimport { fill } from '@domchristie/composite'\nconst Hello = document.getElementById('hello')\nfill(Hello, { greeting: 'Hello', name: 'World' }) // '<h1>Hello, World!</h1>'\n```\n\n## API Docs\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n*   [fill](#fill)\n    *   [Parameters](#parameters)\n*   [html](#html)\n    *   [Parameters](#parameters-1)\n*   [escape](#escape)\n    *   [Parameters](#parameters-2)\n*   [unescape](#unescape)\n    *   [Parameters](#parameters-3)\n*   [raw](#raw)\n    *   [Parameters](#parameters-4)\n\n### fill\n\n[composite.js:8-15](https://github.com/domchristie/composite/blob/47ceebce8126d3ea0fadfa8f7b21ee5db81d3a0d/composite.js#L8-L15 \"Source code on GitHub\")\n\nRenders a template with given properties.\n\n#### Parameters\n\n*   `template` **(HTMLTemplateElement | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** The HTML template to be rendered.\n*   `props` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object containing properties to be interpolated into the template.\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The rendered HTML string with properties interpolated.\n\n### html\n\n[composite.js:25-32](https://github.com/domchristie/composite/blob/47ceebce8126d3ea0fadfa8f7b21ee5db81d3a0d/composite.js#L25-L32 \"Source code on GitHub\")\n\nA tag function for template literals that escapes HTML special characters in\nvalues unless they are marked as raw.\n\n#### Parameters\n\n*   `strings` **TemplateStringsArray** An array of string literals.\n*   `values` **...any** The values to be interpolated into the template.\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The final string with values safely interpolated.\n\n### escape\n\n[composite.js:41-43](https://github.com/domchristie/composite/blob/47ceebce8126d3ea0fadfa8f7b21ee5db81d3a0d/composite.js#L41-L43 \"Source code on GitHub\")\n\nEscapes special characters in a string for use in HTML.\nThe characters escaped are: & < > \" ' \\` = /\n\n#### Parameters\n\n*   `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The input string to escape.\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The escaped string.\n\n### unescape\n\n[composite.js:61-65](https://github.com/domchristie/composite/blob/47ceebce8126d3ea0fadfa8f7b21ee5db81d3a0d/composite.js#L61-L65 \"Source code on GitHub\")\n\nUnescapes a given HTML-encoded string.\n\n#### Parameters\n\n*   `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The HTML-encoded string to unescape.\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The unescaped string.\n\n### raw\n\n[composite.js:74-76](https://github.com/domchristie/composite/blob/47ceebce8126d3ea0fadfa8f7b21ee5db81d3a0d/composite.js#L74-L76 \"Source code on GitHub\")\n\nMarks a string as raw HTML to prevent escaping of special characters.\n\n#### Parameters\n\n*   `html` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The HTML string to wrap.\n\nReturns **RawString** The wrapped HTML string as a RawString object.\n\n## unsafe-eval\n\nComposite uses `new Function` to generate HTML from templates. This approach can fail when using strict Content Security Policies (CSPs).\n\n## License\n\nCopyright © 2024+ Dom Christie and released under the MIT license.\n","readmeFilename":"README.md"}