{"_id":"@bigskysoftware/paxi-js","name":"@bigskysoftware/paxi-js","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bigskysoftware/paxi-js","version":"0.0.1","description":"paxi.js - A Small DOM Morphing Companion for fixi.js","main":"paxi.js","repository":{"type":"git","url":"git+https://github.com/bigskysoftware/paxi.git"},"author":{"name":"1cg"},"license":"BSD-0","keywords":["paxi","fixi","htmx","hypermedia","morph","dom","html"],"bugs":{"url":"https://github.com/bigskysoftware/paxi/issues"},"gitHead":"caa77b3b4b645b49c9e91b38802be2222ca59c0f","_id":"@bigskysoftware/paxi-js@0.0.1","homepage":"https://github.com/bigskysoftware/paxi#readme","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-Ws2uGvD2ct4qz8ZfYhhU0U7mEmJL3li68qnks4iRIGo9blFkyCMxDVOP1S9MzhpUeGKcHBjeNtYya4mpwToBbg==","shasum":"b2f9b49fed1e8f7987c8243de12006fb920c2607","tarball":"https://registry.npmjs.org/@bigskysoftware/paxi-js/-/paxi-js-0.0.1.tgz","fileCount":3,"unpackedSize":5129,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGpe3sMlURgNlSh4s9cCEsnbr9sR2d16ht5dPvHT7Ax9AiBhza8dC5TYDprg1D14jy61XFRbFSNL8N40soS3Gki+HA=="}]},"_npmUser":{"name":"carsongross","email":"carson@bigsky.software"},"directories":{},"maintainers":[{"name":"carsongross","email":"carson@bigsky.software"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/paxi-js_0.0.1_1777133929551_0.3080322403668936"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-25T16:18:49.438Z","0.0.1":"2026-04-25T16:18:49.686Z","modified":"2026-04-25T16:18:49.894Z"},"maintainers":[{"name":"carsongross","email":"carson@bigsky.software"}],"description":"paxi.js - A Small DOM Morphing Companion for fixi.js","homepage":"https://github.com/bigskysoftware/paxi#readme","keywords":["paxi","fixi","htmx","hypermedia","morph","dom","html"],"repository":{"type":"git","url":"git+https://github.com/bigskysoftware/paxi.git"},"author":{"name":"1cg"},"bugs":{"url":"https://github.com/bigskysoftware/paxi/issues"},"license":"BSD-0","readme":"<h1>&#x267B;&#xFE0F; paxi.js - <i>a clever little diff...</i></h1>\n\npaxi.js is an experimental, minimalist companion to [fixi.js](https://github.com/bigskysoftware/fixi)\nthat swaps HTML into the DOM by *morphing* instead of replacing: preserving existing nodes,\nfocus, scroll position, and form state wherever the old and new trees align.\n\nPart of the [fixi project](https://fixiproject.org).\n\nWhen paired with fixi, paxi registers itself as the `morph` swap strategy, so you can write\n`fx-swap=\"morph\"` and get id-keyed reconciliation out of the box. It also works stand-alone\nvia the `window.morph(target, html)` global.\n\nHere is an example:\n\n```html\n<script src=\"fixi.js\"></script>\n<script src=\"paxi.js\"></script>\n\n<button fx-action=\"/profile\"\n        fx-target=\"#profile\"\n        fx-swap=\"morph\">\n    Reload Profile\n</button>\n<div id=\"profile\">\n    <input id=\"nickname\" placeholder=\"typing here survives the swap\">\n    <p id=\"bio\">...</p>\n</div>\n```\n\nThe response HTML replaces the contents of `#profile`, but the `<input>` keeps its focus,\ncaret, and any in-progress value because its `id` matches a node in the incoming markup.\n\n## Minimalism\n\npaxi is to [idiomorph](https://github.com/bigskysoftware/idiomorph) what fixi is to htmx:\na smaller, less ambitious take on the same idea. No configuration, no callbacks, no\nhead-merging, no id-set inference - just a single recursive diff that keeps id-keyed\nnodes stable as the tree around them changes.\n\nAs such, it does *not* include many features found in idiomorph or morphdom:\n\n* head merging / stylesheet reconciliation\n* `beforeNodeMorphed` / `afterNodeMorphed` callbacks\n* `outerHTML` vs `innerHTML` modes\n* id-set propagation across ancestors\n* pluggable node matchers\n\nA hard constraint on the project is that the *unminified, uncompressed* size stays under\n2KB.\n\n## Installing\n\nDrop `paxi.js` in a script tag after (or before) `fixi.js`:\n\n```html\n<script src=\"fixi.js\"></script>\n<script src=\"paxi.js\"></script>\n```\n\nOr install via npm:\n\n```\nnpm install paxi-js\n```\n\n## API\n\n### `window.morph(target, html)`\n\nMorph `target` (an `Element`) toward the first element parsed from `html` (a string). The\ntarget is updated in place when the root node names match; otherwise it is replaced.\n\n```js\nmorph(document.getElementById(\"panel\"), \"<div id='panel'>new contents</div>\")\n```\n\n### `fx-swap=\"morph\"`\n\nWhen loaded alongside fixi, paxi registers a config hook that intercepts `fx-swap=\"morph\"`\nand wires it to `morph(cfg.target, cfg.text)`.\n\n## Modus Operandi\n\npaxi walks the old and new trees in lockstep:\n\n1. If node type or name differ, the old node is replaced - but any id-keyed descendant of\n   the incoming node whose id matches a node in the old tree is first rescued into place.\n2. For text and comment nodes, the value is updated when it differs.\n3. For elements, attributes are synced (extras removed, missing added, values updated).\n4. Children are reconciled positionally, except that id-keyed children in the incoming\n   tree pull their original counterparts forward when they exist.\n\n## LICENCE\n\nBSD-0","readmeFilename":"README.md","_rev":"1-d3dfd996ee146e2711d66780148a126b"}