@storybook/addon-highlight
Advanced tools
Comparing version 0.0.0-pr-26557-sha-7290a2c2 to 0.0.0-pr-26654-sha-49d01553
@@ -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": { |
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
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
9385
2
9
38
2