Skip to content

Commit

Permalink
News properties
Browse files Browse the repository at this point in the history
  • Loading branch information
andrelmlins committed Nov 16, 2019
1 parent d824e4a commit 9b3ce08
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,66 @@
# Svelte FullScreen

[![npm version](https://badge.fury.io/js/svelte-fullscreen.svg)](https://www.npmjs.com/package/svelte-fullscreen) • [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/andrelmlins/svelte-fullscreen/blob/master/LICENSE) • [![Build Status](https://travis-ci.com/andrelmlins/svelte-fullscreen.svg?branch=master)](https://travis-ci.com/andrelmlins/svelte-fullscreen) • [![Dependencies](https://david-dm.org/andrelmlins/svelte-fullscreen.svg)](https://david-dm.org/andrelmlins/svelte-fullscreen) • [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/andrelmlins/svelte-fullscreen.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/andrelmlins/svelte-fullscreen/context:javascript)

Component that performs fullscreen in DOM Elements

## Installation

```
npm i svelte-fullscreen
// OR
yarn add svelte-fullscreen
```

## Demo [Link](https://svelte-fullscreen.netlify.com/)

Local demo:

```
git clone https://github.com/andrelmlins/svelte-fullscreen.git
cd svelte-fullscreen/example
yarn install && yarn start
```

## Examples

```js
<script>
import SvelteFullscreen from "svelte-fullscreen";
</script>

<style>
div {
background-color: red;
width: 120px;
height: 120px;
}
</style>

<SvelteFullscreen let:request let:exit>
<div>
<button onClick={() => onRequest()}>FullScreen</button>
<button onClick={() => onExit()}>Screen</button>
</div>
</SvelteFullscreen>
```

## Slot Properties

Raw component props (before transform):

| Prop | Type | Description |
| --------- | ---- | -------------------------- |
| onToggle | func | Call for fullscreen toggle |
| onExit | func | Call for fullscreen exit |
| onRequest | func | Call for fullscreen enter |

## NPM Statistics

Download stats for this NPM package

[![NPM](https://nodei.co/npm/svelte-fullscreen.png)](https://nodei.co/npm/svelte-fullscreen/)

## License

Svelte FullScreen is open source software [licensed as MIT](https://github.com/andrelmlins/svelte-fullscreen/blob/master/LICENSE).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-fullscreen",
"version": "0.1.0",
"version": "0.2.0",
"description": "Component that performs fullscreen in DOM Elements",
"repository": "https://github.com/andrelmlins/svelte-fullscreen",
"author": "André Lins <andrelucas01@hotmail.com> (https://andrelmlins.github.io/)",
Expand Down
10 changes: 7 additions & 3 deletions src/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
import screenfull from "screenfull";
let component;
const toggle = () => {
const onToggle = () => {
screenfull.toggle(component);
};
const request = () => {
const onRequest = () => {
screenfull.request(component);
};
const onExit = () => {
screenfull.exit(component);
};
</script>

<div bind:this={component}>
<slot {toggle} {request} />
<slot {onToggle} {onRequest} {onExit} />
</div>

0 comments on commit 9b3ce08

Please sign in to comment.