Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hypertabs

Package Overview
Dependencies
Maintainers
4
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypertabs - npm Package Compare versions

Comparing version 4.2.0 to 5.0.0

9

index.js

@@ -10,7 +10,7 @@ var h = require('hyperscript')

module.exports = function (onSelect, opts) {
module.exports = function (opts) {
if (!opts) opts = {}
var content = h('section.content')
var tabs = Tabs(content, function () { getSelection() })
var tabs = Tabs(content, function () { getSelection() }, opts.onClose)
var d = h('div.Hypertabs', [

@@ -33,3 +33,3 @@ h('nav', [

d.selected = selection = sel
if(onSelect) onSelect(selection)
if(opts.onSelect) opts.onSelect(selection)
return sel

@@ -99,3 +99,4 @@ }

var el = d.get(i)
if(el) content.removeChild(d.get(i))
opts.onClose && opts.onClose(el.firstChild)
if(el) content.removeChild(el)
}

@@ -102,0 +103,0 @@

{
"name": "hypertabs",
"description": "tabbed interface with hyperscript",
"version": "4.2.0",
"version": "5.0.0",
"homepage": "https://github.com/dominictarr/hypertabs",

@@ -6,0 +6,0 @@ "repository": {

@@ -28,2 +28,33 @@ # hypertabs

## API
### `Tabs(opts)`
Instantiates a tabs setup. `opts` is an optional _object_ which can contain any of the following keys:
- `onSelect` - a callback function that is called when a tab is selected (called with ...)
- `onClose` - a callback function that is called when a tab is closed (called with the page element being closed)
- `prepend` - an html element which is prepended before your tabs in the 'tab nav'
- `append` - an html element which is appended after your tabs in the 'tab nav'
### `tab#add(page)`
Adds a new page and makes an associated tab for it
### `tab#remove`
### `tab#has`
### `tab#get`
### `tab#select`
### `tab#selectRelative`
### `tab#fullscreen`
### `tab#isFullscreen`
## Notifications

@@ -41,3 +72,3 @@

welcomeTab.classList.constain('-notify')
welcomeTab.classList.contains('-notify')
// -> true

@@ -44,0 +75,0 @@ ```

@@ -38,3 +38,3 @@ var h = require('hyperscript')

module.exports = function (content, onSelect) {
module.exports = function (content, onSelect, onClose) {
var tabs = h('section.tabs')

@@ -47,2 +47,5 @@ var selection

onclick: function (ev) {
ev.preventDefault()
ev.stopPropagation()
if(ev.shiftKey) toggle_focus(page)

@@ -55,4 +58,2 @@ else {

}
ev.preventDefault()
ev.stopPropagation()
}},

@@ -64,4 +65,8 @@ getTitle(page)

onclick: function (ev) {
ev.preventDefault()
ev.stopPropagation()
page.parentNode.removeChild(page)
tabs.removeChild(tab)
onClose && onClose(page.firstChild)
}},

@@ -68,0 +73,0 @@ 'x'

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc