@chromatic-com/storybook 5.2.0-next.0 → 5.2.0-next.1

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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Visual Tests Addon for Storybook
2
2
 
3
- Run visual tests on your stories and compare changes with the latest baselines to catch UI regressions early in development. Supports multiple viewports, themes, and browsers.
3
+ Run [visual tests on your stories](https://storybook.js.org/docs/writing-tests/visual-testing) and compare changes with the latest baselines to catch UI regressions early in development. Supports multiple viewports, themes, and browsers.
4
+
5
+ Also provides the infrastructure for [quick sharing](https://storybook.js.org/docs/sharing#quick-sharing) of your Storybook with your team and collaborators.
4
6
 
5
7
  ## Prerequisites
6
8
 
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 D=Object.defineProperty;var x=(o,n)=>{for(var r in n)D(o,r,{get:n[r],enumerable:!0});};var E={};x(E,{decorators:()=>$,initialGlobals:()=>A});var t="chromaui/addon-visual-tests";var p="highlightIgnored",c=`${t}/highlightIgnored`,d=`${t}/highlightIgnored/count`,u=`${t}/highlightIgnored/select`,h=['[data-chromatic="ignore"]','[class~="chromatic-ignore"]'];var G={backgroundColor:"rgba(255, 173, 51, 0.2)",outline:"1px solid rgba(255, 173, 51, 0.7)",outlineOffset:"-1px"},T={backgroundColor:"rgba(255, 173, 51, 0.1)",outlineWidth:"2px"},C={backgroundColor:"transparent",outlineWidth:"2px"},S=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}},m=o=>{let n=o?.ignoreSelectors??[],r=Array.from(new Set(h.concat(n.filter(S))));return {id:c,selectors:r,styles:G,hoverStyles:T,focusStyles:C,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:u,selectors:[e]}]})}};var N=(o,{globals:n,parameters:r,id:e})=>{let l=!!n[p],s=previewApi.useChannel({}),i=m(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()},$=[N],A={[p]:!1};var pt=()=>csf.definePreviewAddon(E);
7
+ var x=Object.defineProperty;var S=(o,n)=>{for(var r in n)x(o,r,{get:n[r],enumerable:!0});};var E={};S(E,{decorators:()=>N,initialGlobals:()=>$});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 G={backgroundColor:"rgba(255, 173, 51, 0.2)",outline:"1px solid rgba(255, 173, 51, 0.7)",outlineOffset:"-1px"},R={backgroundColor:"rgba(255, 173, 51, 0.1)",outlineWidth:"2px"},T={backgroundColor:"transparent",outlineWidth:"2px"},D=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(D))));return {id:c,selectors:r,styles:G,hoverStyles:R,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 y=(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()},N=[y],$={[p]:!1};var ht=()=>csf.definePreviewAddon(E);
9
9
 
10
- module.exports = pt;
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 D=Object.defineProperty;var x=(o,n)=>{for(var r in n)D(o,r,{get:n[r],enumerable:!0});};var E={};x(E,{decorators:()=>$,initialGlobals:()=>A});var t="chromaui/addon-visual-tests";var p="highlightIgnored",c=`${t}/highlightIgnored`,d=`${t}/highlightIgnored/count`,u=`${t}/highlightIgnored/select`,h=['[data-chromatic="ignore"]','[class~="chromatic-ignore"]'];var G={backgroundColor:"rgba(255, 173, 51, 0.2)",outline:"1px solid rgba(255, 173, 51, 0.7)",outlineOffset:"-1px"},T={backgroundColor:"rgba(255, 173, 51, 0.1)",outlineWidth:"2px"},C={backgroundColor:"transparent",outlineWidth:"2px"},S=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}},m=o=>{let n=o?.ignoreSelectors??[],r=Array.from(new Set(h.concat(n.filter(S))));return {id:c,selectors:r,styles:G,hoverStyles:T,focusStyles:C,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:u,selectors:[e]}]})}};var N=(o,{globals:n,parameters:r,id:e})=>{let l=!!n[p],s=useChannel({}),i=m(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()},$=[N],A={[p]:!1};var pt=()=>definePreviewAddon(E);
5
+ var x=Object.defineProperty;var S=(o,n)=>{for(var r in n)x(o,r,{get:n[r],enumerable:!0});};var E={};S(E,{decorators:()=>N,initialGlobals:()=>$});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 G={backgroundColor:"rgba(255, 173, 51, 0.2)",outline:"1px solid rgba(255, 173, 51, 0.7)",outlineOffset:"-1px"},R={backgroundColor:"rgba(255, 173, 51, 0.1)",outlineWidth:"2px"},T={backgroundColor:"transparent",outlineWidth:"2px"},D=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(D))));return {id:c,selectors:r,styles:G,hoverStyles:R,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 y=(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()},N=[y],$={[p]:!1};var ht=()=>definePreviewAddon(E);
7
7
 
8
- export { pt as default };
8
+ export { ht as default };