Socket
Socket
Sign inDemoInstall

@storybook/addon-highlight

Package Overview
Dependencies
Maintainers
11
Versions
812
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/addon-highlight - npm Package Compare versions

Comparing version 0.0.0-pr-26557-sha-7290a2c2 to 0.0.0-pr-26654-sha-49d01553

dist/preview.d.ts

16

dist/preview.js

@@ -1,13 +0,13 @@

import { global } from '@storybook/global';
import { addons } from '@storybook/preview-api';
import { STORY_CHANGED } from '@storybook/core-events';
'use strict';
var ADDON_ID="storybook/highlight",HIGHLIGHT_STYLE_ID="storybookHighlight",HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var {document}=global,highlightStyle=(color="#FF4785",style="dashed")=>`
var global = require('@storybook/global');
var previewApi = require('storybook/internal/preview-api');
var coreEvents = require('storybook/internal/core-events');
var ADDON_ID="storybook/highlight",HIGHLIGHT_STYLE_ID="storybookHighlight",HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var{document}=global.global,highlightStyle=(color="#FF4785",style="dashed")=>`
outline: 2px ${style} ${color};
outline-offset: 2px;
box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
`,highlightObject=color=>({outline:`2px dashed ${color}`,outlineOffset:2,boxShadow:"0 0 0 6px rgba(255,255,255,0.6)"}),channel=addons.getChannel(),highlight=infos=>{let id=HIGHLIGHT_STYLE_ID;resetHighlight();let elements=Array.from(new Set(infos.elements)),sheet=document.createElement("style");sheet.setAttribute("id",id),sheet.innerHTML=elements.map(target=>`${target}{
`,channel=previewApi.addons.getChannel(),highlight=infos=>{let id=HIGHLIGHT_STYLE_ID;resetHighlight();let elements=Array.from(new Set(infos.elements)),sheet=document.createElement("style");sheet.setAttribute("id",id),sheet.innerHTML=elements.map(target=>`${target}{
${highlightStyle(infos.color,infos.style)}
}`).join(" "),document.head.appendChild(sheet);},resetHighlight=()=>{let id=HIGHLIGHT_STYLE_ID,sheetToBeRemoved=document.getElementById(id);sheetToBeRemoved&&sheetToBeRemoved.parentNode?.removeChild(sheetToBeRemoved);};channel.on(STORY_CHANGED,resetHighlight);channel.on(RESET_HIGHLIGHT,resetHighlight);channel.on(HIGHLIGHT,highlight);
export { highlightObject, highlightStyle };
}`).join(" "),document.head.appendChild(sheet);},resetHighlight=()=>{let id=HIGHLIGHT_STYLE_ID,sheetToBeRemoved=document.getElementById(id);sheetToBeRemoved&&sheetToBeRemoved.parentNode?.removeChild(sheetToBeRemoved);};channel.on(coreEvents.STORY_CHANGED,resetHighlight);channel.on(RESET_HIGHLIGHT,resetHighlight);channel.on(HIGHLIGHT,highlight);
{
"name": "@storybook/addon-highlight",
"version": "0.0.0-pr-26557-sha-7290a2c2",
"version": "0.0.0-pr-26654-sha-49d01553",
"description": "Highlight DOM nodes within your stories",

@@ -30,6 +30,10 @@ "keywords": [

"node": "./dist/index.js",
"require": "./dist/index.js",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./preview": "./dist/preview.js",
"./preview": {
"types": "./dist/preview.d.ts",
"import": "./dist/preview.mjs",
"require": "./dist/preview.js"
},
"./package.json": "./package.json"

@@ -55,7 +59,8 @@ },

"devDependencies": {
"@storybook/core-events": "0.0.0-pr-26557-sha-7290a2c2",
"@storybook/preview-api": "0.0.0-pr-26557-sha-7290a2c2",
"@types/webpack-env": "^1.16.0",
"typescript": "^5.3.2"
},
"peerDependencies": {
"storybook": "^0.0.0-pr-26654-sha-49d01553"
},
"publishConfig": {

@@ -72,3 +77,3 @@ "access": "public"

},
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16",
"sbmodern": "dist/modern/index.js",

@@ -75,0 +80,0 @@ "storybook": {

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