diff --git a/dist/plugin.js b/dist/plugin.js index e8e37b63..82596086 100644 --- a/dist/plugin.js +++ b/dist/plugin.js @@ -1 +1 @@ -(()=>{"use strict";const e={filename:"design-tokens",extension:".tokens.json",nameConversion:"default",tokenFormat:"standard",compression:!1,urlJsonCompression:!0,serverUrl:void 0,eventType:"update-tokens",accessToken:void 0,acceptHeader:"application/vnd.github.everest-preview+json",contentType:"text/plain;charset=UTF-8",authType:"token",reference:"main",exclusionPrefix:"",excludeExtensionProp:!1,alias:"alias, ref, reference",keyInName:!1,prefixInName:!0,prefix:{color:"color",gradient:"gradient",typography:"typography",font:"font",effect:"effect",grid:"grid",border:"border, borders",breakpoint:"breakpoint, breakpoints",radius:"radius, radii",size:"size, sizes",spacing:"spacing",motion:"motion",opacity:"opacity, opacities"},exports:{color:!0,gradient:!0,font:!0,typography:!0,effect:!0,grid:!0,border:!0,breakpoint:!0,radius:!0,size:!0,spacing:!0,motion:!0,opacity:!0,variables:!0}},t={ui:{generalSettings:{width:550,height:755},export:{width:550,height:356},urlExport:{width:550,height:650}},key:{lastVersionSettingsOpened:"lastVersionSettingsOpened",fileId:"fileId",settings:"settings",extensionPluginData:"org.lukasoppermann.figmaDesignTokens",extensionFigmaStyleId:"styleId",extensionVariableStyleId:"variableId",extensionAlias:"alias",authType:{token:"token",gitlabToken:"gitlab_token",basic:"Basic",bearer:"Bearer"}},exclusionPrefixDefault:["_","."],fileExtensions:[{label:".tokens.json",value:".tokens.json"},{label:".tokens",value:".tokens"},{label:".json",value:".json"}]},i=(e,t=!0)=>!0===t?JSON.stringify(e):JSON.stringify(e,null,2),n=(e,t)=>Object.fromEntries(Object.entries(e).map((([i,n])=>void 0!==n&&typeof t[i]!=typeof n?[i,e[i]]:[i,t[i]])));var a=function(e,t,i,n){return new(i||(i=Promise))((function(a,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((n=n.apply(e,t||[])).next())}))};const o={generalSettings:"generalSettings",export:"export",sendSettings:"sendSettings",urlExport:"urlExport",help:"help",demo:"demo",openUrl:"openUrl",reset:"reset",saveSettings:"saveSettings",closePlugin:"closePlugin"},r="6.8.0";const s=e=>{return i=void 0,n=void 0,o=function*(){const i=yield e.clientStorage.getAsync(t.key.lastVersionSettingsOpened),n=((e,t="1.0.0")=>{const[i,n,a]=t.split("."),[o,r,s]=e.split(".");return i{let i=e.root.getPluginData(t.key.fileId);return void 0!==i&&""!==i||(e.root.setPluginData(t.key.fileId,e.root.name+" "+Math.floor(1e9*Math.random())),i=e.root.getPluginData(t.key.fileId)),i},p="color",u="gradient",c="font",d="effect",g="grid",y="border",m="breakpoint",f="radius",v="size",x="spacing",b="motion",h="opacity",k="variables",S=(e,t=2)=>{if(void 0===e)return;if("number"!=typeof e||"number"!=typeof t)throw new Error(`Invalid parameters, both value "${e}" (${typeof e}) and decimalPlaces "${t}" (${typeof t}) must be of type number`);const i=Math.pow(10,t);return Math.round(e*i)/i},R=(e,t)=>{var i;return{r:S(255*e.r,0),g:S(255*e.g,0),b:S(255*e.b,0),a:S(null!==(i=null!=t?t:e.a)&&void 0!==i?i:1)}},E=e=>"SOLID"===e.type&&!0===e.visible?R(e.color,e.opacity):null,I={fill:{value:{r:0,g:0,b:0,a:0},type:"color",blendMode:"normal"}},T=e=>e?{[t.key.extensionAlias]:e}:{},O={GRADIENT_LINEAR:"linear",GRADIENT_RADIAL:"radial",GRADIENT_ANGULAR:"angular",GRADIENT_DIAMOND:"diamond"},A=([[e,t],[i,n]])=>{const a=Math.atan2(n-t,i-e)*(180/Math.PI)+315;return a>360?a-360:a},L=(e,i)=>e.reduce(((e,n)=>{const a=n.paints.filter((e=>"IMAGE"!==e.type));if(n.paints.length&&0===a.length)return e;n.paints=a;const{alias:o,description:r}=((e="",t)=>{t=t&&0!==t.filter((e=>e)).length?t:["Ref:"];const i=new RegExp("("+t.join("|").toLowerCase()+"):?\\s");let n;const a=e.split(/\r?\n/).filter((e=>!e.toLowerCase().match(i)||(n=e.toLowerCase().replace(i,"").trim(),!1)));return{alias:n,description:a.join("\n")}})(n.description,i.alias),s=(l=n.paints[0],["GRADIENT_LINEAR","GRADIENT_RADIAL","GRADIENT_ANGULAR","GRADIENT_DIAMOND"].includes(null==l?void 0:l.type));var l;const c=n.paints.length?n.paints.map((e=>(e=>{var t;return"SOLID"===e.type?{fill:{value:E(e),type:"color",blendMode:(null===(t=e.blendMode)||void 0===t?void 0:t.toLowerCase())||"normal"}}:["GRADIENT_LINEAR","GRADIENT_RADIAL","GRADIENT_ANGULAR","GRADIENT_DIAMOND"].includes(e.type)?{gradientType:{value:O[e.type],type:"string"},rotation:{value:A(e.gradientTransform),type:"number",unit:"degree"},stops:e.gradientStops.map((e=>({position:{value:S(e.position),type:"number"},color:{value:R(e.color),type:"color"}}))),opacity:{value:S(e.opacity),type:"number"}}:null})(e))):[I];return[...e,{name:`${s?i.gradient[0]:i.color[0]}/${n.name}`,category:s?"gradient":"color",exportKey:s?u:p,description:r,values:c,extensions:{[t.key.extensionPluginData]:Object.assign({[t.key.extensionFigmaStyleId]:n.id,exportKey:s?u:p},T(o))}}]}),[]),N=(e,i)=>e.filter((e=>e.layoutGrids.length>0)).map((e=>({name:`${i[0]}/${e.name}`,category:"grid",exportKey:g,description:e.description||null,values:e.layoutGrids.map((e=>"GRID"===e.pattern?(e=>({pattern:{value:e.pattern.toLowerCase(),type:"string"},sectionSize:{value:e.sectionSize,unit:"pixel",type:"number"}}))(e):(e=>{return Object.assign(Object.assign(Object.assign({pattern:{value:e.pattern.toLowerCase(),type:"string"}},void 0!==e.sectionSize&&{sectionSize:{value:e.sectionSize,unit:"pixel",type:"number"}}),{gutterSize:{value:e.gutterSize,unit:"pixel",type:"number"},alignment:{value:e.alignment.toLowerCase(),type:"string"},count:(t=e.count,t===1/0?{value:"auto",type:"string"}:{value:t,type:"number"})}),void 0!==e.offset&&{offset:{value:e.offset,unit:"pixel",type:"number"}});var t})(e))),extensions:{[t.key.extensionPluginData]:{[t.key.extensionFigmaStyleId]:e.id,exportKey:g}}}))),C={NONE:"none",UNDERLINE:"underline",STRIKETHROUGH:"line-through"},D={ORIGINAL:"none",UPPER:"uppercase",LOWER:"lowercase",TITLE:"capitalize"},P={100:100,thin:100,200:200,extralight:200,ultralight:200,extraleicht:200,300:300,light:300,leicht:300,400:400,normal:400,regular:400,buch:400,500:500,medium:500,kraeftig:500,kräftig:500,600:600,semibold:600,demibold:600,halbfett:600,700:700,bold:700,dreiviertelfett:700,800:800,extrabold:800,ultabold:800,fett:800,900:900,black:900,heavy:900,super:900,extrafett:900},w={normal:"normal",condensed:"condensed",expanded:"expanded",extended:"expanded"},_={normal:"normal",italic:"italic",kursiv:"italic",oblique:"oblique"},B=e=>{const t=e.toLowerCase().split(" ");let i=t[0];return["extra","ultra","semi","demi"].includes(t[0])&&["bold","light"].includes(t[1])&&(i=`${t[0]}${t[1]}`),P[i]||400},M=e=>{const t=e.toLowerCase().split(" ");return w[t[t.length-1]]||w[t[t.length-2]]||"normal"},z=e=>{const t=e.toLowerCase().split(" ").pop();return _[t]||"normal"},j=(e,i)=>e.map((e=>({name:`${i[0]}/${e.name}`,category:"font",exportKey:c,description:e.description||void 0,values:{fontSize:{value:e.fontSize,unit:"pixel",type:"number"},textDecoration:{value:C[e.textDecoration],type:"string"},fontFamily:{value:e.fontName.family,type:"string"},fontWeight:{value:B(e.fontName.style),type:"number"},fontStyle:{value:z(e.fontName.style),type:"string"},fontStretch:{value:M(e.fontName.style),type:"string"},_fontStyleOld:{value:e.fontName.style,type:"string"},letterSpacing:{value:S(e.letterSpacing.value),unit:"pixels"===e.letterSpacing.unit.toLowerCase()?"pixel":e.letterSpacing.unit.toLowerCase(),type:"number"},lineHeight:{value:S(e.lineHeight.value)||"normal",unit:"pixels"===e.lineHeight.unit.toLowerCase()?"pixel":e.lineHeight.unit.toLowerCase(),type:Object.prototype.hasOwnProperty.call(e.lineHeight,"value")?"number":"string"},paragraphIndent:{value:e.paragraphIndent,unit:"pixel",type:"number"},paragraphSpacing:{value:e.paragraphSpacing,unit:"pixel",type:"number"},textCase:{value:D[e.textCase],type:"string"}},extensions:{[t.key.extensionPluginData]:{[t.key.extensionFigmaStyleId]:e.id,exportKey:c}}}))),U={LAYER_BLUR:"layerBlur",BACKGROUND_BLUR:"backgroundBlur",DROP_SHADOW:"dropShadow",INNER_SHADOW:"innerShadow"},G=(e,i)=>e.filter((e=>e.effects.length>0)).map((e=>({name:`${i[0]}/${e.name}`,category:"effect",exportKey:d,description:e.description||null,values:e.effects.map((e=>"LAYER_BLUR"===e.type||"BACKGROUND_BLUR"===e.type?(e=>({effectType:{value:U[e.type],type:"string"},radius:{value:e.radius,unit:"pixel",type:"number"}}))(e):(e=>({effectType:{value:U[e.type],type:"string"},radius:{value:e.radius,unit:"pixel",type:"number"},color:{value:R(e.color),type:"color"},offset:{x:{value:e.offset.x,unit:"pixel",type:"number"},y:{value:e.offset.y,unit:"pixel",type:"number"}},spread:{value:e.spread,unit:"pixel",type:"number"}}))(e))),extensions:{[t.key.extensionPluginData]:{[t.key.extensionFigmaStyleId]:e.id,exportKey:d}}}))),K=e=>t=>{if(!Array.isArray(e))return;const i=t.name.substr(0,t.name.indexOf("/")).replace(/\s+/g,"");return 0!==i.length?e.includes(i):void 0},F=e=>{if(Object.prototype.hasOwnProperty.call(e,"direction"))return{direction:{value:e.direction.toLowerCase(),type:"string"}}},$={CUSTOM_CUBIC_BEZIER:{type:"custom-cubicBezier",curveType:"cubicBezier",easing:void 0},CUSTOM_SPRING:{type:"custom-spring",curveType:"spring",easing:void 0},LINEAR:{type:"linear",curveType:"cubicBezier",easing:{x1:0,y1:0,x2:1,y2:1}},EASE_IN:{type:"ease-in",curveType:"cubicBezier",easing:{x1:.41999998688697815,y1:0,x2:1,y2:1}},EASE_OUT:{type:"ease-out",curveType:"cubicBezier",easing:{x1:0,y1:0,x2:.5799999833106995,y2:1}},EASE_IN_AND_OUT:{type:"ease-in-out",curveType:"cubicBezier",easing:{x1:.41999998688697815,y1:0,x2:.5799999833106995,y2:1}},EASE_IN_BACK:{type:"ease-in-back",curveType:"cubicBezier",easing:{x1:.30000001192092896,y1:-.05000000074505806,x2:.699999988079071,y2:-.5}},EASE_OUT_BACK:{type:"ease-out-back",curveType:"cubicBezier",easing:{x1:.44999998807907104,y1:1.4500000476837158,x2:.800000011920929,y2:1}},EASE_IN_AND_OUT_BACK:{type:"ease-in-out-back",curveType:"cubicBezier",easing:{x1:.699999988079071,y1:-.4000000059604645,x2:.4000000059604645,y2:1.399999976158142}},BOUNCY:{type:"bouncy",curveType:"spring",easing:{mass:1,stiffness:600,damping:15}},GENTLE:{type:"gentle",curveType:"spring",easing:{mass:1,stiffness:100,damping:15}},QUICK:{type:"quick",curveType:"spring",easing:{mass:1,stiffness:300,damping:20}},SLOW:{type:"slow",curveType:"spring",easing:{mass:1,stiffness:80,damping:20}}},H=e=>{var t;if("type"in e&&void 0!==$[e.type])return"CUSTOM_CUBIC_BEZIER"===e.type&&($.CUSTOM_CUBIC_BEZIER.easing={x1:e.easingFunctionCubicBezier.x1,y1:e.easingFunctionCubicBezier.y1,x2:e.easingFunctionCubicBezier.x2,y2:e.easingFunctionCubicBezier.y2}),"CUSTOM_SPRING"===e.type&&($.CUSTOM_SPRING.easing={mass:e.easingFunctionSpring.mass,stiffness:e.easingFunctionSpring.stiffness,damping:e.easingFunctionSpring.damping}),{easingType:{value:$[e.type].type,type:"string"},easingCurveType:{value:$[e.type].curveType,type:"string"},easingFunction:(t=$[e.type],"spring"===t.curveType?{mass:{value:t.easing.mass,type:"number"},stiffness:{value:t.easing.stiffness,type:"number"},damping:{value:t.easing.damping,type:"number"}}:"cubicBezier"===t.curveType?{x1:{value:t.easing.x1,type:"number"},x2:{value:t.easing.x2,type:"number"},y1:{value:t.easing.y1,type:"number"},y2:{value:t.easing.y2,type:"number"}}:void 0)}},V=e=>{var t;const i=Object.keys($);return!!(e.reactions.length>0&&"NODE"===(null===(t=e.reactions[0].action)||void 0===t?void 0:t.type)&&null!==e.reactions[0].action.transition&&i.includes(e.reactions[0].action.transition.easing.type))},J=(e,i)=>e.filter(K(i)).filter(V).map((e=>({name:e.name,category:"motion",exportKey:b,description:e.description||null,values:Object.assign(Object.assign({transitionType:{value:e.reactions[0].action.transition.type.toLocaleLowerCase(),type:"string"},duration:{value:Math.round(1e3*(e.reactions[0].action.transition.duration+Number.EPSILON))/1e3,unit:"s",type:"number"}},H(e.reactions[0].action.transition.easing)),F(e.reactions[0].action.transition)),extensions:{[t.key.extensionPluginData]:{exportKey:b}}}))),W=(e,i)=>e.filter(K(i)).map((e=>({name:e.name,category:"spacing",exportKey:x,description:e.description||null,values:{top:{value:S(e.paddingTop,2),unit:"pixel",type:"number"},right:{value:S(e.paddingRight,2),unit:"pixel",type:"number"},bottom:{value:S(e.paddingBottom,2),unit:"pixel",type:"number"},left:{value:S(e.paddingLeft,2),unit:"pixel",type:"number"}},extensions:{[t.key.extensionPluginData]:{exportKey:x}}}))),q={MITER:"miter",BEVEL:"bevel",ROUND:"round"},Q={CENTER:"center",INSIDE:"inside",OUTSIDE:"outside"},Y=(e,i)=>e.filter(K(i)).filter((e=>e.strokes.length>0)).map((e=>({name:e.name,category:"border",exportKey:y,description:e.description||null,values:{strokeAlign:{value:Q[e.strokeAlign],type:"string"},dashPattern:{value:[...void 0!==e.dashPattern&&e.dashPattern.length>0?e.dashPattern:[0,0]],type:"string"},strokeCap:{value:"string"==typeof e.strokeCap?e.strokeCap.toLowerCase():"mixed",type:"string"},strokeJoin:{value:q[e.strokeJoin],type:"string"},strokeMiterLimit:{value:S(e.strokeMiterLimit),unit:"degree",type:"number"},strokeWeight:{value:e.strokeWeight,unit:"pixel",type:"number"},stroke:{value:e.strokes[0],type:"color"}},extensions:{[t.key.extensionPluginData]:{exportKey:y}}}))),Z=(e,i)=>{const n=e=>({topLeft:{value:e.topLeftRadius||0,unit:"pixel",type:"number"},topRight:{value:e.topRightRadius||0,unit:"pixel",type:"number"},bottomRight:{value:e.bottomRightRadius||0,unit:"pixel",type:"number"},bottomLeft:{value:e.bottomLeftRadius||0,unit:"pixel",type:"number"}});return e.filter(K(i)).map((e=>{return{name:e.name,category:"radius",exportKey:f,description:e.description||null,values:Object.assign(Object.assign({},"number"==typeof e.cornerRadius&&{radius:{value:e.cornerRadius,unit:"pixel",type:"number"}}),{radiusType:{value:(i=e.cornerRadius,"number"==typeof i?"single":"mixed"),type:"string"},radii:n(e),smoothing:{value:S(e.cornerSmoothing,2),comment:"Percent as decimal from 0.0 - 1.0",type:"number"}}),extensions:{[t.key.extensionPluginData]:{exportKey:f}}};var i}))},X=(e,i)=>e.filter(K(i)).map((e=>({name:e.name,category:"breakpoint",exportKey:m,description:e.description||null,values:{width:{value:S(e.width,2),unit:"pixel",type:"number"},height:{value:S(e.height,2),unit:"pixel",type:"number"}},extensions:{[t.key.extensionPluginData]:{exportKey:m}}}))),ee=(e,i)=>e.filter(K(i)).map((e=>({name:e.name,category:"opacity",exportKey:h,description:e.description||null,values:{opacity:{value:S(e.opacity,2),type:"number"}},extensions:{[t.key.extensionPluginData]:{exportKey:h}}}))),te=(e,i)=>!(e=>[...t.exclusionPrefixDefault,...e])(i).includes(e.name.trim().substr(0,1)),ie=e=>{const t=[];return e.forEach((e=>{t.push({name:e.name,id:e.id,description:e.description,paints:e.paints})})),t},ne=e=>{const t=[];return e.forEach((e=>{t.push({name:e.name,id:e.id,description:e.description,layoutGrids:e.layoutGrids})})),t},ae=e=>{var t,i;return{name:e.name,description:e.description||void 0,bottomLeftRadius:e.bottomLeftRadius,bottomRightRadius:e.bottomRightRadius,topLeftRadius:e.topLeftRadius,topRightRadius:e.topRightRadius,cornerRadius:e.cornerRadius||void 0,cornerSmoothing:e.cornerSmoothing,strokes:(i=e.strokes,[...i].map((e=>E(e))).filter((e=>null!=e))),strokeWeight:e.strokeWeight,strokeStyleId:e.strokeStyleId,strokeMiterLimit:e.strokeMiterLimit,strokeJoin:e.strokeJoin,strokeCap:e.strokeCap,dashPattern:e.dashPattern,strokeAlign:e.strokeAlign,width:e.width,height:e.height,reactions:e.reactions||void 0,paddingTop:e.paddingTop||0,paddingRight:e.paddingRight||0,paddingBottom:e.paddingBottom||0,paddingLeft:e.paddingLeft||0,opacity:null!==(t=e.opacity)&&void 0!==t?t:1}},oe=["COMPONENT","COMPONENT_SET","RECTANGLE","FRAME"],re="_tokens",se=e=>[...e.map((e=>e.findChildren((e=>(e=>"FRAME"===e.type&&e.name.trim().toLowerCase().substr(0,re.length)===re)(e))))).reduce(((e,t)=>[...e,...t]))].map((e=>e.findAll((e=>(e=>"COMPONENT_SET"!==e.parent.type&&oe.includes(e.type)&&e.name.length>0)(e))))).reduce(((e,t)=>[...e,...t]),[]).map((e=>("RECTANGLE"!==e.type&&"FRAME"!==e.type||console.warn("Please use only main components and variants, other types may be deprecated as tokens in the future"),"COMPONENT_SET"===e.type?e.children.map((t=>{return Object.assign(Object.assign({},ae(t)),{name:(i=e.name,n=t.name,`${i}/${n=n.split(",").filter((e=>!["_","."].includes(e.trim().substr(0,1)))).map((e=>e.split("=")[1])).join("/")}`)});var i,n})):[ae(e)]))).reduce(((e,t)=>[...e,...t]),[]),le=e=>{const t=[];return e.forEach((e=>{t.push({name:e.name,id:e.id,description:e.description,fontSize:e.fontSize,textDecoration:e.textDecoration,fontName:e.fontName,letterSpacing:e.letterSpacing,lineHeight:e.lineHeight,paragraphIndent:e.paragraphIndent,paragraphSpacing:e.paragraphSpacing,textCase:e.textCase})})),t},pe=e=>{const t=[];return e.forEach((e=>{t.push({name:e.name,id:e.id,description:e.description,effects:e.effects})})),t},ue=(e,t)=>{let i="color",n={};if("VARIABLE_ALIAS"===t.type){const i=figma.variables.getVariableById(t.id),n=figma.variables.getVariableCollectionById(i.variableCollectionId);return{name:e.name,description:e.description||void 0,exportKey:k,category:"alias",values:`{${n.name}.${i.name}}`}}switch(e.resolvedType){case"COLOR":i="color",n={fill:{value:R(t),type:"color",blendMode:"normal"}};break;case"FLOAT":i="size",n=t;break;case"STRING":i="string",n=t;break;case"BOOLEAN":i="boolean",n=t}return{name:e.name,description:e.description||void 0,exportKey:k,category:i,values:n}},ce=e=>{const i=Object.fromEntries(e.variables.getLocalVariableCollections().map((e=>[e.id,e])));return e.variables.getLocalVariables().map((e=>{const{variableCollectionId:n}=e,{name:a,modes:o}=i[n];return Object.entries(e.valuesByMode).map((([i,n])=>Object.assign(Object.assign({},ue(e,n)),{name:`${a}/${o.find((({modeId:e})=>e===i)).name}/${e.name}`,extensions:{[t.key.extensionPluginData]:{mode:o.find((({modeId:e})=>e===i)).name,collection:a,scopes:e.scopes,[t.key.extensionVariableStyleId]:e.id,exportKey:k}}})))})).flat()},de=(e="")=>e.split(",").map((e=>e.replace(/\s+/g,""))),ge=(e,i)=>{const n=((e,t)=>{const i=se([...e.root.children]),n=t.exclusionPrefix.split(",").map((e=>e.replace(/\s+/g,"")));return{tokenFrames:i,paintStyles:ie(e.getLocalPaintStyles()).filter((e=>te(e,n))),gridStyles:ne(e.getLocalGridStyles()).filter((e=>te(e,n))),textStyles:le(e.getLocalTextStyles()).filter((e=>te(e,n))),effectStyles:pe(e.getLocalEffectStyles()).filter((e=>te(e,n)))}})(e,i);return[...(a=n.tokenFrames,o=de(i.prefix.size),a.filter(K(o)).map((e=>({name:e.name,category:"size",exportKey:v,description:e.description||null,values:{width:{value:S(e.width,2),unit:"pixel",type:"number"},height:{value:S(e.height,2),unit:"pixel",type:"number"}},extensions:{[t.key.extensionPluginData]:{exportKey:v}}})))),...X(n.tokenFrames,de(i.prefix.breakpoint)),...W(n.tokenFrames,de(i.prefix.spacing)),...Y(n.tokenFrames,de(i.prefix.border)),...Z(n.tokenFrames,de(i.prefix.radius)),...J(n.tokenFrames,de(i.prefix.motion)),...ee(n.tokenFrames,de(i.prefix.opacity)),...L(n.paintStyles,{color:de(i.prefix.color),gradient:de(i.prefix.gradient),alias:de(i.alias)}),...N(n.gridStyles,de(i.prefix.grid)),...j(n.textStyles,de(i.prefix.font)),...G(n.effectStyles,de(i.prefix.effect)),...ce(e)];var a,o};var ye=function(e,t,i,n){return new(i||(i=Promise))((function(a,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((n=n.apply(e,t||[])).next())}))};figma.showUI(__html__,{themeColors:!0,visible:!1}),[o.export,o.urlExport,o.generalSettings].includes(figma.command)&&ye(void 0,void 0,void 0,(function*(){const o=(()=>{let i=figma.root.getPluginData(t.key.settings);if(""===i)return e;i=JSON.parse(i);const a=n(e,i);return a.prefix=n(e.prefix,a.prefix),a.exports=n(e.exports,a.exports),a})(),r=yield s(figma);var p;figma.ui.resize(t.ui[figma.command].width,t.ui[figma.command].height),void 0!==r&&"patch"!==r&&figma.ui.resize(t.ui[figma.command].width,t.ui[figma.command].height+60),figma.ui.postMessage({command:figma.command,payload:{settings:Object.assign(Object.assign({},o),{accessToken:yield(p=l(figma),a(void 0,void 0,void 0,(function*(){const e=yield figma.clientStorage.getAsync("accessTokens");return void 0!==e&&e instanceof Object&&e[p]||""})))}),data:i(ge(figma,o)),versionDifference:r,metadata:{filename:figma.root.name}}}||{}),figma.ui.show()})),figma.command===o.help&&figma.ui.postMessage({command:o.help,payload:{url:"https://github.com/lukasoppermann/design-tokens"}}),figma.command===o.demo&&figma.ui.postMessage({command:o.demo,payload:{url:"https://www.figma.com/file/2MQ759R5kJtzQn4qSHuqR7/Design-Tokens-for-Figma?node-id=231%3A2"}}),figma.command===o.reset&&(figma.root.setPluginData(t.key.settings,i(e)),figma.notify("⚙️ Settings have been reset."),figma.closePlugin()),figma.ui.onmessage=n=>ye(void 0,void 0,void 0,(function*(){const{command:r,payload:s}=n;var p,u,c;r===o.closePlugin&&(void 0!==(null==s?void 0:s.notification)&&""!==(null==s?void 0:s.notification)&&figma.notify(s.notification),figma.ui.hide(),figma.closePlugin()),r===o.saveSettings&&(c=s.settings,c=Object.assign(Object.assign({},e),c),figma.root.setPluginData(t.key.settings,i(c)),yield(p=l(figma),u=s.accessToken,a(void 0,void 0,void 0,(function*(){const e=(yield figma.clientStorage.getAsync("accessTokens"))||{},t=Object.assign(Object.assign({},e),{[p]:u});return yield figma.clientStorage.setAsync("accessTokens",t)}))),s.closePlugin&&!0===s.closePlugin&&figma.closePlugin())}))})(); \ No newline at end of file +(()=>{"use strict";const e={filename:"design-tokens",extension:".tokens.json",nameConversion:"default",tokenFormat:"standard",compression:!1,urlJsonCompression:!0,serverUrl:void 0,eventType:"update-tokens",accessToken:void 0,acceptHeader:"application/vnd.github.everest-preview+json",contentType:"text/plain;charset=UTF-8",authType:"token",reference:"main",exclusionPrefix:"",excludeExtensionProp:!1,alias:"alias, ref, reference",keyInName:!1,prefixInName:!0,prefix:{color:"color",gradient:"gradient",typography:"typography",font:"font",effect:"effect",grid:"grid",border:"border, borders",breakpoint:"breakpoint, breakpoints",radius:"radius, radii",size:"size, sizes",spacing:"spacing",motion:"motion",opacity:"opacity, opacities"},exports:{color:!0,gradient:!0,font:!0,typography:!0,effect:!0,grid:!0,border:!0,breakpoint:!0,radius:!0,size:!0,spacing:!0,motion:!0,opacity:!0,variables:!0}},t={ui:{generalSettings:{width:550,height:755},export:{width:550,height:356},urlExport:{width:550,height:650}},key:{lastVersionSettingsOpened:"lastVersionSettingsOpened",fileId:"fileId",settings:"settings",extensionPluginData:"org.lukasoppermann.figmaDesignTokens",extensionFigmaStyleId:"styleId",extensionVariableStyleId:"variableId",extensionAlias:"alias",authType:{token:"token",gitlabToken:"gitlab_token",basic:"Basic",bearer:"Bearer"}},exclusionPrefixDefault:["_","."],fileExtensions:[{label:".tokens.json",value:".tokens.json"},{label:".tokens",value:".tokens"},{label:".json",value:".json"}]},i=(e,t=!0)=>!0===t?JSON.stringify(e):JSON.stringify(e,null,2),n=(e,t)=>Object.fromEntries(Object.entries(e).map((([i,n])=>void 0!==n&&typeof t[i]!=typeof n?[i,e[i]]:[i,t[i]])));var a=function(e,t,i,n){return new(i||(i=Promise))((function(a,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((n=n.apply(e,t||[])).next())}))};const o={generalSettings:"generalSettings",export:"export",sendSettings:"sendSettings",urlExport:"urlExport",help:"help",demo:"demo",openUrl:"openUrl",reset:"reset",saveSettings:"saveSettings",closePlugin:"closePlugin"},r="6.8.0";const s=e=>{return i=void 0,n=void 0,o=function*(){const i=yield e.clientStorage.getAsync(t.key.lastVersionSettingsOpened),n=((e,t="1.0.0")=>{const[i,n,a]=t.split("."),[o,r,s]=e.split(".");return i{let i=e.root.getPluginData(t.key.fileId);return void 0!==i&&""!==i||(e.root.setPluginData(t.key.fileId,e.root.name+" "+Math.floor(1e9*Math.random())),i=e.root.getPluginData(t.key.fileId)),i},p="color",u="gradient",c="font",d="effect",g="grid",y="border",m="breakpoint",f="radius",v="size",x="spacing",b="motion",h="opacity",k="variables",S=(e,t=2)=>{if(void 0===e)return;if("number"!=typeof e||"number"!=typeof t)throw new Error(`Invalid parameters, both value "${e}" (${typeof e}) and decimalPlaces "${t}" (${typeof t}) must be of type number`);const i=Math.pow(10,t);return Math.round(e*i)/i},R=(e,t)=>{var i;return{r:S(255*e.r,0),g:S(255*e.g,0),b:S(255*e.b,0),a:S(null!==(i=null!=t?t:e.a)&&void 0!==i?i:1)}},E=e=>"SOLID"===e.type&&!0===e.visible?R(e.color,e.opacity):null,I={fill:{value:{r:0,g:0,b:0,a:0},type:"color",blendMode:"normal"}},T=e=>e?{[t.key.extensionAlias]:e}:{},O={GRADIENT_LINEAR:"linear",GRADIENT_RADIAL:"radial",GRADIENT_ANGULAR:"angular",GRADIENT_DIAMOND:"diamond"},A=([[e,t],[i,n]])=>{const a=Math.atan2(n-t,i-e)*(180/Math.PI)+315;return a>360?a-360:a},L=(e,i)=>e.reduce(((e,n)=>{const a=n.paints.filter((e=>"IMAGE"!==e.type));if(n.paints.length&&0===a.length)return e;n.paints=a;const{alias:o,description:r}=((e="",t)=>{t=t&&0!==t.filter((e=>e)).length?t:["Ref:"];const i=new RegExp("("+t.join("|").toLowerCase()+"):?\\s");let n;const a=e.split(/\r?\n/).filter((e=>!e.toLowerCase().match(i)||(n=e.toLowerCase().replace(i,"").trim(),!1)));return{alias:n,description:a.join("\n")}})(n.description,i.alias),s=(l=n.paints[0],["GRADIENT_LINEAR","GRADIENT_RADIAL","GRADIENT_ANGULAR","GRADIENT_DIAMOND"].includes(null==l?void 0:l.type));var l;const c=n.paints.length?n.paints.map((e=>(e=>{var t;return"SOLID"===e.type?{fill:{value:E(e),type:"color",blendMode:(null===(t=e.blendMode)||void 0===t?void 0:t.toLowerCase())||"normal"}}:["GRADIENT_LINEAR","GRADIENT_RADIAL","GRADIENT_ANGULAR","GRADIENT_DIAMOND"].includes(e.type)?{gradientType:{value:O[e.type],type:"string"},rotation:{value:A(e.gradientTransform),type:"number",unit:"degree"},stops:e.gradientStops.map((e=>({position:{value:S(e.position),type:"number"},color:{value:R(e.color),type:"color"}}))),opacity:{value:S(e.opacity),type:"number"}}:null})(e))):[I];return[...e,{name:`${s?i.gradient[0]:i.color[0]}/${n.name}`,category:s?"gradient":"color",exportKey:s?u:p,description:r,values:c,extensions:{[t.key.extensionPluginData]:Object.assign({[t.key.extensionFigmaStyleId]:n.id,exportKey:s?u:p},T(o))}}]}),[]),N=(e,i)=>e.filter((e=>e.layoutGrids.length>0)).map((e=>({name:`${i[0]}/${e.name}`,category:"grid",exportKey:g,description:e.description||null,values:e.layoutGrids.map((e=>"GRID"===e.pattern?(e=>({pattern:{value:e.pattern.toLowerCase(),type:"string"},sectionSize:{value:e.sectionSize,unit:"pixel",type:"number"}}))(e):(e=>{return Object.assign(Object.assign(Object.assign({pattern:{value:e.pattern.toLowerCase(),type:"string"}},void 0!==e.sectionSize&&{sectionSize:{value:e.sectionSize,unit:"pixel",type:"number"}}),{gutterSize:{value:e.gutterSize,unit:"pixel",type:"number"},alignment:{value:e.alignment.toLowerCase(),type:"string"},count:(t=e.count,t===1/0?{value:"auto",type:"string"}:{value:t,type:"number"})}),void 0!==e.offset&&{offset:{value:e.offset,unit:"pixel",type:"number"}});var t})(e))),extensions:{[t.key.extensionPluginData]:{[t.key.extensionFigmaStyleId]:e.id,exportKey:g}}}))),C={NONE:"none",UNDERLINE:"underline",STRIKETHROUGH:"line-through"},D={ORIGINAL:"none",UPPER:"uppercase",LOWER:"lowercase",TITLE:"capitalize",SMALL_CAPS:"small-caps"},P={100:100,thin:100,200:200,extralight:200,ultralight:200,extraleicht:200,300:300,light:300,leicht:300,400:400,normal:400,regular:400,buch:400,500:500,medium:500,kraeftig:500,kräftig:500,600:600,semibold:600,demibold:600,halbfett:600,700:700,bold:700,dreiviertelfett:700,800:800,extrabold:800,ultabold:800,fett:800,900:900,black:900,heavy:900,super:900,extrafett:900},w={normal:"normal",condensed:"condensed",expanded:"expanded",extended:"expanded"},_={normal:"normal",italic:"italic",kursiv:"italic",oblique:"oblique"},B=e=>{const t=e.toLowerCase().split(" ");let i=t[0];return["extra","ultra","semi","demi"].includes(t[0])&&["bold","light"].includes(t[1])&&(i=`${t[0]}${t[1]}`),P[i]||400},M=e=>{const t=e.toLowerCase().split(" ");return w[t[t.length-1]]||w[t[t.length-2]]||"normal"},z=e=>{const t=e.toLowerCase().split(" ").pop();return _[t]||"normal"},j=(e,i)=>e.map((e=>({name:`${i[0]}/${e.name}`,category:"font",exportKey:c,description:e.description||void 0,values:{fontSize:{value:e.fontSize,unit:"pixel",type:"number"},textDecoration:{value:C[e.textDecoration],type:"string"},fontFamily:{value:e.fontName.family,type:"string"},fontWeight:{value:B(e.fontName.style),type:"number"},fontStyle:{value:z(e.fontName.style),type:"string"},fontStretch:{value:M(e.fontName.style),type:"string"},_fontStyleOld:{value:e.fontName.style,type:"string"},letterSpacing:{value:S(e.letterSpacing.value),unit:"pixels"===e.letterSpacing.unit.toLowerCase()?"pixel":e.letterSpacing.unit.toLowerCase(),type:"number"},lineHeight:{value:S(e.lineHeight.value)||"normal",unit:"pixels"===e.lineHeight.unit.toLowerCase()?"pixel":e.lineHeight.unit.toLowerCase(),type:Object.prototype.hasOwnProperty.call(e.lineHeight,"value")?"number":"string"},paragraphIndent:{value:e.paragraphIndent,unit:"pixel",type:"number"},paragraphSpacing:{value:e.paragraphSpacing,unit:"pixel",type:"number"},textCase:{value:D[e.textCase]||"none",type:"string"}},extensions:{[t.key.extensionPluginData]:{[t.key.extensionFigmaStyleId]:e.id,exportKey:c}}}))),U={LAYER_BLUR:"layerBlur",BACKGROUND_BLUR:"backgroundBlur",DROP_SHADOW:"dropShadow",INNER_SHADOW:"innerShadow"},G=(e,i)=>e.filter((e=>e.effects.length>0)).map((e=>({name:`${i[0]}/${e.name}`,category:"effect",exportKey:d,description:e.description||null,values:e.effects.map((e=>"LAYER_BLUR"===e.type||"BACKGROUND_BLUR"===e.type?(e=>({effectType:{value:U[e.type],type:"string"},radius:{value:e.radius,unit:"pixel",type:"number"}}))(e):(e=>({effectType:{value:U[e.type],type:"string"},radius:{value:e.radius,unit:"pixel",type:"number"},color:{value:R(e.color),type:"color"},offset:{x:{value:e.offset.x,unit:"pixel",type:"number"},y:{value:e.offset.y,unit:"pixel",type:"number"}},spread:{value:e.spread,unit:"pixel",type:"number"}}))(e))),extensions:{[t.key.extensionPluginData]:{[t.key.extensionFigmaStyleId]:e.id,exportKey:d}}}))),K=e=>t=>{if(!Array.isArray(e))return;const i=t.name.substr(0,t.name.indexOf("/")).replace(/\s+/g,"");return 0!==i.length?e.includes(i):void 0},F=e=>{if(Object.prototype.hasOwnProperty.call(e,"direction"))return{direction:{value:e.direction.toLowerCase(),type:"string"}}},$={CUSTOM_CUBIC_BEZIER:{type:"custom-cubicBezier",curveType:"cubicBezier",easing:void 0},CUSTOM_SPRING:{type:"custom-spring",curveType:"spring",easing:void 0},LINEAR:{type:"linear",curveType:"cubicBezier",easing:{x1:0,y1:0,x2:1,y2:1}},EASE_IN:{type:"ease-in",curveType:"cubicBezier",easing:{x1:.41999998688697815,y1:0,x2:1,y2:1}},EASE_OUT:{type:"ease-out",curveType:"cubicBezier",easing:{x1:0,y1:0,x2:.5799999833106995,y2:1}},EASE_IN_AND_OUT:{type:"ease-in-out",curveType:"cubicBezier",easing:{x1:.41999998688697815,y1:0,x2:.5799999833106995,y2:1}},EASE_IN_BACK:{type:"ease-in-back",curveType:"cubicBezier",easing:{x1:.30000001192092896,y1:-.05000000074505806,x2:.699999988079071,y2:-.5}},EASE_OUT_BACK:{type:"ease-out-back",curveType:"cubicBezier",easing:{x1:.44999998807907104,y1:1.4500000476837158,x2:.800000011920929,y2:1}},EASE_IN_AND_OUT_BACK:{type:"ease-in-out-back",curveType:"cubicBezier",easing:{x1:.699999988079071,y1:-.4000000059604645,x2:.4000000059604645,y2:1.399999976158142}},BOUNCY:{type:"bouncy",curveType:"spring",easing:{mass:1,stiffness:600,damping:15}},GENTLE:{type:"gentle",curveType:"spring",easing:{mass:1,stiffness:100,damping:15}},QUICK:{type:"quick",curveType:"spring",easing:{mass:1,stiffness:300,damping:20}},SLOW:{type:"slow",curveType:"spring",easing:{mass:1,stiffness:80,damping:20}}},H=e=>{var t;if("type"in e&&void 0!==$[e.type])return"CUSTOM_CUBIC_BEZIER"===e.type&&($.CUSTOM_CUBIC_BEZIER.easing={x1:e.easingFunctionCubicBezier.x1,y1:e.easingFunctionCubicBezier.y1,x2:e.easingFunctionCubicBezier.x2,y2:e.easingFunctionCubicBezier.y2}),"CUSTOM_SPRING"===e.type&&($.CUSTOM_SPRING.easing={mass:e.easingFunctionSpring.mass,stiffness:e.easingFunctionSpring.stiffness,damping:e.easingFunctionSpring.damping}),{easingType:{value:$[e.type].type,type:"string"},easingCurveType:{value:$[e.type].curveType,type:"string"},easingFunction:(t=$[e.type],"spring"===t.curveType?{mass:{value:t.easing.mass,type:"number"},stiffness:{value:t.easing.stiffness,type:"number"},damping:{value:t.easing.damping,type:"number"}}:"cubicBezier"===t.curveType?{x1:{value:t.easing.x1,type:"number"},x2:{value:t.easing.x2,type:"number"},y1:{value:t.easing.y1,type:"number"},y2:{value:t.easing.y2,type:"number"}}:void 0)}},V=e=>{var t;const i=Object.keys($);return!!(e.reactions.length>0&&"NODE"===(null===(t=e.reactions[0].action)||void 0===t?void 0:t.type)&&null!==e.reactions[0].action.transition&&i.includes(e.reactions[0].action.transition.easing.type))},J=(e,i)=>e.filter(K(i)).filter(V).map((e=>({name:e.name,category:"motion",exportKey:b,description:e.description||null,values:Object.assign(Object.assign({transitionType:{value:e.reactions[0].action.transition.type.toLocaleLowerCase(),type:"string"},duration:{value:Math.round(1e3*(e.reactions[0].action.transition.duration+Number.EPSILON))/1e3,unit:"s",type:"number"}},H(e.reactions[0].action.transition.easing)),F(e.reactions[0].action.transition)),extensions:{[t.key.extensionPluginData]:{exportKey:b}}}))),W=(e,i)=>e.filter(K(i)).map((e=>({name:e.name,category:"spacing",exportKey:x,description:e.description||null,values:{top:{value:S(e.paddingTop,2),unit:"pixel",type:"number"},right:{value:S(e.paddingRight,2),unit:"pixel",type:"number"},bottom:{value:S(e.paddingBottom,2),unit:"pixel",type:"number"},left:{value:S(e.paddingLeft,2),unit:"pixel",type:"number"}},extensions:{[t.key.extensionPluginData]:{exportKey:x}}}))),q={MITER:"miter",BEVEL:"bevel",ROUND:"round"},Q={CENTER:"center",INSIDE:"inside",OUTSIDE:"outside"},Y=(e,i)=>e.filter(K(i)).filter((e=>e.strokes.length>0)).map((e=>({name:e.name,category:"border",exportKey:y,description:e.description||null,values:{strokeAlign:{value:Q[e.strokeAlign],type:"string"},dashPattern:{value:[...void 0!==e.dashPattern&&e.dashPattern.length>0?e.dashPattern:[0,0]],type:"string"},strokeCap:{value:"string"==typeof e.strokeCap?e.strokeCap.toLowerCase():"mixed",type:"string"},strokeJoin:{value:q[e.strokeJoin],type:"string"},strokeMiterLimit:{value:S(e.strokeMiterLimit),unit:"degree",type:"number"},strokeWeight:{value:e.strokeWeight,unit:"pixel",type:"number"},stroke:{value:e.strokes[0],type:"color"}},extensions:{[t.key.extensionPluginData]:{exportKey:y}}}))),Z=(e,i)=>{const n=e=>({topLeft:{value:e.topLeftRadius||0,unit:"pixel",type:"number"},topRight:{value:e.topRightRadius||0,unit:"pixel",type:"number"},bottomRight:{value:e.bottomRightRadius||0,unit:"pixel",type:"number"},bottomLeft:{value:e.bottomLeftRadius||0,unit:"pixel",type:"number"}});return e.filter(K(i)).map((e=>{return{name:e.name,category:"radius",exportKey:f,description:e.description||null,values:Object.assign(Object.assign({},"number"==typeof e.cornerRadius&&{radius:{value:e.cornerRadius,unit:"pixel",type:"number"}}),{radiusType:{value:(i=e.cornerRadius,"number"==typeof i?"single":"mixed"),type:"string"},radii:n(e),smoothing:{value:S(e.cornerSmoothing,2),comment:"Percent as decimal from 0.0 - 1.0",type:"number"}}),extensions:{[t.key.extensionPluginData]:{exportKey:f}}};var i}))},X=(e,i)=>e.filter(K(i)).map((e=>({name:e.name,category:"breakpoint",exportKey:m,description:e.description||null,values:{width:{value:S(e.width,2),unit:"pixel",type:"number"},height:{value:S(e.height,2),unit:"pixel",type:"number"}},extensions:{[t.key.extensionPluginData]:{exportKey:m}}}))),ee=(e,i)=>e.filter(K(i)).map((e=>({name:e.name,category:"opacity",exportKey:h,description:e.description||null,values:{opacity:{value:S(e.opacity,2),type:"number"}},extensions:{[t.key.extensionPluginData]:{exportKey:h}}}))),te=(e,i)=>!(e=>[...t.exclusionPrefixDefault,...e])(i).includes(e.name.trim().substr(0,1)),ie=e=>{const t=[];return e.forEach((e=>{t.push({name:e.name,id:e.id,description:e.description,paints:e.paints})})),t},ne=e=>{const t=[];return e.forEach((e=>{t.push({name:e.name,id:e.id,description:e.description,layoutGrids:e.layoutGrids})})),t},ae=e=>{var t,i;return{name:e.name,description:e.description||void 0,bottomLeftRadius:e.bottomLeftRadius,bottomRightRadius:e.bottomRightRadius,topLeftRadius:e.topLeftRadius,topRightRadius:e.topRightRadius,cornerRadius:e.cornerRadius||void 0,cornerSmoothing:e.cornerSmoothing,strokes:(i=e.strokes,[...i].map((e=>E(e))).filter((e=>null!=e))),strokeWeight:e.strokeWeight,strokeStyleId:e.strokeStyleId,strokeMiterLimit:e.strokeMiterLimit,strokeJoin:e.strokeJoin,strokeCap:e.strokeCap,dashPattern:e.dashPattern,strokeAlign:e.strokeAlign,width:e.width,height:e.height,reactions:e.reactions||void 0,paddingTop:e.paddingTop||0,paddingRight:e.paddingRight||0,paddingBottom:e.paddingBottom||0,paddingLeft:e.paddingLeft||0,opacity:null!==(t=e.opacity)&&void 0!==t?t:1}},oe=["COMPONENT","COMPONENT_SET","RECTANGLE","FRAME"],re="_tokens",se=e=>[...e.map((e=>e.findChildren((e=>(e=>"FRAME"===e.type&&e.name.trim().toLowerCase().substr(0,re.length)===re)(e))))).reduce(((e,t)=>[...e,...t]))].map((e=>e.findAll((e=>(e=>"COMPONENT_SET"!==e.parent.type&&oe.includes(e.type)&&e.name.length>0)(e))))).reduce(((e,t)=>[...e,...t]),[]).map((e=>("RECTANGLE"!==e.type&&"FRAME"!==e.type||console.warn("Please use only main components and variants, other types may be deprecated as tokens in the future"),"COMPONENT_SET"===e.type?e.children.map((t=>{return Object.assign(Object.assign({},ae(t)),{name:(i=e.name,n=t.name,`${i}/${n=n.split(",").filter((e=>!["_","."].includes(e.trim().substr(0,1)))).map((e=>e.split("=")[1])).join("/")}`)});var i,n})):[ae(e)]))).reduce(((e,t)=>[...e,...t]),[]),le=e=>{const t=[];return e.forEach((e=>{t.push({name:e.name,id:e.id,description:e.description,fontSize:e.fontSize,textDecoration:e.textDecoration,fontName:e.fontName,letterSpacing:e.letterSpacing,lineHeight:e.lineHeight,paragraphIndent:e.paragraphIndent,paragraphSpacing:e.paragraphSpacing,textCase:e.textCase})})),t},pe=e=>{const t=[];return e.forEach((e=>{t.push({name:e.name,id:e.id,description:e.description,effects:e.effects})})),t},ue=(e,t)=>{let i="color",n={};if("VARIABLE_ALIAS"===t.type){const i=figma.variables.getVariableById(t.id),n=figma.variables.getVariableCollectionById(i.variableCollectionId);return{name:e.name,description:e.description||void 0,exportKey:k,category:"alias",values:`{${n.name}.${i.name}}`}}switch(e.resolvedType){case"COLOR":i="color",n={fill:{value:R(t),type:"color",blendMode:"normal"}};break;case"FLOAT":i="size",n=t;break;case"STRING":i="string",n=t;break;case"BOOLEAN":i="boolean",n=t}return{name:e.name,description:e.description||void 0,exportKey:k,category:i,values:n}},ce=e=>{const i=Object.fromEntries(e.variables.getLocalVariableCollections().map((e=>[e.id,e])));return e.variables.getLocalVariables().map((e=>{const{variableCollectionId:n}=e,{name:a,modes:o}=i[n];return Object.entries(e.valuesByMode).map((([i,n])=>Object.assign(Object.assign({},ue(e,n)),{name:`${a}/${o.find((({modeId:e})=>e===i)).name}/${e.name}`,extensions:{[t.key.extensionPluginData]:{mode:o.find((({modeId:e})=>e===i)).name,collection:a,scopes:e.scopes,[t.key.extensionVariableStyleId]:e.id,exportKey:k}}})))})).flat()},de=(e="")=>e.split(",").map((e=>e.replace(/\s+/g,""))),ge=(e,i)=>{const n=((e,t)=>{const i=se([...e.root.children]),n=t.exclusionPrefix.split(",").map((e=>e.replace(/\s+/g,"")));return{tokenFrames:i,paintStyles:ie(e.getLocalPaintStyles()).filter((e=>te(e,n))),gridStyles:ne(e.getLocalGridStyles()).filter((e=>te(e,n))),textStyles:le(e.getLocalTextStyles()).filter((e=>te(e,n))),effectStyles:pe(e.getLocalEffectStyles()).filter((e=>te(e,n)))}})(e,i);return[...(a=n.tokenFrames,o=de(i.prefix.size),a.filter(K(o)).map((e=>({name:e.name,category:"size",exportKey:v,description:e.description||null,values:{width:{value:S(e.width,2),unit:"pixel",type:"number"},height:{value:S(e.height,2),unit:"pixel",type:"number"}},extensions:{[t.key.extensionPluginData]:{exportKey:v}}})))),...X(n.tokenFrames,de(i.prefix.breakpoint)),...W(n.tokenFrames,de(i.prefix.spacing)),...Y(n.tokenFrames,de(i.prefix.border)),...Z(n.tokenFrames,de(i.prefix.radius)),...J(n.tokenFrames,de(i.prefix.motion)),...ee(n.tokenFrames,de(i.prefix.opacity)),...L(n.paintStyles,{color:de(i.prefix.color),gradient:de(i.prefix.gradient),alias:de(i.alias)}),...N(n.gridStyles,de(i.prefix.grid)),...j(n.textStyles,de(i.prefix.font)),...G(n.effectStyles,de(i.prefix.effect)),...ce(e)];var a,o};var ye=function(e,t,i,n){return new(i||(i=Promise))((function(a,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((n=n.apply(e,t||[])).next())}))};figma.showUI(__html__,{themeColors:!0,visible:!1}),[o.export,o.urlExport,o.generalSettings].includes(figma.command)&&ye(void 0,void 0,void 0,(function*(){const o=(()=>{let i=figma.root.getPluginData(t.key.settings);if(""===i)return e;i=JSON.parse(i);const a=n(e,i);return a.prefix=n(e.prefix,a.prefix),a.exports=n(e.exports,a.exports),a})(),r=yield s(figma);var p;figma.ui.resize(t.ui[figma.command].width,t.ui[figma.command].height),void 0!==r&&"patch"!==r&&figma.ui.resize(t.ui[figma.command].width,t.ui[figma.command].height+60),figma.ui.postMessage({command:figma.command,payload:{settings:Object.assign(Object.assign({},o),{accessToken:yield(p=l(figma),a(void 0,void 0,void 0,(function*(){const e=yield figma.clientStorage.getAsync("accessTokens");return void 0!==e&&e instanceof Object&&e[p]||""})))}),data:i(ge(figma,o)),versionDifference:r,metadata:{filename:figma.root.name}}}||{}),figma.ui.show()})),figma.command===o.help&&figma.ui.postMessage({command:o.help,payload:{url:"https://github.com/lukasoppermann/design-tokens"}}),figma.command===o.demo&&figma.ui.postMessage({command:o.demo,payload:{url:"https://www.figma.com/file/2MQ759R5kJtzQn4qSHuqR7/Design-Tokens-for-Figma?node-id=231%3A2"}}),figma.command===o.reset&&(figma.root.setPluginData(t.key.settings,i(e)),figma.notify("⚙️ Settings have been reset."),figma.closePlugin()),figma.ui.onmessage=n=>ye(void 0,void 0,void 0,(function*(){const{command:r,payload:s}=n;var p,u,c;r===o.closePlugin&&(void 0!==(null==s?void 0:s.notification)&&""!==(null==s?void 0:s.notification)&&figma.notify(s.notification),figma.ui.hide(),figma.closePlugin()),r===o.saveSettings&&(c=s.settings,c=Object.assign(Object.assign({},e),c),figma.root.setPluginData(t.key.settings,i(c)),yield(p=l(figma),u=s.accessToken,a(void 0,void 0,void 0,(function*(){const e=(yield figma.clientStorage.getAsync("accessTokens"))||{},t=Object.assign(Object.assign({},e),{[p]:u});return yield figma.clientStorage.setAsync("accessTokens",t)}))),s.closePlugin&&!0===s.closePlugin&&figma.closePlugin())}))})(); \ No newline at end of file diff --git a/dist/ui.html b/dist/ui.html index 76a4c30d..c653a043 100644 --- a/dist/ui.html +++ b/dist/ui.html @@ -605,7 +605,7 @@ padding: 0 var(--size-xxxsmall) 0 var(--size-xxsmall); color: var(--figma-color-text-secondary); margin-top: 0; -`,kn=e=>["color","gradient","grid","effect","font"].includes(e),En=()=>{const[n,t]=(0,e.useState)(!1),{figmaUIApi:r,figmaMetaData:a}=(0,e.useContext)(rn),{settings:l,updateSettings:o}=(0,e.useContext)(an);return e.createElement("form",{className:yn,onSubmit:e=>{if(e.preventDefault(),!0===e.target.checkValidity()){const{accessToken:e}=l,n=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);ao((n=>{n.keyInName=e}))}),e.createElement(gn,{width:240,label:'The token type (e.g. "color" or "font") will be added to the name e.g. "color/light/bg".'})),e.createElement(Je,{size:"small",weight:"bold"},"Filename",e.createElement(gn,{width:160,label:"The file name used when exporting the tokens"})),e.createElement("div",{className:"grid-2-col"},e.createElement(qe,{type:"text",required:!0,pattern:"^[\\w\\d\\s\\[\\]._-]+$",placeholder:a.filename,value:l.filename,onChange:e=>o((n=>{n.filename=e}))}),e.createElement(Ge,{defaultValue:l.extension,onChange:({value:e})=>o((n=>{n.extension=e})),placeholder:"file extension",options:sn.fileExtensions})),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Name conversion"),e.createElement(Ge,{defaultValue:l.nameConversion,onChange:({value:e})=>o((n=>{n.nameConversion=e})),placeholder:"Name conversion",options:[{label:"Default",value:"default"},{label:"camelCase",value:"camelCase"},{label:"kebab-case",value:"kebabCase"}]})),e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Token format",e.createElement(gn,{width:240,label:"The structure of the output json file. Learn more in the docs."})),e.createElement(Ge,{defaultValue:l.tokenFormat,onChange:({value:e})=>{o((n=>{n.tokenFormat=e})),t("standard"===e)},placeholder:"Token format",options:[{label:"Standard (W3C draft)",value:"standard"},{label:"Original (deprecated)",value:"original"}]}))),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Exclusion prefix ",e.createElement(gn,{width:240,label:'Styles & tokens with this prefix will be ignored when exporting. ("." and "_" work by default)'})),e.createElement(qe,{type:"text",pattern:"^[#\\+*\\\\/&%$!?;:~,\\s]+$",placeholder:"#, @",value:l.exclusionPrefix,onChange:e=>o((n=>{n.exclusionPrefix=e}))})),n&&e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Alias identifier ",e.createElement(gn,{width:180,label:"Use to define an alias for a token; case insensitive"})),e.createElement(qe,{type:"text",pattern:"^[A-Za-z,\\s]+$",placeholder:"alias, ref, reference",value:l.alias,onChange:e=>o((n=>{n.alias=e}))}))),e.createElement(mn,null),e.createElement(Je,{size:"small",weight:"bold"},"Token prefixes ",e.createElement(gn,{width:150,label:"Use commas to separate multiple prefixed"})),e.createElement(nn,{className:wn,size:"small"},'Prefixes are the first part of a tokens name e.g. "radius" in "radius/small". They are used to identify the type of a custom token.'),e.createElement(fn,null,e.createElement(Be,{label:"Include token prefix in token names",type:"switch",checked:l.prefixInName,onChange:e=>o((n=>{n.prefixInName=e}))}),e.createElement(gn,{width:240,label:'When disabled the prefix is removed ("radius/small" → "small"), when enabled it is added ("radius/small" → "radius/small").'})),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},Object.entries(l.prefix).map((([n,t])=>e.createElement(fn,{fill:!0,key:n},e.createElement(Ze,{className:`${xn} flex-grow--none`},n,kn(n)?e.createElement(gn,{width:90,label:"Prefix for style"}):""),e.createElement(qe,{type:"text",pattern:kn(n)?"^[\\w\\-@]+$":"^[\\w\\-@,\\s]+$",required:!0,placeholder:n,value:t,onChange:e=>o((t=>{t.prefix[n]=e}))}))))),e.createElement(cn,null,e.createElement(bn,{align:"start",href:"https://github.com/lukasoppermann/design-tokens#design-tokens"},"Documentation"),e.createElement(on,null),e.createElement(He,{type:"submit",autofocus:!0},"Save changes")))};function zn(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r3?n.i-4:n.i:Array.isArray(e)?1:An(e)?2:Ln(e)?3:0}function Pn(e,n){return 2===Mn(e)?e.has(n):Object.prototype.hasOwnProperty.call(e,n)}function On(e,n,t){var r=Mn(e);2===r?e.set(n,t):3===r?(e.delete(n),e.add(t)):e[n]=t}function An(e){return lt&&e instanceof Map}function Ln(e){return ot&&e instanceof Set}function Nn(e){return e.o||e.t}function Rn(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var n=pt(e);delete n[ct];for(var t=ft(n),r=0;r1&&(e.set=e.add=e.clear=e.delete=Fn),Object.freeze(e),n&&_n(e,(function(e,n){return Tn(n,!0)}),!0)),e}function Fn(){zn(2)}function Dn(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function In(e){var n=gt[e];return n||zn(18,e),n}function Un(){return rt}function jn(e,n){n&&(In("Patches"),e.u=[],e.s=[],e.v=n)}function $n(e){Hn(e),e.p.forEach(Bn),e.p=null}function Hn(e){e===rt&&(rt=e.l)}function Vn(e){return rt={p:[],l:rt,h:e,m:!0,_:0}}function Bn(e){var n=e[ct];0===n.i||1===n.i?n.j():n.O=!0}function Wn(e,n){n._=n.p.length;var t=n.p[0],r=void 0!==e&&e!==t;return n.h.g||In("ES5").S(n,e,r),r?(t[ct].P&&($n(n),zn(4)),Sn(e)&&(e=qn(n,e),n.l||Kn(n,e)),n.u&&In("Patches").M(t[ct].t,e,n.u,n.s)):e=qn(n,t,[]),$n(n),n.u&&n.v(n.u,n.s),e!==st?e:void 0}function qn(e,n,t){if(Dn(n))return n;var r=n[ct];if(!r)return _n(n,(function(a,l){return Qn(e,r,n,a,l,t)}),!0),n;if(r.A!==e)return n;if(!r.P)return Kn(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var a=4===r.i||5===r.i?r.o=Rn(r.k):r.o;_n(3===r.i?new Set(a):a,(function(n,l){return Qn(e,r,a,n,l,t)})),Kn(e,a,!1),t&&e.u&&In("Patches").R(r,t,e.u,e.s)}return r.o}function Qn(e,n,t,r,a,l){if(Cn(a)){var o=qn(e,a,l&&n&&3!==n.i&&!Pn(n.D,r)?l.concat(r):void 0);if(On(t,r,o),!Cn(o))return;e.m=!1}if(Sn(a)&&!Dn(a)){if(!e.h.F&&e._<1)return;qn(e,a),n&&n.A.l||Kn(e,a)}}function Kn(e,n,t){void 0===t&&(t=!1),e.h.F&&e.m&&Tn(n,t)}function Gn(e,n){var t=e[ct];return(t?Nn(t):e)[n]}function Yn(e,n){if(n in e)for(var t=Object.getPrototypeOf(e);t;){var r=Object.getOwnPropertyDescriptor(t,n);if(r)return r;t=Object.getPrototypeOf(t)}}function Zn(e){e.P||(e.P=!0,e.l&&Zn(e.l))}function Xn(e){e.o||(e.o=Rn(e.t))}function Jn(e,n,t){var r=An(n)?In("MapSet").N(n,t):Ln(n)?In("MapSet").T(n,t):e.g?function(e,n){var t=Array.isArray(e),r={i:t?1:0,A:n?n.A:Un(),P:!1,I:!1,D:{},l:n,t:e,k:null,o:null,j:null,C:!1},a=r,l=ht;t&&(a=[r],l=mt);var o=Proxy.revocable(a,l),i=o.revoke,s=o.proxy;return r.k=s,r.j=i,s}(n,t):In("ES5").J(n,t);return(t?t.A:Un()).p.push(r),r}function et(e){return Cn(e)||zn(22,e),function e(n){if(!Sn(n))return n;var t,r=n[ct],a=Mn(n);if(r){if(!r.P&&(r.i<4||!In("ES5").K(r)))return r.t;r.I=!0,t=nt(n,a),r.I=!1}else t=nt(n,a);return _n(t,(function(n,a){r&&function(e,n){return 2===Mn(e)?e.get(n):e[n]}(r.t,n)===a||On(t,n,e(a))})),3===a?new Set(t):t}(e)}function nt(e,n){switch(n){case 2:return new Map(e);case 3:return Array.from(e)}return Rn(e)}var tt,rt,at="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),lt="undefined"!=typeof Map,ot="undefined"!=typeof Set,it="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,st=at?Symbol.for("immer-nothing"):((tt={})["immer-nothing"]=!0,tt),ut=at?Symbol.for("immer-draftable"):"__$immer_draftable",ct=at?Symbol.for("immer-state"):"__$immer_state",dt=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ft="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,pt=Object.getOwnPropertyDescriptors||function(e){var n={};return ft(e).forEach((function(t){n[t]=Object.getOwnPropertyDescriptor(e,t)})),n},gt={},ht={get:function(e,n){if(n===ct)return e;var t=Nn(e);if(!Pn(t,n))return function(e,n,t){var r,a=Yn(n,t);return a?"value"in a?a.value:null===(r=a.get)||void 0===r?void 0:r.call(e.k):void 0}(e,t,n);var r=t[n];return e.I||!Sn(r)?r:r===Gn(e.t,n)?(Xn(e),e.o[n]=Jn(e.A.h,r,e)):r},has:function(e,n){return n in Nn(e)},ownKeys:function(e){return Reflect.ownKeys(Nn(e))},set:function(e,n,t){var r=Yn(Nn(e),n);if(null==r?void 0:r.set)return r.set.call(e.k,t),!0;if(!e.P){var a=Gn(Nn(e),n),l=null==a?void 0:a[ct];if(l&&l.t===t)return e.o[n]=t,e.D[n]=!1,!0;if(function(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}(t,a)&&(void 0!==t||Pn(e.t,n)))return!0;Xn(e),Zn(e)}return e.o[n]===t&&"number"!=typeof t&&(void 0!==t||n in e.o)||(e.o[n]=t,e.D[n]=!0,!0)},deleteProperty:function(e,n){return void 0!==Gn(e.t,n)||n in e.t?(e.D[n]=!1,Xn(e),Zn(e)):delete e.D[n],e.o&&delete e.o[n],!0},getOwnPropertyDescriptor:function(e,n){var t=Nn(e),r=Reflect.getOwnPropertyDescriptor(t,n);return r?{writable:!0,configurable:1!==e.i||"length"!==n,enumerable:r.enumerable,value:t[n]}:r},defineProperty:function(){zn(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){zn(12)}},mt={};_n(ht,(function(e,n){mt[e]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)}})),mt.deleteProperty=function(e,n){return mt.set.call(this,e,n,void 0)},mt.set=function(e,n,t){return ht.set.call(this,e[0],n,t,e[0])};var vt=function(){function e(e){var n=this;this.g=it,this.F=!0,this.produce=function(e,t,r){if("function"==typeof e&&"function"!=typeof t){var a=t;t=e;var l=n;return function(e){var n=this;void 0===e&&(e=a);for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i1?r-1:0),l=1;l=0;t--){var r=n[t];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}t>-1&&(n=n.slice(t+1));var a=In("Patches").$;return Cn(e)?a(e,n):this.produce(e,(function(e){return a(e,n)}))},e}(),bt=new vt,yt=bt.produce;bt.produceWithPatches.bind(bt),bt.setAutoFreeze.bind(bt),bt.setUseProxies.bind(bt),bt.applyPatches.bind(bt),bt.createDraft.bind(bt),bt.finishDraft.bind(bt);const xt=yt,wt=je` +`,kn=e=>["color","gradient","grid","effect","font"].includes(e),En=()=>{const[n,t]=(0,e.useState)(!1),{figmaUIApi:r,figmaMetaData:a}=(0,e.useContext)(rn),{settings:l,updateSettings:o}=(0,e.useContext)(an);return e.createElement("form",{className:yn,onSubmit:e=>{if(e.preventDefault(),!0===e.target.checkValidity()){const{accessToken:e}=l,n=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);ao((n=>{n.keyInName=e}))}),e.createElement(gn,{width:240,label:'The token type (e.g. "color" or "font") will be added to the name e.g. "color/light/bg".'})),e.createElement(Je,{size:"small",weight:"bold"},"Filename",e.createElement(gn,{width:160,label:"The file name used when exporting the tokens"})),e.createElement("div",{className:"grid-2-col"},e.createElement(qe,{type:"text",required:!0,pattern:"^[\\w\\d\\s\\[\\]._\\-]+$",placeholder:a.filename,value:l.filename,onChange:e=>o((n=>{n.filename=e}))}),e.createElement(Ge,{defaultValue:l.extension,onChange:({value:e})=>o((n=>{n.extension=e})),placeholder:"file extension",options:sn.fileExtensions})),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Name conversion"),e.createElement(Ge,{defaultValue:l.nameConversion,onChange:({value:e})=>o((n=>{n.nameConversion=e})),placeholder:"Name conversion",options:[{label:"Default",value:"default"},{label:"camelCase",value:"camelCase"},{label:"kebab-case",value:"kebabCase"}]})),e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Token format",e.createElement(gn,{width:240,label:"The structure of the output json file. Learn more in the docs."})),e.createElement(Ge,{defaultValue:l.tokenFormat,onChange:({value:e})=>{o((n=>{n.tokenFormat=e})),t("standard"===e)},placeholder:"Token format",options:[{label:"Standard (W3C draft)",value:"standard"},{label:"Original (deprecated)",value:"original"}]}))),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Exclusion prefix"," ",e.createElement(gn,{width:240,label:'Styles & tokens with this prefix will be ignored when exporting. ("." and "_" work by default)'})),e.createElement(qe,{type:"text",pattern:"^[#\\+*\\\\/&%$!?;:~,\\s]+$",placeholder:"#, @",value:l.exclusionPrefix,onChange:e=>o((n=>{n.exclusionPrefix=e}))})),n&&e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Alias identifier"," ",e.createElement(gn,{width:180,label:"Use to define an alias for a token; case insensitive"})),e.createElement(qe,{type:"text",pattern:"^[A-Za-z,\\s]+$",placeholder:"alias, ref, reference",value:l.alias,onChange:e=>o((n=>{n.alias=e}))}))),e.createElement(mn,null),e.createElement(Je,{size:"small",weight:"bold"},"Token prefixes"," ",e.createElement(gn,{width:150,label:"Use commas to separate multiple prefixed"})),e.createElement(nn,{className:wn,size:"small"},'Prefixes are the first part of a tokens name e.g. "radius" in "radius/small". They are used to identify the type of a custom token.'),e.createElement(fn,null,e.createElement(Be,{label:"Include token prefix in token names",type:"switch",checked:l.prefixInName,onChange:e=>o((n=>{n.prefixInName=e}))}),e.createElement(gn,{width:240,label:'When disabled the prefix is removed ("radius/small" → "small"), when enabled it is added ("radius/small" → "radius/small").'})),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},Object.entries(l.prefix).map((([n,t])=>e.createElement(fn,{fill:!0,key:n},e.createElement(Ze,{className:`${xn} flex-grow--none`},n,kn(n)?e.createElement(gn,{width:90,label:"Prefix for style"}):""),e.createElement(qe,{type:"text",pattern:kn(n)?"^[\\w\\-@]+$":"^[\\w\\-@,\\s]+$",required:!0,placeholder:n,value:t,onChange:e=>o((t=>{t.prefix[n]=e}))}))))),e.createElement(cn,null,e.createElement(bn,{align:"start",href:"https://github.com/lukasoppermann/design-tokens#design-tokens"},"Documentation"),e.createElement(on,null),e.createElement(He,{type:"submit",autofocus:!0},"Save changes")))};function zn(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r3?n.i-4:n.i:Array.isArray(e)?1:An(e)?2:Ln(e)?3:0}function Pn(e,n){return 2===Mn(e)?e.has(n):Object.prototype.hasOwnProperty.call(e,n)}function On(e,n,t){var r=Mn(e);2===r?e.set(n,t):3===r?(e.delete(n),e.add(t)):e[n]=t}function An(e){return lt&&e instanceof Map}function Ln(e){return ot&&e instanceof Set}function Nn(e){return e.o||e.t}function Rn(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var n=pt(e);delete n[ct];for(var t=ft(n),r=0;r1&&(e.set=e.add=e.clear=e.delete=Fn),Object.freeze(e),n&&_n(e,(function(e,n){return Tn(n,!0)}),!0)),e}function Fn(){zn(2)}function Dn(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function In(e){var n=gt[e];return n||zn(18,e),n}function Un(){return rt}function jn(e,n){n&&(In("Patches"),e.u=[],e.s=[],e.v=n)}function $n(e){Hn(e),e.p.forEach(Bn),e.p=null}function Hn(e){e===rt&&(rt=e.l)}function Vn(e){return rt={p:[],l:rt,h:e,m:!0,_:0}}function Bn(e){var n=e[ct];0===n.i||1===n.i?n.j():n.O=!0}function Wn(e,n){n._=n.p.length;var t=n.p[0],r=void 0!==e&&e!==t;return n.h.g||In("ES5").S(n,e,r),r?(t[ct].P&&($n(n),zn(4)),Sn(e)&&(e=qn(n,e),n.l||Kn(n,e)),n.u&&In("Patches").M(t[ct].t,e,n.u,n.s)):e=qn(n,t,[]),$n(n),n.u&&n.v(n.u,n.s),e!==st?e:void 0}function qn(e,n,t){if(Dn(n))return n;var r=n[ct];if(!r)return _n(n,(function(a,l){return Qn(e,r,n,a,l,t)}),!0),n;if(r.A!==e)return n;if(!r.P)return Kn(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var a=4===r.i||5===r.i?r.o=Rn(r.k):r.o;_n(3===r.i?new Set(a):a,(function(n,l){return Qn(e,r,a,n,l,t)})),Kn(e,a,!1),t&&e.u&&In("Patches").R(r,t,e.u,e.s)}return r.o}function Qn(e,n,t,r,a,l){if(Cn(a)){var o=qn(e,a,l&&n&&3!==n.i&&!Pn(n.D,r)?l.concat(r):void 0);if(On(t,r,o),!Cn(o))return;e.m=!1}if(Sn(a)&&!Dn(a)){if(!e.h.F&&e._<1)return;qn(e,a),n&&n.A.l||Kn(e,a)}}function Kn(e,n,t){void 0===t&&(t=!1),e.h.F&&e.m&&Tn(n,t)}function Gn(e,n){var t=e[ct];return(t?Nn(t):e)[n]}function Yn(e,n){if(n in e)for(var t=Object.getPrototypeOf(e);t;){var r=Object.getOwnPropertyDescriptor(t,n);if(r)return r;t=Object.getPrototypeOf(t)}}function Zn(e){e.P||(e.P=!0,e.l&&Zn(e.l))}function Xn(e){e.o||(e.o=Rn(e.t))}function Jn(e,n,t){var r=An(n)?In("MapSet").N(n,t):Ln(n)?In("MapSet").T(n,t):e.g?function(e,n){var t=Array.isArray(e),r={i:t?1:0,A:n?n.A:Un(),P:!1,I:!1,D:{},l:n,t:e,k:null,o:null,j:null,C:!1},a=r,l=ht;t&&(a=[r],l=mt);var o=Proxy.revocable(a,l),i=o.revoke,s=o.proxy;return r.k=s,r.j=i,s}(n,t):In("ES5").J(n,t);return(t?t.A:Un()).p.push(r),r}function et(e){return Cn(e)||zn(22,e),function e(n){if(!Sn(n))return n;var t,r=n[ct],a=Mn(n);if(r){if(!r.P&&(r.i<4||!In("ES5").K(r)))return r.t;r.I=!0,t=nt(n,a),r.I=!1}else t=nt(n,a);return _n(t,(function(n,a){r&&function(e,n){return 2===Mn(e)?e.get(n):e[n]}(r.t,n)===a||On(t,n,e(a))})),3===a?new Set(t):t}(e)}function nt(e,n){switch(n){case 2:return new Map(e);case 3:return Array.from(e)}return Rn(e)}var tt,rt,at="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),lt="undefined"!=typeof Map,ot="undefined"!=typeof Set,it="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,st=at?Symbol.for("immer-nothing"):((tt={})["immer-nothing"]=!0,tt),ut=at?Symbol.for("immer-draftable"):"__$immer_draftable",ct=at?Symbol.for("immer-state"):"__$immer_state",dt=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ft="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,pt=Object.getOwnPropertyDescriptors||function(e){var n={};return ft(e).forEach((function(t){n[t]=Object.getOwnPropertyDescriptor(e,t)})),n},gt={},ht={get:function(e,n){if(n===ct)return e;var t=Nn(e);if(!Pn(t,n))return function(e,n,t){var r,a=Yn(n,t);return a?"value"in a?a.value:null===(r=a.get)||void 0===r?void 0:r.call(e.k):void 0}(e,t,n);var r=t[n];return e.I||!Sn(r)?r:r===Gn(e.t,n)?(Xn(e),e.o[n]=Jn(e.A.h,r,e)):r},has:function(e,n){return n in Nn(e)},ownKeys:function(e){return Reflect.ownKeys(Nn(e))},set:function(e,n,t){var r=Yn(Nn(e),n);if(null==r?void 0:r.set)return r.set.call(e.k,t),!0;if(!e.P){var a=Gn(Nn(e),n),l=null==a?void 0:a[ct];if(l&&l.t===t)return e.o[n]=t,e.D[n]=!1,!0;if(function(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}(t,a)&&(void 0!==t||Pn(e.t,n)))return!0;Xn(e),Zn(e)}return e.o[n]===t&&"number"!=typeof t&&(void 0!==t||n in e.o)||(e.o[n]=t,e.D[n]=!0,!0)},deleteProperty:function(e,n){return void 0!==Gn(e.t,n)||n in e.t?(e.D[n]=!1,Xn(e),Zn(e)):delete e.D[n],e.o&&delete e.o[n],!0},getOwnPropertyDescriptor:function(e,n){var t=Nn(e),r=Reflect.getOwnPropertyDescriptor(t,n);return r?{writable:!0,configurable:1!==e.i||"length"!==n,enumerable:r.enumerable,value:t[n]}:r},defineProperty:function(){zn(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){zn(12)}},mt={};_n(ht,(function(e,n){mt[e]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)}})),mt.deleteProperty=function(e,n){return mt.set.call(this,e,n,void 0)},mt.set=function(e,n,t){return ht.set.call(this,e[0],n,t,e[0])};var vt=function(){function e(e){var n=this;this.g=it,this.F=!0,this.produce=function(e,t,r){if("function"==typeof e&&"function"!=typeof t){var a=t;t=e;var l=n;return function(e){var n=this;void 0===e&&(e=a);for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i1?r-1:0),l=1;l=0;t--){var r=n[t];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}t>-1&&(n=n.slice(t+1));var a=In("Patches").$;return Cn(e)?a(e,n):this.produce(e,(function(e){return a(e,n)}))},e}(),bt=new vt,yt=bt.produce;bt.produceWithPatches.bind(bt),bt.setAutoFreeze.bind(bt),bt.setUseProxies.bind(bt),bt.applyPatches.bind(bt),bt.createDraft.bind(bt),bt.finishDraft.bind(bt);const xt=yt,wt=je` font-family: var(--font-stack); font-size: var(--font-size-xsmall); font-weight: var(--font-weight-normal); @@ -637,7 +637,7 @@ margin-right: var(--size-xxsmall); margin-left: var(--size-xxxsmall); } -`,kt=({versionDifference:n})=>"major"!==n&&"minor"!==n?e.createElement(e.Fragment,null):e.createElement("div",{id:"versionNotice",className:wt},e.createElement("div",{className:"icon"},"🎉"),e.createElement("div",null,"The ",e.createElement("a",{className:"subtle",href:"https://www.figma.com/community/plugin/888356646278934516/Design-Tokens",target:"_blank",rel:"noreferrer"},"Design Token plugin")," was updated.",e.createElement("br",null),"Find out about changes & new features in the ",e.createElement("a",{href:"https://github.com/lukasoppermann/design-tokens/releases",target:"_blank",rel:"noreferrer"},"release notes →"))),Et={filename:"design-tokens",extension:".tokens.json",nameConversion:"default",tokenFormat:"standard",compression:!1,urlJsonCompression:!0,serverUrl:void 0,eventType:"update-tokens",accessToken:void 0,acceptHeader:"application/vnd.github.everest-preview+json",contentType:"text/plain;charset=UTF-8",authType:"token",reference:"main",exclusionPrefix:"",excludeExtensionProp:!1,alias:"alias, ref, reference",keyInName:!1,prefixInName:!0,prefix:{color:"color",gradient:"gradient",typography:"typography",font:"font",effect:"effect",grid:"grid",border:"border, borders",breakpoint:"breakpoint, breakpoints",radius:"radius, radii",size:"size, sizes",spacing:"spacing",motion:"motion",opacity:"opacity, opacities"},exports:{color:!0,gradient:!0,font:!0,typography:!0,effect:!0,grid:!0,border:!0,breakpoint:!0,radius:!0,size:!0,spacing:!0,motion:!0,opacity:!0,variables:!0}};function zt(e,n){(function(e){return"string"==typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var t=function(e){return"string"==typeof e&&-1!==e.indexOf("%")}(e);return e=360===n?e:Math.min(n,Math.max(0,parseFloat(e))),t&&(e=parseInt(String(e*n),10)/100),Math.abs(e-n)<1e-6?1:e=360===n?(e<0?e%n+n:e%n)/parseFloat(String(n)):e%n/parseFloat(String(n))}function Ct(e){return Math.min(1,Math.max(0,e))}function St(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function _t(e){return e<=1?"".concat(100*Number(e),"%"):e}function Mt(e){return 1===e.length?"0"+e:String(e)}function Pt(e,n,t){e=zt(e,255),n=zt(n,255),t=zt(t,255);var r=Math.max(e,n,t),a=Math.min(e,n,t),l=0,o=0,i=(r+a)/2;if(r===a)o=0,l=0;else{var s=r-a;switch(o=i>.5?s/(2-r-a):s/(r+a),r){case e:l=(n-t)/s+(n1&&(t-=1),t<1/6?e+6*t*(n-e):t<.5?n:t<2/3?e+(n-e)*(2/3-t)*6:e}function At(e,n,t){e=zt(e,255),n=zt(n,255),t=zt(t,255);var r=Math.max(e,n,t),a=Math.min(e,n,t),l=0,o=r,i=r-a,s=0===r?0:i/r;if(r===a)l=0;else{switch(r){case e:l=(n-t)/i+(n>16,g:(65280&e)>>8,b:255&e}}(n)),this.originalInput=n;var a=function(e){var n={r:0,g:0,b:0},t=1,r=null,a=null,l=null,o=!1,i=!1;return"string"==typeof e&&(e=function(e){if(0===(e=e.trim().toLowerCase()).length)return!1;var n=!1;if(Ft[e])e=Ft[e],n=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var t=jt.rgb.exec(e);return t?{r:t[1],g:t[2],b:t[3]}:(t=jt.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=jt.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=jt.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=jt.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=jt.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=jt.hex8.exec(e))?{r:Tt(t[1]),g:Tt(t[2]),b:Tt(t[3]),a:Rt(t[4]),format:n?"name":"hex8"}:(t=jt.hex6.exec(e))?{r:Tt(t[1]),g:Tt(t[2]),b:Tt(t[3]),format:n?"name":"hex"}:(t=jt.hex4.exec(e))?{r:Tt(t[1]+t[1]),g:Tt(t[2]+t[2]),b:Tt(t[3]+t[3]),a:Rt(t[4]+t[4]),format:n?"name":"hex8"}:!!(t=jt.hex3.exec(e))&&{r:Tt(t[1]+t[1]),g:Tt(t[2]+t[2]),b:Tt(t[3]+t[3]),format:n?"name":"hex"}}(e)),"object"==typeof e&&($t(e.r)&&$t(e.g)&&$t(e.b)?(n=function(e,n,t){return{r:255*zt(e,255),g:255*zt(n,255),b:255*zt(t,255)}}(e.r,e.g,e.b),o=!0,i="%"===String(e.r).substr(-1)?"prgb":"rgb"):$t(e.h)&&$t(e.s)&&$t(e.v)?(r=_t(e.s),a=_t(e.v),n=function(e,n,t){e=6*zt(e,360),n=zt(n,100),t=zt(t,100);var r=Math.floor(e),a=e-r,l=t*(1-n),o=t*(1-a*n),i=t*(1-(1-a)*n),s=r%6;return{r:255*[t,o,l,l,i,t][s],g:255*[i,t,t,o,l,l][s],b:255*[l,l,i,t,t,o][s]}}(e.h,r,a),o=!0,i="hsv"):$t(e.h)&&$t(e.s)&&$t(e.l)&&(r=_t(e.s),l=_t(e.l),n=function(e,n,t){var r,a,l;if(e=zt(e,360),n=zt(n,100),t=zt(t,100),0===n)a=t,l=t,r=t;else{var o=t<.5?t*(1+n):t+n-t*n,i=2*t-o;r=Ot(i,o,e+1/3),a=Ot(i,o,e),l=Ot(i,o,e-1/3)}return{r:255*r,g:255*a,b:255*l}}(e.h,r,l),o=!0,i="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(t=e.a)),t=St(t),{ok:o,format:e.format||i,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:t}}(n);this.originalInput=n,this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(r=t.format)&&void 0!==r?r:a.format,this.gradientType=t.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=a.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),n=e.r/255,t=e.g/255,r=e.b/255;return.2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=St(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.toHsv=function(){var e=At(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=At(this.r,this.g,this.b),n=Math.round(360*e.h),t=Math.round(100*e.s),r=Math.round(100*e.v);return 1===this.a?"hsv(".concat(n,", ").concat(t,"%, ").concat(r,"%)"):"hsva(".concat(n,", ").concat(t,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=Pt(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=Pt(this.r,this.g,this.b),n=Math.round(360*e.h),t=Math.round(100*e.s),r=Math.round(100*e.l);return 1===this.a?"hsl(".concat(n,", ").concat(t,"%, ").concat(r,"%)"):"hsla(".concat(n,", ").concat(t,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),Lt(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),function(e,n,t,r,a){var l=[Mt(Math.round(e).toString(16)),Mt(Math.round(n).toString(16)),Mt(Math.round(t).toString(16)),Mt(Nt(r))];return a&&l[0].startsWith(l[0].charAt(1))&&l[1].startsWith(l[1].charAt(1))&&l[2].startsWith(l[2].charAt(1))&&l[3].startsWith(l[3].charAt(1))?l[0].charAt(0)+l[1].charAt(0)+l[2].charAt(0)+l[3].charAt(0):l.join("")}(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),n=Math.round(this.g),t=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(n,", ").concat(t,")"):"rgba(".concat(e,", ").concat(n,", ").concat(t,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*zt(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*zt(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+Lt(this.r,this.g,this.b,!1),n=0,t=Object.entries(Ft);n=0;return n||!r||!e.startsWith("hex")&&"name"!==e?("rgb"===e&&(t=this.toRgbString()),"prgb"===e&&(t=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(t=this.toHexString()),"hex3"===e&&(t=this.toHexString(!0)),"hex4"===e&&(t=this.toHex8String(!0)),"hex8"===e&&(t=this.toHex8String()),"name"===e&&(t=this.toName()),"hsl"===e&&(t=this.toHslString()),"hsv"===e&&(t=this.toHsvString()),t||this.toHexString()):"name"===e&&0===this.a?this.toName():this.toRgbString()},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.l+=n/100,t.l=Ct(t.l),new e(t)},e.prototype.brighten=function(n){void 0===n&&(n=10);var t=this.toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(-n/100*255))),t.g=Math.max(0,Math.min(255,t.g-Math.round(-n/100*255))),t.b=Math.max(0,Math.min(255,t.b-Math.round(-n/100*255))),new e(t)},e.prototype.darken=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.l-=n/100,t.l=Ct(t.l),new e(t)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.s-=n/100,t.s=Ct(t.s),new e(t)},e.prototype.saturate=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.s+=n/100,t.s=Ct(t.s),new e(t)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(n){var t=this.toHsl(),r=(t.h+n)%360;return t.h=r<0?360+r:r,new e(t)},e.prototype.mix=function(n,t){void 0===t&&(t=50);var r=this.toRgb(),a=new e(n).toRgb(),l=t/100;return new e({r:(a.r-r.r)*l+r.r,g:(a.g-r.g)*l+r.g,b:(a.b-r.b)*l+r.b,a:(a.a-r.a)*l+r.a})},e.prototype.analogous=function(n,t){void 0===n&&(n=6),void 0===t&&(t=30);var r=this.toHsl(),a=360/t,l=[this];for(r.h=(r.h-(a*n>>1)+720)%360;--n;)r.h=(r.h+a)%360,l.push(new e(r));return l},e.prototype.complement=function(){var n=this.toHsl();return n.h=(n.h+180)%360,new e(n)},e.prototype.monochromatic=function(n){void 0===n&&(n=6);for(var t=this.toHsv(),r=t.h,a=t.s,l=t.v,o=[],i=1/n;n--;)o.push(new e({h:r,s:a,v:l})),l=(l+i)%1;return o},e.prototype.splitcomplement=function(){var n=this.toHsl(),t=n.h;return[this,new e({h:(t+72)%360,s:n.s,l:n.l}),new e({h:(t+216)%360,s:n.s,l:n.l})]},e.prototype.onBackground=function(n){var t=this.toRgb(),r=new e(n).toRgb();return new e({r:r.r+(t.r-r.r)*t.a,g:r.g+(t.g-r.g)*t.a,b:r.b+(t.b-r.b)*t.a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(n){for(var t=this.toHsl(),r=t.h,a=[this],l=360/n,o=1;o`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`,Bt=e=>{return(n=Vt(e),void 0===n&&(n=""),void 0===t&&(t={}),new Ht(n,t)).toHex8String();var n,t},Wt=({width:e})=>Object.assign({value:e.value,type:e.type},void 0!==e.unit&&{unit:e.unit}),qt=(e,n)=>{if(null!=e)return"color"===n?Vt(e):e},Qt=e=>Object.assign(Object.assign({value:qt(e.value,e.type),type:e.type},void 0!==e.description&&{comment:e.description}),void 0!==e.unit&&{unit:e.unit}),Kt=e=>{Array.isArray(e)&&1===e.length&&(e=e[0]);const n={};return Object.keys(e).forEach((function(t){Object.prototype.hasOwnProperty.call(e[t],"value")?n[t]=Qt(e[t]):n[t]=Kt(e[t])})),1===Object.keys(n).length?Object.values(n)[0]:n},Gt={size:Wt,color:Kt,gradient:Kt,font:Kt,effect:e=>{const n=e.map((e=>["dropShadow","innerShadow"].includes(e.effectType.value)?(e=>({type:{value:e.effectType.value,type:"string"},radius:{value:e.radius.value,type:"number",unit:"pixel"},color:{value:Vt(e.color.value),type:"color"},offset:{x:{value:e.offset.x.value,type:"number",unit:"pixel"},y:{value:e.offset.y.value,type:"number",unit:"pixel"}},spread:{value:e.spread.value,type:"number",unit:"pixel"}}))(e):(e=>({type:{value:e.effectType.value,type:"string"},radius:{value:e.radius.value,type:"number",unit:"pixel"}}))(e)));return Array.isArray(n)&&1===n.length?n[0]:n},grid:Kt,border:e=>Object.fromEntries(Object.entries(e).map((([e,n])=>{if("dashPattern"===e){const t=Qt(n);return t.value=t.value.join(", "),[e,t]}return[e,Qt(n)]}))),breakpoint:Wt,radius:Kt,spacing:Kt,motion:e=>Object.assign(Object.assign({type:{value:e.transitionType.value,type:"string"},duration:{value:e.duration.value,type:"number",unit:"s"}},e.direction?{direction:{value:e.direction.value,type:"string"}}:{}),{easing:{value:e.easingType.value.replace("cubicBezier","cubic-bezier"),type:"string"},easingFunction:e.easingFunction}),opacity:({opacity:e})=>({value:e.value,type:e.type})},Yt=(e,n=2)=>{if(void 0===e)return;if("number"!=typeof e||"number"!=typeof n)throw new Error(`Invalid parameters, both value "${e}" (${typeof e}) and decimalPlaces "${n}" (${typeof n}) must be of type number`);const t=Math.pow(10,n);return Math.round(e*t)/t},Zt=(e,{excludeExtensionProp:n})=>{if(!0!==n)return{extensions:Object.assign({},e.extensions)}},Xt=e=>"pixel"===e.lineHeight.unit?Yt(e.lineHeight.value,3):"percent"===e.lineHeight.unit?Yt(e.fontSize.value*(e.lineHeight.value/100),3):Yt(1.2*e.fontSize.value,3),Jt=e=>"pixel"===e.letterSpacing.unit?Yt(e.letterSpacing.value,3):"percent"===e.letterSpacing.unit?Yt(e.fontSize.value*(e.letterSpacing.value/100),3):void 0,er=({values:e})=>({value:e.width.value,type:"dimension"}),nr=e=>{var n,t,r;if(e.extensions&&e.extensions[sn.key.extensionPluginData]&&e.extensions[sn.key.extensionPluginData].alias)return{type:Object.hasOwnProperty.call(e.values[0],"fill")?"color":"custom-gradient",value:`{${e.extensions[sn.key.extensionPluginData].alias}}`,blendMode:(null===(r=null===(t=null===(n=e.values[0])||void 0===n?void 0:n.fill)||void 0===t?void 0:t.blendMode)||void 0===r?void 0:r.toLowerCase())||"normal"};const a=e.values.map((e=>Object.hasOwnProperty.call(e,"fill")?(({fill:e})=>{var n;return{type:"color",value:Bt(e.value),blendMode:(null===(n=e.blendMode)||void 0===n?void 0:n.toLowerCase())||"normal"}})(e):(({gradientType:e,rotation:n,stops:t,opacity:r})=>({type:"custom-gradient",value:{gradientType:e.value,rotation:n.value,stops:t.map((e=>({position:e.position.value,color:Bt(Object.assign(Object.assign({},e.color.value),{a:e.color.value.a*r.value}))})))}}))(e)));return 1===a.length?a[0]:Object.assign({},a)},tr={size:er,color:nr,gradient:nr,font:({values:e})=>({type:"custom-fontStyle",value:{fontSize:e.fontSize.value,textDecoration:e.textDecoration.value,fontFamily:e.fontFamily.value,fontWeight:e.fontWeight.value,fontStyle:e.fontStyle.value,fontStretch:e.fontStretch.value,letterSpacing:Jt(e),lineHeight:Xt(e),paragraphIndent:e.paragraphIndent.value,paragraphSpacing:e.paragraphSpacing.value,textCase:e.textCase.value}}),effect:({values:e})=>{const n=e.map((e=>{return["dropShadow","innerShadow"].includes(e.effectType.value)?{type:"custom-shadow",value:{shadowType:(n=e).effectType.value,radius:n.radius.value,color:Bt(n.color.value),offsetX:n.offset.x.value,offsetY:n.offset.y.value,spread:n.spread.value}}:null;var n}));return 1===n.length?n[0]:Object.assign({},n)},grid:({values:e})=>{const n=e.map((e=>({type:"custom-grid",value:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({pattern:e.pattern.value},e.sectionSize?{sectionSize:e.sectionSize.value}:{}),e.gutterSize?{gutterSize:e.gutterSize.value}:{}),e.alignment?{alignment:e.alignment.value}:{}),e.count?{count:e.count.value}:{}),e.offset?{offset:e.offset.value}:{})})));return 1===n.length?n[0]:Object.assign({},n)},border:({values:e})=>({type:"custom-stroke",value:{align:e.strokeAlign.value,dashPattern:e.dashPattern.value,lineCap:e.strokeCap.value,lineJoin:e.strokeJoin.value,miterLimit:e.strokeMiterLimit.value,weight:e.strokeWeight.value,color:Bt(e.stroke.value)}}),breakpoint:er,radius:({values:e})=>({type:"custom-radius",value:{smoothing:e.smoothing.value,topLeft:e.radii.topLeft.value,topRight:e.radii.topRight.value,bottomLeft:e.radii.bottomLeft.value,bottomRight:e.radii.bottomRight.value}}),spacing:({values:e})=>({type:"custom-spacing",value:{top:e.top.value,bottom:e.bottom.value,left:e.left.value,right:e.right.value}}),motion:({values:e})=>({type:"custom-transition",value:Object.assign(Object.assign({transitionType:e.transitionType.value,duration:e.duration.value},e.direction?{direction:e.direction.value}:{}),{easingType:e.easingCurveType.value,easingFunction:Object.fromEntries(Object.entries(e.easingFunction).map((e=>[e[0],e[1].value])))})}),opacity:({values:e})=>({value:e.opacity.value,type:"custom-opacity"})},rr=(e,n)=>"typography"===e.category?Object.assign({name:e.name,description:e.description},(({name:e,values:n})=>({fontSize:{type:"dimension",value:n.fontSize.value},textDecoration:{type:"string",value:n.textDecoration.value},fontFamily:{type:"string",value:n.fontFamily.value},fontWeight:{type:"number",value:n.fontWeight.value},fontStyle:{type:"string",value:n.fontStyle.value},fontStretch:{type:"string",value:n.fontStretch.value},letterSpacing:{type:"dimension",value:Jt(n)},lineHeight:{type:"dimension",value:Xt(n)},paragraphIndent:{type:"dimension",value:n.paragraphIndent.value},paragraphSpacing:{type:"dimension",value:n.paragraphSpacing.value},textCase:{type:"string",value:n.textCase.value}}))(e)):"variables"===e.extensions[sn.key.extensionPluginData].exportKey?Object.assign(Object.assign({name:e.name,description:e.description},(({values:e,category:n})=>{var t;return"color"===n?{type:"color",value:Bt(e.fill.value),blendMode:(null===(t=e.fill.blendMode)||void 0===t?void 0:t.toLowerCase())||"normal"}:["size","boolean","string","alias"].includes(n)?{type:n,value:e}:void 0})(e)),Zt(e,n)):Object.assign(Object.assign({name:e.name,description:e.description},(e=>tr[e.category](e))(e)),Zt(e,n)),ar=(e,n)=>{const t=e=>e&&"object"==typeof e;return t(e)&&t(n)?(Object.keys(n).forEach((r=>{const a=e[r],l=n[r];Array.isArray(a)&&Array.isArray(l)?e[r]=a.concat(l):t(a)&&t(l)?e[r]=ar(Object.assign({},a),l):e[r]=l})),e):n},lr=ar,or=(e,n,t)=>{if("string"==typeof e&&""!==e)return e;throw new Error(`converting "${n}" to ${t}, resulting in "${e}"`)},ir=(e,n="default")=>"camelCase"===n?(e=>{const n=e.toLowerCase().replace(/['"]/g,"").replace(/([-_ ]){1,}/g," ").replace(/\W+/g," ").trim().replace(/ (.)/g,(function(e){return e.toUpperCase()})).replace(/ /g,"");return or(n,e,"camelCase")})(e):"kebabCase"===n?(e=>{const n=e.toLowerCase().replace(/['"]/g,"").replace(/([-_ ]){1,}/g," ").replace(/\W+/g," ").trim().replace(/ /g,"-");return or(n,e,"kebabCase")})(e):e.trim().toLowerCase(),sr={color:{label:"Colors",key:"color"},gradient:{label:"Gradients",key:"gradient"},font:{label:"Font Styles",key:"font"},typography:{label:"Typography",key:"typography",exclude:["original"]},effect:{label:"Effects",key:"effect"},grid:{label:"Grids",key:"grid"},border:{label:"Borders",key:"border"},breakpoint:{label:"Breakpoints",key:"breakpoint"},radius:{label:"Radii",key:"radius"},size:{label:"Sizes",key:"size"},spacing:{label:"Spacing",key:"spacing"},motion:{label:"Motion",key:"motion"},opacity:{label:"Opacity",key:"opacity"},variables:{label:"Figma Variables (BETA)",key:"variables",exclude:["original"]}},ur=e=>{var n,t;return void 0!==(null===(t=null===(n=e.extensions)||void 0===n?void 0:n[sn.key.extensionPluginData])||void 0===t?void 0:t.exportKey)?e.extensions[sn.key.extensionPluginData].exportKey:"missingExportKey"},cr={original:(e,n)=>Object.assign(Object.assign({name:e.name,category:e.category,exportKey:e.extensions[sn.key.extensionPluginData].exportKey},e.description&&e.description.length>0&&{comment:e.description}),Gt[e.category](e.values)||{}),standard:rr,standardDeprecated:rr},dr=(e,n)=>"standard"===n.tokenFormat?JSON.parse(JSON.stringify(e.filter((e=>e.category===sr.font.key)))).map((e=>(e.name="typography/"+e.name.substr(e.name.indexOf("/")+1).trim().trimStart(),e.category=sr.typography.key,e.exportKey=sr.typography.key,!0!==n.excludeExtensionProp&&(e.extensions[sn.key.extensionPluginData].exportKey=sr.typography.key),e))):[],fr=(e,n)=>{let t=JSON.parse(e);t=[...t,...dr(t,n)];const r=((e,n)=>e.length<=0?[]:e.map((e=>{var t,r,a,l;if(!1===n.prefixInName)e.name=e.name.substr(e.name.indexOf("/")+1).trim().trimLeft();else if(void 0!==(null===(r=null===(t=e.extensions)||void 0===t?void 0:t[sn.key.extensionPluginData])||void 0===r?void 0:r.alias)){const n=e.name.substr(0,e.name.indexOf("/")).trim().trimLeft();e.extensions[sn.key.extensionPluginData].alias=`${n}.${e.extensions[sn.key.extensionPluginData].alias}`}return n.keyInName&&(e.name=`${ur(e)}/${e.name}`,void 0!==(null===(l=null===(a=e.extensions)||void 0===a?void 0:a[sn.key.extensionPluginData])||void 0===l?void 0:l.alias)&&(e.extensions[sn.key.extensionPluginData].alias=`${ur(e)}.${e.extensions[sn.key.extensionPluginData].alias}`)),e})))(t.filter((({exportKey:e})=>n.exports[e])),n),a=r.map((e=>cr[n.tokenFormat](e,n))),l=((e,n)=>{if(e.length<=0)return[];const t=e.map((e=>{const t=e.name.split("/").map((e=>ir(e,n.nameConversion)));return delete e.name,r=e,t.reduceRight(((e,n)=>({[n]:e})),r);var r}));return t.reduce(((e={},n)=>lr(e,n)))})(a,n);return l},pr=(e,n=!0)=>!0===n?JSON.stringify(e):JSON.stringify(e,null,2);const gr=je` +`,kt=({versionDifference:n})=>"major"!==n&&"minor"!==n?e.createElement(e.Fragment,null):e.createElement("div",{id:"versionNotice",className:wt},e.createElement("div",{className:"icon"},"🎉"),e.createElement("div",null,"The ",e.createElement("a",{className:"subtle",href:"https://www.figma.com/community/plugin/888356646278934516/Design-Tokens",target:"_blank",rel:"noreferrer"},"Design Token plugin")," was updated.",e.createElement("br",null),"Find out about changes & new features in the ",e.createElement("a",{href:"https://github.com/lukasoppermann/design-tokens/releases",target:"_blank",rel:"noreferrer"},"release notes →"))),Et={filename:"design-tokens",extension:".tokens.json",nameConversion:"default",tokenFormat:"standard",compression:!1,urlJsonCompression:!0,serverUrl:void 0,eventType:"update-tokens",accessToken:void 0,acceptHeader:"application/vnd.github.everest-preview+json",contentType:"text/plain;charset=UTF-8",authType:"token",reference:"main",exclusionPrefix:"",excludeExtensionProp:!1,alias:"alias, ref, reference",keyInName:!1,prefixInName:!0,prefix:{color:"color",gradient:"gradient",typography:"typography",font:"font",effect:"effect",grid:"grid",border:"border, borders",breakpoint:"breakpoint, breakpoints",radius:"radius, radii",size:"size, sizes",spacing:"spacing",motion:"motion",opacity:"opacity, opacities"},exports:{color:!0,gradient:!0,font:!0,typography:!0,effect:!0,grid:!0,border:!0,breakpoint:!0,radius:!0,size:!0,spacing:!0,motion:!0,opacity:!0,variables:!0}};function zt(e,n){(function(e){return"string"==typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var t=function(e){return"string"==typeof e&&-1!==e.indexOf("%")}(e);return e=360===n?e:Math.min(n,Math.max(0,parseFloat(e))),t&&(e=parseInt(String(e*n),10)/100),Math.abs(e-n)<1e-6?1:e=360===n?(e<0?e%n+n:e%n)/parseFloat(String(n)):e%n/parseFloat(String(n))}function Ct(e){return Math.min(1,Math.max(0,e))}function St(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function _t(e){return e<=1?"".concat(100*Number(e),"%"):e}function Mt(e){return 1===e.length?"0"+e:String(e)}function Pt(e,n,t){e=zt(e,255),n=zt(n,255),t=zt(t,255);var r=Math.max(e,n,t),a=Math.min(e,n,t),l=0,o=0,i=(r+a)/2;if(r===a)o=0,l=0;else{var s=r-a;switch(o=i>.5?s/(2-r-a):s/(r+a),r){case e:l=(n-t)/s+(n1&&(t-=1),t<1/6?e+6*t*(n-e):t<.5?n:t<2/3?e+(n-e)*(2/3-t)*6:e}function At(e,n,t){e=zt(e,255),n=zt(n,255),t=zt(t,255);var r=Math.max(e,n,t),a=Math.min(e,n,t),l=0,o=r,i=r-a,s=0===r?0:i/r;if(r===a)l=0;else{switch(r){case e:l=(n-t)/i+(n>16,g:(65280&e)>>8,b:255&e}}(n)),this.originalInput=n;var a=function(e){var n={r:0,g:0,b:0},t=1,r=null,a=null,l=null,o=!1,i=!1;return"string"==typeof e&&(e=function(e){if(0===(e=e.trim().toLowerCase()).length)return!1;var n=!1;if(Ft[e])e=Ft[e],n=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var t=jt.rgb.exec(e);return t?{r:t[1],g:t[2],b:t[3]}:(t=jt.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=jt.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=jt.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=jt.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=jt.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=jt.hex8.exec(e))?{r:Tt(t[1]),g:Tt(t[2]),b:Tt(t[3]),a:Rt(t[4]),format:n?"name":"hex8"}:(t=jt.hex6.exec(e))?{r:Tt(t[1]),g:Tt(t[2]),b:Tt(t[3]),format:n?"name":"hex"}:(t=jt.hex4.exec(e))?{r:Tt(t[1]+t[1]),g:Tt(t[2]+t[2]),b:Tt(t[3]+t[3]),a:Rt(t[4]+t[4]),format:n?"name":"hex8"}:!!(t=jt.hex3.exec(e))&&{r:Tt(t[1]+t[1]),g:Tt(t[2]+t[2]),b:Tt(t[3]+t[3]),format:n?"name":"hex"}}(e)),"object"==typeof e&&($t(e.r)&&$t(e.g)&&$t(e.b)?(n=function(e,n,t){return{r:255*zt(e,255),g:255*zt(n,255),b:255*zt(t,255)}}(e.r,e.g,e.b),o=!0,i="%"===String(e.r).substr(-1)?"prgb":"rgb"):$t(e.h)&&$t(e.s)&&$t(e.v)?(r=_t(e.s),a=_t(e.v),n=function(e,n,t){e=6*zt(e,360),n=zt(n,100),t=zt(t,100);var r=Math.floor(e),a=e-r,l=t*(1-n),o=t*(1-a*n),i=t*(1-(1-a)*n),s=r%6;return{r:255*[t,o,l,l,i,t][s],g:255*[i,t,t,o,l,l][s],b:255*[l,l,i,t,t,o][s]}}(e.h,r,a),o=!0,i="hsv"):$t(e.h)&&$t(e.s)&&$t(e.l)&&(r=_t(e.s),l=_t(e.l),n=function(e,n,t){var r,a,l;if(e=zt(e,360),n=zt(n,100),t=zt(t,100),0===n)a=t,l=t,r=t;else{var o=t<.5?t*(1+n):t+n-t*n,i=2*t-o;r=Ot(i,o,e+1/3),a=Ot(i,o,e),l=Ot(i,o,e-1/3)}return{r:255*r,g:255*a,b:255*l}}(e.h,r,l),o=!0,i="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(t=e.a)),t=St(t),{ok:o,format:e.format||i,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:t}}(n);this.originalInput=n,this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(r=t.format)&&void 0!==r?r:a.format,this.gradientType=t.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=a.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),n=e.r/255,t=e.g/255,r=e.b/255;return.2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=St(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.toHsv=function(){var e=At(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=At(this.r,this.g,this.b),n=Math.round(360*e.h),t=Math.round(100*e.s),r=Math.round(100*e.v);return 1===this.a?"hsv(".concat(n,", ").concat(t,"%, ").concat(r,"%)"):"hsva(".concat(n,", ").concat(t,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=Pt(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=Pt(this.r,this.g,this.b),n=Math.round(360*e.h),t=Math.round(100*e.s),r=Math.round(100*e.l);return 1===this.a?"hsl(".concat(n,", ").concat(t,"%, ").concat(r,"%)"):"hsla(".concat(n,", ").concat(t,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),Lt(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),function(e,n,t,r,a){var l=[Mt(Math.round(e).toString(16)),Mt(Math.round(n).toString(16)),Mt(Math.round(t).toString(16)),Mt(Nt(r))];return a&&l[0].startsWith(l[0].charAt(1))&&l[1].startsWith(l[1].charAt(1))&&l[2].startsWith(l[2].charAt(1))&&l[3].startsWith(l[3].charAt(1))?l[0].charAt(0)+l[1].charAt(0)+l[2].charAt(0)+l[3].charAt(0):l.join("")}(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),n=Math.round(this.g),t=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(n,", ").concat(t,")"):"rgba(".concat(e,", ").concat(n,", ").concat(t,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*zt(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*zt(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+Lt(this.r,this.g,this.b,!1),n=0,t=Object.entries(Ft);n=0;return n||!r||!e.startsWith("hex")&&"name"!==e?("rgb"===e&&(t=this.toRgbString()),"prgb"===e&&(t=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(t=this.toHexString()),"hex3"===e&&(t=this.toHexString(!0)),"hex4"===e&&(t=this.toHex8String(!0)),"hex8"===e&&(t=this.toHex8String()),"name"===e&&(t=this.toName()),"hsl"===e&&(t=this.toHslString()),"hsv"===e&&(t=this.toHsvString()),t||this.toHexString()):"name"===e&&0===this.a?this.toName():this.toRgbString()},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.l+=n/100,t.l=Ct(t.l),new e(t)},e.prototype.brighten=function(n){void 0===n&&(n=10);var t=this.toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(-n/100*255))),t.g=Math.max(0,Math.min(255,t.g-Math.round(-n/100*255))),t.b=Math.max(0,Math.min(255,t.b-Math.round(-n/100*255))),new e(t)},e.prototype.darken=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.l-=n/100,t.l=Ct(t.l),new e(t)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.s-=n/100,t.s=Ct(t.s),new e(t)},e.prototype.saturate=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.s+=n/100,t.s=Ct(t.s),new e(t)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(n){var t=this.toHsl(),r=(t.h+n)%360;return t.h=r<0?360+r:r,new e(t)},e.prototype.mix=function(n,t){void 0===t&&(t=50);var r=this.toRgb(),a=new e(n).toRgb(),l=t/100;return new e({r:(a.r-r.r)*l+r.r,g:(a.g-r.g)*l+r.g,b:(a.b-r.b)*l+r.b,a:(a.a-r.a)*l+r.a})},e.prototype.analogous=function(n,t){void 0===n&&(n=6),void 0===t&&(t=30);var r=this.toHsl(),a=360/t,l=[this];for(r.h=(r.h-(a*n>>1)+720)%360;--n;)r.h=(r.h+a)%360,l.push(new e(r));return l},e.prototype.complement=function(){var n=this.toHsl();return n.h=(n.h+180)%360,new e(n)},e.prototype.monochromatic=function(n){void 0===n&&(n=6);for(var t=this.toHsv(),r=t.h,a=t.s,l=t.v,o=[],i=1/n;n--;)o.push(new e({h:r,s:a,v:l})),l=(l+i)%1;return o},e.prototype.splitcomplement=function(){var n=this.toHsl(),t=n.h;return[this,new e({h:(t+72)%360,s:n.s,l:n.l}),new e({h:(t+216)%360,s:n.s,l:n.l})]},e.prototype.onBackground=function(n){var t=this.toRgb(),r=new e(n).toRgb();return new e({r:r.r+(t.r-r.r)*t.a,g:r.g+(t.g-r.g)*t.a,b:r.b+(t.b-r.b)*t.a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(n){for(var t=this.toHsl(),r=t.h,a=[this],l=360/n,o=1;o`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`,Bt=e=>{return(n=Vt(e),void 0===n&&(n=""),void 0===t&&(t={}),new Ht(n,t)).toHex8String();var n,t},Wt=({width:e})=>Object.assign({value:e.value,type:e.type},void 0!==e.unit&&{unit:e.unit}),qt=(e,n)=>{if(null!=e)return"color"===n?Vt(e):e},Qt=e=>Object.assign(Object.assign({value:qt(e.value,e.type),type:e.type},void 0!==e.description&&{comment:e.description}),void 0!==e.unit&&{unit:e.unit}),Kt=e=>{Array.isArray(e)&&1===e.length&&(e=e[0]);const n={};return Object.keys(e).forEach((function(t){Object.prototype.hasOwnProperty.call(e[t],"value")?n[t]=Qt(e[t]):n[t]=Kt(e[t])})),1===Object.keys(n).length?Object.values(n)[0]:n},Gt={size:Wt,color:Kt,gradient:Kt,font:Kt,effect:e=>{const n=e.map((e=>["dropShadow","innerShadow"].includes(e.effectType.value)?(e=>({type:{value:e.effectType.value,type:"string"},radius:{value:e.radius.value,type:"number",unit:"pixel"},color:{value:Vt(e.color.value),type:"color"},offset:{x:{value:e.offset.x.value,type:"number",unit:"pixel"},y:{value:e.offset.y.value,type:"number",unit:"pixel"}},spread:{value:e.spread.value,type:"number",unit:"pixel"}}))(e):(e=>({type:{value:e.effectType.value,type:"string"},radius:{value:e.radius.value,type:"number",unit:"pixel"}}))(e)));return Array.isArray(n)&&1===n.length?n[0]:n},grid:Kt,border:e=>Object.fromEntries(Object.entries(e).map((([e,n])=>{if("dashPattern"===e){const t=Qt(n);return t.value=t.value.join(", "),[e,t]}return[e,Qt(n)]}))),breakpoint:Wt,radius:Kt,spacing:Kt,motion:e=>Object.assign(Object.assign({type:{value:e.transitionType.value,type:"string"},duration:{value:e.duration.value,type:"number",unit:"s"}},e.direction?{direction:{value:e.direction.value,type:"string"}}:{}),{easing:{value:e.easingType.value.replace("cubicBezier","cubic-bezier"),type:"string"},easingFunction:e.easingFunction}),opacity:({opacity:e})=>({value:e.value,type:e.type})},Yt=(e,n=2)=>{if(void 0===e)return;if("number"!=typeof e||"number"!=typeof n)throw new Error(`Invalid parameters, both value "${e}" (${typeof e}) and decimalPlaces "${n}" (${typeof n}) must be of type number`);const t=Math.pow(10,n);return Math.round(e*t)/t},Zt=(e,{excludeExtensionProp:n})=>{if(!0!==n)return{extensions:Object.assign({},e.extensions)}},Xt=e=>"pixel"===e.lineHeight.unit?Yt(e.lineHeight.value,3):"percent"===e.lineHeight.unit?Yt(e.fontSize.value*(e.lineHeight.value/100),3):Yt(1.2*e.fontSize.value,3),Jt=e=>"pixel"===e.letterSpacing.unit?Yt(e.letterSpacing.value,3):"percent"===e.letterSpacing.unit?Yt(e.fontSize.value*(e.letterSpacing.value/100),3):void 0,er=({values:e})=>({value:e.width.value,type:"dimension"}),nr=e=>{var n,t,r;if(e.extensions&&e.extensions[sn.key.extensionPluginData]&&e.extensions[sn.key.extensionPluginData].alias)return{type:Object.hasOwnProperty.call(e.values[0],"fill")?"color":"custom-gradient",value:`{${e.extensions[sn.key.extensionPluginData].alias}}`,blendMode:(null===(r=null===(t=null===(n=e.values[0])||void 0===n?void 0:n.fill)||void 0===t?void 0:t.blendMode)||void 0===r?void 0:r.toLowerCase())||"normal"};const a=e.values.map((e=>Object.hasOwnProperty.call(e,"fill")?(({fill:e})=>{var n;return{type:"color",value:Bt(e.value),blendMode:(null===(n=e.blendMode)||void 0===n?void 0:n.toLowerCase())||"normal"}})(e):(({gradientType:e,rotation:n,stops:t,opacity:r})=>({type:"custom-gradient",value:{gradientType:e.value,rotation:n.value,stops:t.map((e=>({position:e.position.value,color:Bt(Object.assign(Object.assign({},e.color.value),{a:e.color.value.a*r.value}))})))}}))(e)));return 1===a.length?a[0]:Object.assign({},a)},tr={size:er,color:nr,gradient:nr,font:({values:e})=>({type:"custom-fontStyle",value:{fontSize:e.fontSize.value,textDecoration:e.textDecoration.value,fontFamily:e.fontFamily.value,fontWeight:e.fontWeight.value,fontStyle:e.fontStyle.value,fontStretch:e.fontStretch.value,letterSpacing:Jt(e),lineHeight:Xt(e),paragraphIndent:e.paragraphIndent.value,paragraphSpacing:e.paragraphSpacing.value,textCase:e.textCase.value}}),effect:({values:e})=>{const n=e.map((e=>{return["dropShadow","innerShadow"].includes(e.effectType.value)?{type:"custom-shadow",value:{shadowType:(n=e).effectType.value,radius:n.radius.value,color:Bt(n.color.value),offsetX:n.offset.x.value,offsetY:n.offset.y.value,spread:n.spread.value}}:null;var n}));return 1===n.length?n[0]:Object.assign({},n)},grid:({values:e})=>{const n=e.map((e=>({type:"custom-grid",value:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({pattern:e.pattern.value},e.sectionSize?{sectionSize:e.sectionSize.value}:{}),e.gutterSize?{gutterSize:e.gutterSize.value}:{}),e.alignment?{alignment:e.alignment.value}:{}),e.count?{count:e.count.value}:{}),e.offset?{offset:e.offset.value}:{})})));return 1===n.length?n[0]:Object.assign({},n)},border:({values:e})=>({type:"custom-stroke",value:{align:e.strokeAlign.value,dashPattern:e.dashPattern.value,lineCap:e.strokeCap.value,lineJoin:e.strokeJoin.value,miterLimit:e.strokeMiterLimit.value,weight:e.strokeWeight.value,color:Bt(e.stroke.value)}}),breakpoint:er,radius:({values:e})=>({type:"custom-radius",value:{smoothing:e.smoothing.value,topLeft:e.radii.topLeft.value,topRight:e.radii.topRight.value,bottomLeft:e.radii.bottomLeft.value,bottomRight:e.radii.bottomRight.value}}),spacing:({values:e})=>({type:"custom-spacing",value:{top:e.top.value,bottom:e.bottom.value,left:e.left.value,right:e.right.value}}),motion:({values:e})=>({type:"custom-transition",value:Object.assign(Object.assign({transitionType:e.transitionType.value,duration:e.duration.value},e.direction?{direction:e.direction.value}:{}),{easingType:e.easingCurveType.value,easingFunction:Object.fromEntries(Object.entries(e.easingFunction).map((e=>[e[0],e[1].value])))})}),opacity:({values:e})=>({value:e.opacity.value,type:"custom-opacity"})},rr=(e,n)=>"typography"===e.category?Object.assign({name:e.name,description:e.description},(({name:e,values:n})=>({fontSize:{type:"dimension",value:n.fontSize.value},textDecoration:{type:"string",value:n.textDecoration.value},fontFamily:{type:"string",value:n.fontFamily.value},fontWeight:{type:"number",value:n.fontWeight.value},fontStyle:{type:"string",value:n.fontStyle.value},fontStretch:{type:"string",value:n.fontStretch.value},letterSpacing:{type:"dimension",value:Jt(n)},lineHeight:{type:"dimension",value:Xt(n)},paragraphIndent:{type:"dimension",value:n.paragraphIndent.value},paragraphSpacing:{type:"dimension",value:n.paragraphSpacing.value},textCase:{type:"string",value:n.textCase.value}}))(e)):"variables"===e.extensions[sn.key.extensionPluginData].exportKey?Object.assign(Object.assign({name:e.name,description:e.description},(({values:e,category:n})=>{var t;return"color"===n?{type:"color",value:Bt(e.fill.value),blendMode:(null===(t=e.fill.blendMode)||void 0===t?void 0:t.toLowerCase())||"normal"}:["size","boolean","string","alias"].includes(n)?{type:n,value:e}:void 0})(e)),Zt(e,n)):Object.assign(Object.assign({name:e.name,description:e.description},(e=>tr[e.category](e))(e)),Zt(e,n)),ar=(e,n)=>{const t=e=>e&&"object"==typeof e;return t(e)&&t(n)?(Object.keys(n).forEach((r=>{const a=e[r],l=n[r];Array.isArray(a)&&Array.isArray(l)?e[r]=a.concat(l):t(a)&&t(l)?e[r]=ar(Object.assign({},a),l):e[r]=l})),e):n},lr=ar,or=(e,n,t)=>{if("string"==typeof e&&""!==e)return e;throw new Error(`converting "${n}" to ${t}, resulting in "${e}"`)},ir=(e,n="default")=>"camelCase"===n?(e=>{const n=e.toLowerCase().replace(/['"]/g,"").replace(/([-_ ]){1,}/g," ").replace(/\W+/g," ").trim().replace(/ (.)/g,(function(e){return e.toUpperCase()})).replace(/ /g,"");return or(n,e,"camelCase")})(e):"kebabCase"===n?(e=>{const n=e.toLowerCase().replace(/['"]/g,"").replace(/([-_ ]){1,}/g," ").replace(/\W+/g," ").trim().replace(/ /g,"-");return or(n,e,"kebabCase")})(e):e.trim().toLowerCase(),sr={color:{label:"Colors",key:"color"},gradient:{label:"Gradients",key:"gradient"},font:{label:"Font Styles",key:"font"},typography:{label:"Typography",key:"typography",exclude:["original"]},effect:{label:"Effects",key:"effect"},grid:{label:"Grids",key:"grid"},border:{label:"Borders",key:"border"},breakpoint:{label:"Breakpoints",key:"breakpoint"},radius:{label:"Radii",key:"radius"},size:{label:"Sizes",key:"size"},spacing:{label:"Spacing",key:"spacing"},motion:{label:"Motion",key:"motion"},opacity:{label:"Opacity",key:"opacity"},variables:{label:"Figma Variables (BETA)",key:"variables",exclude:["original"]}},ur=e=>{var n,t;return void 0!==(null===(t=null===(n=e.extensions)||void 0===n?void 0:n[sn.key.extensionPluginData])||void 0===t?void 0:t.exportKey)?e.extensions[sn.key.extensionPluginData].exportKey:"missingExportKey"},cr={original:(e,n)=>"variables"===e.extensions[sn.key.extensionPluginData].exportKey?null:Object.assign(Object.assign({name:e.name,category:e.category,exportKey:e.extensions[sn.key.extensionPluginData].exportKey},e.description&&e.description.length>0&&{comment:e.description}),Gt[e.category](e.values)||{}),standard:rr,standardDeprecated:rr},dr=(e,n)=>"standard"===n.tokenFormat?JSON.parse(JSON.stringify(e.filter((e=>e.category===sr.font.key)))).map((e=>(e.name="typography/"+e.name.substr(e.name.indexOf("/")+1).trim().trimStart(),e.category=sr.typography.key,e.exportKey=sr.typography.key,!0!==n.excludeExtensionProp&&(e.extensions[sn.key.extensionPluginData].exportKey=sr.typography.key),e))):[],fr=(e,n)=>{let t=JSON.parse(e);t=[...t,...dr(t,n)];const r=((e,n)=>e.length<=0?[]:e.map((e=>{var t,r,a,l;if(!1===n.prefixInName)e.name=e.name.substr(e.name.indexOf("/")+1).trim().trimLeft();else if(void 0!==(null===(r=null===(t=e.extensions)||void 0===t?void 0:t[sn.key.extensionPluginData])||void 0===r?void 0:r.alias)){const n=e.name.substr(0,e.name.indexOf("/")).trim().trimLeft();e.extensions[sn.key.extensionPluginData].alias=`${n}.${e.extensions[sn.key.extensionPluginData].alias}`}return n.keyInName&&(e.name=`${ur(e)}/${e.name}`,void 0!==(null===(l=null===(a=e.extensions)||void 0===a?void 0:a[sn.key.extensionPluginData])||void 0===l?void 0:l.alias)&&(e.extensions[sn.key.extensionPluginData].alias=`${ur(e)}.${e.extensions[sn.key.extensionPluginData].alias}`)),e})))(t.filter((({exportKey:e})=>n.exports[e])),n),a=r.map((e=>cr[n.tokenFormat](e,n))).filter(Boolean),l=((e,n)=>{if(e.length<=0)return[];const t=e.map((e=>{const t=e.name.split("/").map((e=>ir(e,n.nameConversion)));return delete e.name,r=e,t.reduceRight(((e,n)=>({[n]:e})),r);var r}));return t.reduce(((e={},n)=>lr(e,n)))})(a,n);return l},pr=(e,n=!0)=>!0===n?JSON.stringify(e):JSON.stringify(e,null,2);const gr=je` display: flex; flex-direction: column; h1:first-child { diff --git a/dist/ui.js b/dist/ui.js index e25280f9..1947b7b3 100644 --- a/dist/ui.js +++ b/dist/ui.js @@ -605,7 +605,7 @@ select.select-menu { padding: 0 var(--size-xxxsmall) 0 var(--size-xxsmall); color: var(--figma-color-text-secondary); margin-top: 0; -`,kn=e=>["color","gradient","grid","effect","font"].includes(e),En=()=>{const[n,t]=(0,e.useState)(!1),{figmaUIApi:r,figmaMetaData:a}=(0,e.useContext)(rn),{settings:l,updateSettings:o}=(0,e.useContext)(an);return e.createElement("form",{className:yn,onSubmit:e=>{if(e.preventDefault(),!0===e.target.checkValidity()){const{accessToken:e}=l,n=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);ao((n=>{n.keyInName=e}))}),e.createElement(gn,{width:240,label:'The token type (e.g. "color" or "font") will be added to the name e.g. "color/light/bg".'})),e.createElement(Je,{size:"small",weight:"bold"},"Filename",e.createElement(gn,{width:160,label:"The file name used when exporting the tokens"})),e.createElement("div",{className:"grid-2-col"},e.createElement(qe,{type:"text",required:!0,pattern:"^[\\w\\d\\s\\[\\]._-]+$",placeholder:a.filename,value:l.filename,onChange:e=>o((n=>{n.filename=e}))}),e.createElement(Ge,{defaultValue:l.extension,onChange:({value:e})=>o((n=>{n.extension=e})),placeholder:"file extension",options:sn.fileExtensions})),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Name conversion"),e.createElement(Ge,{defaultValue:l.nameConversion,onChange:({value:e})=>o((n=>{n.nameConversion=e})),placeholder:"Name conversion",options:[{label:"Default",value:"default"},{label:"camelCase",value:"camelCase"},{label:"kebab-case",value:"kebabCase"}]})),e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Token format",e.createElement(gn,{width:240,label:"The structure of the output json file. Learn more in the docs."})),e.createElement(Ge,{defaultValue:l.tokenFormat,onChange:({value:e})=>{o((n=>{n.tokenFormat=e})),t("standard"===e)},placeholder:"Token format",options:[{label:"Standard (W3C draft)",value:"standard"},{label:"Original (deprecated)",value:"original"}]}))),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Exclusion prefix ",e.createElement(gn,{width:240,label:'Styles & tokens with this prefix will be ignored when exporting. ("." and "_" work by default)'})),e.createElement(qe,{type:"text",pattern:"^[#\\+*\\\\/&%$!?;:~,\\s]+$",placeholder:"#, @",value:l.exclusionPrefix,onChange:e=>o((n=>{n.exclusionPrefix=e}))})),n&&e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Alias identifier ",e.createElement(gn,{width:180,label:"Use to define an alias for a token; case insensitive"})),e.createElement(qe,{type:"text",pattern:"^[A-Za-z,\\s]+$",placeholder:"alias, ref, reference",value:l.alias,onChange:e=>o((n=>{n.alias=e}))}))),e.createElement(mn,null),e.createElement(Je,{size:"small",weight:"bold"},"Token prefixes ",e.createElement(gn,{width:150,label:"Use commas to separate multiple prefixed"})),e.createElement(nn,{className:wn,size:"small"},'Prefixes are the first part of a tokens name e.g. "radius" in "radius/small". They are used to identify the type of a custom token.'),e.createElement(fn,null,e.createElement(Be,{label:"Include token prefix in token names",type:"switch",checked:l.prefixInName,onChange:e=>o((n=>{n.prefixInName=e}))}),e.createElement(gn,{width:240,label:'When disabled the prefix is removed ("radius/small" → "small"), when enabled it is added ("radius/small" → "radius/small").'})),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},Object.entries(l.prefix).map((([n,t])=>e.createElement(fn,{fill:!0,key:n},e.createElement(Ze,{className:`${xn} flex-grow--none`},n,kn(n)?e.createElement(gn,{width:90,label:"Prefix for style"}):""),e.createElement(qe,{type:"text",pattern:kn(n)?"^[\\w\\-@]+$":"^[\\w\\-@,\\s]+$",required:!0,placeholder:n,value:t,onChange:e=>o((t=>{t.prefix[n]=e}))}))))),e.createElement(cn,null,e.createElement(bn,{align:"start",href:"https://github.com/lukasoppermann/design-tokens#design-tokens"},"Documentation"),e.createElement(on,null),e.createElement(He,{type:"submit",autofocus:!0},"Save changes")))};function zn(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r3?n.i-4:n.i:Array.isArray(e)?1:An(e)?2:Ln(e)?3:0}function Pn(e,n){return 2===Mn(e)?e.has(n):Object.prototype.hasOwnProperty.call(e,n)}function On(e,n,t){var r=Mn(e);2===r?e.set(n,t):3===r?(e.delete(n),e.add(t)):e[n]=t}function An(e){return lt&&e instanceof Map}function Ln(e){return ot&&e instanceof Set}function Nn(e){return e.o||e.t}function Rn(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var n=pt(e);delete n[ct];for(var t=ft(n),r=0;r1&&(e.set=e.add=e.clear=e.delete=Fn),Object.freeze(e),n&&_n(e,(function(e,n){return Tn(n,!0)}),!0)),e}function Fn(){zn(2)}function Dn(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function In(e){var n=gt[e];return n||zn(18,e),n}function Un(){return rt}function jn(e,n){n&&(In("Patches"),e.u=[],e.s=[],e.v=n)}function $n(e){Hn(e),e.p.forEach(Bn),e.p=null}function Hn(e){e===rt&&(rt=e.l)}function Vn(e){return rt={p:[],l:rt,h:e,m:!0,_:0}}function Bn(e){var n=e[ct];0===n.i||1===n.i?n.j():n.O=!0}function Wn(e,n){n._=n.p.length;var t=n.p[0],r=void 0!==e&&e!==t;return n.h.g||In("ES5").S(n,e,r),r?(t[ct].P&&($n(n),zn(4)),Sn(e)&&(e=qn(n,e),n.l||Kn(n,e)),n.u&&In("Patches").M(t[ct].t,e,n.u,n.s)):e=qn(n,t,[]),$n(n),n.u&&n.v(n.u,n.s),e!==st?e:void 0}function qn(e,n,t){if(Dn(n))return n;var r=n[ct];if(!r)return _n(n,(function(a,l){return Qn(e,r,n,a,l,t)}),!0),n;if(r.A!==e)return n;if(!r.P)return Kn(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var a=4===r.i||5===r.i?r.o=Rn(r.k):r.o;_n(3===r.i?new Set(a):a,(function(n,l){return Qn(e,r,a,n,l,t)})),Kn(e,a,!1),t&&e.u&&In("Patches").R(r,t,e.u,e.s)}return r.o}function Qn(e,n,t,r,a,l){if(Cn(a)){var o=qn(e,a,l&&n&&3!==n.i&&!Pn(n.D,r)?l.concat(r):void 0);if(On(t,r,o),!Cn(o))return;e.m=!1}if(Sn(a)&&!Dn(a)){if(!e.h.F&&e._<1)return;qn(e,a),n&&n.A.l||Kn(e,a)}}function Kn(e,n,t){void 0===t&&(t=!1),e.h.F&&e.m&&Tn(n,t)}function Gn(e,n){var t=e[ct];return(t?Nn(t):e)[n]}function Yn(e,n){if(n in e)for(var t=Object.getPrototypeOf(e);t;){var r=Object.getOwnPropertyDescriptor(t,n);if(r)return r;t=Object.getPrototypeOf(t)}}function Zn(e){e.P||(e.P=!0,e.l&&Zn(e.l))}function Xn(e){e.o||(e.o=Rn(e.t))}function Jn(e,n,t){var r=An(n)?In("MapSet").N(n,t):Ln(n)?In("MapSet").T(n,t):e.g?function(e,n){var t=Array.isArray(e),r={i:t?1:0,A:n?n.A:Un(),P:!1,I:!1,D:{},l:n,t:e,k:null,o:null,j:null,C:!1},a=r,l=ht;t&&(a=[r],l=mt);var o=Proxy.revocable(a,l),i=o.revoke,s=o.proxy;return r.k=s,r.j=i,s}(n,t):In("ES5").J(n,t);return(t?t.A:Un()).p.push(r),r}function et(e){return Cn(e)||zn(22,e),function e(n){if(!Sn(n))return n;var t,r=n[ct],a=Mn(n);if(r){if(!r.P&&(r.i<4||!In("ES5").K(r)))return r.t;r.I=!0,t=nt(n,a),r.I=!1}else t=nt(n,a);return _n(t,(function(n,a){r&&function(e,n){return 2===Mn(e)?e.get(n):e[n]}(r.t,n)===a||On(t,n,e(a))})),3===a?new Set(t):t}(e)}function nt(e,n){switch(n){case 2:return new Map(e);case 3:return Array.from(e)}return Rn(e)}var tt,rt,at="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),lt="undefined"!=typeof Map,ot="undefined"!=typeof Set,it="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,st=at?Symbol.for("immer-nothing"):((tt={})["immer-nothing"]=!0,tt),ut=at?Symbol.for("immer-draftable"):"__$immer_draftable",ct=at?Symbol.for("immer-state"):"__$immer_state",dt=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ft="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,pt=Object.getOwnPropertyDescriptors||function(e){var n={};return ft(e).forEach((function(t){n[t]=Object.getOwnPropertyDescriptor(e,t)})),n},gt={},ht={get:function(e,n){if(n===ct)return e;var t=Nn(e);if(!Pn(t,n))return function(e,n,t){var r,a=Yn(n,t);return a?"value"in a?a.value:null===(r=a.get)||void 0===r?void 0:r.call(e.k):void 0}(e,t,n);var r=t[n];return e.I||!Sn(r)?r:r===Gn(e.t,n)?(Xn(e),e.o[n]=Jn(e.A.h,r,e)):r},has:function(e,n){return n in Nn(e)},ownKeys:function(e){return Reflect.ownKeys(Nn(e))},set:function(e,n,t){var r=Yn(Nn(e),n);if(null==r?void 0:r.set)return r.set.call(e.k,t),!0;if(!e.P){var a=Gn(Nn(e),n),l=null==a?void 0:a[ct];if(l&&l.t===t)return e.o[n]=t,e.D[n]=!1,!0;if(function(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}(t,a)&&(void 0!==t||Pn(e.t,n)))return!0;Xn(e),Zn(e)}return e.o[n]===t&&"number"!=typeof t&&(void 0!==t||n in e.o)||(e.o[n]=t,e.D[n]=!0,!0)},deleteProperty:function(e,n){return void 0!==Gn(e.t,n)||n in e.t?(e.D[n]=!1,Xn(e),Zn(e)):delete e.D[n],e.o&&delete e.o[n],!0},getOwnPropertyDescriptor:function(e,n){var t=Nn(e),r=Reflect.getOwnPropertyDescriptor(t,n);return r?{writable:!0,configurable:1!==e.i||"length"!==n,enumerable:r.enumerable,value:t[n]}:r},defineProperty:function(){zn(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){zn(12)}},mt={};_n(ht,(function(e,n){mt[e]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)}})),mt.deleteProperty=function(e,n){return mt.set.call(this,e,n,void 0)},mt.set=function(e,n,t){return ht.set.call(this,e[0],n,t,e[0])};var vt=function(){function e(e){var n=this;this.g=it,this.F=!0,this.produce=function(e,t,r){if("function"==typeof e&&"function"!=typeof t){var a=t;t=e;var l=n;return function(e){var n=this;void 0===e&&(e=a);for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i1?r-1:0),l=1;l=0;t--){var r=n[t];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}t>-1&&(n=n.slice(t+1));var a=In("Patches").$;return Cn(e)?a(e,n):this.produce(e,(function(e){return a(e,n)}))},e}(),bt=new vt,yt=bt.produce;bt.produceWithPatches.bind(bt),bt.setAutoFreeze.bind(bt),bt.setUseProxies.bind(bt),bt.applyPatches.bind(bt),bt.createDraft.bind(bt),bt.finishDraft.bind(bt);const xt=yt,wt=je` +`,kn=e=>["color","gradient","grid","effect","font"].includes(e),En=()=>{const[n,t]=(0,e.useState)(!1),{figmaUIApi:r,figmaMetaData:a}=(0,e.useContext)(rn),{settings:l,updateSettings:o}=(0,e.useContext)(an);return e.createElement("form",{className:yn,onSubmit:e=>{if(e.preventDefault(),!0===e.target.checkValidity()){const{accessToken:e}=l,n=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);ao((n=>{n.keyInName=e}))}),e.createElement(gn,{width:240,label:'The token type (e.g. "color" or "font") will be added to the name e.g. "color/light/bg".'})),e.createElement(Je,{size:"small",weight:"bold"},"Filename",e.createElement(gn,{width:160,label:"The file name used when exporting the tokens"})),e.createElement("div",{className:"grid-2-col"},e.createElement(qe,{type:"text",required:!0,pattern:"^[\\w\\d\\s\\[\\]._\\-]+$",placeholder:a.filename,value:l.filename,onChange:e=>o((n=>{n.filename=e}))}),e.createElement(Ge,{defaultValue:l.extension,onChange:({value:e})=>o((n=>{n.extension=e})),placeholder:"file extension",options:sn.fileExtensions})),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Name conversion"),e.createElement(Ge,{defaultValue:l.nameConversion,onChange:({value:e})=>o((n=>{n.nameConversion=e})),placeholder:"Name conversion",options:[{label:"Default",value:"default"},{label:"camelCase",value:"camelCase"},{label:"kebab-case",value:"kebabCase"}]})),e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Token format",e.createElement(gn,{width:240,label:"The structure of the output json file. Learn more in the docs."})),e.createElement(Ge,{defaultValue:l.tokenFormat,onChange:({value:e})=>{o((n=>{n.tokenFormat=e})),t("standard"===e)},placeholder:"Token format",options:[{label:"Standard (W3C draft)",value:"standard"},{label:"Original (deprecated)",value:"original"}]}))),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Exclusion prefix"," ",e.createElement(gn,{width:240,label:'Styles & tokens with this prefix will be ignored when exporting. ("." and "_" work by default)'})),e.createElement(qe,{type:"text",pattern:"^[#\\+*\\\\/&%$!?;:~,\\s]+$",placeholder:"#, @",value:l.exclusionPrefix,onChange:e=>o((n=>{n.exclusionPrefix=e}))})),n&&e.createElement("div",null,e.createElement(Je,{size:"small",weight:"bold"},"Alias identifier"," ",e.createElement(gn,{width:180,label:"Use to define an alias for a token; case insensitive"})),e.createElement(qe,{type:"text",pattern:"^[A-Za-z,\\s]+$",placeholder:"alias, ref, reference",value:l.alias,onChange:e=>o((n=>{n.alias=e}))}))),e.createElement(mn,null),e.createElement(Je,{size:"small",weight:"bold"},"Token prefixes"," ",e.createElement(gn,{width:150,label:"Use commas to separate multiple prefixed"})),e.createElement(nn,{className:wn,size:"small"},'Prefixes are the first part of a tokens name e.g. "radius" in "radius/small". They are used to identify the type of a custom token.'),e.createElement(fn,null,e.createElement(Be,{label:"Include token prefix in token names",type:"switch",checked:l.prefixInName,onChange:e=>o((n=>{n.prefixInName=e}))}),e.createElement(gn,{width:240,label:'When disabled the prefix is removed ("radius/small" → "small"), when enabled it is added ("radius/small" → "radius/small").'})),e.createElement(mn,null),e.createElement("div",{className:"grid-2-col"},Object.entries(l.prefix).map((([n,t])=>e.createElement(fn,{fill:!0,key:n},e.createElement(Ze,{className:`${xn} flex-grow--none`},n,kn(n)?e.createElement(gn,{width:90,label:"Prefix for style"}):""),e.createElement(qe,{type:"text",pattern:kn(n)?"^[\\w\\-@]+$":"^[\\w\\-@,\\s]+$",required:!0,placeholder:n,value:t,onChange:e=>o((t=>{t.prefix[n]=e}))}))))),e.createElement(cn,null,e.createElement(bn,{align:"start",href:"https://github.com/lukasoppermann/design-tokens#design-tokens"},"Documentation"),e.createElement(on,null),e.createElement(He,{type:"submit",autofocus:!0},"Save changes")))};function zn(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r3?n.i-4:n.i:Array.isArray(e)?1:An(e)?2:Ln(e)?3:0}function Pn(e,n){return 2===Mn(e)?e.has(n):Object.prototype.hasOwnProperty.call(e,n)}function On(e,n,t){var r=Mn(e);2===r?e.set(n,t):3===r?(e.delete(n),e.add(t)):e[n]=t}function An(e){return lt&&e instanceof Map}function Ln(e){return ot&&e instanceof Set}function Nn(e){return e.o||e.t}function Rn(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var n=pt(e);delete n[ct];for(var t=ft(n),r=0;r1&&(e.set=e.add=e.clear=e.delete=Fn),Object.freeze(e),n&&_n(e,(function(e,n){return Tn(n,!0)}),!0)),e}function Fn(){zn(2)}function Dn(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function In(e){var n=gt[e];return n||zn(18,e),n}function Un(){return rt}function jn(e,n){n&&(In("Patches"),e.u=[],e.s=[],e.v=n)}function $n(e){Hn(e),e.p.forEach(Bn),e.p=null}function Hn(e){e===rt&&(rt=e.l)}function Vn(e){return rt={p:[],l:rt,h:e,m:!0,_:0}}function Bn(e){var n=e[ct];0===n.i||1===n.i?n.j():n.O=!0}function Wn(e,n){n._=n.p.length;var t=n.p[0],r=void 0!==e&&e!==t;return n.h.g||In("ES5").S(n,e,r),r?(t[ct].P&&($n(n),zn(4)),Sn(e)&&(e=qn(n,e),n.l||Kn(n,e)),n.u&&In("Patches").M(t[ct].t,e,n.u,n.s)):e=qn(n,t,[]),$n(n),n.u&&n.v(n.u,n.s),e!==st?e:void 0}function qn(e,n,t){if(Dn(n))return n;var r=n[ct];if(!r)return _n(n,(function(a,l){return Qn(e,r,n,a,l,t)}),!0),n;if(r.A!==e)return n;if(!r.P)return Kn(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var a=4===r.i||5===r.i?r.o=Rn(r.k):r.o;_n(3===r.i?new Set(a):a,(function(n,l){return Qn(e,r,a,n,l,t)})),Kn(e,a,!1),t&&e.u&&In("Patches").R(r,t,e.u,e.s)}return r.o}function Qn(e,n,t,r,a,l){if(Cn(a)){var o=qn(e,a,l&&n&&3!==n.i&&!Pn(n.D,r)?l.concat(r):void 0);if(On(t,r,o),!Cn(o))return;e.m=!1}if(Sn(a)&&!Dn(a)){if(!e.h.F&&e._<1)return;qn(e,a),n&&n.A.l||Kn(e,a)}}function Kn(e,n,t){void 0===t&&(t=!1),e.h.F&&e.m&&Tn(n,t)}function Gn(e,n){var t=e[ct];return(t?Nn(t):e)[n]}function Yn(e,n){if(n in e)for(var t=Object.getPrototypeOf(e);t;){var r=Object.getOwnPropertyDescriptor(t,n);if(r)return r;t=Object.getPrototypeOf(t)}}function Zn(e){e.P||(e.P=!0,e.l&&Zn(e.l))}function Xn(e){e.o||(e.o=Rn(e.t))}function Jn(e,n,t){var r=An(n)?In("MapSet").N(n,t):Ln(n)?In("MapSet").T(n,t):e.g?function(e,n){var t=Array.isArray(e),r={i:t?1:0,A:n?n.A:Un(),P:!1,I:!1,D:{},l:n,t:e,k:null,o:null,j:null,C:!1},a=r,l=ht;t&&(a=[r],l=mt);var o=Proxy.revocable(a,l),i=o.revoke,s=o.proxy;return r.k=s,r.j=i,s}(n,t):In("ES5").J(n,t);return(t?t.A:Un()).p.push(r),r}function et(e){return Cn(e)||zn(22,e),function e(n){if(!Sn(n))return n;var t,r=n[ct],a=Mn(n);if(r){if(!r.P&&(r.i<4||!In("ES5").K(r)))return r.t;r.I=!0,t=nt(n,a),r.I=!1}else t=nt(n,a);return _n(t,(function(n,a){r&&function(e,n){return 2===Mn(e)?e.get(n):e[n]}(r.t,n)===a||On(t,n,e(a))})),3===a?new Set(t):t}(e)}function nt(e,n){switch(n){case 2:return new Map(e);case 3:return Array.from(e)}return Rn(e)}var tt,rt,at="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),lt="undefined"!=typeof Map,ot="undefined"!=typeof Set,it="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,st=at?Symbol.for("immer-nothing"):((tt={})["immer-nothing"]=!0,tt),ut=at?Symbol.for("immer-draftable"):"__$immer_draftable",ct=at?Symbol.for("immer-state"):"__$immer_state",dt=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ft="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,pt=Object.getOwnPropertyDescriptors||function(e){var n={};return ft(e).forEach((function(t){n[t]=Object.getOwnPropertyDescriptor(e,t)})),n},gt={},ht={get:function(e,n){if(n===ct)return e;var t=Nn(e);if(!Pn(t,n))return function(e,n,t){var r,a=Yn(n,t);return a?"value"in a?a.value:null===(r=a.get)||void 0===r?void 0:r.call(e.k):void 0}(e,t,n);var r=t[n];return e.I||!Sn(r)?r:r===Gn(e.t,n)?(Xn(e),e.o[n]=Jn(e.A.h,r,e)):r},has:function(e,n){return n in Nn(e)},ownKeys:function(e){return Reflect.ownKeys(Nn(e))},set:function(e,n,t){var r=Yn(Nn(e),n);if(null==r?void 0:r.set)return r.set.call(e.k,t),!0;if(!e.P){var a=Gn(Nn(e),n),l=null==a?void 0:a[ct];if(l&&l.t===t)return e.o[n]=t,e.D[n]=!1,!0;if(function(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}(t,a)&&(void 0!==t||Pn(e.t,n)))return!0;Xn(e),Zn(e)}return e.o[n]===t&&"number"!=typeof t&&(void 0!==t||n in e.o)||(e.o[n]=t,e.D[n]=!0,!0)},deleteProperty:function(e,n){return void 0!==Gn(e.t,n)||n in e.t?(e.D[n]=!1,Xn(e),Zn(e)):delete e.D[n],e.o&&delete e.o[n],!0},getOwnPropertyDescriptor:function(e,n){var t=Nn(e),r=Reflect.getOwnPropertyDescriptor(t,n);return r?{writable:!0,configurable:1!==e.i||"length"!==n,enumerable:r.enumerable,value:t[n]}:r},defineProperty:function(){zn(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){zn(12)}},mt={};_n(ht,(function(e,n){mt[e]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)}})),mt.deleteProperty=function(e,n){return mt.set.call(this,e,n,void 0)},mt.set=function(e,n,t){return ht.set.call(this,e[0],n,t,e[0])};var vt=function(){function e(e){var n=this;this.g=it,this.F=!0,this.produce=function(e,t,r){if("function"==typeof e&&"function"!=typeof t){var a=t;t=e;var l=n;return function(e){var n=this;void 0===e&&(e=a);for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i1?r-1:0),l=1;l=0;t--){var r=n[t];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}t>-1&&(n=n.slice(t+1));var a=In("Patches").$;return Cn(e)?a(e,n):this.produce(e,(function(e){return a(e,n)}))},e}(),bt=new vt,yt=bt.produce;bt.produceWithPatches.bind(bt),bt.setAutoFreeze.bind(bt),bt.setUseProxies.bind(bt),bt.applyPatches.bind(bt),bt.createDraft.bind(bt),bt.finishDraft.bind(bt);const xt=yt,wt=je` font-family: var(--font-stack); font-size: var(--font-size-xsmall); font-weight: var(--font-weight-normal); @@ -637,7 +637,7 @@ select.select-menu { margin-right: var(--size-xxsmall); margin-left: var(--size-xxxsmall); } -`,kt=({versionDifference:n})=>"major"!==n&&"minor"!==n?e.createElement(e.Fragment,null):e.createElement("div",{id:"versionNotice",className:wt},e.createElement("div",{className:"icon"},"🎉"),e.createElement("div",null,"The ",e.createElement("a",{className:"subtle",href:"https://www.figma.com/community/plugin/888356646278934516/Design-Tokens",target:"_blank",rel:"noreferrer"},"Design Token plugin")," was updated.",e.createElement("br",null),"Find out about changes & new features in the ",e.createElement("a",{href:"https://github.com/lukasoppermann/design-tokens/releases",target:"_blank",rel:"noreferrer"},"release notes →"))),Et={filename:"design-tokens",extension:".tokens.json",nameConversion:"default",tokenFormat:"standard",compression:!1,urlJsonCompression:!0,serverUrl:void 0,eventType:"update-tokens",accessToken:void 0,acceptHeader:"application/vnd.github.everest-preview+json",contentType:"text/plain;charset=UTF-8",authType:"token",reference:"main",exclusionPrefix:"",excludeExtensionProp:!1,alias:"alias, ref, reference",keyInName:!1,prefixInName:!0,prefix:{color:"color",gradient:"gradient",typography:"typography",font:"font",effect:"effect",grid:"grid",border:"border, borders",breakpoint:"breakpoint, breakpoints",radius:"radius, radii",size:"size, sizes",spacing:"spacing",motion:"motion",opacity:"opacity, opacities"},exports:{color:!0,gradient:!0,font:!0,typography:!0,effect:!0,grid:!0,border:!0,breakpoint:!0,radius:!0,size:!0,spacing:!0,motion:!0,opacity:!0,variables:!0}};function zt(e,n){(function(e){return"string"==typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var t=function(e){return"string"==typeof e&&-1!==e.indexOf("%")}(e);return e=360===n?e:Math.min(n,Math.max(0,parseFloat(e))),t&&(e=parseInt(String(e*n),10)/100),Math.abs(e-n)<1e-6?1:e=360===n?(e<0?e%n+n:e%n)/parseFloat(String(n)):e%n/parseFloat(String(n))}function Ct(e){return Math.min(1,Math.max(0,e))}function St(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function _t(e){return e<=1?"".concat(100*Number(e),"%"):e}function Mt(e){return 1===e.length?"0"+e:String(e)}function Pt(e,n,t){e=zt(e,255),n=zt(n,255),t=zt(t,255);var r=Math.max(e,n,t),a=Math.min(e,n,t),l=0,o=0,i=(r+a)/2;if(r===a)o=0,l=0;else{var s=r-a;switch(o=i>.5?s/(2-r-a):s/(r+a),r){case e:l=(n-t)/s+(n1&&(t-=1),t<1/6?e+6*t*(n-e):t<.5?n:t<2/3?e+(n-e)*(2/3-t)*6:e}function At(e,n,t){e=zt(e,255),n=zt(n,255),t=zt(t,255);var r=Math.max(e,n,t),a=Math.min(e,n,t),l=0,o=r,i=r-a,s=0===r?0:i/r;if(r===a)l=0;else{switch(r){case e:l=(n-t)/i+(n>16,g:(65280&e)>>8,b:255&e}}(n)),this.originalInput=n;var a=function(e){var n={r:0,g:0,b:0},t=1,r=null,a=null,l=null,o=!1,i=!1;return"string"==typeof e&&(e=function(e){if(0===(e=e.trim().toLowerCase()).length)return!1;var n=!1;if(Ft[e])e=Ft[e],n=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var t=jt.rgb.exec(e);return t?{r:t[1],g:t[2],b:t[3]}:(t=jt.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=jt.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=jt.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=jt.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=jt.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=jt.hex8.exec(e))?{r:Tt(t[1]),g:Tt(t[2]),b:Tt(t[3]),a:Rt(t[4]),format:n?"name":"hex8"}:(t=jt.hex6.exec(e))?{r:Tt(t[1]),g:Tt(t[2]),b:Tt(t[3]),format:n?"name":"hex"}:(t=jt.hex4.exec(e))?{r:Tt(t[1]+t[1]),g:Tt(t[2]+t[2]),b:Tt(t[3]+t[3]),a:Rt(t[4]+t[4]),format:n?"name":"hex8"}:!!(t=jt.hex3.exec(e))&&{r:Tt(t[1]+t[1]),g:Tt(t[2]+t[2]),b:Tt(t[3]+t[3]),format:n?"name":"hex"}}(e)),"object"==typeof e&&($t(e.r)&&$t(e.g)&&$t(e.b)?(n=function(e,n,t){return{r:255*zt(e,255),g:255*zt(n,255),b:255*zt(t,255)}}(e.r,e.g,e.b),o=!0,i="%"===String(e.r).substr(-1)?"prgb":"rgb"):$t(e.h)&&$t(e.s)&&$t(e.v)?(r=_t(e.s),a=_t(e.v),n=function(e,n,t){e=6*zt(e,360),n=zt(n,100),t=zt(t,100);var r=Math.floor(e),a=e-r,l=t*(1-n),o=t*(1-a*n),i=t*(1-(1-a)*n),s=r%6;return{r:255*[t,o,l,l,i,t][s],g:255*[i,t,t,o,l,l][s],b:255*[l,l,i,t,t,o][s]}}(e.h,r,a),o=!0,i="hsv"):$t(e.h)&&$t(e.s)&&$t(e.l)&&(r=_t(e.s),l=_t(e.l),n=function(e,n,t){var r,a,l;if(e=zt(e,360),n=zt(n,100),t=zt(t,100),0===n)a=t,l=t,r=t;else{var o=t<.5?t*(1+n):t+n-t*n,i=2*t-o;r=Ot(i,o,e+1/3),a=Ot(i,o,e),l=Ot(i,o,e-1/3)}return{r:255*r,g:255*a,b:255*l}}(e.h,r,l),o=!0,i="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(t=e.a)),t=St(t),{ok:o,format:e.format||i,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:t}}(n);this.originalInput=n,this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(r=t.format)&&void 0!==r?r:a.format,this.gradientType=t.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=a.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),n=e.r/255,t=e.g/255,r=e.b/255;return.2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=St(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.toHsv=function(){var e=At(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=At(this.r,this.g,this.b),n=Math.round(360*e.h),t=Math.round(100*e.s),r=Math.round(100*e.v);return 1===this.a?"hsv(".concat(n,", ").concat(t,"%, ").concat(r,"%)"):"hsva(".concat(n,", ").concat(t,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=Pt(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=Pt(this.r,this.g,this.b),n=Math.round(360*e.h),t=Math.round(100*e.s),r=Math.round(100*e.l);return 1===this.a?"hsl(".concat(n,", ").concat(t,"%, ").concat(r,"%)"):"hsla(".concat(n,", ").concat(t,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),Lt(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),function(e,n,t,r,a){var l=[Mt(Math.round(e).toString(16)),Mt(Math.round(n).toString(16)),Mt(Math.round(t).toString(16)),Mt(Nt(r))];return a&&l[0].startsWith(l[0].charAt(1))&&l[1].startsWith(l[1].charAt(1))&&l[2].startsWith(l[2].charAt(1))&&l[3].startsWith(l[3].charAt(1))?l[0].charAt(0)+l[1].charAt(0)+l[2].charAt(0)+l[3].charAt(0):l.join("")}(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),n=Math.round(this.g),t=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(n,", ").concat(t,")"):"rgba(".concat(e,", ").concat(n,", ").concat(t,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*zt(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*zt(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+Lt(this.r,this.g,this.b,!1),n=0,t=Object.entries(Ft);n=0;return n||!r||!e.startsWith("hex")&&"name"!==e?("rgb"===e&&(t=this.toRgbString()),"prgb"===e&&(t=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(t=this.toHexString()),"hex3"===e&&(t=this.toHexString(!0)),"hex4"===e&&(t=this.toHex8String(!0)),"hex8"===e&&(t=this.toHex8String()),"name"===e&&(t=this.toName()),"hsl"===e&&(t=this.toHslString()),"hsv"===e&&(t=this.toHsvString()),t||this.toHexString()):"name"===e&&0===this.a?this.toName():this.toRgbString()},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.l+=n/100,t.l=Ct(t.l),new e(t)},e.prototype.brighten=function(n){void 0===n&&(n=10);var t=this.toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(-n/100*255))),t.g=Math.max(0,Math.min(255,t.g-Math.round(-n/100*255))),t.b=Math.max(0,Math.min(255,t.b-Math.round(-n/100*255))),new e(t)},e.prototype.darken=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.l-=n/100,t.l=Ct(t.l),new e(t)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.s-=n/100,t.s=Ct(t.s),new e(t)},e.prototype.saturate=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.s+=n/100,t.s=Ct(t.s),new e(t)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(n){var t=this.toHsl(),r=(t.h+n)%360;return t.h=r<0?360+r:r,new e(t)},e.prototype.mix=function(n,t){void 0===t&&(t=50);var r=this.toRgb(),a=new e(n).toRgb(),l=t/100;return new e({r:(a.r-r.r)*l+r.r,g:(a.g-r.g)*l+r.g,b:(a.b-r.b)*l+r.b,a:(a.a-r.a)*l+r.a})},e.prototype.analogous=function(n,t){void 0===n&&(n=6),void 0===t&&(t=30);var r=this.toHsl(),a=360/t,l=[this];for(r.h=(r.h-(a*n>>1)+720)%360;--n;)r.h=(r.h+a)%360,l.push(new e(r));return l},e.prototype.complement=function(){var n=this.toHsl();return n.h=(n.h+180)%360,new e(n)},e.prototype.monochromatic=function(n){void 0===n&&(n=6);for(var t=this.toHsv(),r=t.h,a=t.s,l=t.v,o=[],i=1/n;n--;)o.push(new e({h:r,s:a,v:l})),l=(l+i)%1;return o},e.prototype.splitcomplement=function(){var n=this.toHsl(),t=n.h;return[this,new e({h:(t+72)%360,s:n.s,l:n.l}),new e({h:(t+216)%360,s:n.s,l:n.l})]},e.prototype.onBackground=function(n){var t=this.toRgb(),r=new e(n).toRgb();return new e({r:r.r+(t.r-r.r)*t.a,g:r.g+(t.g-r.g)*t.a,b:r.b+(t.b-r.b)*t.a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(n){for(var t=this.toHsl(),r=t.h,a=[this],l=360/n,o=1;o`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`,Bt=e=>{return(n=Vt(e),void 0===n&&(n=""),void 0===t&&(t={}),new Ht(n,t)).toHex8String();var n,t},Wt=({width:e})=>Object.assign({value:e.value,type:e.type},void 0!==e.unit&&{unit:e.unit}),qt=(e,n)=>{if(null!=e)return"color"===n?Vt(e):e},Qt=e=>Object.assign(Object.assign({value:qt(e.value,e.type),type:e.type},void 0!==e.description&&{comment:e.description}),void 0!==e.unit&&{unit:e.unit}),Kt=e=>{Array.isArray(e)&&1===e.length&&(e=e[0]);const n={};return Object.keys(e).forEach((function(t){Object.prototype.hasOwnProperty.call(e[t],"value")?n[t]=Qt(e[t]):n[t]=Kt(e[t])})),1===Object.keys(n).length?Object.values(n)[0]:n},Gt={size:Wt,color:Kt,gradient:Kt,font:Kt,effect:e=>{const n=e.map((e=>["dropShadow","innerShadow"].includes(e.effectType.value)?(e=>({type:{value:e.effectType.value,type:"string"},radius:{value:e.radius.value,type:"number",unit:"pixel"},color:{value:Vt(e.color.value),type:"color"},offset:{x:{value:e.offset.x.value,type:"number",unit:"pixel"},y:{value:e.offset.y.value,type:"number",unit:"pixel"}},spread:{value:e.spread.value,type:"number",unit:"pixel"}}))(e):(e=>({type:{value:e.effectType.value,type:"string"},radius:{value:e.radius.value,type:"number",unit:"pixel"}}))(e)));return Array.isArray(n)&&1===n.length?n[0]:n},grid:Kt,border:e=>Object.fromEntries(Object.entries(e).map((([e,n])=>{if("dashPattern"===e){const t=Qt(n);return t.value=t.value.join(", "),[e,t]}return[e,Qt(n)]}))),breakpoint:Wt,radius:Kt,spacing:Kt,motion:e=>Object.assign(Object.assign({type:{value:e.transitionType.value,type:"string"},duration:{value:e.duration.value,type:"number",unit:"s"}},e.direction?{direction:{value:e.direction.value,type:"string"}}:{}),{easing:{value:e.easingType.value.replace("cubicBezier","cubic-bezier"),type:"string"},easingFunction:e.easingFunction}),opacity:({opacity:e})=>({value:e.value,type:e.type})},Yt=(e,n=2)=>{if(void 0===e)return;if("number"!=typeof e||"number"!=typeof n)throw new Error(`Invalid parameters, both value "${e}" (${typeof e}) and decimalPlaces "${n}" (${typeof n}) must be of type number`);const t=Math.pow(10,n);return Math.round(e*t)/t},Zt=(e,{excludeExtensionProp:n})=>{if(!0!==n)return{extensions:Object.assign({},e.extensions)}},Xt=e=>"pixel"===e.lineHeight.unit?Yt(e.lineHeight.value,3):"percent"===e.lineHeight.unit?Yt(e.fontSize.value*(e.lineHeight.value/100),3):Yt(1.2*e.fontSize.value,3),Jt=e=>"pixel"===e.letterSpacing.unit?Yt(e.letterSpacing.value,3):"percent"===e.letterSpacing.unit?Yt(e.fontSize.value*(e.letterSpacing.value/100),3):void 0,er=({values:e})=>({value:e.width.value,type:"dimension"}),nr=e=>{var n,t,r;if(e.extensions&&e.extensions[sn.key.extensionPluginData]&&e.extensions[sn.key.extensionPluginData].alias)return{type:Object.hasOwnProperty.call(e.values[0],"fill")?"color":"custom-gradient",value:`{${e.extensions[sn.key.extensionPluginData].alias}}`,blendMode:(null===(r=null===(t=null===(n=e.values[0])||void 0===n?void 0:n.fill)||void 0===t?void 0:t.blendMode)||void 0===r?void 0:r.toLowerCase())||"normal"};const a=e.values.map((e=>Object.hasOwnProperty.call(e,"fill")?(({fill:e})=>{var n;return{type:"color",value:Bt(e.value),blendMode:(null===(n=e.blendMode)||void 0===n?void 0:n.toLowerCase())||"normal"}})(e):(({gradientType:e,rotation:n,stops:t,opacity:r})=>({type:"custom-gradient",value:{gradientType:e.value,rotation:n.value,stops:t.map((e=>({position:e.position.value,color:Bt(Object.assign(Object.assign({},e.color.value),{a:e.color.value.a*r.value}))})))}}))(e)));return 1===a.length?a[0]:Object.assign({},a)},tr={size:er,color:nr,gradient:nr,font:({values:e})=>({type:"custom-fontStyle",value:{fontSize:e.fontSize.value,textDecoration:e.textDecoration.value,fontFamily:e.fontFamily.value,fontWeight:e.fontWeight.value,fontStyle:e.fontStyle.value,fontStretch:e.fontStretch.value,letterSpacing:Jt(e),lineHeight:Xt(e),paragraphIndent:e.paragraphIndent.value,paragraphSpacing:e.paragraphSpacing.value,textCase:e.textCase.value}}),effect:({values:e})=>{const n=e.map((e=>{return["dropShadow","innerShadow"].includes(e.effectType.value)?{type:"custom-shadow",value:{shadowType:(n=e).effectType.value,radius:n.radius.value,color:Bt(n.color.value),offsetX:n.offset.x.value,offsetY:n.offset.y.value,spread:n.spread.value}}:null;var n}));return 1===n.length?n[0]:Object.assign({},n)},grid:({values:e})=>{const n=e.map((e=>({type:"custom-grid",value:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({pattern:e.pattern.value},e.sectionSize?{sectionSize:e.sectionSize.value}:{}),e.gutterSize?{gutterSize:e.gutterSize.value}:{}),e.alignment?{alignment:e.alignment.value}:{}),e.count?{count:e.count.value}:{}),e.offset?{offset:e.offset.value}:{})})));return 1===n.length?n[0]:Object.assign({},n)},border:({values:e})=>({type:"custom-stroke",value:{align:e.strokeAlign.value,dashPattern:e.dashPattern.value,lineCap:e.strokeCap.value,lineJoin:e.strokeJoin.value,miterLimit:e.strokeMiterLimit.value,weight:e.strokeWeight.value,color:Bt(e.stroke.value)}}),breakpoint:er,radius:({values:e})=>({type:"custom-radius",value:{smoothing:e.smoothing.value,topLeft:e.radii.topLeft.value,topRight:e.radii.topRight.value,bottomLeft:e.radii.bottomLeft.value,bottomRight:e.radii.bottomRight.value}}),spacing:({values:e})=>({type:"custom-spacing",value:{top:e.top.value,bottom:e.bottom.value,left:e.left.value,right:e.right.value}}),motion:({values:e})=>({type:"custom-transition",value:Object.assign(Object.assign({transitionType:e.transitionType.value,duration:e.duration.value},e.direction?{direction:e.direction.value}:{}),{easingType:e.easingCurveType.value,easingFunction:Object.fromEntries(Object.entries(e.easingFunction).map((e=>[e[0],e[1].value])))})}),opacity:({values:e})=>({value:e.opacity.value,type:"custom-opacity"})},rr=(e,n)=>"typography"===e.category?Object.assign({name:e.name,description:e.description},(({name:e,values:n})=>({fontSize:{type:"dimension",value:n.fontSize.value},textDecoration:{type:"string",value:n.textDecoration.value},fontFamily:{type:"string",value:n.fontFamily.value},fontWeight:{type:"number",value:n.fontWeight.value},fontStyle:{type:"string",value:n.fontStyle.value},fontStretch:{type:"string",value:n.fontStretch.value},letterSpacing:{type:"dimension",value:Jt(n)},lineHeight:{type:"dimension",value:Xt(n)},paragraphIndent:{type:"dimension",value:n.paragraphIndent.value},paragraphSpacing:{type:"dimension",value:n.paragraphSpacing.value},textCase:{type:"string",value:n.textCase.value}}))(e)):"variables"===e.extensions[sn.key.extensionPluginData].exportKey?Object.assign(Object.assign({name:e.name,description:e.description},(({values:e,category:n})=>{var t;return"color"===n?{type:"color",value:Bt(e.fill.value),blendMode:(null===(t=e.fill.blendMode)||void 0===t?void 0:t.toLowerCase())||"normal"}:["size","boolean","string","alias"].includes(n)?{type:n,value:e}:void 0})(e)),Zt(e,n)):Object.assign(Object.assign({name:e.name,description:e.description},(e=>tr[e.category](e))(e)),Zt(e,n)),ar=(e,n)=>{const t=e=>e&&"object"==typeof e;return t(e)&&t(n)?(Object.keys(n).forEach((r=>{const a=e[r],l=n[r];Array.isArray(a)&&Array.isArray(l)?e[r]=a.concat(l):t(a)&&t(l)?e[r]=ar(Object.assign({},a),l):e[r]=l})),e):n},lr=ar,or=(e,n,t)=>{if("string"==typeof e&&""!==e)return e;throw new Error(`converting "${n}" to ${t}, resulting in "${e}"`)},ir=(e,n="default")=>"camelCase"===n?(e=>{const n=e.toLowerCase().replace(/['"]/g,"").replace(/([-_ ]){1,}/g," ").replace(/\W+/g," ").trim().replace(/ (.)/g,(function(e){return e.toUpperCase()})).replace(/ /g,"");return or(n,e,"camelCase")})(e):"kebabCase"===n?(e=>{const n=e.toLowerCase().replace(/['"]/g,"").replace(/([-_ ]){1,}/g," ").replace(/\W+/g," ").trim().replace(/ /g,"-");return or(n,e,"kebabCase")})(e):e.trim().toLowerCase(),sr={color:{label:"Colors",key:"color"},gradient:{label:"Gradients",key:"gradient"},font:{label:"Font Styles",key:"font"},typography:{label:"Typography",key:"typography",exclude:["original"]},effect:{label:"Effects",key:"effect"},grid:{label:"Grids",key:"grid"},border:{label:"Borders",key:"border"},breakpoint:{label:"Breakpoints",key:"breakpoint"},radius:{label:"Radii",key:"radius"},size:{label:"Sizes",key:"size"},spacing:{label:"Spacing",key:"spacing"},motion:{label:"Motion",key:"motion"},opacity:{label:"Opacity",key:"opacity"},variables:{label:"Figma Variables (BETA)",key:"variables",exclude:["original"]}},ur=e=>{var n,t;return void 0!==(null===(t=null===(n=e.extensions)||void 0===n?void 0:n[sn.key.extensionPluginData])||void 0===t?void 0:t.exportKey)?e.extensions[sn.key.extensionPluginData].exportKey:"missingExportKey"},cr={original:(e,n)=>Object.assign(Object.assign({name:e.name,category:e.category,exportKey:e.extensions[sn.key.extensionPluginData].exportKey},e.description&&e.description.length>0&&{comment:e.description}),Gt[e.category](e.values)||{}),standard:rr,standardDeprecated:rr},dr=(e,n)=>"standard"===n.tokenFormat?JSON.parse(JSON.stringify(e.filter((e=>e.category===sr.font.key)))).map((e=>(e.name="typography/"+e.name.substr(e.name.indexOf("/")+1).trim().trimStart(),e.category=sr.typography.key,e.exportKey=sr.typography.key,!0!==n.excludeExtensionProp&&(e.extensions[sn.key.extensionPluginData].exportKey=sr.typography.key),e))):[],fr=(e,n)=>{let t=JSON.parse(e);t=[...t,...dr(t,n)];const r=((e,n)=>e.length<=0?[]:e.map((e=>{var t,r,a,l;if(!1===n.prefixInName)e.name=e.name.substr(e.name.indexOf("/")+1).trim().trimLeft();else if(void 0!==(null===(r=null===(t=e.extensions)||void 0===t?void 0:t[sn.key.extensionPluginData])||void 0===r?void 0:r.alias)){const n=e.name.substr(0,e.name.indexOf("/")).trim().trimLeft();e.extensions[sn.key.extensionPluginData].alias=`${n}.${e.extensions[sn.key.extensionPluginData].alias}`}return n.keyInName&&(e.name=`${ur(e)}/${e.name}`,void 0!==(null===(l=null===(a=e.extensions)||void 0===a?void 0:a[sn.key.extensionPluginData])||void 0===l?void 0:l.alias)&&(e.extensions[sn.key.extensionPluginData].alias=`${ur(e)}.${e.extensions[sn.key.extensionPluginData].alias}`)),e})))(t.filter((({exportKey:e})=>n.exports[e])),n),a=r.map((e=>cr[n.tokenFormat](e,n))),l=((e,n)=>{if(e.length<=0)return[];const t=e.map((e=>{const t=e.name.split("/").map((e=>ir(e,n.nameConversion)));return delete e.name,r=e,t.reduceRight(((e,n)=>({[n]:e})),r);var r}));return t.reduce(((e={},n)=>lr(e,n)))})(a,n);return l},pr=(e,n=!0)=>!0===n?JSON.stringify(e):JSON.stringify(e,null,2);const gr=je` +`,kt=({versionDifference:n})=>"major"!==n&&"minor"!==n?e.createElement(e.Fragment,null):e.createElement("div",{id:"versionNotice",className:wt},e.createElement("div",{className:"icon"},"🎉"),e.createElement("div",null,"The ",e.createElement("a",{className:"subtle",href:"https://www.figma.com/community/plugin/888356646278934516/Design-Tokens",target:"_blank",rel:"noreferrer"},"Design Token plugin")," was updated.",e.createElement("br",null),"Find out about changes & new features in the ",e.createElement("a",{href:"https://github.com/lukasoppermann/design-tokens/releases",target:"_blank",rel:"noreferrer"},"release notes →"))),Et={filename:"design-tokens",extension:".tokens.json",nameConversion:"default",tokenFormat:"standard",compression:!1,urlJsonCompression:!0,serverUrl:void 0,eventType:"update-tokens",accessToken:void 0,acceptHeader:"application/vnd.github.everest-preview+json",contentType:"text/plain;charset=UTF-8",authType:"token",reference:"main",exclusionPrefix:"",excludeExtensionProp:!1,alias:"alias, ref, reference",keyInName:!1,prefixInName:!0,prefix:{color:"color",gradient:"gradient",typography:"typography",font:"font",effect:"effect",grid:"grid",border:"border, borders",breakpoint:"breakpoint, breakpoints",radius:"radius, radii",size:"size, sizes",spacing:"spacing",motion:"motion",opacity:"opacity, opacities"},exports:{color:!0,gradient:!0,font:!0,typography:!0,effect:!0,grid:!0,border:!0,breakpoint:!0,radius:!0,size:!0,spacing:!0,motion:!0,opacity:!0,variables:!0}};function zt(e,n){(function(e){return"string"==typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var t=function(e){return"string"==typeof e&&-1!==e.indexOf("%")}(e);return e=360===n?e:Math.min(n,Math.max(0,parseFloat(e))),t&&(e=parseInt(String(e*n),10)/100),Math.abs(e-n)<1e-6?1:e=360===n?(e<0?e%n+n:e%n)/parseFloat(String(n)):e%n/parseFloat(String(n))}function Ct(e){return Math.min(1,Math.max(0,e))}function St(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function _t(e){return e<=1?"".concat(100*Number(e),"%"):e}function Mt(e){return 1===e.length?"0"+e:String(e)}function Pt(e,n,t){e=zt(e,255),n=zt(n,255),t=zt(t,255);var r=Math.max(e,n,t),a=Math.min(e,n,t),l=0,o=0,i=(r+a)/2;if(r===a)o=0,l=0;else{var s=r-a;switch(o=i>.5?s/(2-r-a):s/(r+a),r){case e:l=(n-t)/s+(n1&&(t-=1),t<1/6?e+6*t*(n-e):t<.5?n:t<2/3?e+(n-e)*(2/3-t)*6:e}function At(e,n,t){e=zt(e,255),n=zt(n,255),t=zt(t,255);var r=Math.max(e,n,t),a=Math.min(e,n,t),l=0,o=r,i=r-a,s=0===r?0:i/r;if(r===a)l=0;else{switch(r){case e:l=(n-t)/i+(n>16,g:(65280&e)>>8,b:255&e}}(n)),this.originalInput=n;var a=function(e){var n={r:0,g:0,b:0},t=1,r=null,a=null,l=null,o=!1,i=!1;return"string"==typeof e&&(e=function(e){if(0===(e=e.trim().toLowerCase()).length)return!1;var n=!1;if(Ft[e])e=Ft[e],n=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var t=jt.rgb.exec(e);return t?{r:t[1],g:t[2],b:t[3]}:(t=jt.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=jt.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=jt.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=jt.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=jt.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=jt.hex8.exec(e))?{r:Tt(t[1]),g:Tt(t[2]),b:Tt(t[3]),a:Rt(t[4]),format:n?"name":"hex8"}:(t=jt.hex6.exec(e))?{r:Tt(t[1]),g:Tt(t[2]),b:Tt(t[3]),format:n?"name":"hex"}:(t=jt.hex4.exec(e))?{r:Tt(t[1]+t[1]),g:Tt(t[2]+t[2]),b:Tt(t[3]+t[3]),a:Rt(t[4]+t[4]),format:n?"name":"hex8"}:!!(t=jt.hex3.exec(e))&&{r:Tt(t[1]+t[1]),g:Tt(t[2]+t[2]),b:Tt(t[3]+t[3]),format:n?"name":"hex"}}(e)),"object"==typeof e&&($t(e.r)&&$t(e.g)&&$t(e.b)?(n=function(e,n,t){return{r:255*zt(e,255),g:255*zt(n,255),b:255*zt(t,255)}}(e.r,e.g,e.b),o=!0,i="%"===String(e.r).substr(-1)?"prgb":"rgb"):$t(e.h)&&$t(e.s)&&$t(e.v)?(r=_t(e.s),a=_t(e.v),n=function(e,n,t){e=6*zt(e,360),n=zt(n,100),t=zt(t,100);var r=Math.floor(e),a=e-r,l=t*(1-n),o=t*(1-a*n),i=t*(1-(1-a)*n),s=r%6;return{r:255*[t,o,l,l,i,t][s],g:255*[i,t,t,o,l,l][s],b:255*[l,l,i,t,t,o][s]}}(e.h,r,a),o=!0,i="hsv"):$t(e.h)&&$t(e.s)&&$t(e.l)&&(r=_t(e.s),l=_t(e.l),n=function(e,n,t){var r,a,l;if(e=zt(e,360),n=zt(n,100),t=zt(t,100),0===n)a=t,l=t,r=t;else{var o=t<.5?t*(1+n):t+n-t*n,i=2*t-o;r=Ot(i,o,e+1/3),a=Ot(i,o,e),l=Ot(i,o,e-1/3)}return{r:255*r,g:255*a,b:255*l}}(e.h,r,l),o=!0,i="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(t=e.a)),t=St(t),{ok:o,format:e.format||i,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:t}}(n);this.originalInput=n,this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(r=t.format)&&void 0!==r?r:a.format,this.gradientType=t.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=a.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),n=e.r/255,t=e.g/255,r=e.b/255;return.2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=St(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.toHsv=function(){var e=At(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=At(this.r,this.g,this.b),n=Math.round(360*e.h),t=Math.round(100*e.s),r=Math.round(100*e.v);return 1===this.a?"hsv(".concat(n,", ").concat(t,"%, ").concat(r,"%)"):"hsva(".concat(n,", ").concat(t,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=Pt(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=Pt(this.r,this.g,this.b),n=Math.round(360*e.h),t=Math.round(100*e.s),r=Math.round(100*e.l);return 1===this.a?"hsl(".concat(n,", ").concat(t,"%, ").concat(r,"%)"):"hsla(".concat(n,", ").concat(t,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),Lt(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),function(e,n,t,r,a){var l=[Mt(Math.round(e).toString(16)),Mt(Math.round(n).toString(16)),Mt(Math.round(t).toString(16)),Mt(Nt(r))];return a&&l[0].startsWith(l[0].charAt(1))&&l[1].startsWith(l[1].charAt(1))&&l[2].startsWith(l[2].charAt(1))&&l[3].startsWith(l[3].charAt(1))?l[0].charAt(0)+l[1].charAt(0)+l[2].charAt(0)+l[3].charAt(0):l.join("")}(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),n=Math.round(this.g),t=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(n,", ").concat(t,")"):"rgba(".concat(e,", ").concat(n,", ").concat(t,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*zt(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*zt(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+Lt(this.r,this.g,this.b,!1),n=0,t=Object.entries(Ft);n=0;return n||!r||!e.startsWith("hex")&&"name"!==e?("rgb"===e&&(t=this.toRgbString()),"prgb"===e&&(t=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(t=this.toHexString()),"hex3"===e&&(t=this.toHexString(!0)),"hex4"===e&&(t=this.toHex8String(!0)),"hex8"===e&&(t=this.toHex8String()),"name"===e&&(t=this.toName()),"hsl"===e&&(t=this.toHslString()),"hsv"===e&&(t=this.toHsvString()),t||this.toHexString()):"name"===e&&0===this.a?this.toName():this.toRgbString()},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.l+=n/100,t.l=Ct(t.l),new e(t)},e.prototype.brighten=function(n){void 0===n&&(n=10);var t=this.toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(-n/100*255))),t.g=Math.max(0,Math.min(255,t.g-Math.round(-n/100*255))),t.b=Math.max(0,Math.min(255,t.b-Math.round(-n/100*255))),new e(t)},e.prototype.darken=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.l-=n/100,t.l=Ct(t.l),new e(t)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.s-=n/100,t.s=Ct(t.s),new e(t)},e.prototype.saturate=function(n){void 0===n&&(n=10);var t=this.toHsl();return t.s+=n/100,t.s=Ct(t.s),new e(t)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(n){var t=this.toHsl(),r=(t.h+n)%360;return t.h=r<0?360+r:r,new e(t)},e.prototype.mix=function(n,t){void 0===t&&(t=50);var r=this.toRgb(),a=new e(n).toRgb(),l=t/100;return new e({r:(a.r-r.r)*l+r.r,g:(a.g-r.g)*l+r.g,b:(a.b-r.b)*l+r.b,a:(a.a-r.a)*l+r.a})},e.prototype.analogous=function(n,t){void 0===n&&(n=6),void 0===t&&(t=30);var r=this.toHsl(),a=360/t,l=[this];for(r.h=(r.h-(a*n>>1)+720)%360;--n;)r.h=(r.h+a)%360,l.push(new e(r));return l},e.prototype.complement=function(){var n=this.toHsl();return n.h=(n.h+180)%360,new e(n)},e.prototype.monochromatic=function(n){void 0===n&&(n=6);for(var t=this.toHsv(),r=t.h,a=t.s,l=t.v,o=[],i=1/n;n--;)o.push(new e({h:r,s:a,v:l})),l=(l+i)%1;return o},e.prototype.splitcomplement=function(){var n=this.toHsl(),t=n.h;return[this,new e({h:(t+72)%360,s:n.s,l:n.l}),new e({h:(t+216)%360,s:n.s,l:n.l})]},e.prototype.onBackground=function(n){var t=this.toRgb(),r=new e(n).toRgb();return new e({r:r.r+(t.r-r.r)*t.a,g:r.g+(t.g-r.g)*t.a,b:r.b+(t.b-r.b)*t.a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(n){for(var t=this.toHsl(),r=t.h,a=[this],l=360/n,o=1;o`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`,Bt=e=>{return(n=Vt(e),void 0===n&&(n=""),void 0===t&&(t={}),new Ht(n,t)).toHex8String();var n,t},Wt=({width:e})=>Object.assign({value:e.value,type:e.type},void 0!==e.unit&&{unit:e.unit}),qt=(e,n)=>{if(null!=e)return"color"===n?Vt(e):e},Qt=e=>Object.assign(Object.assign({value:qt(e.value,e.type),type:e.type},void 0!==e.description&&{comment:e.description}),void 0!==e.unit&&{unit:e.unit}),Kt=e=>{Array.isArray(e)&&1===e.length&&(e=e[0]);const n={};return Object.keys(e).forEach((function(t){Object.prototype.hasOwnProperty.call(e[t],"value")?n[t]=Qt(e[t]):n[t]=Kt(e[t])})),1===Object.keys(n).length?Object.values(n)[0]:n},Gt={size:Wt,color:Kt,gradient:Kt,font:Kt,effect:e=>{const n=e.map((e=>["dropShadow","innerShadow"].includes(e.effectType.value)?(e=>({type:{value:e.effectType.value,type:"string"},radius:{value:e.radius.value,type:"number",unit:"pixel"},color:{value:Vt(e.color.value),type:"color"},offset:{x:{value:e.offset.x.value,type:"number",unit:"pixel"},y:{value:e.offset.y.value,type:"number",unit:"pixel"}},spread:{value:e.spread.value,type:"number",unit:"pixel"}}))(e):(e=>({type:{value:e.effectType.value,type:"string"},radius:{value:e.radius.value,type:"number",unit:"pixel"}}))(e)));return Array.isArray(n)&&1===n.length?n[0]:n},grid:Kt,border:e=>Object.fromEntries(Object.entries(e).map((([e,n])=>{if("dashPattern"===e){const t=Qt(n);return t.value=t.value.join(", "),[e,t]}return[e,Qt(n)]}))),breakpoint:Wt,radius:Kt,spacing:Kt,motion:e=>Object.assign(Object.assign({type:{value:e.transitionType.value,type:"string"},duration:{value:e.duration.value,type:"number",unit:"s"}},e.direction?{direction:{value:e.direction.value,type:"string"}}:{}),{easing:{value:e.easingType.value.replace("cubicBezier","cubic-bezier"),type:"string"},easingFunction:e.easingFunction}),opacity:({opacity:e})=>({value:e.value,type:e.type})},Yt=(e,n=2)=>{if(void 0===e)return;if("number"!=typeof e||"number"!=typeof n)throw new Error(`Invalid parameters, both value "${e}" (${typeof e}) and decimalPlaces "${n}" (${typeof n}) must be of type number`);const t=Math.pow(10,n);return Math.round(e*t)/t},Zt=(e,{excludeExtensionProp:n})=>{if(!0!==n)return{extensions:Object.assign({},e.extensions)}},Xt=e=>"pixel"===e.lineHeight.unit?Yt(e.lineHeight.value,3):"percent"===e.lineHeight.unit?Yt(e.fontSize.value*(e.lineHeight.value/100),3):Yt(1.2*e.fontSize.value,3),Jt=e=>"pixel"===e.letterSpacing.unit?Yt(e.letterSpacing.value,3):"percent"===e.letterSpacing.unit?Yt(e.fontSize.value*(e.letterSpacing.value/100),3):void 0,er=({values:e})=>({value:e.width.value,type:"dimension"}),nr=e=>{var n,t,r;if(e.extensions&&e.extensions[sn.key.extensionPluginData]&&e.extensions[sn.key.extensionPluginData].alias)return{type:Object.hasOwnProperty.call(e.values[0],"fill")?"color":"custom-gradient",value:`{${e.extensions[sn.key.extensionPluginData].alias}}`,blendMode:(null===(r=null===(t=null===(n=e.values[0])||void 0===n?void 0:n.fill)||void 0===t?void 0:t.blendMode)||void 0===r?void 0:r.toLowerCase())||"normal"};const a=e.values.map((e=>Object.hasOwnProperty.call(e,"fill")?(({fill:e})=>{var n;return{type:"color",value:Bt(e.value),blendMode:(null===(n=e.blendMode)||void 0===n?void 0:n.toLowerCase())||"normal"}})(e):(({gradientType:e,rotation:n,stops:t,opacity:r})=>({type:"custom-gradient",value:{gradientType:e.value,rotation:n.value,stops:t.map((e=>({position:e.position.value,color:Bt(Object.assign(Object.assign({},e.color.value),{a:e.color.value.a*r.value}))})))}}))(e)));return 1===a.length?a[0]:Object.assign({},a)},tr={size:er,color:nr,gradient:nr,font:({values:e})=>({type:"custom-fontStyle",value:{fontSize:e.fontSize.value,textDecoration:e.textDecoration.value,fontFamily:e.fontFamily.value,fontWeight:e.fontWeight.value,fontStyle:e.fontStyle.value,fontStretch:e.fontStretch.value,letterSpacing:Jt(e),lineHeight:Xt(e),paragraphIndent:e.paragraphIndent.value,paragraphSpacing:e.paragraphSpacing.value,textCase:e.textCase.value}}),effect:({values:e})=>{const n=e.map((e=>{return["dropShadow","innerShadow"].includes(e.effectType.value)?{type:"custom-shadow",value:{shadowType:(n=e).effectType.value,radius:n.radius.value,color:Bt(n.color.value),offsetX:n.offset.x.value,offsetY:n.offset.y.value,spread:n.spread.value}}:null;var n}));return 1===n.length?n[0]:Object.assign({},n)},grid:({values:e})=>{const n=e.map((e=>({type:"custom-grid",value:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({pattern:e.pattern.value},e.sectionSize?{sectionSize:e.sectionSize.value}:{}),e.gutterSize?{gutterSize:e.gutterSize.value}:{}),e.alignment?{alignment:e.alignment.value}:{}),e.count?{count:e.count.value}:{}),e.offset?{offset:e.offset.value}:{})})));return 1===n.length?n[0]:Object.assign({},n)},border:({values:e})=>({type:"custom-stroke",value:{align:e.strokeAlign.value,dashPattern:e.dashPattern.value,lineCap:e.strokeCap.value,lineJoin:e.strokeJoin.value,miterLimit:e.strokeMiterLimit.value,weight:e.strokeWeight.value,color:Bt(e.stroke.value)}}),breakpoint:er,radius:({values:e})=>({type:"custom-radius",value:{smoothing:e.smoothing.value,topLeft:e.radii.topLeft.value,topRight:e.radii.topRight.value,bottomLeft:e.radii.bottomLeft.value,bottomRight:e.radii.bottomRight.value}}),spacing:({values:e})=>({type:"custom-spacing",value:{top:e.top.value,bottom:e.bottom.value,left:e.left.value,right:e.right.value}}),motion:({values:e})=>({type:"custom-transition",value:Object.assign(Object.assign({transitionType:e.transitionType.value,duration:e.duration.value},e.direction?{direction:e.direction.value}:{}),{easingType:e.easingCurveType.value,easingFunction:Object.fromEntries(Object.entries(e.easingFunction).map((e=>[e[0],e[1].value])))})}),opacity:({values:e})=>({value:e.opacity.value,type:"custom-opacity"})},rr=(e,n)=>"typography"===e.category?Object.assign({name:e.name,description:e.description},(({name:e,values:n})=>({fontSize:{type:"dimension",value:n.fontSize.value},textDecoration:{type:"string",value:n.textDecoration.value},fontFamily:{type:"string",value:n.fontFamily.value},fontWeight:{type:"number",value:n.fontWeight.value},fontStyle:{type:"string",value:n.fontStyle.value},fontStretch:{type:"string",value:n.fontStretch.value},letterSpacing:{type:"dimension",value:Jt(n)},lineHeight:{type:"dimension",value:Xt(n)},paragraphIndent:{type:"dimension",value:n.paragraphIndent.value},paragraphSpacing:{type:"dimension",value:n.paragraphSpacing.value},textCase:{type:"string",value:n.textCase.value}}))(e)):"variables"===e.extensions[sn.key.extensionPluginData].exportKey?Object.assign(Object.assign({name:e.name,description:e.description},(({values:e,category:n})=>{var t;return"color"===n?{type:"color",value:Bt(e.fill.value),blendMode:(null===(t=e.fill.blendMode)||void 0===t?void 0:t.toLowerCase())||"normal"}:["size","boolean","string","alias"].includes(n)?{type:n,value:e}:void 0})(e)),Zt(e,n)):Object.assign(Object.assign({name:e.name,description:e.description},(e=>tr[e.category](e))(e)),Zt(e,n)),ar=(e,n)=>{const t=e=>e&&"object"==typeof e;return t(e)&&t(n)?(Object.keys(n).forEach((r=>{const a=e[r],l=n[r];Array.isArray(a)&&Array.isArray(l)?e[r]=a.concat(l):t(a)&&t(l)?e[r]=ar(Object.assign({},a),l):e[r]=l})),e):n},lr=ar,or=(e,n,t)=>{if("string"==typeof e&&""!==e)return e;throw new Error(`converting "${n}" to ${t}, resulting in "${e}"`)},ir=(e,n="default")=>"camelCase"===n?(e=>{const n=e.toLowerCase().replace(/['"]/g,"").replace(/([-_ ]){1,}/g," ").replace(/\W+/g," ").trim().replace(/ (.)/g,(function(e){return e.toUpperCase()})).replace(/ /g,"");return or(n,e,"camelCase")})(e):"kebabCase"===n?(e=>{const n=e.toLowerCase().replace(/['"]/g,"").replace(/([-_ ]){1,}/g," ").replace(/\W+/g," ").trim().replace(/ /g,"-");return or(n,e,"kebabCase")})(e):e.trim().toLowerCase(),sr={color:{label:"Colors",key:"color"},gradient:{label:"Gradients",key:"gradient"},font:{label:"Font Styles",key:"font"},typography:{label:"Typography",key:"typography",exclude:["original"]},effect:{label:"Effects",key:"effect"},grid:{label:"Grids",key:"grid"},border:{label:"Borders",key:"border"},breakpoint:{label:"Breakpoints",key:"breakpoint"},radius:{label:"Radii",key:"radius"},size:{label:"Sizes",key:"size"},spacing:{label:"Spacing",key:"spacing"},motion:{label:"Motion",key:"motion"},opacity:{label:"Opacity",key:"opacity"},variables:{label:"Figma Variables (BETA)",key:"variables",exclude:["original"]}},ur=e=>{var n,t;return void 0!==(null===(t=null===(n=e.extensions)||void 0===n?void 0:n[sn.key.extensionPluginData])||void 0===t?void 0:t.exportKey)?e.extensions[sn.key.extensionPluginData].exportKey:"missingExportKey"},cr={original:(e,n)=>"variables"===e.extensions[sn.key.extensionPluginData].exportKey?null:Object.assign(Object.assign({name:e.name,category:e.category,exportKey:e.extensions[sn.key.extensionPluginData].exportKey},e.description&&e.description.length>0&&{comment:e.description}),Gt[e.category](e.values)||{}),standard:rr,standardDeprecated:rr},dr=(e,n)=>"standard"===n.tokenFormat?JSON.parse(JSON.stringify(e.filter((e=>e.category===sr.font.key)))).map((e=>(e.name="typography/"+e.name.substr(e.name.indexOf("/")+1).trim().trimStart(),e.category=sr.typography.key,e.exportKey=sr.typography.key,!0!==n.excludeExtensionProp&&(e.extensions[sn.key.extensionPluginData].exportKey=sr.typography.key),e))):[],fr=(e,n)=>{let t=JSON.parse(e);t=[...t,...dr(t,n)];const r=((e,n)=>e.length<=0?[]:e.map((e=>{var t,r,a,l;if(!1===n.prefixInName)e.name=e.name.substr(e.name.indexOf("/")+1).trim().trimLeft();else if(void 0!==(null===(r=null===(t=e.extensions)||void 0===t?void 0:t[sn.key.extensionPluginData])||void 0===r?void 0:r.alias)){const n=e.name.substr(0,e.name.indexOf("/")).trim().trimLeft();e.extensions[sn.key.extensionPluginData].alias=`${n}.${e.extensions[sn.key.extensionPluginData].alias}`}return n.keyInName&&(e.name=`${ur(e)}/${e.name}`,void 0!==(null===(l=null===(a=e.extensions)||void 0===a?void 0:a[sn.key.extensionPluginData])||void 0===l?void 0:l.alias)&&(e.extensions[sn.key.extensionPluginData].alias=`${ur(e)}.${e.extensions[sn.key.extensionPluginData].alias}`)),e})))(t.filter((({exportKey:e})=>n.exports[e])),n),a=r.map((e=>cr[n.tokenFormat](e,n))).filter(Boolean),l=((e,n)=>{if(e.length<=0)return[];const t=e.map((e=>{const t=e.name.split("/").map((e=>ir(e,n.nameConversion)));return delete e.name,r=e,t.reduceRight(((e,n)=>({[n]:e})),r);var r}));return t.reduce(((e={},n)=>lr(e,n)))})(a,n);return l},pr=(e,n=!0)=>!0===n?JSON.stringify(e):JSON.stringify(e,null,2);const gr=je` display: flex; flex-direction: column; h1:first-child { diff --git a/src/extractor/extractFonts.ts b/src/extractor/extractFonts.ts index c0ba15c1..5b215c06 100644 --- a/src/extractor/extractFonts.ts +++ b/src/extractor/extractFonts.ts @@ -17,7 +17,8 @@ const textCases = { ORIGINAL: 'none', UPPER: 'uppercase', LOWER: 'lowercase', - TITLE: 'capitalize' + TITLE: 'capitalize', + SMALL_CAPS: 'small-caps' } const fontWeights = { @@ -149,7 +150,7 @@ const extractFonts: extractorInterface = (tokenNodes: TextStyle[], prefixArray: type: 'number' as PropertyType }, textCase: { - value: textCases[node.textCase] as TextCase, + value: textCases[node.textCase] as TextCase || 'none' as TextCase, type: 'string' as PropertyType } }, diff --git a/src/transformer/originalFormatTransformer.ts b/src/transformer/originalFormatTransformer.ts index e6060015..eda35da0 100644 --- a/src/transformer/originalFormatTransformer.ts +++ b/src/transformer/originalFormatTransformer.ts @@ -170,6 +170,7 @@ const valueTransformer: {} | undefined = { } const transformer = (token: internalTokenInterface, _settings): OriginalFormatTokenInterface => { + if (token.extensions[config.key.extensionPluginData].exportKey === 'variables') return null return { name: token.name, category: token.category, diff --git a/src/ui/components/GeneralSettings.tsx b/src/ui/components/GeneralSettings.tsx index ec5f1e81..72a750c7 100644 --- a/src/ui/components/GeneralSettings.tsx +++ b/src/ui/components/GeneralSettings.tsx @@ -70,147 +70,222 @@ export const GeneralSettings = () => { return (
- Design Token Settings + + Design Token Settings + updateSettings(draft => { draft.keyInName = value })} + onChange={(value) => + updateSettings((draft) => { + draft.keyInName = value; + }) + } + /> + - - + <Title size="small" weight="bold"> Filename - <Info width={160} label='The file name used when exporting the tokens' /> + <Info + width={160} + label="The file name used when exporting the tokens" + /> -
+
updateSettings((draft: Settings) => { draft.filename = value })} + onChange={(value) => + updateSettings((draft: Settings) => { + draft.filename = value; + }) + } /> updateSettings((draft: Settings) => { draft.nameConversion = value as nameConversionType })} - placeholder='Name conversion' + onChange={({ value }) => + updateSettings((draft: Settings) => { + draft.nameConversion = value as nameConversionType; + }) + } + placeholder="Name conversion" options={[ { - label: 'Default', - value: 'default' + label: "Default", + value: "default", }, { - label: 'camelCase', - value: 'camelCase' + label: "camelCase", + value: "camelCase", }, { - label: 'kebab-case', - value: 'kebabCase' - } + label: "kebab-case", + value: "kebabCase", + }, ]} />
- Token format<Info width={240} label='The structure of the output json file. Learn more in the docs.' /> + + Token format + <Info + width={240} + label="The structure of the output json file. Learn more in the docs." + /> + updateSettings((draft: Settings) => { draft.exclusionPrefix = value })} + onChange={(value) => + updateSettings((draft: Settings) => { + draft.exclusionPrefix = value; + }) + } />
{isStandard && (
- Alias identifier <Info width={180} label='Use to define an alias for a token; case insensitive' /> + + Alias identifier{" "} + <Info + width={180} + label="Use to define an alias for a token; case insensitive" + /> + updateSettings((draft: Settings) => { draft.alias = value })} + onChange={(value) => + updateSettings((draft: Settings) => { + draft.alias = value; + }) + } />
)}
- Token prefixes <Info width={150} label='Use commas to separate multiple prefixed' /> - - Prefixes are the first part of a tokens name e.g. "radius" in "radius/small". They are used to identify the type of a custom token. + + Token prefixes{" "} + <Info width={150} label="Use commas to separate multiple prefixed" /> + + + Prefixes are the first part of a tokens name e.g. "radius" in + "radius/small". They are used to identify the type of a custom token. updateSettings(draft => { draft.prefixInName = value })} + onChange={(value) => + updateSettings((draft) => { + draft.prefixInName = value; + }) + } + /> + - -
- {Object.entries(settings.prefix).map(([key, currentValue]) => +
+ {Object.entries(settings.prefix).map(([key, currentValue]) => ( - - )} + ))}
- ) + ); } diff --git a/src/utilities/prepareExport.ts b/src/utilities/prepareExport.ts index 84ccd248..e5dd5d51 100644 --- a/src/utilities/prepareExport.ts +++ b/src/utilities/prepareExport.ts @@ -41,7 +41,7 @@ export const prepareExport = (tokens: string, settings: Settings) => { // add to name const prefixedTokens = prefixTokenName(tokensFiltered, settings) // converted values - const tokensConverted = prefixedTokens.map(token => tokenTransformer[settings.tokenFormat](token, settings)) + const tokensConverted = prefixedTokens.map(token => tokenTransformer[settings.tokenFormat](token, settings)).filter(Boolean) // group items by their names // @ts-ignore const tokensGroupedByName = groupByKeyAndName(tokensConverted, settings)