Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@storybook/preview-api
Advanced tools
The @storybook/preview-api package is part of the Storybook ecosystem, which is a tool for developing UI components in isolation for React, Vue, Angular, and more. This package provides APIs to interact with the Storybook preview, allowing developers to control the rendering of stories, listen to events, and manipulate the state of the Storybook UI.
Fetching and rendering stories
This feature allows developers to fetch story data by ID and render it using a custom component or utility.
import { useStorybookApi } from '@storybook/api';
function MyComponent() {
const api = useStorybookApi();
const story = api.getData('some-story-id');
return <StoryRenderer story={story} />;
}
Listening to Storybook events
This feature enables components to listen to Storybook-specific events and react accordingly, as well as emit events to the Storybook environment.
import { useEffect } from 'react';
import { useChannel } from '@storybook/api';
function MyComponent() {
const emit = useChannel({
'storybook/my-event': (eventData) => {
console.log('Event data:', eventData);
}
});
useEffect(() => {
emit('storybook/my-event', { payload: 'data' });
}, [emit]);
return <div>Check the console for event data.</div>;
}
Manipulating the Storybook UI
Developers can use this feature to programmatically control the Storybook UI, such as changing the current story displayed.
import { addons } from '@storybook/addons';
addons.setChannel(new Channel({ transport: new PostmsgTransport({ key: 'iframe-key' }) }));
addons.getChannel().emit('setCurrentStory', { storyId: 'some-story-id' });
This package allows developers to create callbacks that appear in the actions panel of the Storybook UI when clicked. It is similar to @storybook/preview-api in that it enhances the Storybook development experience but focuses on actions rather than preview functionality.
This package provides a way to create links between stories. It is similar to @storybook/preview-api in that it interacts with the Storybook UI, but it specifically focuses on linking stories together rather than providing a general API for preview manipulation.
This addon shows the source of the story next to the story itself. While it enhances the Storybook experience by providing source code context, it does not offer an API for controlling the preview like @storybook/preview-api does.
TODO write proper documentation of this package
This package used to be multiple packages (they have been combined into this one):
@storybook/addons
read (old) docs@storybook/client-api
read (old) docs@storybook/core-client
read (old) docs@storybook/preview-web
read (old) docs@storybook/store
read (old) docs7.0.0-beta.34 (January 26, 2023)
FAQs
Unknown package
The npm package @storybook/preview-api receives a total of 5,927,454 weekly downloads. As such, @storybook/preview-api popularity was classified as popular.
We found that @storybook/preview-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.