{"id":15011818,"url":"https://github.com/groupon/phy","last_synced_at":"2025-04-12T03:31:43.629Z","repository":{"id":37925514,"uuid":"152321864","full_name":"groupon/phy","owner":"groupon","description":"Minimal hyperscript helpers for Preact","archived":false,"fork":false,"pushed_at":"2023-01-07T23:43:33.000Z","size":871,"stargazers_count":6,"open_issues_count":8,"forks_count":6,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-10-29T14:17:55.408Z","etag":null,"topics":["hyperscript","javascript","preact"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/groupon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-09T21:10:16.000Z","updated_at":"2022-07-26T16:43:17.000Z","dependencies_parsed_at":"2023-02-08T03:31:26.804Z","dependency_job_id":null,"html_url":"https://github.com/groupon/phy","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/groupon%2Fphy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groupon%2Fphy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groupon%2Fphy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groupon%2Fphy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/groupon","download_url":"https://codeload.github.com/groupon/phy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248512736,"owners_count":21116672,"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":["hyperscript","javascript","preact"],"created_at":"2024-09-24T19:41:45.544Z","updated_at":"2025-04-12T03:31:43.356Z","avatar_url":"https://github.com/groupon.png","language":"JavaScript","readme":"[![nlm-github](https://img.shields.io/badge/github-groupon%2Fphy%2Fissues-F4D03F?logo=github\u0026logoColor=white)](https://github.com/groupon/phy/issues)\n![nlm-node](https://img.shields.io/badge/node-%3E%3D8.3-blue?logo=node.js\u0026logoColor=white)\n![nlm-version](https://img.shields.io/badge/version-4.2.7-blue?logo=version\u0026logoColor=white)\n# `phy`\n\nMinimal hyperscript helpers for Preact.\n\nThe intent while creating this package was to create as small of a footprint as possible, with only Preact as a dependency.\n\n## Examples\n\n```js\nconst h = require('phy');\n\nmodule.exports = function SomeComponent() {\n  return h('#foo', h('span.bar', 'whee!'));\n}\n```\n\nor, if you need access to other things from Preact, `Component` and `render`\nare passed thru for your convenience:\n\n```js\nconst { h, Component } = require('phy');\n\nclass SomeComponent extends Component {\n  render() {\n    return h('#foo', h('span.bar', 'whee!'));\n  }\n}\nmodule.exports = SomeComponent;\n```\n\nYou can create a Fragment tersely by passing only one argument: an\narray of other nodes or strings:\n\n```js\nconst frag = h([\n  h('div', 'one'),\n  h('div', 'two'),\n  'three'\n]);\n\n// is equivalent to:\n\nconst { Fragment } = require('preact');\nconst frag = h(Fragment, [\n  h('div', 'one'),\n  h('div', 'two'),\n  'three'\n]);\n```\n\n## Optional Tag Helpers\n\nAt the cost of a modestly larger import and slight function call overhead,\nyou can also use a set of named tag function helpers for terser syntax.\n\n**Important**: bare string children **must** be enclosed in an array.\n`h('div', 'kittens')` or `div(['kittens'])` are ok, `div('kittens')` is NOT.\n\n```js\n// h() is passed through as an export so you don't need to require preact\nconst { h, span, div } = require('phy/tags');\n\nmodule.exports = function SomeComponent() {\n  return div('#foo', [span(['kittens']), h(SomeOtherComponent)]);\n}\n```\n\nLicense\n----------------------------------------------------------------------\n\n[BSD 3-Clause open source license](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroupon%2Fphy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgroupon%2Fphy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroupon%2Fphy/lists"}