@storybook/addon-highlight 7.0.6 → 7.0.8
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/dist/chunk-33ALZPRS.mjs +3 -1
- package/dist/index.mjs +5 -1
- package/dist/preview.mjs +9 -2
- package/package.json +9 -9
package/dist/chunk-33ALZPRS.mjs
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
var ADDON_ID="storybook/highlight",HIGHLIGHT_STYLE_ID="storybookHighlight",HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;
|
|
1
|
+
var ADDON_ID="storybook/highlight",HIGHLIGHT_STYLE_ID="storybookHighlight",HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;
|
|
2
|
+
|
|
3
|
+
export { HIGHLIGHT, HIGHLIGHT_STYLE_ID, RESET_HIGHLIGHT };
|
package/dist/index.mjs
CHANGED
package/dist/preview.mjs
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import{HIGHLIGHT,HIGHLIGHT_STYLE_ID
|
|
1
|
+
import { RESET_HIGHLIGHT, HIGHLIGHT, HIGHLIGHT_STYLE_ID } from './chunk-33ALZPRS.mjs';
|
|
2
|
+
import { global } from '@storybook/global';
|
|
3
|
+
import { addons } from '@storybook/preview-api';
|
|
4
|
+
import { STORY_CHANGED } from '@storybook/core-events';
|
|
5
|
+
|
|
6
|
+
var {document}=global,highlightStyle=(color="#FF4785",style="dashed")=>`
|
|
2
7
|
outline: 2px ${style} ${color};
|
|
3
8
|
outline-offset: 2px;
|
|
4
9
|
box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
|
|
5
10
|
`,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}{
|
|
6
11
|
${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);
|
|
12
|
+
}`).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);
|
|
13
|
+
|
|
14
|
+
export { highlightObject, highlightStyle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-highlight",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.8",
|
|
4
4
|
"description": "Highlight DOM nodes within your stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook-addons",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "https://github.com/storybookjs/storybook.git",
|
|
18
|
-
"directory": "addons/highlight"
|
|
18
|
+
"directory": "code/addons/highlight"
|
|
19
19
|
},
|
|
20
20
|
"funding": {
|
|
21
21
|
"type": "opencollective",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"author": "winkerVSbecks",
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
28
29
|
"node": "./dist/index.js",
|
|
29
30
|
"require": "./dist/index.js",
|
|
30
|
-
"import": "./dist/index.mjs"
|
|
31
|
-
"types": "./dist/index.d.ts"
|
|
31
|
+
"import": "./dist/index.mjs"
|
|
32
32
|
},
|
|
33
33
|
"./preview": {
|
|
34
|
+
"types": "./dist/preview.d.ts",
|
|
34
35
|
"require": "./dist/preview.js",
|
|
35
|
-
"import": "./dist/preview.mjs"
|
|
36
|
-
"types": "./dist/preview.d.ts"
|
|
36
|
+
"import": "./dist/preview.mjs"
|
|
37
37
|
},
|
|
38
38
|
"./package.json": "./package.json"
|
|
39
39
|
},
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@storybook/core-events": "7.0.
|
|
64
|
+
"@storybook/core-events": "7.0.8",
|
|
65
65
|
"@storybook/global": "^5.0.0",
|
|
66
|
-
"@storybook/preview-api": "7.0.
|
|
66
|
+
"@storybook/preview-api": "7.0.8"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/webpack-env": "^1.16.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"./src/preview.ts"
|
|
79
79
|
]
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "9991b68c7d0cd1543c974f358cae9e0d02b29e7e",
|
|
82
82
|
"sbmodern": "dist/modern/index.js",
|
|
83
83
|
"storybook": {
|
|
84
84
|
"displayName": "Highlight",
|