@storybook/addon-highlight 7.6.0-alpha.6 → 7.6.0-alpha.7
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/index.d.ts +2 -2
- package/dist/index.js +9 -1
- package/dist/index.mjs +2 -4
- package/dist/preview.js +9 -3
- package/package.json +11 -23
- package/dist/chunk-33ALZPRS.mjs +0 -3
- package/dist/preview.d.ts +0 -9
- package/dist/preview.mjs +0 -14
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ADDON_ID="storybook/highlight";var HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var src_default={};
|
|
6
|
+
|
|
7
|
+
exports.HIGHLIGHT = HIGHLIGHT;
|
|
8
|
+
exports.RESET_HIGHLIGHT = RESET_HIGHLIGHT;
|
|
9
|
+
exports.default = src_default;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
var ADDON_ID="storybook/highlight";var HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var src_default={};
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { src_default as default };
|
|
3
|
+
export { HIGHLIGHT, RESET_HIGHLIGHT, src_default as default };
|
package/dist/preview.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { global } from '@storybook/global';
|
|
2
|
+
import { addons } from '@storybook/preview-api';
|
|
3
|
+
import { STORY_CHANGED } from '@storybook/core-events';
|
|
4
|
+
|
|
5
|
+
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")=>`
|
|
2
6
|
outline: 2px ${style} ${color};
|
|
3
7
|
outline-offset: 2px;
|
|
4
8
|
box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
|
|
5
|
-
`,highlightObject=color=>({outline:`2px dashed ${color}`,outlineOffset:2,boxShadow:"0 0 0 6px rgba(255,255,255,0.6)"}),channel=
|
|
9
|
+
`,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
10
|
${highlightStyle(infos.color,infos.style)}
|
|
7
|
-
}`).join(" "),document.head.appendChild(sheet)},resetHighlight=()=>{
|
|
11
|
+
}`).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
|
+
|
|
13
|
+
export { highlightObject, highlightStyle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-highlight",
|
|
3
|
-
"version": "7.6.0-alpha.
|
|
3
|
+
"version": "7.6.0-alpha.7",
|
|
4
4
|
"description": "Highlight DOM nodes within your stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook-addons",
|
|
@@ -30,26 +30,12 @@
|
|
|
30
30
|
"require": "./dist/index.js",
|
|
31
31
|
"import": "./dist/index.mjs"
|
|
32
32
|
},
|
|
33
|
-
"./preview":
|
|
34
|
-
"types": "./dist/preview.d.ts",
|
|
35
|
-
"require": "./dist/preview.js",
|
|
36
|
-
"import": "./dist/preview.mjs"
|
|
37
|
-
},
|
|
33
|
+
"./preview": "./dist/preview.js",
|
|
38
34
|
"./package.json": "./package.json"
|
|
39
35
|
},
|
|
40
36
|
"main": "dist/index.js",
|
|
41
37
|
"module": "dist/index.mjs",
|
|
42
38
|
"types": "dist/index.d.ts",
|
|
43
|
-
"typesVersions": {
|
|
44
|
-
"*": {
|
|
45
|
-
"*": [
|
|
46
|
-
"dist/index.d.ts"
|
|
47
|
-
],
|
|
48
|
-
"preview": [
|
|
49
|
-
"dist/preview.d.ts"
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
39
|
"files": [
|
|
54
40
|
"dist/**/*",
|
|
55
41
|
"README.md",
|
|
@@ -58,15 +44,15 @@
|
|
|
58
44
|
"!src/**/*"
|
|
59
45
|
],
|
|
60
46
|
"scripts": {
|
|
61
|
-
"check": "../../../scripts/prepare/check.ts",
|
|
62
|
-
"prep": "../../../scripts/prepare/bundle.ts"
|
|
47
|
+
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts",
|
|
48
|
+
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts"
|
|
63
49
|
},
|
|
64
50
|
"dependencies": {
|
|
65
|
-
"@storybook/
|
|
66
|
-
"@storybook/global": "^5.0.0",
|
|
67
|
-
"@storybook/preview-api": "7.6.0-alpha.6"
|
|
51
|
+
"@storybook/global": "^5.0.0"
|
|
68
52
|
},
|
|
69
53
|
"devDependencies": {
|
|
54
|
+
"@storybook/core-events": "7.6.0-alpha.7",
|
|
55
|
+
"@storybook/preview-api": "7.6.0-alpha.7",
|
|
70
56
|
"@types/webpack-env": "^1.16.0",
|
|
71
57
|
"typescript": "~4.9.3"
|
|
72
58
|
},
|
|
@@ -74,8 +60,10 @@
|
|
|
74
60
|
"access": "public"
|
|
75
61
|
},
|
|
76
62
|
"bundler": {
|
|
77
|
-
"
|
|
78
|
-
"./src/index.ts"
|
|
63
|
+
"exportEntries": [
|
|
64
|
+
"./src/index.ts"
|
|
65
|
+
],
|
|
66
|
+
"previewEntries": [
|
|
79
67
|
"./src/preview.ts"
|
|
80
68
|
]
|
|
81
69
|
},
|
package/dist/chunk-33ALZPRS.mjs
DELETED
package/dist/preview.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type OutlineStyle = 'dotted' | 'dashed' | 'solid' | 'double';
|
|
2
|
-
declare const highlightStyle: (color?: string, style?: OutlineStyle) => string;
|
|
3
|
-
declare const highlightObject: (color: string) => {
|
|
4
|
-
outline: string;
|
|
5
|
-
outlineOffset: number;
|
|
6
|
-
boxShadow: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { highlightObject, highlightStyle };
|
package/dist/preview.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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")=>`
|
|
7
|
-
outline: 2px ${style} ${color};
|
|
8
|
-
outline-offset: 2px;
|
|
9
|
-
box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
|
|
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}{
|
|
11
|
-
${highlightStyle(infos.color,infos.style)}
|
|
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 };
|