1 line
9.9 KiB
Plaintext
1 line
9.9 KiB
Plaintext
{"version":3,"file":"preview-15309724.js","sources":["../../node_modules/@storybook/addon-backgrounds/dist/chunk-GRJZJKJ4.mjs","../../node_modules/@storybook/addon-backgrounds/dist/preview.mjs"],"sourcesContent":["import { global } from '@storybook/global';\nimport { dedent } from 'ts-dedent';\nimport { logger } from '@storybook/client-logger';\n\nvar ADDON_ID=\"storybook/background\",PARAM_KEY=\"backgrounds\";var {document,window}=global,isReduceMotionEnabled=()=>window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches,getBackgroundColorByName=(currentSelectedValue,backgrounds=[],defaultName)=>{if(currentSelectedValue===\"transparent\")return \"transparent\";if(backgrounds.find(background=>background.value===currentSelectedValue))return currentSelectedValue;let defaultBackground=backgrounds.find(background=>background.name===defaultName);if(defaultBackground)return defaultBackground.value;if(defaultName){let availableColors=backgrounds.map(background=>background.name).join(\", \");logger.warn(dedent`\n Backgrounds Addon: could not find the default color \"${defaultName}\".\n These are the available colors for your story based on your configuration:\n ${availableColors}.\n `);}return \"transparent\"},clearStyles=selector=>{(Array.isArray(selector)?selector:[selector]).forEach(clearStyle);},clearStyle=selector=>{let element=document.getElementById(selector);element&&element.parentElement.removeChild(element);},addGridStyle=(selector,css)=>{let existingStyle=document.getElementById(selector);if(existingStyle)existingStyle.innerHTML!==css&&(existingStyle.innerHTML=css);else {let style=document.createElement(\"style\");style.setAttribute(\"id\",selector),style.innerHTML=css,document.head.appendChild(style);}},addBackgroundStyle=(selector,css,storyId)=>{let existingStyle=document.getElementById(selector);if(existingStyle)existingStyle.innerHTML!==css&&(existingStyle.innerHTML=css);else {let style=document.createElement(\"style\");style.setAttribute(\"id\",selector),style.innerHTML=css;let gridStyleSelector=`addon-backgrounds-grid${storyId?`-docs-${storyId}`:\"\"}`,existingGridStyle=document.getElementById(gridStyleSelector);existingGridStyle?existingGridStyle.parentElement.insertBefore(style,existingGridStyle):document.head.appendChild(style);}};\n\nexport { ADDON_ID, PARAM_KEY, addBackgroundStyle, addGridStyle, clearStyles, getBackgroundColorByName, isReduceMotionEnabled };\n","import { PARAM_KEY, getBackgroundColorByName, isReduceMotionEnabled, clearStyles, addBackgroundStyle, addGridStyle } from './chunk-GRJZJKJ4.mjs';\nimport { useMemo, useEffect } from '@storybook/preview-api';\n\nvar withBackground=(StoryFn,context)=>{let{globals:globals2,parameters:parameters2}=context,globalsBackgroundColor=globals2[PARAM_KEY]?.value,backgroundsConfig=parameters2[PARAM_KEY],selectedBackgroundColor=useMemo(()=>backgroundsConfig.disable?\"transparent\":getBackgroundColorByName(globalsBackgroundColor,backgroundsConfig.values,backgroundsConfig.default),[backgroundsConfig,globalsBackgroundColor]),isActive=useMemo(()=>selectedBackgroundColor&&selectedBackgroundColor!==\"transparent\",[selectedBackgroundColor]),selector=context.viewMode===\"docs\"?`#anchor--${context.id} .docs-story`:\".sb-show-main\",backgroundStyles=useMemo(()=>{let transitionStyle=\"transition: background-color 0.3s;\";return `\n ${selector} {\n background: ${selectedBackgroundColor} !important;\n ${isReduceMotionEnabled()?\"\":transitionStyle}\n }\n `},[selectedBackgroundColor,selector]);return useEffect(()=>{let selectorId=context.viewMode===\"docs\"?`addon-backgrounds-docs-${context.id}`:\"addon-backgrounds-color\";if(!isActive){clearStyles(selectorId);return}addBackgroundStyle(selectorId,backgroundStyles,context.viewMode===\"docs\"?context.id:null);},[isActive,backgroundStyles,context]),StoryFn()};var withGrid=(StoryFn,context)=>{let{globals:globals2,parameters:parameters2}=context,gridParameters=parameters2[PARAM_KEY].grid,isActive=globals2[PARAM_KEY]?.grid===!0&&gridParameters.disable!==!0,{cellAmount,cellSize,opacity}=gridParameters,isInDocs=context.viewMode===\"docs\",defaultOffset=parameters2.layout===void 0||parameters2.layout===\"padded\"?16:0,offsetX=gridParameters.offsetX??(isInDocs?20:defaultOffset),offsetY=gridParameters.offsetY??(isInDocs?20:defaultOffset),gridStyles=useMemo(()=>{let selector=context.viewMode===\"docs\"?`#anchor--${context.id} .docs-story`:\".sb-show-main\",backgroundSize=[`${cellSize*cellAmount}px ${cellSize*cellAmount}px`,`${cellSize*cellAmount}px ${cellSize*cellAmount}px`,`${cellSize}px ${cellSize}px`,`${cellSize}px ${cellSize}px`].join(\", \");return `\n ${selector} {\n background-size: ${backgroundSize} !important;\n background-position: ${offsetX}px ${offsetY}px, ${offsetX}px ${offsetY}px, ${offsetX}px ${offsetY}px, ${offsetX}px ${offsetY}px !important;\n background-blend-mode: difference !important;\n background-image: linear-gradient(rgba(130, 130, 130, ${opacity}) 1px, transparent 1px),\n linear-gradient(90deg, rgba(130, 130, 130, ${opacity}) 1px, transparent 1px),\n linear-gradient(rgba(130, 130, 130, ${opacity/2}) 1px, transparent 1px),\n linear-gradient(90deg, rgba(130, 130, 130, ${opacity/2}) 1px, transparent 1px) !important;\n }\n `},[cellSize]);return useEffect(()=>{let selectorId=context.viewMode===\"docs\"?`addon-backgrounds-grid-docs-${context.id}`:\"addon-backgrounds-grid\";if(!isActive){clearStyles(selectorId);return}addGridStyle(selectorId,gridStyles);},[isActive,gridStyles,context]),StoryFn()};var decorators=[withGrid,withBackground],parameters={[PARAM_KEY]:{grid:{cellSize:20,opacity:.5,cellAmount:5},values:[{name:\"light\",value:\"#F8F8F8\"},{name:\"dark\",value:\"#333333\"}]}},globals={[PARAM_KEY]:null};\n\nexport { decorators, globals, parameters };\n"],"names":["global","logger","PARAM_KEY","document","window","isReduceMotionEnabled","getBackgroundColorByName","currentSelectedValue","backgrounds","defaultName","background","defaultBackground","availableColors","dedent","clearStyles","selector","clearStyle","element","addGridStyle","css","existingStyle","style","addBackgroundStyle","storyId","gridStyleSelector","existingGridStyle","useMemo","useEffect","withBackground","StoryFn","context","globals2","parameters2","globalsBackgroundColor","_a","backgroundsConfig","selectedBackgroundColor","isActive","backgroundStyles","transitionStyle","selectorId","withGrid","gridParameters","cellAmount","cellSize","opacity","isInDocs","defaultOffset","offsetX","offsetY","gridStyles","backgroundSize","decorators","parameters","globals"],"mappings":"wCAAA,K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