{"id":21381156,"url":"https://github.com/zecat/paper-toast-patterns","last_synced_at":"2025-03-16T10:43:37.868Z","repository":{"id":58237202,"uuid":"49795360","full_name":"Zecat/paper-toast-patterns","owner":"Zecat","description":"Factorize your paper-toasts using patterns.","archived":false,"fork":false,"pushed_at":"2017-06-07T15:28:40.000Z","size":2185,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-22T12:06:41.479Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zecat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-16T23:30:24.000Z","updated_at":"2018-02-23T14:26:56.000Z","dependencies_parsed_at":"2022-08-30T22:31:00.833Z","dependency_job_id":null,"html_url":"https://github.com/Zecat/paper-toast-patterns","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zecat%2Fpaper-toast-patterns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zecat%2Fpaper-toast-patterns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zecat%2Fpaper-toast-patterns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zecat%2Fpaper-toast-patterns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zecat","download_url":"https://codeload.github.com/Zecat/paper-toast-patterns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243857996,"owners_count":20359259,"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":[],"created_at":"2024-11-22T10:44:41.466Z","updated_at":"2025-03-16T10:43:37.838Z","avatar_url":"https://github.com/Zecat.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# paper-toast-patterns\n\n\n[Demo \u0026 Doc](http://zecat.github.io/paper-toast-patterns)\n\n\n```\n\tbower install --save Zecat/paper-toast-patterns\n```\n\n## Factorize your paper-toasts using patterns.\n\n\nFirst create some \u0026lt;paper-toast\u0026gt; as child of \u0026lt;paper-toast-patterns\u0026gt;, give them a 'type' \nattribute to retrieve them later and configure/style them as you please.\n\nExemple :\n\n```html\n  \u003cstyle is=\"custom-style\"\u003e\n    paper-toast[type=\"warn\"] {\n      font-weight: bold;\n      --paper-toast-color: var(--google-red-500);\n    }\n    paper-toast[type=\"info\"] {\n      --paper-toast-color: var(--google-blue-500);\n    }\n  \u003c/style\u003e\n  \u003cpaper-toast-patterns\u003e\n    \u003cpaper-toast type=\"warn\" duration=\"0\" text=\"Warning message pattern\"\u003e\n    \u003c/paper-toast\u003e\n    \u003cpaper-toast type=\"info\"\u003e\u003c/paper-toast\u003e\n  \u003c/paper-toast-patterns\u003e\n```\n\nThen, implement Zecat.PaperToastFirerBehavior in your favorite elements and use \nfireToast(type, text) method to open the matching type toast. If text param\nisn't provide, the text from your 'toast pattern' will be used.\n\nExemple :\n\n```html\n\u003cdom-module id=\"toast-sender\"\u003e\n  \u003ctemplate\u003e\n    \u003cpaper-button on-tap=\"sendWarn\"\u003ewarning\u003c/paper-button\u003e\n    \u003cpaper-button on-tap=\"sendInfo\"\u003einfo\u003c/paper-button\u003e \n  \u003c/template\u003e\n\n  \u003cscript\u003e\n    Polymer({\n      is: 'toast-sender',\n      behaviors: [\n        Zecat.PaperToastFirerBehavior\n      ],\n      sendWarn: function() {\n        this.fireToast('warn');\n      },\n      sendInfo: function() {\n        this.fireToast('info', 'A spermatozoid contains 37.5 mb of data.');\n      }\n    });\n  \u003c/script\u003e\n\u003c/dom-module\u003e\n```\n\nYou can also trigger yourself the toast from anywhere by firing an event \nwith this exact structure :\n\n```js\n  this.fire('iron-signal', {\n    name: 'toast',\n    data: {\n      type: \"your-type\",\n      text: \"your-text\"\n    }\n  });\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzecat%2Fpaper-toast-patterns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzecat%2Fpaper-toast-patterns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzecat%2Fpaper-toast-patterns/lists"}