{"id":18415082,"url":"https://github.com/elonehoo/vnode-util","last_synced_at":"2025-04-07T12:31:37.628Z","repository":{"id":65189032,"uuid":"586535270","full_name":"elonehoo/vnode-util","owner":"elonehoo","description":"Utilities for manipulating Vue 3 VNodes","archived":false,"fork":false,"pushed_at":"2024-04-15T03:27:56.000Z","size":1193,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-17T06:53:34.924Z","etag":null,"topics":["util","vnode","vue"],"latest_commit_sha":null,"homepage":"https://vnode-util.elonehoo.me","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elonehoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"elonehoo"}},"created_at":"2023-01-08T13:46:48.000Z","updated_at":"2024-04-20T01:36:50.431Z","dependencies_parsed_at":"2023-11-27T04:22:12.519Z","dependency_job_id":"7705e20c-6b0b-4bef-9d48-18214cb09a20","html_url":"https://github.com/elonehoo/vnode-util","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elonehoo%2Fvnode-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elonehoo%2Fvnode-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elonehoo%2Fvnode-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elonehoo%2Fvnode-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elonehoo","download_url":"https://codeload.github.com/elonehoo/vnode-util/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247653074,"owners_count":20973748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["util","vnode","vue"],"created_at":"2024-11-06T03:52:59.365Z","updated_at":"2025-04-07T12:31:37.620Z","avatar_url":"https://github.com/elonehoo.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./public/logo.svg\" wigth='100px' height='100px' /\u003e\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003e\n  vnode-util\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nUtilities for manipulating Vue 3 VNodes\n\u003cp\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/vnode-util\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/vnode-util?color=43B36B\u0026label=\"\u003e\u003c/a\u003e\n\u003cp\u003e\n\n\u003cp align=\"center\"\u003e\n \u003ca href=\"https://vnode-util.elonehoo.me\"\u003eDocumentation\u003c/a\u003e | \u003ca href=\"https://vnode-util.elonehoo.me/guide/\"\u003eGetting Started\u003c/a\u003e | \u003ca href=\"https://stackblitz.com/edit/vnode-util?file=src/App.vue\"\u003ePlayground\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Features\n\n- Walk slot VNodes without worrying about fragments created by v-for.\n- Add extra props, CSS classes, events and refs to slot contents.\n- Remove existing nodes, wrap them with other nodes, or insert new nodes into the VNode tree.\n- The library is already small, but the helpers are also highly tree-shakable, reducing the size even further.\n- A fully typed API, building on the core Vue types.\n- But if you really have to manipulate VNodes, a library to smooth over the edge cases makes it less likely to go wrong.\n\n```vue\n\u003cscript\u003e\nimport { addProps, betweenChildren, isText, replaceChildren } from 'vnode-util'\nimport { h } from 'vue'\n\nexport default {\n  setup(_, { slots }) {\n    return () =\u003e {\n      let children = slots.default?.() ?? []\n\n      // Wrap text nodes in a `\u003cdiv\u003e`\n      children = replaceChildren(children, (vnode) =\u003e {\n        if (isText(vnode))\n          return h('div', vnode)\n      })\n\n      // Add the 'my-child' class to all children\n      children = addProps(children, () =\u003e {\n        return {\n          class: 'my-child'\n        }\n      })\n\n      // Insert the text 'then' between children\n      children = betweenChildren(children, () =\u003e 'then')\n\n      return h('div', children)\n    }\n  }\n}\n\u003c/script\u003e\n\n\u003cstyle\u003e\n.my-child {\n  border: 1px solid #000;\n  margin: 5px 0;\n  max-width: 200px;\n  padding: 5px;\n}\n\u003c/style\u003e\n```\n\n## License\n\n[MIT](./LICENSE) License © 2023-Present [Elone Hoo](https://github.com/elonehoo)\n","funding_links":["https://github.com/sponsors/elonehoo"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felonehoo%2Fvnode-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felonehoo%2Fvnode-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felonehoo%2Fvnode-util/lists"}