@chromatic-com/storybook 5.1.1 → 5.1.2--canary.bdbdc11.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.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/manager.mjs +39 -38
- package/dist/preset.js +26 -6
- package/dist/preview.mjs +3 -3
- package/package.json +6 -6
- package/types.d.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var csf = require('storybook/internal/csf');
|
|
|
4
4
|
var highlight = require('storybook/highlight');
|
|
5
5
|
var previewApi = require('storybook/preview-api');
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
`)??"";return previewApi.useEffect(()=>{if(s(highlight.REMOVE_HIGHLIGHT,c),!i?.selectors.length){s(d,0);return}l&&s(highlight.HIGHLIGHT,i);let H=document.getElementById("storybook-root"),O=i.selectors.reduce((a,g)=>(document.querySelectorAll(`:is(${g}):not([id^="storybook-"], [id^="storybook-"] *, [class^="sb-"], [class^="sb-"] *)`).forEach(I=>a.add(I)),(H?.querySelectorAll(g)??[]).forEach(I=>a.add(I)),a),new Set);return s(d,O.size),()=>s(highlight.REMOVE_HIGHLIGHT,c)},[s,i,e,
|
|
7
|
+
var x=Object.defineProperty;var G=(o,n)=>{for(var r in n)x(o,r,{get:n[r],enumerable:!0});};var E={};G(E,{decorators:()=>A,initialGlobals:()=>N});var t="chromaui/addon-visual-tests";var p="highlightIgnored",c=`${t}/highlightIgnored`,d=`${t}/highlightIgnored/count`,m=`${t}/highlightIgnored/select`,h=['[data-chromatic="ignore"]','[class~="chromatic-ignore"]'];var S={backgroundColor:"rgba(255, 173, 51, 0.2)",outline:"1px solid rgba(255, 173, 51, 0.7)",outlineOffset:"-1px"},D={backgroundColor:"rgba(255, 173, 51, 0.1)",outlineWidth:"2px"},T={backgroundColor:"transparent",outlineWidth:"2px"},R=o=>{if(!o)return !1;if(typeof document>"u")return !0;try{return document.createDocumentFragment().querySelector(o),!0}catch{return console.warn(`Invalid ignoreSelector: ${o}`),!1}},u=o=>{let n=o?.ignoreSelectors??[],r=Array.from(new Set(h.concat(n.filter(R))));return {id:c,selectors:r,styles:S,hoverStyles:D,focusStyles:T,menu:r.map(e=>{let l=h.includes(e);return [{id:`${e}-info`,title:"Element ignored in visual tests",description:l?`${e} will be ignored by Chromatic`:`${e} matches an ignored selector`,selectors:[e]},{id:`${e}-link`,iconLeft:"info",iconRight:"shareAlt",title:"Learn how to configure ignored elements",clickEvent:m,selectors:[e]}]})}};var $=(o,{globals:n,parameters:r,id:e})=>{let l=!!n[p],s=previewApi.useChannel({}),i=u(r.chromatic),f=i?.selectors.join(`
|
|
8
|
+
`)??"";return previewApi.useEffect(()=>{if(s(highlight.REMOVE_HIGHLIGHT,c),!i?.selectors.length){s(d,0);return}l&&s(highlight.HIGHLIGHT,i);let H=document.getElementById("storybook-root"),O=i.selectors.reduce((a,g)=>(document.querySelectorAll(`:is(${g}):not([id^="storybook-"], [id^="storybook-"] *, [class^="sb-"], [class^="sb-"] *)`).forEach(I=>a.add(I)),(H?.querySelectorAll(g)??[]).forEach(I=>a.add(I)),a),new Set);return s(d,O.size),()=>s(highlight.REMOVE_HIGHLIGHT,c)},[s,i,e,f,l]),o()},A=[$],N={[p]:!1};var ht=()=>csf.definePreviewAddon(E);
|
|
9
9
|
|
|
10
|
-
module.exports =
|
|
10
|
+
module.exports = ht;
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { definePreviewAddon } from 'storybook/internal/csf';
|
|
|
2
2
|
import { REMOVE_HIGHLIGHT, HIGHLIGHT } from 'storybook/highlight';
|
|
3
3
|
import { useChannel, useEffect } from 'storybook/preview-api';
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
`)??"";return useEffect(()=>{if(s(REMOVE_HIGHLIGHT,c),!i?.selectors.length){s(d,0);return}l&&s(HIGHLIGHT,i);let H=document.getElementById("storybook-root"),O=i.selectors.reduce((a,g)=>(document.querySelectorAll(`:is(${g}):not([id^="storybook-"], [id^="storybook-"] *, [class^="sb-"], [class^="sb-"] *)`).forEach(I=>a.add(I)),(H?.querySelectorAll(g)??[]).forEach(I=>a.add(I)),a),new Set);return s(d,O.size),()=>s(REMOVE_HIGHLIGHT,c)},[s,i,e,
|
|
5
|
+
var x=Object.defineProperty;var G=(o,n)=>{for(var r in n)x(o,r,{get:n[r],enumerable:!0});};var E={};G(E,{decorators:()=>A,initialGlobals:()=>N});var t="chromaui/addon-visual-tests";var p="highlightIgnored",c=`${t}/highlightIgnored`,d=`${t}/highlightIgnored/count`,m=`${t}/highlightIgnored/select`,h=['[data-chromatic="ignore"]','[class~="chromatic-ignore"]'];var S={backgroundColor:"rgba(255, 173, 51, 0.2)",outline:"1px solid rgba(255, 173, 51, 0.7)",outlineOffset:"-1px"},D={backgroundColor:"rgba(255, 173, 51, 0.1)",outlineWidth:"2px"},T={backgroundColor:"transparent",outlineWidth:"2px"},R=o=>{if(!o)return !1;if(typeof document>"u")return !0;try{return document.createDocumentFragment().querySelector(o),!0}catch{return console.warn(`Invalid ignoreSelector: ${o}`),!1}},u=o=>{let n=o?.ignoreSelectors??[],r=Array.from(new Set(h.concat(n.filter(R))));return {id:c,selectors:r,styles:S,hoverStyles:D,focusStyles:T,menu:r.map(e=>{let l=h.includes(e);return [{id:`${e}-info`,title:"Element ignored in visual tests",description:l?`${e} will be ignored by Chromatic`:`${e} matches an ignored selector`,selectors:[e]},{id:`${e}-link`,iconLeft:"info",iconRight:"shareAlt",title:"Learn how to configure ignored elements",clickEvent:m,selectors:[e]}]})}};var $=(o,{globals:n,parameters:r,id:e})=>{let l=!!n[p],s=useChannel({}),i=u(r.chromatic),f=i?.selectors.join(`
|
|
6
|
+
`)??"";return useEffect(()=>{if(s(REMOVE_HIGHLIGHT,c),!i?.selectors.length){s(d,0);return}l&&s(HIGHLIGHT,i);let H=document.getElementById("storybook-root"),O=i.selectors.reduce((a,g)=>(document.querySelectorAll(`:is(${g}):not([id^="storybook-"], [id^="storybook-"] *, [class^="sb-"], [class^="sb-"] *)`).forEach(I=>a.add(I)),(H?.querySelectorAll(g)??[]).forEach(I=>a.add(I)),a),new Set);return s(d,O.size),()=>s(REMOVE_HIGHLIGHT,c)},[s,i,e,f,l]),o()},A=[$],N={[p]:!1};var ht=()=>definePreviewAddon(E);
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { ht as default };
|