@storybook/addon-highlight 8.6.0-alpha.4 → 8.6.0-beta.0

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 CHANGED
@@ -1,6 +1,21 @@
1
+ import * as core_dist_types from 'storybook/internal/types';
2
+ import * as core_dist_csf from 'storybook/internal/csf';
3
+
1
4
  declare const HIGHLIGHT = "storybook/highlight/add";
2
5
  declare const RESET_HIGHLIGHT = "storybook/highlight/reset";
3
6
 
4
- declare const _default: {};
7
+ interface HighlightParameters {
8
+ /**
9
+ * Highlight configuration
10
+ *
11
+ * @see https://storybook.js.org/docs/essentials/highlight#parameters
12
+ */
13
+ highlight: {
14
+ /** Remove the addon panel and disable the addon's behavior */
15
+ disable?: boolean;
16
+ };
17
+ }
18
+
19
+ declare const _default: () => core_dist_types.ProjectAnnotations<core_dist_csf.Renderer>;
5
20
 
6
- export { HIGHLIGHT, RESET_HIGHLIGHT, _default as default };
21
+ export { HIGHLIGHT, HighlightParameters, RESET_HIGHLIGHT, _default as default };
package/dist/index.js CHANGED
@@ -2,7 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ADDON_ID="storybook/highlight";var HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var src_default={};
5
+ var previewApi = require('storybook/internal/preview-api');
6
+ var coreEvents = require('storybook/internal/core-events');
7
+ var global = require('@storybook/global');
8
+
9
+ 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")=>`
10
+ outline: 2px ${style} ${color};
11
+ outline-offset: 2px;
12
+ box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
13
+ `,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}{
14
+ ${highlightStyle(infos.color,infos.style)}
15
+ }`).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);var src_default=()=>previewApi.definePreview({});
6
16
 
7
17
  exports.HIGHLIGHT = HIGHLIGHT;
8
18
  exports.RESET_HIGHLIGHT = RESET_HIGHLIGHT;
package/dist/index.mjs CHANGED
@@ -1,3 +1,13 @@
1
- var ADDON_ID="storybook/highlight";var HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var src_default={};
1
+ import { addons, definePreview } from 'storybook/internal/preview-api';
2
+ import { STORY_CHANGED } from 'storybook/internal/core-events';
3
+ import { global } from '@storybook/global';
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")=>`
6
+ outline: 2px ${style} ${color};
7
+ outline-offset: 2px;
8
+ box-shadow: 0 0 0 6px rgba(255,255,255,0.6);
9
+ `,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}{
10
+ ${highlightStyle(infos.color,infos.style)}
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);var src_default=()=>definePreview({});
2
12
 
3
13
  export { HIGHLIGHT, RESET_HIGHLIGHT, src_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-highlight",
3
- "version": "8.6.0-alpha.4",
3
+ "version": "8.6.0-beta.0",
4
4
  "description": "Highlight DOM nodes within your stories",
5
5
  "keywords": [
6
6
  "storybook-addons",
@@ -39,6 +39,16 @@
39
39
  "main": "dist/index.js",
40
40
  "module": "dist/index.mjs",
41
41
  "types": "dist/index.d.ts",
42
+ "typesVersions": {
43
+ "*": {
44
+ "*": [
45
+ "dist/index.d.ts"
46
+ ],
47
+ "preview": [
48
+ "dist/preview.d.ts"
49
+ ]
50
+ }
51
+ },
42
52
  "files": [
43
53
  "dist/**/*",
44
54
  "README.md",
@@ -58,7 +68,7 @@
58
68
  "typescript": "^5.7.3"
59
69
  },
60
70
  "peerDependencies": {
61
- "storybook": "^8.6.0-alpha.4"
71
+ "storybook": "^8.6.0-beta.0"
62
72
  },
63
73
  "publishConfig": {
64
74
  "access": "public"