{"id":19428505,"url":"https://github.com/tolyo/server-page-component","last_synced_at":"2025-08-01T16:09:33.039Z","repository":{"id":220017662,"uuid":"750506256","full_name":"tolyo/server-page-component","owner":"tolyo","description":"Web Component for partials","archived":false,"fork":false,"pushed_at":"2024-05-24T23:51:16.000Z","size":273,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-24T01:03:34.488Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/tolyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2024-01-30T19:17:08.000Z","updated_at":"2024-05-24T23:51:19.000Z","dependencies_parsed_at":"2024-02-08T18:48:31.521Z","dependency_job_id":"8f8a22d5-9bbd-4d2f-b484-08d06c2d0c8c","html_url":"https://github.com/tolyo/server-page-component","commit_stats":null,"previous_names":["tolyo/server-page-component"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tolyo/server-page-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolyo%2Fserver-page-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolyo%2Fserver-page-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolyo%2Fserver-page-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolyo%2Fserver-page-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tolyo","download_url":"https://codeload.github.com/tolyo/server-page-component/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tolyo%2Fserver-page-component/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268257248,"owners_count":24221054,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-10T14:15:27.127Z","updated_at":"2025-08-01T16:09:33.011Z","avatar_url":"https://github.com/tolyo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web Component for partials\n\nPartial is a fragment of a web-page, loaded separately from the main content. This Web Component simplifies their use. It is based on Open Web Components defaults and recommendations. \n\n## Install\n\n```bash\n$ npm i server-page-component\n\n```\n\nor\n\n```html\n\u003cscript src=\"\n    https://cdn.jsdelivr.net/npm/server-page-component/dist/server-page.umd.min.js\n\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nIf using module imports:\n\n```js\nimport 'server-page-component';\n```\n\nThen:\n\n```html\n# anywhere in your html\n\u003cserver-page url=\"./cat.html\"\u003e\u003c/server-page\u003e\n```\n\nThis will initiate an AJAX request to the address, specified in the `url` attribute, replacing the content of the component with received response. Modifying the `url` attribute will trigger a new request. If the `id` attribute is present, the component will use `window.document` as an event listener on `partial:#{id}` namespace. This allows partial content updates to be triggered from any part of your application. \n\n## Example \n\n```html\n\u003cserver-page id=\"SPY\" url=\"./stock?name=SPY\"\u003e\u003c/server-page\u003e\n\n\u003cscript\u003e\n    document.dispatchEvent(new Event(\"partial:SPY\"))                                                                                                                                                                         \n\u003c/script\u003e\n```\n\nOr use the helper `triggerServerPage`:\n\n```js\n\nimport { triggerServerPage } from 'server-page-component';\n\ntriggerServerPage('SPY');\n\n```\n\nFor updates from DOM without changing `url` attribute, a `latch` attribute \ncan be set to any value and the component will react to any changes to it. Example:\n\n```html\n\u003cserver-page url=\"./cat.html\" latch=\"0\"\u003e\u003c/server-page\u003e\n```\n\nOr wire it with a framework of choice:\n\n```html\n\u003cdiv ng-app\u003e\n    \u003cscript src=\"https://cdn.jsdelivr.net/npm/@angular-wave/angular.ts/dist/angular-ts.cjs.min.js\"\u003e\u003c/script\u003e\n    \u003cinput type=\"text\" ng-model=\"yourName\" placeholder=\"Enter anything\"\u003e\n    \u003cserver-page url=\"./test.html\" latch=\"{{ yourName }}\"\u003e\u003c/server-page\u003e\n\u003c/div\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftolyo%2Fserver-page-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftolyo%2Fserver-page-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftolyo%2Fserver-page-component/lists"}