@storybook/addon-highlight 7.0.0-alpha.52 → 7.0.0-alpha.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,7 +28,7 @@ Highlight DOM nodes by emitting the `HIGHLIGHT` event from within a story or an
28
28
 
29
29
  ```js
30
30
  import React, { useEffect } from 'react';
31
- import { useChannel } from '@storybook/addons';
31
+ import { useChannel } from '@storybook/preview-api';
32
32
  import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight';
33
33
  import { MyComponent } form './MyComponent';
34
34
 
@@ -0,0 +1 @@
1
+ var ADDON_ID="storybook/highlight",HIGHLIGHT_STYLE_ID="storybookHighlight",HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;export{HIGHLIGHT_STYLE_ID,HIGHLIGHT,RESET_HIGHLIGHT};
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{b as e,c as o}from"./chunk-3L7URCJV.mjs";module&&module.hot&&module.hot.decline&&module.hot.decline();var d={};export{e as HIGHLIGHT,o as RESET_HIGHLIGHT,d as default};
1
+ import{HIGHLIGHT,RESET_HIGHLIGHT}from"./chunk-33ALZPRS.mjs";module&&module.hot&&module.hot.decline&&module.hot.decline();var src_default={};export{HIGHLIGHT,RESET_HIGHLIGHT,src_default as default};
package/dist/preview.js CHANGED
@@ -1,4 +1,4 @@
1
- var x=Object.create;var i=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},c=(e,t,o,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!y.call(e,n)&&n!==o&&i(e,n,{get:()=>t[n],enumerable:!(l=G(t,n))||l.enumerable});return e};var b=(e,t,o)=>(o=e!=null?x(f(e)):{},c(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),E=e=>c(i({},"__esModule",{value:!0}),e);var O={};S(O,{highlightObject:()=>L,highlightStyle:()=>u});module.exports=E(O);var p=b(require("global")),a=require("@storybook/addons"),I=require("@storybook/core-events");var g="storybook/highlight",s="storybookHighlight",H=`${g}/add`,m=`${g}/reset`;var{document:h}=p.default,u=(e="#FF4785",t="dashed")=>`
1
+ var x=Object.create;var i=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},c=(e,t,o,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!y.call(e,n)&&n!==o&&i(e,n,{get:()=>t[n],enumerable:!(l=G(t,n))||l.enumerable});return e};var b=(e,t,o)=>(o=e!=null?x(f(e)):{},c(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),E=e=>c(i({},"__esModule",{value:!0}),e);var O={};S(O,{highlightObject:()=>L,highlightStyle:()=>u});module.exports=E(O);var p=b(require("global")),a=require("@storybook/preview-api"),I=require("@storybook/core-events");var g="storybook/highlight",s="storybookHighlight",H=`${g}/add`,m=`${g}/reset`;var{document:h}=p.default,u=(e="#FF4785",t="dashed")=>`
2
2
  outline: 2px ${t} ${e};
3
3
  outline-offset: 2px;
4
4
  box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
package/dist/preview.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import{a as n,b as h,c as s}from"./chunk-3L7URCJV.mjs";import c from"global";import{addons as g}from"@storybook/addons";import{STORY_CHANGED as a}from"@storybook/core-events";var{document:l}=c,p=(e="#FF4785",t="dashed")=>`
2
- outline: 2px ${t} ${e};
1
+ import{HIGHLIGHT,HIGHLIGHT_STYLE_ID,RESET_HIGHLIGHT}from"./chunk-33ALZPRS.mjs";import global from"global";import{addons}from"@storybook/preview-api";import{STORY_CHANGED}from"@storybook/core-events";var{document}=global,highlightStyle=(color="#FF4785",style="dashed")=>`
2
+ outline: 2px ${style} ${color};
3
3
  outline-offset: 2px;
4
4
  box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
5
- `,x=e=>({outline:`2px dashed ${e}`,outlineOffset:2,boxShadow:"0 0 0 6px rgba(255,255,255,0.6)"});module&&module.hot&&module.hot.decline&&module.hot.decline();var i=g.getChannel(),u=e=>{let t=n;d();let r=Array.from(new Set(e.elements)),o=l.createElement("style");o.setAttribute("id",t),o.innerHTML=r.map(m=>`${m}{
6
- ${p(e.color,e.style)}
7
- }`).join(" "),l.head.appendChild(o)},d=()=>{let e=n,t=l.getElementById(e);t&&t.parentNode.removeChild(t)};i.on(a,d);i.on(s,d);i.on(h,u);export{x as highlightObject,p as highlightStyle};
5
+ `,highlightObject=color=>({outline:`2px dashed ${color}`,outlineOffset:2,boxShadow:"0 0 0 6px rgba(255,255,255,0.6)"});module&&module.hot&&module.hot.decline&&module.hot.decline();var 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}{
6
+ ${highlightStyle(infos.color,infos.style)}
7
+ }`).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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-highlight",
3
- "version": "7.0.0-alpha.52",
3
+ "version": "7.0.0-alpha.54",
4
4
  "description": "Highlight DOM nodes within your stories",
5
5
  "keywords": [
6
6
  "storybook-addons",
@@ -60,8 +60,8 @@
60
60
  "prep": "../../../scripts/prepare/bundle.ts"
61
61
  },
62
62
  "dependencies": {
63
- "@storybook/addons": "7.0.0-alpha.52",
64
- "@storybook/core-events": "7.0.0-alpha.52",
63
+ "@storybook/core-events": "7.0.0-alpha.54",
64
+ "@storybook/preview-api": "7.0.0-alpha.54",
65
65
  "global": "^4.4.0"
66
66
  },
67
67
  "devDependencies": {
@@ -77,7 +77,7 @@
77
77
  "./src/preview.ts"
78
78
  ]
79
79
  },
80
- "gitHead": "d2494e3f51ce0f55bcb1ef693a6477c669fbe666",
80
+ "gitHead": "91177d4e27daec556a24ae6223c3cbe17a998d9b",
81
81
  "sbmodern": "dist/modern/index.js",
82
82
  "storybook": {
83
83
  "displayName": "Highlight",
@@ -1 +0,0 @@
1
- var o="storybook/highlight",t="storybookHighlight",H=`${o}/add`,I=`${o}/reset`;export{t as a,H as b,I as c};