@storybook/addon-docs 9.0.0-beta.4 → 9.0.0-beta.5

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.
@@ -0,0 +1,3 @@
1
+ function debounce(func,debounceMs,{signal,edges}={}){let pendingThis,pendingArgs=null,leading=edges!=null&&edges.includes("leading"),trailing=edges==null||edges.includes("trailing"),invoke=()=>{pendingArgs!==null&&(func.apply(pendingThis,pendingArgs),pendingThis=void 0,pendingArgs=null);},onTimerEnd=()=>{trailing&&invoke(),cancel();},timeoutId=null,schedule=()=>{timeoutId!=null&&clearTimeout(timeoutId),timeoutId=setTimeout(()=>{timeoutId=null,onTimerEnd();},debounceMs);},cancelTimer=()=>{timeoutId!==null&&(clearTimeout(timeoutId),timeoutId=null);},cancel=()=>{cancelTimer(),pendingThis=void 0,pendingArgs=null;},flush=()=>{cancelTimer(),invoke();},debounced=function(...args){if(signal?.aborted)return;pendingThis=this,pendingArgs=args;let isFirstCall=timeoutId==null;schedule(),leading&&isFirstCall&&invoke();};return debounced.schedule=schedule,debounced.cancel=cancel,debounced.flush=flush,signal?.addEventListener("abort",cancel,{once:!0}),debounced}function debounce2(func,debounceMs=0,options={}){typeof options!="object"&&(options={});let{signal,leading=!1,trailing=!0,maxWait}=options,edges=Array(2);leading&&(edges[0]="leading"),trailing&&(edges[1]="trailing");let result,pendingAt=null,_debounced=debounce(function(...args){result=func.apply(this,args),pendingAt=null;},debounceMs,{signal,edges}),debounced=function(...args){if(maxWait!=null){if(pendingAt===null)pendingAt=Date.now();else if(Date.now()-pendingAt>=maxWait)return result=func.apply(this,args),pendingAt=Date.now(),_debounced.cancel(),_debounced.schedule(),result}return _debounced.apply(this,args),result},flush=()=>(_debounced.flush(),result);return debounced.cancel=_debounced.cancel,debounced.flush=flush,debounced}function isSymbol(value){return typeof value=="symbol"||value instanceof Symbol}function toNumber(value){return isSymbol(value)?NaN:Number(value)}function toFinite(value){return value?(value=toNumber(value),value===1/0||value===-1/0?(value<0?-1:1)*Number.MAX_VALUE:value===value?value:0):value===0?value:0}function toInteger(value){let finite=toFinite(value),remainder=finite%1;return remainder?finite-remainder:finite}function uniq(arr){return Array.from(new Set(arr))}function isPrimitive(value){return value==null||typeof value!="object"&&typeof value!="function"}function isTypedArray(x){return ArrayBuffer.isView(x)&&!(x instanceof DataView)}function getSymbols(object){return Object.getOwnPropertySymbols(object).filter(symbol=>Object.prototype.propertyIsEnumerable.call(object,symbol))}function getTag(value){return value==null?value===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(value)}var regexpTag="[object RegExp]",stringTag="[object String]",numberTag="[object Number]",booleanTag="[object Boolean]",argumentsTag="[object Arguments]",symbolTag="[object Symbol]",dateTag="[object Date]",mapTag="[object Map]",setTag="[object Set]",arrayTag="[object Array]";var arrayBufferTag="[object ArrayBuffer]",objectTag="[object Object]";var dataViewTag="[object DataView]",uint8ArrayTag="[object Uint8Array]",uint8ClampedArrayTag="[object Uint8ClampedArray]",uint16ArrayTag="[object Uint16Array]",uint32ArrayTag="[object Uint32Array]";var int8ArrayTag="[object Int8Array]",int16ArrayTag="[object Int16Array]",int32ArrayTag="[object Int32Array]";var float32ArrayTag="[object Float32Array]",float64ArrayTag="[object Float64Array]";function cloneDeepWith(obj,cloneValue){return cloneDeepWithImpl(obj,void 0,obj,new Map,cloneValue)}function cloneDeepWithImpl(valueToClone,keyToClone,objectToClone,stack=new Map,cloneValue=void 0){let cloned=cloneValue?.(valueToClone,keyToClone,objectToClone,stack);if(cloned!=null)return cloned;if(isPrimitive(valueToClone))return valueToClone;if(stack.has(valueToClone))return stack.get(valueToClone);if(Array.isArray(valueToClone)){let result=new Array(valueToClone.length);stack.set(valueToClone,result);for(let i=0;i<valueToClone.length;i++)result[i]=cloneDeepWithImpl(valueToClone[i],i,objectToClone,stack,cloneValue);return Object.hasOwn(valueToClone,"index")&&(result.index=valueToClone.index),Object.hasOwn(valueToClone,"input")&&(result.input=valueToClone.input),result}if(valueToClone instanceof Date)return new Date(valueToClone.getTime());if(valueToClone instanceof RegExp){let result=new RegExp(valueToClone.source,valueToClone.flags);return result.lastIndex=valueToClone.lastIndex,result}if(valueToClone instanceof Map){let result=new Map;stack.set(valueToClone,result);for(let[key,value]of valueToClone)result.set(key,cloneDeepWithImpl(value,key,objectToClone,stack,cloneValue));return result}if(valueToClone instanceof Set){let result=new Set;stack.set(valueToClone,result);for(let value of valueToClone)result.add(cloneDeepWithImpl(value,void 0,objectToClone,stack,cloneValue));return result}if(typeof Buffer<"u"&&Buffer.isBuffer(valueToClone))return valueToClone.subarray();if(isTypedArray(valueToClone)){let result=new(Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);stack.set(valueToClone,result);for(let i=0;i<valueToClone.length;i++)result[i]=cloneDeepWithImpl(valueToClone[i],i,objectToClone,stack,cloneValue);return result}if(valueToClone instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&valueToClone instanceof SharedArrayBuffer)return valueToClone.slice(0);if(valueToClone instanceof DataView){let result=new DataView(valueToClone.buffer.slice(0),valueToClone.byteOffset,valueToClone.byteLength);return stack.set(valueToClone,result),copyProperties(result,valueToClone,objectToClone,stack,cloneValue),result}if(typeof File<"u"&&valueToClone instanceof File){let result=new File([valueToClone],valueToClone.name,{type:valueToClone.type});return stack.set(valueToClone,result),copyProperties(result,valueToClone,objectToClone,stack,cloneValue),result}if(valueToClone instanceof Blob){let result=new Blob([valueToClone],{type:valueToClone.type});return stack.set(valueToClone,result),copyProperties(result,valueToClone,objectToClone,stack,cloneValue),result}if(valueToClone instanceof Error){let result=new valueToClone.constructor;return stack.set(valueToClone,result),result.message=valueToClone.message,result.name=valueToClone.name,result.stack=valueToClone.stack,result.cause=valueToClone.cause,copyProperties(result,valueToClone,objectToClone,stack,cloneValue),result}if(typeof valueToClone=="object"&&isCloneableObject(valueToClone)){let result=Object.create(Object.getPrototypeOf(valueToClone));return stack.set(valueToClone,result),copyProperties(result,valueToClone,objectToClone,stack,cloneValue),result}return valueToClone}function copyProperties(target,source,objectToClone=target,stack,cloneValue){let keys=[...Object.keys(source),...getSymbols(source)];for(let i=0;i<keys.length;i++){let key=keys[i],descriptor=Object.getOwnPropertyDescriptor(target,key);(descriptor==null||descriptor.writable)&&(target[key]=cloneDeepWithImpl(source[key],key,objectToClone,stack,cloneValue));}}function isCloneableObject(object){switch(getTag(object)){case argumentsTag:case arrayTag:case arrayBufferTag:case dataViewTag:case booleanTag:case dateTag:case float32ArrayTag:case float64ArrayTag:case int8ArrayTag:case int16ArrayTag:case int32ArrayTag:case mapTag:case numberTag:case objectTag:case regexpTag:case setTag:case stringTag:case symbolTag:case uint8ArrayTag:case uint8ClampedArrayTag:case uint16ArrayTag:case uint32ArrayTag:return !0;default:return !1}}function isLength(value){return Number.isSafeInteger(value)&&value>=0}function isArrayLike(value){return value!=null&&typeof value!="function"&&isLength(value.length)}function cloneDeepWith2(obj,cloneValue){return cloneDeepWith(obj,(value,key,object,stack)=>{let cloned=cloneValue?.(value,key,object,stack);if(cloned!=null)return cloned;if(typeof obj=="object")switch(Object.prototype.toString.call(obj)){case numberTag:case stringTag:case booleanTag:{let result=new obj.constructor(obj?.valueOf());return copyProperties(result,obj),result}case argumentsTag:{let result={};return copyProperties(result,obj),result.length=obj.length,result[Symbol.iterator]=obj[Symbol.iterator],result}default:return}})}function cloneDeep(obj){return cloneDeepWith2(obj)}function range(start,end,step=1){if(end==null&&(end=start,start=0),!Number.isInteger(step)||step===0)throw new Error("The step value must be a non-zero integer.");let length=Math.max(Math.ceil((end-start)/step),0),result=new Array(length);for(let i=0;i<length;i++)result[i]=start+i*step;return result}function uniq2(arr){return isArrayLike(arr)?uniq(Array.from(arr)):[]}function isBuffer(x){return typeof Buffer<"u"&&Buffer.isBuffer(x)}function isPrototype(value){let constructor=value?.constructor,prototype=typeof constructor=="function"?constructor.prototype:Object.prototype;return value===prototype}function isTypedArray2(x){return isTypedArray(x)}function times(n,getValue){if(n=toInteger(n),n<1||!Number.isSafeInteger(n))return [];let result=new Array(n);for(let i=0;i<n;i++)result[i]=typeof getValue=="function"?getValue(i):i;return result}function keysIn(object){if(object==null)return [];switch(typeof object){case"object":case"function":return isArrayLike(object)?arrayLikeKeysIn(object):isPrototype(object)?prototypeKeysIn(object):keysInImpl(object);default:return keysInImpl(Object(object))}}function keysInImpl(object){let result=[];for(let key in object)result.push(key);return result}function prototypeKeysIn(object){return keysInImpl(object).filter(key=>key!=="constructor")}function arrayLikeKeysIn(object){let indices=times(object.length,index=>`${index}`),filteredKeys=new Set(indices);return isBuffer(object)&&(filteredKeys.add("offset"),filteredKeys.add("parent")),isTypedArray2(object)&&(filteredKeys.add("buffer"),filteredKeys.add("byteLength"),filteredKeys.add("byteOffset")),[...indices,...keysInImpl(object).filter(key=>!filteredKeys.has(key))]}function getSymbolsIn(object){let result=[];for(;object;)result.push(...getSymbols(object)),object=Object.getPrototypeOf(object);return result}function pickBy(obj,shouldPick){if(obj==null)return {};let result={};if(shouldPick==null)return obj;let keys=isArrayLike(obj)?range(0,obj.length):[...keysIn(obj),...getSymbolsIn(obj)];for(let i=0;i<keys.length;i++){let key=isSymbol(keys[i])?keys[i]:keys[i].toString(),value=obj[key];shouldPick(value,key,obj)&&(result[key]=value);}return result}var getControlId=value=>`control-${value.replace(/\s+/g,"-")}`,getControlSetterButtonId=value=>`set-${value.replace(/\s+/g,"-")}`;
2
+
3
+ export { cloneDeep, debounce2 as debounce, getControlId, getControlSetterButtonId, pickBy, uniq2 as uniq };
package/dist/index.js CHANGED
@@ -1 +1,22 @@
1
- "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};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},__reExport=(target,mod,secondTarget)=>(__copyProps(target,mod,"default"),secondTarget&&__copyProps(secondTarget,mod,"default")),__toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var DocsRenderer_exports={};__export(DocsRenderer_exports,{DocsRenderer:()=>DocsRenderer,defaultComponents:()=>defaultComponents});var import_react,import_react_dom_shim,import_blocks,defaultComponents,ErrorBoundary,DocsRenderer,init_DocsRenderer=__esm({"src/DocsRenderer.tsx"(){"use strict";import_react=__toESM(require("react")),import_react_dom_shim=require("@storybook/react-dom-shim"),import_blocks=require("@storybook/addon-docs/blocks"),defaultComponents={code:import_blocks.CodeOrSourceMdx,a:import_blocks.AnchorMdx,...import_blocks.HeadersMdx},ErrorBoundary=class extends import_react.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(err){let{showException}=this.props;showException(err)}render(){let{hasError}=this.state,{children}=this.props;return hasError?null:import_react.default.createElement(import_react.default.Fragment,null,children)}},DocsRenderer=class{constructor(){this.render=async(context,docsParameter,element)=>{let components={...defaultComponents,...docsParameter?.components},TDocs=import_blocks.Docs;return new Promise((resolve,reject)=>{import("@mdx-js/react").then(({MDXProvider})=>(0,import_react_dom_shim.renderElement)(import_react.default.createElement(ErrorBoundary,{showException:reject,key:Math.random()},import_react.default.createElement(MDXProvider,{components},import_react.default.createElement(TDocs,{context,docsParameter}))),element)).then(()=>resolve())})},this.unmount=element=>{(0,import_react_dom_shim.unmountElement)(element)}}}}});var index_exports={};__export(index_exports,{DocsRenderer:()=>DocsRenderer,default:()=>index_default});module.exports=__toCommonJS(index_exports);var import_preview_api=require("storybook/preview-api");var preview_exports={};__export(preview_exports,{parameters:()=>parameters});var excludeTags=Object.entries(globalThis.TAGS_OPTIONS??{}).reduce((acc,entry)=>{let[tag,option]=entry;return option.excludeFromDocsStories&&(acc[tag]=!0),acc},{}),parameters={docs:{renderer:async()=>{let{DocsRenderer:DocsRenderer2}=await Promise.resolve().then(()=>(init_DocsRenderer(),DocsRenderer_exports));return new DocsRenderer2},stories:{filter:story=>(story.tags||[]).filter(tag=>excludeTags[tag]).length===0&&!story.parameters.docs?.disable}}};__reExport(index_exports,require("@storybook/addon-docs/blocks"),module.exports);init_DocsRenderer();var index_default=()=>(0,import_preview_api.definePreview)(preview_exports);0&&(module.exports={DocsRenderer,...require("@storybook/addon-docs/blocks")});
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var reactDomShim = require('@storybook/react-dom-shim');
7
+ var blocks = require('@storybook/addon-docs/blocks');
8
+ var previewApi = require('storybook/preview-api');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefault(React);
13
+
14
+ var __defProp=Object.defineProperty;var __getOwnPropNames=Object.getOwnPropertyNames;var __esm=(fn,res)=>function(){return fn&&(res=(0, fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0});};var DocsRenderer_exports={};__export(DocsRenderer_exports,{DocsRenderer:()=>exports.DocsRenderer,defaultComponents:()=>defaultComponents});var defaultComponents,ErrorBoundary;exports.DocsRenderer = void 0;var init_DocsRenderer=__esm({"src/DocsRenderer.tsx"(){defaultComponents={code:blocks.CodeOrSourceMdx,a:blocks.AnchorMdx,...blocks.HeadersMdx},ErrorBoundary=class extends React.Component{constructor(){super(...arguments);this.state={hasError:!1};}static getDerivedStateFromError(){return {hasError:!0}}componentDidCatch(err){let{showException}=this.props;showException(err);}render(){let{hasError}=this.state,{children}=this.props;return hasError?null:React__default.default.createElement(React__default.default.Fragment,null,children)}},exports.DocsRenderer=class{constructor(){this.render=async(context,docsParameter,element)=>{let components={...defaultComponents,...docsParameter?.components},TDocs=blocks.Docs;return new Promise((resolve,reject)=>{import('@mdx-js/react').then(({MDXProvider})=>reactDomShim.renderElement(React__default.default.createElement(ErrorBoundary,{showException:reject,key:Math.random()},React__default.default.createElement(MDXProvider,{components},React__default.default.createElement(TDocs,{context,docsParameter}))),element)).then(()=>resolve());})},this.unmount=element=>{reactDomShim.unmountElement(element);};}};}});var preview_exports={};__export(preview_exports,{parameters:()=>parameters});var excludeTags=Object.entries(globalThis.TAGS_OPTIONS??{}).reduce((acc,entry)=>{let[tag,option]=entry;return option.excludeFromDocsStories&&(acc[tag]=!0),acc},{}),parameters={docs:{renderer:async()=>{let{DocsRenderer:DocsRenderer2}=await Promise.resolve().then(()=>(init_DocsRenderer(),DocsRenderer_exports));return new DocsRenderer2},stories:{filter:story=>(story.tags||[]).filter(tag=>excludeTags[tag]).length===0&&!story.parameters.docs?.disable}}};init_DocsRenderer();var index_default=()=>previewApi.definePreview(preview_exports);
15
+
16
+ exports.default = index_default;
17
+ Object.keys(blocks).forEach(function (k) {
18
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
19
+ enumerable: true,
20
+ get: function () { return blocks[k]; }
21
+ });
22
+ });
package/dist/index.mjs CHANGED
@@ -1,9 +1,8 @@
1
- import { preview_exports } from './chunk-GFTNOJSG.mjs';
2
1
  export { DocsRenderer } from './chunk-GWJYCGSQ.mjs';
