@kadira/storybook-addons
Advanced tools
Comparing version 1.5.0 to 1.6.0
## Changelog | ||
### v1.6.0 | ||
28 Oct 2016 | ||
* Add `setPreviewDecorator` and `getPreviewDecorator` methods. | ||
* Now following methods can only be set once and they accept an option name as the second argument. | ||
* setChannel(channel, name) | ||
* setDatabase(database, name) | ||
* setPreview(preview, name) | ||
* setPreviewDecorator(decorator, name) | ||
### v1.5.0 | ||
@@ -4,0 +14,0 @@ 13 Aug 2016 |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -17,44 +17,52 @@ Object.defineProperty(exports, "__esModule", { | ||
this._panels = {}; | ||
this._channel = null; | ||
this._preview = null; | ||
this._database = null; | ||
this._store = {}; | ||
} | ||
_createClass(AddonStore, [{ | ||
key: "getChannel", | ||
value: function getChannel() { | ||
return this._channel; | ||
key: 'getPanels', | ||
value: function getPanels() { | ||
return this._panels; | ||
} | ||
}, { | ||
key: "setChannel", | ||
value: function setChannel(channel) { | ||
this._channel = channel; | ||
key: 'setChannel', | ||
value: function setChannel(channel, name) { | ||
this._set('channel', channel, name); | ||
} | ||
}, { | ||
key: "getPreview", | ||
value: function getPreview() { | ||
return this._preview; | ||
key: 'getChannel', | ||
value: function getChannel() { | ||
return this._get('channel'); | ||
} | ||
}, { | ||
key: "setPreview", | ||
value: function setPreview(preview) { | ||
this._preview = preview; | ||
key: 'setDatabase', | ||
value: function setDatabase(database, name) { | ||
this._set('database', database, name); | ||
} | ||
}, { | ||
key: "getDatabase", | ||
key: 'getDatabase', | ||
value: function getDatabase() { | ||
return this._database; | ||
return this._get('database'); | ||
} | ||
}, { | ||
key: "setDatabase", | ||
value: function setDatabase(database) { | ||
this._database = database; | ||
key: 'setPreview', | ||
value: function setPreview(preview, name) { | ||
this._set('preview', preview, name); | ||
} | ||
}, { | ||
key: "getPanels", | ||
value: function getPanels() { | ||
return this._panels; | ||
key: 'getPreview', | ||
value: function getPreview() { | ||
return this._get('preview'); | ||
} | ||
}, { | ||
key: "addPanel", | ||
key: 'setPreviewDecorator', | ||
value: function setPreviewDecorator(decorator, name) { | ||
this._set('preview decorator', decorator, name); | ||
} | ||
}, { | ||
key: 'getPreviewDecorator', | ||
value: function getPreviewDecorator() { | ||
return this._get('preview decorator'); | ||
} | ||
}, { | ||
key: 'addPanel', | ||
value: function addPanel(name, panel) { | ||
@@ -64,3 +72,3 @@ this._panels[name] = panel; | ||
}, { | ||
key: "register", | ||
key: 'register', | ||
value: function register(name, loader) { | ||
@@ -70,3 +78,3 @@ this._loaders[name] = loader; | ||
}, { | ||
key: "loadAddons", | ||
key: 'loadAddons', | ||
value: function loadAddons(api) { | ||
@@ -81,2 +89,21 @@ var _this = this; | ||
} | ||
}, { | ||
key: '_set', | ||
value: function _set(key, value, name) { | ||
if (this._store[key]) { | ||
throw new Error('There\'s ' + key + ' called "' + this._store[key].name + '". You can only have a single ' + key + '.'); | ||
} | ||
this._store[key] = { value: value, name: name }; | ||
} | ||
}, { | ||
key: '_get', | ||
value: function _get(key) { | ||
var item = this._store[key]; | ||
if (!item) { | ||
return null; | ||
} | ||
return item.value; | ||
} | ||
}]); | ||
@@ -83,0 +110,0 @@ |
{ | ||
"name": "@kadira/storybook-addons", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Storybook addons store", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,35 +5,41 @@ export class AddonStore { | ||
this._panels = {}; | ||
this._channel = null; | ||
this._preview = null; | ||
this._database = null; | ||
this._store = {}; | ||
} | ||
getChannel() { | ||
return this._channel; | ||
getPanels() { | ||
return this._panels; | ||
} | ||
setChannel(channel) { | ||
this._channel = channel; | ||
setChannel(channel, name) { | ||
this._set('channel', channel, name); | ||
} | ||
getPreview() { | ||
return this._preview; | ||
getChannel() { | ||
return this._get('channel'); | ||
} | ||
setPreview(preview) { | ||
this._preview = preview; | ||
setDatabase(database, name) { | ||
this._set('database', database, name); | ||
} | ||
getDatabase() { | ||
return this._database; | ||
return this._get('database'); | ||
} | ||
setDatabase(database) { | ||
this._database = database; | ||
setPreview(preview, name) { | ||
this._set('preview', preview, name); | ||
} | ||
getPanels() { | ||
return this._panels; | ||
getPreview() { | ||
return this._get('preview'); | ||
} | ||
setPreviewDecorator(decorator, name) { | ||
this._set('preview decorator', decorator, name); | ||
} | ||
getPreviewDecorator() { | ||
return this._get('preview decorator'); | ||
} | ||
addPanel(name, panel) { | ||
@@ -52,4 +58,21 @@ this._panels[name] = panel; | ||
} | ||
_set(key, value, name) { | ||
if (this._store[key]) { | ||
throw new Error(`There's ${key} called "${this._store[key].name}". You can only have a single ${key}.`); | ||
} | ||
this._store[key] = { value, name }; | ||
} | ||
_get(key) { | ||
const item = this._store[key]; | ||
if (!item) { | ||
return null; | ||
} | ||
return item.value; | ||
} | ||
} | ||
export default new AddonStore(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73375
9
163
1