{"id":17026084,"url":"https://github.com/silencesys/silentbox","last_synced_at":"2025-04-04T14:09:09.900Z","repository":{"id":23406401,"uuid":"98872124","full_name":"silencesys/silentbox","owner":"silencesys","description":"A lightbox inspired Vue.js component.","archived":false,"fork":false,"pushed_at":"2023-07-18T21:07:51.000Z","size":1581,"stargazers_count":297,"open_issues_count":8,"forks_count":50,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-05T22:20:54.846Z","etag":null,"topics":["component","fancybox","fancybox-gallery","galleries","gallery","image","image-slider","image-viewer","images","lightbox","lightbox-gallery","silentbox","video","vue","vue3","vue3-typescript","vuejs"],"latest_commit_sha":null,"homepage":"https://silentbox.rocek.dev","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/silencesys.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.MD","contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-07-31T09:29:55.000Z","updated_at":"2024-06-19T01:35:28.521Z","dependencies_parsed_at":"2024-06-19T01:35:03.963Z","dependency_job_id":"a3017843-a78c-4cef-9d36-2c0f3faa76be","html_url":"https://github.com/silencesys/silentbox","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.04761904761904767,"last_synced_commit":"5b53f0b5e10e4833feb78c1c1899e0d0aa07cf1a"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silencesys%2Fsilentbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silencesys%2Fsilentbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silencesys%2Fsilentbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silencesys%2Fsilentbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silencesys","download_url":"https://codeload.github.com/silencesys/silentbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190231,"owners_count":20898700,"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":["component","fancybox","fancybox-gallery","galleries","gallery","image","image-slider","image-viewer","images","lightbox","lightbox-gallery","silentbox","video","vue","vue3","vue3-typescript","vuejs"],"created_at":"2024-10-14T07:30:26.815Z","updated_at":"2025-04-04T14:09:09.885Z","avatar_url":"https://github.com/silencesys.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://silentbox.rocek.dev/images/sb3-dark.png\"\u003e\n  \u003cimg alt=\"SilentBox logo.\" src=\"https://silentbox.rocek.dev/images/sb3-light.png\"\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/silencesys/silentbox/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/silencesys/silentbox.svg?color=08AEEA\u0026labelColor=169DC1\u0026style=flat-square\" alt=\"Github Stars\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/silencesys/silentbox/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/silencesys/silentbox.svg?style=flat-square\u0026labelColor=25ADA3\u0026color=4CC1B8\" alt=\"Github Issues\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/silencesys/silentbox/blob/master/license.md\"\u003e\u003cimg src=\"https://img.shields.io/github/license/silencesys/silentbox.svg?color=2AC47A\u0026labelColor=389367\u0026style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\nA third version of the lightweight lightbox inspired component for Vue.js with local video support and more features coming. If you're interested, see \u003ca href=\"https://silentbox.silencesys.com\"\u003edemo\u003c/a\u003e.\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cbr\u003e\n\n## Supported formats and services\n- All image formats that can be displayed in browser\n- Local video files with following extensions .mp4, .ogg, .webm, .mov, .flv, .wmv, .mkv\n- YouTube, Vimeo and Twitch embed videos with autoplay\n\n\u003cbr\u003e\n\n## Installation\n### Npm\n```\nnpm install --save vue-silentbox\n```\nImport the plugin into Vue:\n```js\nimport { createApp } from 'vue'\nimport VueSilentbox from 'vue-silentbox'\nimport 'vue-silentbox/dist/style.css'\n\ncreateApp({\n    // your app props ...\n})\n.use(VueSilentbox)\n.mount('#root')\n```\n\n\u003cbr\u003e\n\n## How to use?\nDefine an array of images in the data object of your Vue instance or component.\n```js\nimport { createApp } from 'vue'\nimport VueSilentbox from 'vue-silentbox'\nimport 'vue-silentbox/dist/style.css'\n\ncreateApp({\n    data: {\n        images: [\n            {\n                src: 'images/image001.jpg',\n                srcSet: '/images/image001-640.jpg 640w,/images/image001-1280.jpg 1280w,/images/image001-1920.jpg 1920w',\n                description: 'Sunken dreams II. by Arbebuk',\n            },\n            {\n                src: 'images/image002.jpg',\n                srcSet: '/images/image002-640.jpg 640w,/images/image002-1280.jpg 1280w,/images/image003-1920.jpg 1920w',\n                description: 'Tunnel View Sunrise by Porbital',\n            }\n        ]\n    },\n})\n.use(VueSilentbox)\n.mount('#root')\n```\n\nThen in the template you use a `silent-box` component to display the gallery.\n\n```vue\n\u003csilent-box :gallery=\"images\"\u003e\u003c!-- your additional content --\u003e\u003c/silent-box\u003e\n```\nOr you can show a single image by just renaming the property.\n```vue\n\u003csilent-box :image=\"images[0]\"\u003e\u003c!-- your additional content --\u003e\u003c/silent-box\u003e\n```\n\n\n### Custom activators\n\nIn case you don't like the default image previews that SilentBox provides, you can\nset your own activators - text, button or even a video! SilentBox provides a named slot for this - `silentbox-item`. The slot provides variable called `silentboxItem` which\nprovides you access to all properties you set on image object.\n\n```html\n\u003c!--\nIn this example only alt text is displayed as an activator.\n--\u003e\n\u003csilent-box :gallery=\"images\"\u003e\n    \u003ch2 class=\"tw-text-3xl tw-font-bold tw-mb-2\"\u003eGallery\u003c/h2\u003e\n    \u003cp class=\"tw-font-light tw-mb-3\"\u003e\n        Items could be merged into groups that make galleries.\n    \u003c/p\u003e\n    \u003ctemplate v-slot:silentbox-item=\"{ silentboxItem }\"\u003e\n        \u003cp\u003e{{ silentboxItem.alt  }}\u003c/p\u003e\n    \u003c/template\u003e\n\u003c/silent-box\u003e\n```\n\n### Plugin options\nYou can set the following options to the plugin to change the behaviour of the\nSilentBox or display additional information.\n\n| Name | Required | Type | Default | Description |\n|:------| :------: | :------: | :------: |:------|\n| downloadButtonLabel | no | string | Download | Label used in the download button. |\n\n```js\ncreateApp({\n    // your app props ...\n})\n.use(VueSilentbox, {\n    downloadButtonLabel: 'Download'\n})\n.mount('#root')\n```\n\n\n### Image object attributes\n\nYou can set the following attributes to the image object to change the behaviour\nof the SilentBox or display additional information. On the other hand, if you're\nlazy, only the `src` attribute is required.\n\n| Attribute | required | type | Description |\n|:------| :------: | :------: |:------|\n| src | yes | string | media source, it could be an image, video or a YouTube / Vimeo embed link |\n| srcSet | no | string | srcSet to make use of [responsive images](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images) |\n| thumbnail | no | string | image used for thumbnail |\n| thumbnailHeight | no | string | height of the thumbnail in px |\n| thumbnailWidth | no | string | width of the thumbnail in px |\n| description | no | string | short description below image (doesn't work below videos yet) |\n| alt | no | string | alt description for images |\n| autoplay | no | bool| to autoplay youtube / Vimeo video |\n| download | no | bool/string | Link to download the file. When set to a boolean value (`true`/`false`), the src is used as the download link. |\n| controls | no | bool | **does not work for Vimeo**, setting false will hide video controls |\n\n### Gallery element attributes\n\nThese attributes can change the gallery element behaviour.\n\n| Attribute | required | type | Description |\n|:------| :------: | :------: |:------|\n| gallery | no | array | list of image objects that will be displayed in the gallery |\n| image | no | object | image object that will be displayed in the gallery |\n| lazy-loading | no | bool | whether images should be lazy loaded |\n| preview-count | no | number | number of images that should be displayed in the gallery |\n\n### Events\nSilentBox also fires several events that can be further used in your Vue.js application. Each event has a payload that contains the\n`item` object which holds information about the currently displayed item.\n| Event name | When is event fired |\n|:------| :------ |\n| `silentbox-overlay-opened` | when the overlay is opened |\n| `silentbox-overlay-hidden` | when the overlay is closed (button or ESC key) |\n| `silentbox-overlay-next-item-displayed` | when the user moves to the next picture (arrow or key) |\n| `silentbox-overlay-prev-item-displayed` | when the user moves to the previous picture (arrow or key) |\n\n### Open overlay programatically\nSilentBox provides two options how to open the overlay programatically. If you need to open an existing gallery, the best option\nis to use the `ref` attribute and then call the method `openOverlay` on the `$refs` object in your method. See example:\n```html\n\u003csilent-box ref=\"silentbox\" :gallery=\"images\"\u003e\u003c/silent-box\u003e\n```\nand then the method `openOverlay` can be called from your method:\n```javascript\n// ...\nmethods: {\n    // the index parameter is optional, however it should be set if you're opening\n    // the overlay on different position than the beginning of the gallery\n    openOverlayProgramaticallyWithContext (item, index = 0) {\n        this.$refs.silentbox.openOverlay(item, index)\n    }\n}\n// ...\n```\n\nHowever, in case you just want to open an item without any context, it might be a better choice to call the global `open`\nmethod that SilentBox provides.\n```javascript\n// ...\nmethods: {\n    openOverlayProgramaticallyWithoutContext (item) {\n        this.$silentbox.open(item)\n    }\n}\n// ...\n```\n\n\u003cbr\u003e\n\n\n## Upgrading from 2.x to 3.x?\nAlmost all APIs remained same except two things:\n- Vue3 always transforms `\u003cimg /\u003e` width and height to numbers, thus properties `thumbnailWidth` and `thumbnailHeight` should always be a number\n- event fired when user navigates to previous image was renamed to `silentbox-overlay-prev-item-displayed` from `silentbox-overlay-previous-item-displayed`\n\n\u003cbr\u003e\n\n## Upgrading from 0.1?\nVersion 2 brought many breaking changes. There are no more two separate components\nto display a single image or gallery. So, change all your `silentbox-group` and `silentbox-single` components to `silent-box`.\nThe source of images must be an array of objects or a single object with previously mentioned attributes.\n\n\u003cbr\u003e\n\n## Contributions\n\nAll contributions are welcomed, however give me some time to review your requests. Please, use emoji in your commits, so it is easier to identify what your commits do.\nThere are several _emoji guides_ on the internet. Please stick with mine which is inspired by Atom contributing guidelines, see [emoji in commits](https://gist.github.com/silencesys/2ede032fe31fed95434aff10d29cabbf).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilencesys%2Fsilentbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilencesys%2Fsilentbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilencesys%2Fsilentbox/lists"}