3
- import './chunk-QUZPS4B6.mjs';
2
+ import { __export } from './chunk-QUZPS4B6.mjs';
4
3
  import { definePreview } from 'storybook/preview-api';
5
4
  export * from '@storybook/addon-docs/blocks';
6
5
 
7
- var index_default=()=>definePreview(preview_exports);
6
+ var preview_exports={};__export(preview_exports,{parameters:()=>parameters});var excludeTags=Object.entries(globalThis.TAGS_OPTIONS??{}).reduce((acc,entry)=>{let[tag,option]=entry;return option.excludeFromDocsStories&&(acc[tag]=!0),acc},{}),parameters={docs:{renderer:async()=>{let{DocsRenderer:DocsRenderer2}=await import('./DocsRenderer-3PZUHFFL.mjs');return new DocsRenderer2},stories:{filter:story=>(story.tags||[]).filter(tag=>excludeTags[tag]).length===0&&!story.parameters.docs?.disable}}};var index_default=()=>definePreview(preview_exports);
8
7
 
9
8
  export { index_default as default };
@@ -0,0 +1,154 @@
1
+ import React2, { useState } from 'react';
2
+ import { withReset, SyntaxHighlighter, AddonPanel } from 'storybook/internal/components';
3
+ import { addons, types, useParameter, useChannel } from 'storybook/manager-api';
4
+ import { styled, ignoreSsrWarning, useTheme, themes, ThemeProvider, convert } from 'storybook/theming';
5
+
6
+ var ADDON_ID="storybook/docs",PANEL_ID=`${ADDON_ID}/panel`,PARAM_KEY="docs",SNIPPET_RENDERED=`${ADDON_ID}/snippet-rendered`;function _extends(){return _extends=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r]);}return n},_extends.apply(null,arguments)}function _assertThisInitialized(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t2,e2){return t2.__proto__=e2,t2},_setPrototypeOf(t,e)}function _inheritsLoose(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,_setPrototypeOf(t,o);}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t2){return t2.__proto__||Object.getPrototypeOf(t2)},_getPrototypeOf(t)}function _isNativeFunction(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (_isNativeReflectConstruct=function(){return !!t})()}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o));return r&&_setPrototypeOf(p,r.prototype),p}function _wrapNativeSuper(t){var r=typeof Map=="function"?new Map:void 0;return _wrapNativeSuper=function(t2){if(t2===null||!_isNativeFunction(t2))return t2;if(typeof t2!="function")throw new TypeError("Super expression must either be null or a function");if(r!==void 0){if(r.has(t2))return r.get(t2);r.set(t2,Wrapper2);}function Wrapper2(){return _construct(t2,arguments,_getPrototypeOf(this).constructor)}return Wrapper2.prototype=Object.create(t2.prototype,{constructor:{value:Wrapper2,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper2,t2)},_wrapNativeSuper(t)}var ERRORS={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
7
+
8
+ `,2:`Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
9
+
10
+ `,3:`Passed an incorrect argument to a color function, please pass a string representation of a color.
11
+
12
+ `,4:`Couldn't generate valid rgb string from %s, it returned %s.
13
+
14
+ `,5:`Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.
15
+
16
+ `,6:`Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).
17
+
18
+ `,7:`Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).
19
+
20
+ `,8:`Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.
21
+
22
+ `,9:`Please provide a number of steps to the modularScale helper.
23
+
24
+ `,10:`Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
25
+
26
+ `,11:`Invalid value passed as base to modularScale, expected number or em string but got "%s"
27
+
28
+ `,12:`Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.
29
+
30
+ `,13:`Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.
31
+
32
+ `,14:`Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.
33
+
34
+ `,15:`Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.
35
+
36
+ `,16:`You must provide a template to this method.
37
+
38
+ `,17:`You passed an unsupported selector state to this method.
39
+
40
+ `,18:`minScreen and maxScreen must be provided as stringified numbers with the same units.
41
+
42
+ `,19:`fromSize and toSize must be provided as stringified numbers with the same units.
43
+
44
+ `,20:`expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
45
+
46
+ `,21:"expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",22:"expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",23:`fontFace expects a name of a font-family.
47
+
48
+ `,24:`fontFace expects either the path to the font file(s) or a name of a local copy.
49
+
50
+ `,25:`fontFace expects localFonts to be an array.
51
+
52
+ `,26:`fontFace expects fileFormats to be an array.
53
+
54
+ `,27:`radialGradient requries at least 2 color-stops to properly render.
55
+
56
+ `,28:`Please supply a filename to retinaImage() as the first argument.
57
+
58
+ `,29:`Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
59
+
60
+ `,30:"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",31:`The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation
61
+
62
+ `,32:`To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])
63
+ To pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')
64
+
65
+ `,33:`The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation
66
+
67
+ `,34:`borderRadius expects a radius value as a string or number as the second argument.
68
+
69
+ `,35:`borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
70
+
71
+ `,36:`Property must be a string value.
72
+
73
+ `,37:`Syntax Error at %s.
74
+
75
+ `,38:`Formula contains a function that needs parentheses at %s.
76
+
77
+ `,39:`Formula is missing closing parenthesis at %s.
78
+
79
+ `,40:`Formula has too many closing parentheses at %s.
80
+
81
+ `,41:`All values in a formula must have the same unit or be unitless.
82
+
83
+ `,42:`Please provide a number of steps to the modularScale helper.
84
+
85
+ `,43:`Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
86
+
87
+ `,44:`Invalid value passed as base to modularScale, expected number or em/rem string but got %s.
88
+
89
+ `,45:`Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.
90
+
91
+ `,46:`Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.
92
+
93
+ `,47:`minScreen and maxScreen must be provided as stringified numbers with the same units.
94
+
95
+ `,48:`fromSize and toSize must be provided as stringified numbers with the same units.
96
+
97
+ `,49:`Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
98
+
99
+ `,50:`Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.
100
+
101
+ `,51:`Expects the first argument object to have the properties prop, fromSize, and toSize.
102
+
103
+ `,52:`fontFace expects either the path to the font file(s) or a name of a local copy.
104
+
105
+ `,53:`fontFace expects localFonts to be an array.
106
+
107
+ `,54:`fontFace expects fileFormats to be an array.
108
+
109
+ `,55:`fontFace expects a name of a font-family.
110
+
111
+ `,56:`linearGradient requries at least 2 color-stops to properly render.
112
+
113
+ `,57:`radialGradient requries at least 2 color-stops to properly render.
114
+
115
+ `,58:`Please supply a filename to retinaImage() as the first argument.
116
+
117
+ `,59:`Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
118
+
119
+ `,60:"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",61:`Property must be a string value.
120
+
121
+ `,62:`borderRadius expects a radius value as a string or number as the second argument.
122
+
123
+ `,63:`borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
124
+
125
+ `,64:`The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.
126
+
127
+ `,65:`To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').
128
+
129
+ `,66:`The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.
130
+
131
+ `,67:`You must provide a template to this method.
132
+
133
+ `,68:`You passed an unsupported selector state to this method.
134
+
135
+ `,69:`Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.
136
+
137
+ `,70:`Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.
138
+
139
+ `,71:`Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.
140
+
141
+ `,72:`Passed invalid base value %s to %s(), please pass a value like "12px" or 12.
142
+
143
+ `,73:`Please provide a valid CSS variable.
144
+
145
+ `,74:`CSS variable not found and no default was provided.
146
+
147
+ `,75:`important requires a valid style object, got a %s instead.
148
+
149
+ `,76:`fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.
150
+
151
+ `,77:`remToPx expects a value in "rem" but you provided it in "%s".
152
+
153
+ `,78:`base must be set in "px" or "%" but you set it in "%s".
154
+ `};function format(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];var a=args[0],b=[],c;for(c=1;c<args.length;c+=1)b.push(args[c]);return b.forEach(function(d){a=a.replace(/%[a-z]/,d);}),a}var PolishedError=function(_Error){_inheritsLoose(PolishedError2,_Error);function PolishedError2(code){for(var _this,_len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return _this=_Error.call(this,format.apply(void 0,[ERRORS[code]].concat(args)))||this,_assertThisInitialized(_this)}return PolishedError2}(_wrapNativeSuper(Error));function colorToInt(color){return Math.round(color*255)}function convertToInt(red,green,blue){return colorToInt(red)+","+colorToInt(green)+","+colorToInt(blue)}function hslToRgb(hue,saturation,lightness,convert2){if(convert2===void 0&&(convert2=convertToInt),saturation===0)return convert2(lightness,lightness,lightness);var huePrime=(hue%360+360)%360/60,chroma=(1-Math.abs(2*lightness-1))*saturation,secondComponent=chroma*(1-Math.abs(huePrime%2-1)),red=0,green=0,blue=0;huePrime>=0&&huePrime<1?(red=chroma,green=secondComponent):huePrime>=1&&huePrime<2?(red=secondComponent,green=chroma):huePrime>=2&&huePrime<3?(green=chroma,blue=secondComponent):huePrime>=3&&huePrime<4?(green=secondComponent,blue=chroma):huePrime>=4&&huePrime<5?(red=secondComponent,blue=chroma):huePrime>=5&&huePrime<6&&(red=chroma,blue=secondComponent);var lightnessModification=lightness-chroma/2,finalRed=red+lightnessModification,finalGreen=green+lightnessModification,finalBlue=blue+lightnessModification;return convert2(finalRed,finalGreen,finalBlue)}var namedColorMap={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function nameToHex(color){if(typeof color!="string")return color;var normalizedColorName=color.toLowerCase();return namedColorMap[normalizedColorName]?"#"+namedColorMap[normalizedColorName]:color}var hexRegex=/^#[a-fA-F0-9]{6}$/,hexRgbaRegex=/^#[a-fA-F0-9]{8}$/,reducedHexRegex=/^#[a-fA-F0-9]{3}$/,reducedRgbaHexRegex=/^#[a-fA-F0-9]{4}$/,rgbRegex=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,rgbaRegex=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,hslRegex=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,hslaRegex=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function parseToRgb(color){if(typeof color!="string")throw new PolishedError(3);var normalizedColor=nameToHex(color);if(normalizedColor.match(hexRegex))return {red:parseInt(""+normalizedColor[1]+normalizedColor[2],16),green:parseInt(""+normalizedColor[3]+normalizedColor[4],16),blue:parseInt(""+normalizedColor[5]+normalizedColor[6],16)};if(normalizedColor.match(hexRgbaRegex)){var alpha=parseFloat((parseInt(""+normalizedColor[7]+normalizedColor[8],16)/255).toFixed(2));return {red:parseInt(""+normalizedColor[1]+normalizedColor[2],16),green:parseInt(""+normalizedColor[3]+normalizedColor[4],16),blue:parseInt(""+normalizedColor[5]+normalizedColor[6],16),alpha}}if(normalizedColor.match(reducedHexRegex))return {red:parseInt(""+normalizedColor[1]+normalizedColor[1],16),green:parseInt(""+normalizedColor[2]+normalizedColor[2],16),blue:parseInt(""+normalizedColor[3]+normalizedColor[3],16)};if(normalizedColor.match(reducedRgbaHexRegex)){var _alpha=parseFloat((parseInt(""+normalizedColor[4]+normalizedColor[4],16)/255).toFixed(2));return {red:parseInt(""+normalizedColor[1]+normalizedColor[1],16),green:parseInt(""+normalizedColor[2]+normalizedColor[2],16),blue:parseInt(""+normalizedColor[3]+normalizedColor[3],16),alpha:_alpha}}var rgbMatched=rgbRegex.exec(normalizedColor);if(rgbMatched)return {red:parseInt(""+rgbMatched[1],10),green:parseInt(""+rgbMatched[2],10),blue:parseInt(""+rgbMatched[3],10)};var rgbaMatched=rgbaRegex.exec(normalizedColor.substring(0,50));if(rgbaMatched)return {red:parseInt(""+rgbaMatched[1],10),green:parseInt(""+rgbaMatched[2],10),blue:parseInt(""+rgbaMatched[3],10),alpha:parseFloat(""+rgbaMatched[4])>1?parseFloat(""+rgbaMatched[4])/100:parseFloat(""+rgbaMatched[4])};var hslMatched=hslRegex.exec(normalizedColor);if(hslMatched){var hue=parseInt(""+hslMatched[1],10),saturation=parseInt(""+hslMatched[2],10)/100,lightness=parseInt(""+hslMatched[3],10)/100,rgbColorString="rgb("+hslToRgb(hue,saturation,lightness)+")",hslRgbMatched=rgbRegex.exec(rgbColorString);if(!hslRgbMatched)throw new PolishedError(4,normalizedColor,rgbColorString);return {red:parseInt(""+hslRgbMatched[1],10),green:parseInt(""+hslRgbMatched[2],10),blue:parseInt(""+hslRgbMatched[3],10)}}var hslaMatched=hslaRegex.exec(normalizedColor.substring(0,50));if(hslaMatched){var _hue=parseInt(""+hslaMatched[1],10),_saturation=parseInt(""+hslaMatched[2],10)/100,_lightness=parseInt(""+hslaMatched[3],10)/100,_rgbColorString="rgb("+hslToRgb(_hue,_saturation,_lightness)+")",_hslRgbMatched=rgbRegex.exec(_rgbColorString);if(!_hslRgbMatched)throw new PolishedError(4,normalizedColor,_rgbColorString);return {red:parseInt(""+_hslRgbMatched[1],10),green:parseInt(""+_hslRgbMatched[2],10),blue:parseInt(""+_hslRgbMatched[3],10),alpha:parseFloat(""+hslaMatched[4])>1?parseFloat(""+hslaMatched[4])/100:parseFloat(""+hslaMatched[4])}}throw new PolishedError(5)}function rgbToHsl(color){var red=color.red/255,green=color.green/255,blue=color.blue/255,max=Math.max(red,green,blue),min=Math.min(red,green,blue),lightness=(max+min)/2;if(max===min)return color.alpha!==void 0?{hue:0,saturation:0,lightness,alpha:color.alpha}:{hue:0,saturation:0,lightness};var hue,delta=max-min,saturation=lightness>.5?delta/(2-max-min):delta/(max+min);switch(max){case red:hue=(green-blue)/delta+(green<blue?6:0);break;case green:hue=(blue-red)/delta+2;break;default:hue=(red-green)/delta+4;break}return hue*=60,color.alpha!==void 0?{hue,saturation,lightness,alpha:color.alpha}:{hue,saturation,lightness}}function parseToHsl(color){return rgbToHsl(parseToRgb(color))}var reduceHexValue=function(value){return value.length===7&&value[1]===value[2]&&value[3]===value[4]&&value[5]===value[6]?"#"+value[1]+value[3]+value[5]:value},reduceHexValue$1=reduceHexValue;function numberToHex(value){var hex=value.toString(16);return hex.length===1?"0"+hex:hex}function colorToHex(color){return numberToHex(Math.round(color*255))}function convertToHex(red,green,blue){return reduceHexValue$1("#"+colorToHex(red)+colorToHex(green)+colorToHex(blue))}function hslToHex(hue,saturation,lightness){return hslToRgb(hue,saturation,lightness,convertToHex)}function hsl(value,saturation,lightness){if(typeof value=="number"&&typeof saturation=="number"&&typeof lightness=="number")return hslToHex(value,saturation,lightness);if(typeof value=="object"&&saturation===void 0&&lightness===void 0)return hslToHex(value.hue,value.saturation,value.lightness);throw new PolishedError(1)}function hsla(value,saturation,lightness,alpha){if(typeof value=="number"&&typeof saturation=="number"&&typeof lightness=="number"&&typeof alpha=="number")return alpha>=1?hslToHex(value,saturation,lightness):"rgba("+hslToRgb(value,saturation,lightness)+","+alpha+")";if(typeof value=="object"&&saturation===void 0&&lightness===void 0&&alpha===void 0)return value.alpha>=1?hslToHex(value.hue,value.saturation,value.lightness):"rgba("+hslToRgb(value.hue,value.saturation,value.lightness)+","+value.alpha+")";throw new PolishedError(2)}function rgb(value,green,blue){if(typeof value=="number"&&typeof green=="number"&&typeof blue=="number")return reduceHexValue$1("#"+numberToHex(value)+numberToHex(green)+numberToHex(blue));if(typeof value=="object"&&green===void 0&&blue===void 0)return reduceHexValue$1("#"+numberToHex(value.red)+numberToHex(value.green)+numberToHex(value.blue));throw new PolishedError(6)}function rgba(firstValue,secondValue,thirdValue,fourthValue){if(typeof firstValue=="string"&&typeof secondValue=="number"){var rgbValue=parseToRgb(firstValue);return "rgba("+rgbValue.red+","+rgbValue.green+","+rgbValue.blue+","+secondValue+")"}else {if(typeof firstValue=="number"&&typeof secondValue=="number"&&typeof thirdValue=="number"&&typeof fourthValue=="number")return fourthValue>=1?rgb(firstValue,secondValue,thirdValue):"rgba("+firstValue+","+secondValue+","+thirdValue+","+fourthValue+")";if(typeof firstValue=="object"&&secondValue===void 0&&thirdValue===void 0&&fourthValue===void 0)return firstValue.alpha>=1?rgb(firstValue.red,firstValue.green,firstValue.blue):"rgba("+firstValue.red+","+firstValue.green+","+firstValue.blue+","+firstValue.alpha+")"}throw new PolishedError(7)}var isRgb=function(color){return typeof color.red=="number"&&typeof color.green=="number"&&typeof color.blue=="number"&&(typeof color.alpha!="number"||typeof color.alpha>"u")},isRgba=function(color){return typeof color.red=="number"&&typeof color.green=="number"&&typeof color.blue=="number"&&typeof color.alpha=="number"},isHsl=function(color){return typeof color.hue=="number"&&typeof color.saturation=="number"&&typeof color.lightness=="number"&&(typeof color.alpha!="number"||typeof color.alpha>"u")},isHsla=function(color){return typeof color.hue=="number"&&typeof color.saturation=="number"&&typeof color.lightness=="number"&&typeof color.alpha=="number"};function toColorString(color){if(typeof color!="object")throw new PolishedError(8);if(isRgba(color))return rgba(color);if(isRgb(color))return rgb(color);if(isHsla(color))return hsla(color);if(isHsl(color))return hsl(color);throw new PolishedError(8)}function curried(f,length,acc){return function(){var combined=acc.concat(Array.prototype.slice.call(arguments));return combined.length>=length?f.apply(this,combined):curried(f,length,combined)}}function curry(f){return curried(f,f.length,[])}function adjustHue(degree,color){if(color==="transparent")return color;var hslColor=parseToHsl(color);return toColorString(_extends({},hslColor,{hue:hslColor.hue+parseFloat(degree)}))}curry(adjustHue);function guard(lowerBoundary,upperBoundary,value){return Math.max(lowerBoundary,Math.min(upperBoundary,value))}function darken(amount,color){if(color==="transparent")return color;var hslColor=parseToHsl(color);return toColorString(_extends({},hslColor,{lightness:guard(0,1,hslColor.lightness-parseFloat(amount))}))}curry(darken);function desaturate(amount,color){if(color==="transparent")return color;var hslColor=parseToHsl(color);return toColorString(_extends({},hslColor,{saturation:guard(0,1,hslColor.saturation-parseFloat(amount))}))}curry(desaturate);function lighten(amount,color){if(color==="transparent")return color;var hslColor=parseToHsl(color);return toColorString(_extends({},hslColor,{lightness:guard(0,1,hslColor.lightness+parseFloat(amount))}))}curry(lighten);function mix(weight,color,otherColor){if(color==="transparent")return otherColor;if(otherColor==="transparent")return color;if(weight===0)return otherColor;var parsedColor1=parseToRgb(color),color1=_extends({},parsedColor1,{alpha:typeof parsedColor1.alpha=="number"?parsedColor1.alpha:1}),parsedColor2=parseToRgb(otherColor),color2=_extends({},parsedColor2,{alpha:typeof parsedColor2.alpha=="number"?parsedColor2.alpha:1}),alphaDelta=color1.alpha-color2.alpha,x=parseFloat(weight)*2-1,y=x*alphaDelta===-1?x:x+alphaDelta,z=1+x*alphaDelta,weight1=(y/z+1)/2,weight2=1-weight1,mixedColor={red:Math.floor(color1.red*weight1+color2.red*weight2),green:Math.floor(color1.green*weight1+color2.green*weight2),blue:Math.floor(color1.blue*weight1+color2.blue*weight2),alpha:color1.alpha*parseFloat(weight)+color2.alpha*(1-parseFloat(weight))};return rgba(mixedColor)}var curriedMix=curry(mix),mix$1=curriedMix;function opacify(amount,color){if(color==="transparent")return color;var parsedColor=parseToRgb(color),alpha=typeof parsedColor.alpha=="number"?parsedColor.alpha:1,colorWithAlpha=_extends({},parsedColor,{alpha:guard(0,1,(alpha*100+parseFloat(amount)*100)/100)});return rgba(colorWithAlpha)}curry(opacify);function saturate(amount,color){if(color==="transparent")return color;var hslColor=parseToHsl(color);return toColorString(_extends({},hslColor,{saturation:guard(0,1,hslColor.saturation+parseFloat(amount))}))}curry(saturate);function setHue(hue,color){return color==="transparent"?color:toColorString(_extends({},parseToHsl(color),{hue:parseFloat(hue)}))}curry(setHue);function setLightness(lightness,color){return color==="transparent"?color:toColorString(_extends({},parseToHsl(color),{lightness:parseFloat(lightness)}))}curry(setLightness);function setSaturation(saturation,color){return color==="transparent"?color:toColorString(_extends({},parseToHsl(color),{saturation:parseFloat(saturation)}))}curry(setSaturation);function shade(percentage,color){return color==="transparent"?color:mix$1(parseFloat(percentage),"rgb(0, 0, 0)",color)}curry(shade);function tint(percentage,color){return color==="transparent"?color:mix$1(parseFloat(percentage),"rgb(255, 255, 255)",color)}curry(tint);function transparentize(amount,color){if(color==="transparent")return color;var parsedColor=parseToRgb(color),alpha=typeof parsedColor.alpha=="number"?parsedColor.alpha:1,colorWithAlpha=_extends({},parsedColor,{alpha:guard(0,1,+(alpha*100-parseFloat(amount)*100).toFixed(2)/100)});return rgba(colorWithAlpha)}var curriedTransparentize=curry(transparentize),curriedTransparentize$1=curriedTransparentize;var Wrapper=styled.div(withReset,({theme})=>({backgroundColor:theme.base==="light"?"rgba(0,0,0,.01)":"rgba(255,255,255,.01)",borderRadius:theme.appBorderRadius,border:`1px dashed ${theme.appBorderColor}`,display:"flex",alignItems:"center",justifyContent:"center",padding:20,margin:"25px 0 40px",color:curriedTransparentize$1(.3,theme.color.defaultText),fontSize:theme.typography.size.s2})),EmptyBlock=props=>React2.createElement(Wrapper,{...props,className:"docblock-emptyblock sb-unstyled"});var StyledSyntaxHighlighter=styled(SyntaxHighlighter)(({theme})=>({fontSize:`${theme.typography.size.s2-1}px`,lineHeight:"19px",margin:"25px 0 40px",borderRadius:theme.appBorderRadius,boxShadow:theme.base==="light"?"rgba(0, 0, 0, 0.10) 0 1px 3px 0":"rgba(0, 0, 0, 0.20) 0 2px 5px 0","pre.prismjs":{padding:20,background:"inherit"}}));var SourceSkeletonWrapper=styled.div(({theme})=>({background:theme.background.content,borderRadius:theme.appBorderRadius,border:`1px solid ${theme.appBorderColor}`,boxShadow:theme.base==="light"?"rgba(0, 0, 0, 0.10) 0 1px 3px 0":"rgba(0, 0, 0, 0.20) 0 2px 5px 0",margin:"25px 0 40px",padding:"20px 20px 20px 22px"})),SourceSkeletonPlaceholder=styled.div(({theme})=>({animation:`${theme.animation.glow} 1.5s ease-in-out infinite`,background:theme.appBorderColor,height:17,marginTop:1,width:"60%",[`&:first-child${ignoreSsrWarning}`]:{margin:0}})),SourceSkeleton=()=>React2.createElement(SourceSkeletonWrapper,null,React2.createElement(SourceSkeletonPlaceholder,null),React2.createElement(SourceSkeletonPlaceholder,{style:{width:"80%"}}),React2.createElement(SourceSkeletonPlaceholder,{style:{width:"30%"}}),React2.createElement(SourceSkeletonPlaceholder,{style:{width:"80%"}})),Source=({isLoading,error,language,code,dark,format:format2=!0,...rest})=>{let{typography}=useTheme();if(isLoading)return React2.createElement(SourceSkeleton,null);if(error)return React2.createElement(EmptyBlock,null,error);let syntaxHighlighter=React2.createElement(StyledSyntaxHighlighter,{bordered:!0,copyable:!0,format:format2,language:language??"jsx",className:"docblock-source sb-unstyled",...rest},code);if(typeof dark>"u")return syntaxHighlighter;let overrideTheme=dark?themes.dark:themes.light;return React2.createElement(ThemeProvider,{theme:convert({...overrideTheme,fontCode:typography.fonts.mono,fontBase:typography.fonts.base})},syntaxHighlighter)};addons.register(ADDON_ID,api=>{addons.add(PANEL_ID,{title:"Code",type:types.PANEL,paramKey:PARAM_KEY,disabled:parameters=>!parameters?.docs?.codePanel,match:({viewMode})=>viewMode==="story",render:({active})=>{let lastEvent=api.getChannel()?.last(SNIPPET_RENDERED)?.[0],[codeSnippet,setSourceCode]=useState({source:lastEvent?.source??"",format:lastEvent?.format??void 0}),parameter=useParameter(PARAM_KEY,{source:{code:""},theme:"dark"});useChannel({[SNIPPET_RENDERED]:({source,format:format2})=>{setSourceCode({source,format:format2});}});let isDark=useTheme().base!=="light";return React2.createElement(AddonPanel,{active:!!active},React2.createElement(SourceStyles,null,React2.createElement(Source,{...parameter.source,code:parameter.source.code||codeSnippet.source,format:codeSnippet.format,dark:isDark})))}});});var SourceStyles=styled.div(()=>({height:"100%",[`> :first-child${ignoreSsrWarning}`]:{margin:0,height:"100%",boxShadow:"none"}}));