@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 CHANGED
@@ -1,5 +1,5 @@
1
- declare const HIGHLIGHT: string;
2
- declare const RESET_HIGHLIGHT: string;
1
+ declare const HIGHLIGHT = "storybook/highlight/add";
2
+ declare const RESET_HIGHLIGHT = "storybook/highlight/reset";
3
3
 
4
4
  declare const _default: {};
5
5
 
package/dist/index.js CHANGED
@@ -1 +1,9 @@
1
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{HIGHLIGHT:()=>HIGHLIGHT,RESET_HIGHLIGHT:()=>RESET_HIGHLIGHT,default:()=>src_default});module.exports=__toCommonJS(src_exports);var ADDON_ID="storybook/highlight";var HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var src_default={};0&&(module.exports={HIGHLIGHT,RESET_HIGHLIGHT});
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
- export { HIGHLIGHT, RESET_HIGHLIGHT } from './chunk-33ALZPRS.mjs';
1
+ var ADDON_ID="storybook/highlight";var HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var src_default={};
2
2
 
3
- var src_default={};
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
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preview_exports={};__export(preview_exports,{highlightObject:()=>highlightObject,highlightStyle:()=>highlightStyle});module.exports=__toCommonJS(preview_exports);var import_global=require("@storybook/global"),import_preview_api=require("@storybook/preview-api"),import_core_events=require("@storybook/core-events");var ADDON_ID="storybook/highlight",HIGHLIGHT_STYLE_ID="storybookHighlight",HIGHLIGHT=`${ADDON_ID}/add`,RESET_HIGHLIGHT=`${ADDON_ID}/reset`;var{document}=import_global.global,highlightStyle=(color="#FF4785",style="dashed")=>`
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=import_preview_api.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}{
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=()=>{var _a;let id=HIGHLIGHT_STYLE_ID,sheetToBeRemoved=document.getElementById(id);sheetToBeRemoved&&((_a=sheetToBeRemoved.parentNode)==null||_a.removeChild(sheetToBeRemoved))};channel.on(import_core_events.STORY_CHANGED,resetHighlight);channel.on(RESET_HIGHLIGHT,resetHighlight);channel.on(HIGHLIGHT,highlight);0&&(module.exports={highlightObject,highlightStyle});
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.6",
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/core-events": "7.6.0-alpha.6",
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
- "entries": [
78
- "./src/index.ts",
63
+ "exportEntries": [
64
+ "./src/index.ts"
65
+ ],
66
+ "previewEntries": [
79
67
  "./src/preview.ts"
80
68
  ]
81
69
  },
@@ -1,3 +0,0 @@
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/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 };