@razorwind/tamagui 0.0.47 → 0.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/utils"),n=require("node:path"),r=require("@razorwind/core/lib/fonts");function i(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`
2
- `,`\\n`).replaceAll(`\r`,`\\r`)}function a(e){return typeof e==`string`?`"${i(e)}"`:typeof e==`number`||typeof e==`boolean`?String(e):e==null?`undefined`:JSON.stringify(e)}function o(e,n){if(typeof e==`number`)return e;if(typeof e==`boolean`)return Number(e);if((0,t.isObject)(e)&&typeof e.value==`number`&&typeof e.unit==`string`){let t=e.unit.toLowerCase();return t===`px`||t===``?e.value:t===`rem`?e.value*16:`${e.value}${e.unit}`}if(typeof e==`string`){let t=/^(-?\d+(?:\.\d+)?)px$/i.exec(e.trim());if(t)return Number(t[1]);let n=/^(-?\d+(?:\.\d+)?)rem$/i.exec(e.trim());if(n)return Number(n[1])*16;let r=Number(e);return!Number.isNaN(r)&&e.trim()!==``?r:e}return(0,t.formatTokenValue)(e,n)}const s=/^(?:font-size|fontSize)(?:\.|$)/i,c=/^(?:font-weight|fontWeight)(?:\.|$)/i,l=/^shadow(?:\.|$)/i,u=/^inset-shadow(?:\.|$)/i,d=/^drop-shadow(?:\.|$)/i,f=/^text-shadow(?:\.|$)/i,p=/^(?:blur|blur-?radius)(?:\.|$)/i,m=new Set([`color`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`]),h=[{prefix:/^(?:color|colours?|palette)(?:\.|$)/i,category:`color`},{prefix:s,category:`fontSize`},{prefix:c,category:`fontWeight`},{prefix:d,category:`dropShadow`},{prefix:u,category:`insetShadow`},{prefix:f,category:`textShadow`},{prefix:l,category:`shadow`},{prefix:p,category:`blur`},{prefix:/^(?:space|spacing|gap)(?:\.|$)/i,category:`space`},{prefix:/^inset(?:\.|$)/i,category:`space`},{prefix:/^(?:size|sizing)(?:\.|$)/i,category:`size`},{prefix:/^(?:radius|rounded|radii)(?:\.|$)/i,category:`radius`},{prefix:/^(?:z-?index|zindex|elevation)(?:\.|$)/i,category:`zIndex`}];function g(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function _(e){return e===!0||e===`true`||e===1}function v(e){return _(e.palette)||_(e.$palette)?!0:C(e)===`palette`}function ee(e,t){return(e===`palette`||e===`$palette`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function y(e){return e===!0||e===`true`||e===1}function b(e){return y(e.primitive)||y(e.$primitive)?!0:C(e)===`primitive`}function x(e,t){return(e===`primitive`||e===`$primitive`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function S(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function C(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function te(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function w(e,t){for(let{prefix:t,category:n}of h)if(t.test(e))return n;if(t===`color`||t===`palette`)return`color`;if(t===`shadow`)return u.test(e)?`insetShadow`:d.test(e)?`dropShadow`:f.test(e)?`textShadow`:`shadow`;if(t===`dimension`){if(s.test(e))return`fontSize`;if(p.test(e))return`blur`;if(/(?:^|\.)(?:space|spacing|gap)(?:\.|$)/i.test(e)||/(?:^|\.)inset(?:\.|$)/i.test(e))return`space`;if(/radius|rounded/i.test(e))return`radius`;if(/z-?index|elevation/i.test(e))return`zIndex`;if(/(?:^|\.)(?:size|sizing)(?:\.|$)/i.test(e)||/(?:^|\.)(?:width|height)(?:\.|$)/i.test(e))return`size`}if(t===`number`&&/z-?index|elevation/i.test(e))return`zIndex`;if(t===`fontWeight`||c.test(e))return`fontWeight`}function T(e){return e.flatMap(e=>e.split(/[-_\s]+/)).filter(Boolean).map((e,t)=>{if(/^\d/.test(e))return e;let n=e.toLowerCase();return t===0?n:`${n.charAt(0).toUpperCase()}${n.slice(1)}`}).join(``)}function E(e){let t=e.split(`.`).filter(Boolean),n=t[0];n&&/^(?:color|colours?|palette|primitive|space|spacing|gap|inset|shadow|inset-shadow|drop-shadow|text-shadow|font-size|fontSize|font-weight|fontWeight|size|sizing|radius|rounded|radii|z-?index|zindex|elevation|blur)$/i.test(n)&&t.shift();let r=t.length>0?t:e.split(`.`).slice(-1);return r.length===1&&/^(?:DEFAULT|default)$/i.test(r[0]??``)?`true`:T(r)}function D(e,n,r,i,a,s){if(!(0,t.isObject)(e))return;let c=a||b(e)||v(e),l=C(e,r);if(g(e)){let r=te(e),a=n.join(`.`),u=w(a,l)??(c||l===`primitive`||l===`palette`?`color`:void 0),d=(0,t.formatTokenValue)(r,l),f=u&&m.has(u)||l===`color`||l===`palette`||l===`primitive`||l===`shadow`?d:o(r,l);s.push({path:a,type:l===`palette`||l===`primitive`?`color`:l,value:r,cssValue:d,tamaguiValue:f,category:u,tokenKey:u?E(a):void 0,description:S(e),theme:i,primitive:c});return}for(let[t,r]of Object.entries(e))t.startsWith(`$`)&&t!==`$palette`&&t!==`$primitive`||ee(t,r)||x(t,r)||D(r,[...n,t],l,i,c,s)}function O(e,n={}){let r=n.includeTypes?new Set(n.includeTypes):void 0,i=[];for(let n of(0,t.resolveTokenSets)(e)){let e=n.id==="default"?void 0:n.id;D(n.tokens,[],void 0,e,!1,i)}return r?i.filter(e=>!e.type||r.has(e.type)):i}const k=/^\{([^{}]+)\}$/,A=/^(?:typography|type|text)$/i,j=/^(?:font|fonts|font-family|fontFamily)$/i,M=/^(?:font-size|fontSize)$/i,N=/^(?:font-weight|fontWeight)$/i,ne=/^(?:line-height|lineHeight|leading)$/i,re=/^(?:letter-spacing|letterSpacing|tracking)$/i,ie=/^(?:[a-z]{2}(?:-[A-Z]{2})?|cn|zh|jp|ja|kr|ko|ar|he|th|hi|ru|french|mandarin|chinese|japanese|korean|arabic|hebrew)$/i,ae=[`fontFamily`,`font-family`,`family`],oe=[`fontSize`,`font-size`,`size`],se=[`fontWeight`,`font-weight`,`weight`],ce=[`lineHeight`,`line-height`,`leading`],le=[`letterSpacing`,`letter-spacing`,`tracking`],ue={1:12,2:14,3:16,4:18,5:20,6:24,7:28,8:32,9:40,10:48};function P(e){if(typeof e==`string`)return k.exec(e.trim())?.[1]?.trim()}function F(e,t){let n=P(e);if(!n)return e;let r=t.get(n),i=new Set([n]);for(let e=0;e<8&&r;e++){let e=P(r.value);if(!e||i.has(e))return r.value;i.add(e),r=t.get(e)}return r?.value??e}function I(e,t){for(let n of t)if(e[n]!==void 0&&e[n]!==null)return e[n]}function de(e){return(e.split(`,`)[0]?.trim()??e).replaceAll(/^["']|["']$/g,``)}function fe(e){if(typeof e==`string`){let t=e.trim();return t.length===0||P(t)?void 0:t}if(Array.isArray(e)&&e.every(e=>typeof e==`string`)){let t=e.map(e=>e.trim()).filter(Boolean);return t.length>0?t.join(`, `):void 0}}function pe(e){return Number.isInteger(e)?e:Math.round(e*1e3)/1e3}function L(e){if(e==null)return;let t=o(e);if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`){let e=/^(-?\d+(?:\.\d+)?)%$/.exec(t.trim());if(e)return Number.parseFloat(e[1])/100}}function me(e){if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`string`){let t=e.trim();if(t.length===0||P(t))return;let n=Number(t);return Number.isNaN(n)?t:String(n)}let t=o(e);if(typeof t==`number`&&Number.isFinite(t))return String(t);if(typeof t==`string`&&t.length>0)return t}function he(e,t){let n=L(e);if(n!=null)return pe(t!=null&&n>0&&n<=4?n*t:n)}function R(e,t){return t.test(e.split(`.`)[0]??``)}function ge(e){return e.split(`.`).filter(Boolean).at(-1)??e}function _e(e,t){let n=e.split(`.`).filter(Boolean);return n[0]&&t.test(n[0])&&n.shift(),n}function ve(e){let t=e.flatMap(e=>e.split(`-`)).filter(Boolean);return t.length===0?`body`:t.map((e,t)=>t===0?`${e.charAt(0).toLowerCase()}${e.slice(1)}`:`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(``)}function z(e){switch(e.toLowerCase()){case`sans`:case`body`:case`serif`:return`body`;case`monospace`:case`mono`:return`mono`;default:return ve([e])}}function ye(e){return e.role?z(e.role):z(e.name)}function be(e){let t=_e(e,A);if(t.length===0)return`body`;let n=t.at(-1);return n&&t.length>=2&&ie.test(n)&&!n.includes(`_`)?`${t.slice(0,-1).join(`-`)}_${n}`:t.join(`-`)}function xe(e){return z(_e(e,j)[0]??ge(e))}function Se(e,t){let n=_e(e,t);return n.length===0||n.length===1&&/^(?:DEFAULT|default)$/i.test(n[0])?`true`:ve(n)}function Ce(e){return e.type===`typography`&&(0,t.isObject)(e.value)}function we(e){return e.category===`fontSize`||e.category===`fontWeight`||Te(e)||Ee(e)||De(e)||Oe(e)?!1:e.type===`fontFamily`||R(e.path,j)}function Te(e){return e.category===`fontSize`||R(e.path,M)}function Ee(e){return e.category===`fontWeight`||e.type===`fontWeight`||R(e.path,N)}function De(e){return R(e.path,ne)}function Oe(e){return R(e.path,re)}function ke(e,t){if(!e.has(t))return t;let n=2,r=`${t}${n}`;for(;e.has(r);)n++,r=`${t}${n}`;return r}function Ae(e){let t=new Map;for(let n of Object.values(e)){let e=ye(n);t.has(e)&&(e=ke(t,ve([n.name]))),t.set(e,n)}return t}function je(e,t,n){if(!e)return;let i=Object.values(e);if(i.length===0)return;if(n){let e=n.split(`.`).filter(Boolean).at(-1);if(e){let t=i.find(t=>t.role===e||t.name.toLowerCase()===e.toLowerCase());if(t)return t}}if(!t)return;let a=de(t).toLowerCase();return i.find(e=>(0,r.fontFamilyName)(e).toLowerCase()===a||e.title.toLowerCase()===a||e.name.toLowerCase()===a)}function Me(e){let t=new Map;for(let r of e.files){let e=String(r.weight??400),i=(0,n.basename)(r.path).replace(/\.[^.]+$/,``),a=t.get(e)??{};r.style===`italic`||r.style===`oblique`?a.italic=i:a.normal=i,t.set(e,a)}if(t.size!==0)return`{\n${[...t.entries()].toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0})).map(([e,t])=>{let n=[];return t.normal&&n.push(`normal: ${a(t.normal)}`),t.italic&&n.push(`italic: ${a(t.italic)}`),` ${e}: { ${n.join(`, `)} }`}).join(`,
3
- `)}\n }`}function B(e,t){return{...e,webFamily:(0,r.cssFontFamily)(t),nativeFamily:(0,r.fontFamilyName)(t),face:t.source===`local`?Me(t):e.face}}function V(e){return{key:e,webFamily:`system-ui, sans-serif`,nativeFamily:`system-ui`,size:{},lineHeight:{},weight:{},letterSpacing:{}}}function Ne(e,t){return{...e,webFamily:t,nativeFamily:de(t)}}const Pe=/^(?:font-size|fontSize|font-weight|fontWeight|line-height|lineHeight|leading|letter-spacing|letterSpacing|tracking)$/i;function H(e,t){let n={true:e},r=P(t);if(!r)return n;let i=Se(r,Pe);return i&&i!==`true`&&(n[i]=e),n}function Fe(e){return Object.keys(e.size).length>0?e:{...e,size:{...ue}}}function Ie(e,n,r,i){if(!(0,t.isObject)(n.value))return e;let a=I(n.value,ae),o=P(a),s=fe(F(a,r)),c=je(i,s,o),l=e;c?l=B(l,c):s&&(l=Ne(l,s));let u=I(n.value,oe),d=L(F(u,r));d!=null&&(l={...l,size:H(d,u)});let f=I(n.value,se),p=me(F(f,r));p&&(l={...l,weight:H(p,f)});let m=I(n.value,le),h=L(F(m,r));h!=null&&(l={...l,letterSpacing:H(h,m)});let g=I(n.value,ce),_=he(F(g,r),l.size.true??d);return _!=null&&(l={...l,lineHeight:H(_,g)}),Le(l)}function Le(e){let t=Object.keys(e.size);if(t.length===0)return e;let n=e=>{let n=e.true??Object.values(e)[0];if(n==null)return e;let r={...e};for(let e of t)r[e]??=n;return r};return{...e,lineHeight:Object.keys(e.lineHeight).length>0?n(e.lineHeight):e.lineHeight,weight:Object.keys(e.weight).length>0?n(e.weight):e.weight,letterSpacing:Object.keys(e.letterSpacing).length>0?n(e.letterSpacing):e.letterSpacing}}function Re(e,t){let n=new Map(e.map(e=>[e.path,e])),r=new Map,i=e=>{r.set(e.key,e)};if(t)for(let[e,n]of Ae(t))i(B(V(e),n));for(let a of e){if(!we(a)||Ce(a))continue;let e=xe(a.path),o=fe(F(a.value,n)),s=r.get(e)??V(e),c=je(t,o,a.path),l=s;c?l=B(l,c):(o&&s.webFamily===V(e).webFamily||o&&!r.has(e))&&(l=Ne(l,o)),i(l)}for(let a of e){if(!Ce(a))continue;let e=be(a.path);i(Ie(r.get(e)??V(e),a,n,t))}return[...r.values()].map(Fe).toSorted((e,t)=>e.key.localeCompare(t.key))}function ze(e){return/^\d+$/.test(e)||/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}function U(e,t=4){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{}`:`{\n${i.map(([e,t])=>`${n}${ze(e)}: ${a(t)}`).join(`,
4
- `)}\n${r}}`}function Be(e,t){let n=`${e.split(`-`).filter(Boolean).map((e,t)=>t===0?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(``).replaceAll(/[^\w$]/g,``)||`font${t}`}Font`;return/^[A-Z_$]/i.test(n)?n:`font${t}`}function Ve(e,t){let n=a(e.webFamily),r=a(e.nativeFamily),i=[n===r?` family: ${n}`:` family: isWeb ? ${n} : ${r}`,` size: ${U(e.size)}`];return Object.keys(e.lineHeight).length>0&&i.push(` lineHeight: ${U(e.lineHeight)}`),Object.keys(e.weight).length>0&&i.push(` weight: ${U(e.weight)}`),Object.keys(e.letterSpacing).length>0&&i.push(` letterSpacing: ${U(e.letterSpacing)}`),e.face&&i.push(` face: ${e.face}`),`const ${t} = createFont({\n${i.join(`,
5
- `)}\n});`}function He(e){return`# Installing Tamagui Config
2
+ `,`\\n`).replaceAll(`\r`,`\\r`)}function a(e){return typeof e==`string`?`"${i(e)}"`:typeof e==`number`||typeof e==`boolean`?String(e):e==null?`undefined`:JSON.stringify(e)}function o(e,n){if(typeof e==`number`)return e;if(typeof e==`boolean`)return Number(e);if((0,t.isObject)(e)&&typeof e.value==`number`&&typeof e.unit==`string`){let t=e.unit.toLowerCase();return t===`px`||t===``?e.value:t===`rem`?e.value*16:`${e.value}${e.unit}`}if(typeof e==`string`){let t=/^(-?\d+(?:\.\d+)?)px$/i.exec(e.trim());if(t)return Number(t[1]);let n=/^(-?\d+(?:\.\d+)?)rem$/i.exec(e.trim());if(n)return Number(n[1])*16;let r=Number(e);return!Number.isNaN(r)&&e.trim()!==``?r:e}return(0,t.formatTokenValue)(e,n)}const s=/^(?:font-size|fontSize)(?:\.|$)/i,c=/^(?:font-weight|fontWeight)(?:\.|$)/i,l=/^shadow(?:\.|$)/i,u=/^inset-shadow(?:\.|$)/i,d=/^drop-shadow(?:\.|$)/i,f=/^text-shadow(?:\.|$)/i,p=/^(?:blur|blur-?radius)(?:\.|$)/i,m=new Set([`color`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`]),h=[{prefix:/^(?:color|colours?|palette)(?:\.|$)/i,category:`color`},{prefix:s,category:`fontSize`},{prefix:c,category:`fontWeight`},{prefix:d,category:`dropShadow`},{prefix:u,category:`insetShadow`},{prefix:f,category:`textShadow`},{prefix:l,category:`shadow`},{prefix:p,category:`blur`},{prefix:/^(?:space|spacing|gap)(?:\.|$)/i,category:`space`},{prefix:/^inset(?:\.|$)/i,category:`space`},{prefix:/^(?:size|sizing)(?:\.|$)/i,category:`size`},{prefix:/^(?:radius|rounded|radii)(?:\.|$)/i,category:`radius`},{prefix:/^(?:z-?index|zindex|elevation)(?:\.|$)/i,category:`zIndex`}];function g(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function _(e){return e===!0||e===`true`||e===1}function v(e){return _(e.palette)||_(e.$palette)?!0:C(e)===`palette`}function ee(e,t){return(e===`palette`||e===`$palette`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function y(e){return e===!0||e===`true`||e===1}function b(e){return y(e.primitive)||y(e.$primitive)?!0:C(e)===`primitive`}function x(e,t){return(e===`primitive`||e===`$primitive`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function S(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function C(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function te(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function w(e,t){for(let{prefix:t,category:n}of h)if(t.test(e))return n;if(t===`color`||t===`palette`)return`color`;if(t===`shadow`)return u.test(e)?`insetShadow`:d.test(e)?`dropShadow`:f.test(e)?`textShadow`:`shadow`;if(t===`dimension`){if(s.test(e))return`fontSize`;if(p.test(e))return`blur`;if(/(?:^|\.)(?:space|spacing|gap)(?:\.|$)/i.test(e)||/(?:^|\.)inset(?:\.|$)/i.test(e))return`space`;if(/radius|rounded/i.test(e))return`radius`;if(/z-?index|elevation/i.test(e))return`zIndex`;if(/(?:^|\.)(?:size|sizing)(?:\.|$)/i.test(e)||/(?:^|\.)(?:width|height)(?:\.|$)/i.test(e))return`size`}if(t===`number`&&/z-?index|elevation/i.test(e))return`zIndex`;if(t===`fontWeight`||c.test(e))return`fontWeight`}function T(e){return e.flatMap(e=>e.split(/[-_\s]+/)).filter(Boolean).map((e,t)=>{if(/^\d/.test(e))return e;let n=e.toLowerCase();return t===0?n:`${n.charAt(0).toUpperCase()}${n.slice(1)}`}).join(``)}function E(e){let t=e.split(`.`).filter(Boolean),n=t[0];n&&/^(?:color|colours?|palette|primitive|space|spacing|gap|inset|shadow|inset-shadow|drop-shadow|text-shadow|font-size|fontSize|font-weight|fontWeight|size|sizing|radius|rounded|radii|z-?index|zindex|elevation|blur)$/i.test(n)&&t.shift();let r=t.length>0?t:e.split(`.`).slice(-1);return r.length===1&&/^(?:DEFAULT|default)$/i.test(r[0]??``)?`true`:T(r)}function D(e,n,r,i,a,s){if(!(0,t.isObject)(e))return;let c=a||b(e)||v(e),l=C(e,r);if(g(e)){let r=te(e),a=n.join(`.`),u=w(a,l)??(c||l===`primitive`||l===`palette`?`color`:void 0),d=(0,t.formatTokenValue)(r,l),f=u&&m.has(u)||l===`color`||l===`palette`||l===`primitive`||l===`shadow`?d:o(r,l);s.push({path:a,type:l===`palette`||l===`primitive`?`color`:l,value:r,cssValue:d,tamaguiValue:f,category:u,tokenKey:u?E(a):void 0,description:S(e),theme:i,primitive:c});return}for(let[t,r]of Object.entries(e))t.startsWith(`$`)&&t!==`$palette`&&t!==`$primitive`||ee(t,r)||x(t,r)||D(r,[...n,t],l,i,c,s)}function O(e,n={}){let r=n.includeTypes?new Set(n.includeTypes):void 0,i=[];for(let n of(0,t.resolveTokenSets)(e)){let e=n.id==="default"?void 0:n.id;D(n.tokens,[],void 0,e,!1,i)}return r?i.filter(e=>!e.type||r.has(e.type)):i}const k=/^\{([^{}]+)\}$/,A=/^(?:typography|type|text)$/i,ne=/^(?:font|fonts|font-family|fontFamily)$/i,j=/^(?:font-size|fontSize)$/i,M=/^(?:font-weight|fontWeight)$/i,re=/^(?:line-height|lineHeight|leading)$/i,ie=/^(?:letter-spacing|letterSpacing|tracking)$/i,ae=/^(?:[a-z]{2}(?:-[A-Z]{2})?|cn|zh|jp|ja|kr|ko|ar|he|th|hi|ru|french|mandarin|chinese|japanese|korean|arabic|hebrew)$/i,oe=[`fontFamily`,`font-family`,`family`],se=[`fontSize`,`font-size`,`size`],ce=[`fontWeight`,`font-weight`,`weight`],le=[`lineHeight`,`line-height`,`leading`],ue=[`letterSpacing`,`letter-spacing`,`tracking`],de={1:12,2:14,3:16,4:18,5:20,6:24,7:28,8:32,9:40,10:48};function N(e){if(typeof e==`string`)return k.exec(e.trim())?.[1]?.trim()}function P(e,t){let n=N(e);if(!n)return e;let r=t.get(n),i=new Set([n]);for(let e=0;e<8&&r;e++){let e=N(r.value);if(!e||i.has(e))return r.value;i.add(e),r=t.get(e)}return r?.value??e}function F(e,t){for(let n of t)if(e[n]!==void 0&&e[n]!==null)return e[n]}function fe(e){return(e.split(`,`)[0]?.trim()??e).replaceAll(/^["']|["']$/g,``)}function pe(e){if(typeof e==`string`){let t=e.trim();return t.length===0||N(t)?void 0:t}if(Array.isArray(e)&&e.every(e=>typeof e==`string`)){let t=e.map(e=>e.trim()).filter(Boolean);return t.length>0?t.join(`, `):void 0}}function me(e){return Number.isInteger(e)?e:Math.round(e*1e3)/1e3}function I(e){if(e==null)return;let t=o(e);if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`){let e=/^(-?\d+(?:\.\d+)?)%$/.exec(t.trim());if(e)return Number.parseFloat(e[1])/100}}function he(e){if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`string`){let t=e.trim();if(t.length===0||N(t))return;let n=Number(t);return Number.isNaN(n)?t:String(n)}let t=o(e);if(typeof t==`number`&&Number.isFinite(t))return String(t);if(typeof t==`string`&&t.length>0)return t}function ge(e,t){let n=I(e);if(n!=null)return me(t!=null&&n>0&&n<=4?n*t:n)}function L(e,t){return t.test(e.split(`.`)[0]??``)}function _e(e){return e.split(`.`).filter(Boolean).at(-1)??e}function R(e,t){let n=e.split(`.`).filter(Boolean);return n[0]&&t.test(n[0])&&n.shift(),n}function z(e){let t=e.flatMap(e=>e.split(`-`)).filter(Boolean);return t.length===0?`body`:t.map((e,t)=>t===0?`${e.charAt(0).toLowerCase()}${e.slice(1)}`:`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(``)}function B(e){switch(e.toLowerCase()){case`sans`:case`body`:case`serif`:return`body`;case`monospace`:case`mono`:return`mono`;default:return z([e])}}function ve(e){return e.role?B(e.role):B(e.name)}function ye(e){let t=R(e,A);if(t.length===0)return`body`;let n=t.at(-1);return n&&t.length>=2&&ae.test(n)&&!n.includes(`_`)?`${t.slice(0,-1).join(`-`)}_${n}`:t.join(`-`)}function be(e){return B(R(e,ne)[0]??_e(e))}function xe(e,t){let n=R(e,t);return n.length===0||n.length===1&&/^(?:DEFAULT|default)$/i.test(n[0])?`true`:z(n)}function Se(e){return e.type===`typography`&&(0,t.isObject)(e.value)}function Ce(e){return e.category===`fontSize`||e.category===`fontWeight`||we(e)||Te(e)||Ee(e)||De(e)?!1:e.type===`fontFamily`||L(e.path,ne)}function we(e){return e.category===`fontSize`||L(e.path,j)}function Te(e){return e.category===`fontWeight`||e.type===`fontWeight`||L(e.path,M)}function Ee(e){return L(e.path,re)}function De(e){return L(e.path,ie)}function Oe(e,t){if(!e.has(t))return t;let n=2,r=`${t}${n}`;for(;e.has(r);)n++,r=`${t}${n}`;return r}function ke(e){let t=new Map;for(let n of Object.values(e)){let e=ve(n);t.has(e)&&(e=Oe(t,z([n.name]))),t.set(e,n)}return t}function Ae(e,t,n){if(!e)return;let i=Object.values(e);if(i.length===0)return;if(n){let e=n.split(`.`).filter(Boolean).at(-1);if(e){let t=i.find(t=>t.role===e||t.name.toLowerCase()===e.toLowerCase());if(t)return t}}if(!t)return;let a=fe(t).toLowerCase();return i.find(e=>(0,r.fontFamilyName)(e).toLowerCase()===a||e.title.toLowerCase()===a||e.name.toLowerCase()===a)}function je(e){let t=new Map;for(let r of e.files){let e=String(r.weight??400),i=(0,n.basename)(r.path).replace(/\.[^.]+$/,``),a=t.get(e)??{};r.style===`italic`||r.style===`oblique`?a.italic=i:a.normal=i,t.set(e,a)}if(t.size!==0)return`{\n${[...t.entries()].toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0})).map(([e,t])=>{let n=[];return t.normal&&n.push(`normal: ${a(t.normal)}`),t.italic&&n.push(`italic: ${a(t.italic)}`),` ${e}: { ${n.join(`, `)} }`}).join(`,
3
+ `)}\n }`}function V(e,t){return{...e,webFamily:(0,r.cssFontFamily)(t),nativeFamily:(0,r.fontFamilyName)(t),face:t.source===`local`?je(t):e.face}}function H(e){return{key:e,webFamily:`system-ui, sans-serif`,nativeFamily:`system-ui`,size:{},lineHeight:{},weight:{},letterSpacing:{}}}function Me(e,t){return{...e,webFamily:t,nativeFamily:fe(t)}}const Ne=/^(?:font-size|fontSize|font-weight|fontWeight|line-height|lineHeight|leading|letter-spacing|letterSpacing|tracking)$/i;function U(e,t){let n={true:e},r=N(t);if(!r)return n;let i=xe(r,Ne);return i&&i!==`true`&&(n[i]=e),n}function Pe(e){return Object.keys(e.size).length>0?e:{...e,size:{...de}}}function Fe(e,n,r,i){if(!(0,t.isObject)(n.value))return e;let a=F(n.value,oe),o=N(a),s=pe(P(a,r)),c=Ae(i,s,o),l=e;c?l=V(l,c):s&&(l=Me(l,s));let u=F(n.value,se),d=I(P(u,r));d!=null&&(l={...l,size:U(d,u)});let f=F(n.value,ce),p=he(P(f,r));p&&(l={...l,weight:U(p,f)});let m=F(n.value,ue),h=I(P(m,r));h!=null&&(l={...l,letterSpacing:U(h,m)});let g=F(n.value,le),_=ge(P(g,r),l.size.true??d);return _!=null&&(l={...l,lineHeight:U(_,g)}),Ie(l)}function Ie(e){let t=Object.keys(e.size);if(t.length===0)return e;let n=e=>{let n=e.true??Object.values(e)[0];if(n==null)return e;let r={...e};for(let e of t)r[e]??=n;return r};return{...e,lineHeight:Object.keys(e.lineHeight).length>0?n(e.lineHeight):e.lineHeight,weight:Object.keys(e.weight).length>0?n(e.weight):e.weight,letterSpacing:Object.keys(e.letterSpacing).length>0?n(e.letterSpacing):e.letterSpacing}}function Le(e,t){let n=new Map(e.map(e=>[e.path,e])),r=new Map,i=e=>{r.set(e.key,e)};if(t)for(let[e,n]of ke(t))i(V(H(e),n));for(let a of e){if(!Ce(a)||Se(a))continue;let e=be(a.path),o=pe(P(a.value,n)),s=r.get(e)??H(e),c=Ae(t,o,a.path),l=s;c?l=V(l,c):(o&&s.webFamily===H(e).webFamily||o&&!r.has(e))&&(l=Me(l,o)),i(l)}for(let a of e){if(!Se(a))continue;let e=ye(a.path);i(Fe(r.get(e)??H(e),a,n,t))}return[...r.values()].map(Pe).toSorted((e,t)=>e.key.localeCompare(t.key))}function Re(e){return/^\d+$/.test(e)||/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}function W(e,t=4){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{}`:`{\n${i.map(([e,t])=>`${n}${Re(e)}: ${a(t)}`).join(`,
4
+ `)}\n${r}}`}function ze(e,t){let n=`${e.split(`-`).filter(Boolean).map((e,t)=>t===0?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(``).replaceAll(/[^\w$]/g,``)||`font${t}`}Font`;return/^[A-Z_$]/i.test(n)?n:`font${t}`}function Be(e,t){let n=a(e.webFamily),r=a(e.nativeFamily),i=[n===r?` family: ${n}`:` family: isWeb ? ${n} : ${r}`,` size: ${W(e.size)}`];return Object.keys(e.lineHeight).length>0&&i.push(` lineHeight: ${W(e.lineHeight)}`),Object.keys(e.weight).length>0&&i.push(` weight: ${W(e.weight)}`),Object.keys(e.letterSpacing).length>0&&i.push(` letterSpacing: ${W(e.letterSpacing)}`),e.face&&i.push(` face: ${e.face}`),`const ${t} = createFont({\n${i.join(`,
5
+ `)}\n});`}function Ve(e){return`# Installing Tamagui Config
6
6
 
7
7
  Generated by \`@razorwind/tamagui\`.
8
8
 
@@ -48,19 +48,19 @@ export function App() {
48
48
  ## Regenerate
49
49
 
50
50
  Re-run Razorwind generate when tokens change so \`${e.outputPath}\` stays aligned with your design system.
51
- `}const Ue=new Set([`default`,`light`,`theme`]),We=/^base(?:[A-Z]\w*|[._-].+)?$/i,Ge=/^ring(?:\.|$)/i,Ke=[`base`,`gray`,`grey`,`neutral`],qe={css:`@tamagui/config/v5-css`,rn:`@tamagui/config/v5-rn`,reanimated:`@tamagui/config/v5-reanimated`,motion:`@tamagui/config/v5-motion`};function Je(e){return Ue.has(e)}function Ye(e){return e===`dark`}function W(e,t){let n=new Map,r=t===`dark`?Ye:Je;for(let t of e){let e=t.theme?.toLowerCase();(!e||We.test(e))&&n.set(t.path,t)}for(let t of e){let e=t.theme?.toLowerCase();e&&r(e)&&n.set(t.path,t)}return[...n.values()]}function Xe(e){return Ge.test(e.path)&&e.category===`shadow`}const Ze=new Set([`fontSize`,`blur`]),Qe=[`space`,`size`,`radius`,`zIndex`,`blur`,`fontSize`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`,`fontWeight`];function $e(e){return/^px\(-?\d/.test(e)}function et(e){if(e.category===`radius`&&e.tokenKey?.startsWith(`borderRadius`)){let t=e.tokenKey.replace(/^borderRadius/,``);return t?T([t]):e.tokenKey}return e.tokenKey??``}function tt(e,t){if(e.category&&Ze.has(e.category)&&typeof e.tamaguiValue==`number`)return`px(${e.tamaguiValue})`;if(typeof e.tamaguiValue==`string`){let n=ft(e.tamaguiValue,t);return e.category===`dropShadow`?nt(n):n}return e.tamaguiValue}function nt(e){return e.includes(`drop-shadow(`)?e:e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.replace(/^inset\s+/i,``).split(/\s+/);if(t.length>=5){let[e,n,r]=t;return`drop-shadow(${e} ${n} ${r} ${t.slice(4).join(` `)})`}return`drop-shadow(${e.replace(/^inset\s+/i,``)})`}).join(` `)}function rt(e){let t={},n=K(e);for(let r of e){if(!r.category||r.category===`color`||!r.tokenKey||Xe(r))continue;let e=et(r);if(!e)continue;let i=tt(r,n);if(typeof i==`string`&&dt(i))continue;let a=t[r.category]??{};a[e]=i,t[r.category]=a}return t}function it(e,t){let n={},r=(e,t)=>{let r=t.cssValue;typeof r!=`string`||r.length===0||J(r)||r===`[object Object]`||(n[e]=r)},i=e=>{let t=e.path.replace(/^color\./i,``).replaceAll(`.`,``);return e.theme?`${e.theme}_${t}`:t};for(let t of e)t.tokenKey&&(t.primitive?r(i(t),t):r(t.tokenKey,t));for(let e of t)!e.tokenKey||!e.primitive||r(i(e),e);return n}function G(e,t=2){let n=` `.repeat(t),r=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return r.length===0?`{}`:`{\n${r.map(([e,t])=>{let r=typeof t==`string`&&$e(t)?t:a(t);return`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${r}`}).join(`,
52
- `)}\n${` `.repeat(Math.max(t-2,0))}}`}function at(e,t=2){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{\n${n}...theme\n${r}}`:`{\n${n}...theme,\n${i.map(([e,t])=>`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${t}`).join(`,
53
- `)}\n${r}}`}const ot=/^\{([^{}]+)\}$/,st=/\{([^{}]+)\}/g,ct=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/,lt=/var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g;function K(e){return{byPath:new Map(e.map(e=>[e.path,e])),byCssVar:new Map(e.map(e=>[(0,t.toThemeCssVar)(e.path),e]))}}function ut(e){if(typeof e==`string`)return ot.exec(e.trim())?.[1]?.trim()}function q(e){if(typeof e==`string`)return ct.exec(e.trim())?.[1]}function J(e){return ut(e)!=null||q(e)!=null}function dt(e){return/var\(|\{[^{}]+\}/.test(e)}function Y(e,t){let n=pt(e,t.byPath,t.byCssVar);if(n.category!=null&&n.category!==`color`)return;let r=[n.cssValue,n.tamaguiValue];for(let e of r)if(typeof e==`string`&&e.length>0&&!J(e))return e}function ft(e,t){return e.replace(st,(e,n)=>{let r=t.byPath.get(n.trim());return r?Y(r,t)??e:e}).replace(lt,(e,n)=>{let r=t.byCssVar.get(n);return r?Y(r,t)??e:e})}function pt(e,t,n){let r=e,i=new Set;for(let e=0;e<8;e++){if(i.has(r.path))return r;i.add(r.path);let e=ut(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=q(r.value)??q(r.cssValue)??q(r.tamaguiValue);if(a){let e=n.get(a);if(!e||e.path===r.path)return r;r=e;continue}return r}return r}function mt(e){return/^[A-Z_$][\w$]*$/i.test(e)?`theme.${e}`:`theme[${a(e)}]`}function ht(e,t,n){let r=_t(e);if(r){if(t&&r.name.toLowerCase()===t.toLowerCase())return`color${r.step}`;if(n[r.name])return`${r.name}${r.step}`}}function gt(e){if(e>=1&&e<=12)return e;if(e>=100&&e<=900&&e%100==0)return e/100}function _t(e){let t=e.path.split(`.`).filter(Boolean),n=t.at(-1);if(n&&/^\d+$/.test(n)){let e=gt(Number(n)),r=t.at(-2);if(e!=null&&r&&!/^(?:color|colours?|palette)$/i.test(r))return{name:T([r]),step:e}}if(!e.tokenKey)return;let r=/^([A-Z]+)(\d{1,3})$/i.exec(e.tokenKey);if(!r)return;let[,i=``,a=``]=r,o=gt(Number(a));if(o!=null)return{name:i,step:o}}function vt(e,t,n,r){let i=e[t]??{};i[`${t}${n}`]=r,e[t]=i}function yt(e){let t={};for(let n of e){if(typeof n.tamaguiValue!=`string`)continue;let e=_t(n);e&&vt(t,e.name,e.step,n.tamaguiValue)}return Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=3))}function X(e){let t={};for(let n of e){if(!n.primitive||typeof n.tamaguiValue!=`string`)continue;let e=_t(n);e&&vt(t,e.name,e.step,n.tamaguiValue)}let n=Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=2));return Object.keys(n).length>0?n:yt(e)}function bt(e,t){if(e.length<2)return[...e];let n=$(e[0]),r=$(e[e.length-1]);if(n==null||r==null||n===r)return[...e];let i=n>r;return t===`light`?i?[...e]:e.toReversed():i?e.toReversed():[...e]}function Z(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function xt(e){let t=e.startsWith(`#`)?e.slice(1):``;if((t.length===3||t.length===4)&&(t=[...t].map(e=>e+e).join(``)),t.length===8&&(t=t.slice(0,6)),t.length!==6||/[^0-9a-f]/i.test(t))return;let n=Number.parseInt(t.slice(0,2),16)/255,r=Number.parseInt(t.slice(2,4),16)/255,i=Number.parseInt(t.slice(4,6),16)/255;return .2126*Z(n)+.7152*Z(r)+.0722*Z(i)}function Q(e){let t=e.trim();if(t.endsWith(`%`)){let e=Number.parseFloat(t);return Number.isFinite(e)?e/100:void 0}let n=Number.parseFloat(t);return Number.isFinite(n)?n:void 0}function St(e){return e>1?e/100:e}function Ct(e,t){let n=RegExp(`^${t}\\((.+)\\)$`,`i`).exec(e.trim());if(n?.[1])return n[1].split(/[\s,/]+/).filter(Boolean)}function $(e){let t=e.trim();if(!t||t.startsWith(`var(`)||t.includes(`{`))return;let n=xt(t);if(n!=null)return n;let r=Ct(t,`oklch`);if(r?.[0]){let e=Q(r[0]);return e==null?void 0:St(e)}let i=Ct(t,`hsla?`);if(i?.[2]){let e=Q(i[2]);return e==null?void 0:St(e)}let a=Ct(t,`rgba?`);if(a?.[0]&&a[1]&&a[2]){let e=Q(a[0]),t=Q(a[1]),n=Q(a[2]);if(e==null||t==null||n==null)return;let r=(e,t)=>t.trim().endsWith(`%`)||e<=1?e:e/255;return .2126*Z(r(e,a[0]))+.7152*Z(r(t,a[1]))+.0722*Z(r(n,a[2]))}}function wt(e,t){let n=[],r=t.toLowerCase();for(let[i,a]of Object.entries(e)){if(!i.toLowerCase().startsWith(r))continue;let e=i.slice(t.length);/^\d+$/.test(e)&&n.push([Number(e),a])}return n.sort(([e],[t])=>e-t),n}function Tt(e,t,n){let r=wt(e,t);if(r.length===0)return e;let i=bt(r.map(([,e])=>e),n),a={};for(let[e,[n]]of r.entries())a[`${t}${n}`]=i[e]??r[e][1];return a}function Et(e){if(e.length>=12)return e.slice(0,12);let t=[...e],n=t.at(-1);if(n==null)return t;for(;t.length<12;)t.push(n);return t}function Dt(e,t,n){let r=wt(e,t);if(!(r.length<2))return Et(bt(r.map(([,e])=>e),n))}function Ot(e,t){let n=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),{name:e,scale:t}]));for(let e of Ke){let r=n.get(e);if(!r)continue;let i=Dt(r.scale,r.name,t);if(i)return{name:r.name,palette:i}}}function kt(e){let t=e.filter(e=>e.category===`color`||e.primitive),n=X(W(t,`light`)),r=X(W(t,`dark`)),i=Ot(n,`light`),a=Ot(r,`dark`);return{lightPalette:i?.palette,darkPalette:a?.palette,lightBaseName:i?.name,darkBaseName:a?.name}}function At(e,t){let n=X(e),{byPath:r,byCssVar:i}=K(e),o={};for(let s of e){if(s.category!==`color`||!s.tokenKey||s.primitive||/^[A-Z]+\d{1,3}$/i.test(s.tokenKey)&&n[s.tokenKey.replace(/\d{1,3}$/,``)])continue;let e=pt(s,r,i),c=ht(e,t,n);if(c){o[s.tokenKey]=mt(c);continue}let l=e.tamaguiValue;J(l)||J(e.cssValue)||(typeof l==`string`||typeof l==`number`)&&(o[s.tokenKey]=a(l))}return o}function jt(e){return e.replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${")}function Mt(e,t,n,r){let i=pt(e,t.byPath,t.byCssVar),a=ht(i,n,r);if(a)return{kind:`theme`,property:a};let o=Y(i,t);if(o)return{kind:`text`,value:o}}function Nt(e,t,n,r){let i=[],a=/\{([^{}]+)\}|var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g,o=0;for(let s of e.matchAll(a)){let a=s.index??0;a>o&&i.push({kind:`text`,value:e.slice(o,a)});let c=s[1]?t.byPath.get(s[1].trim()):s[2]?t.byCssVar.get(s[2]):void 0;if(!c)return;let l=Mt(c,t,n,r);if(!l)return;i.push(l),o=a+s[0].length}return o<e.length&&i.push({kind:`text`,value:e.slice(o)}),i}function Pt(e){return e.some(e=>e.kind===`theme`)?`\`${e.map(e=>e.kind===`theme`?`\${${mt(e.property)}}`:jt(e.value)).join(``)}\``:a(e.map(e=>e.kind===`text`?e.value:``).join(``))}function Ft(e,t){let n=K(e),r=X(e.filter(e=>e.category===`color`)),i={};for(let a of e){if(!Xe(a)||!a.tokenKey)continue;let e=typeof a.tamaguiValue==`string`?a.tamaguiValue:a.cssValue;if(typeof e!=`string`||e.length===0)continue;let o=Nt(e,n,t,r);o&&(i[a.tokenKey]=Pt(o))}return i}function It(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);if(n.size===0)return;let r=[];for(let i of[...n].toSorted((e,t)=>e.localeCompare(t))){let n=Tt(e[i]??t[i]??{},i,`light`),a=Tt(t[i]??e[i]??{},i,`dark`);Object.keys(n).length!==0&&Object.keys(a).length!==0&&r.push(` ${i}: {
54
- light: ${G(n,8)},
55
- dark: ${G(a,8)}
51
+ `}const He=new Set([`default`,`light`,`theme`]),Ue=/^base(?:[A-Z]\w*|[._-].+)?$/i,We=/^ring(?:\.|$)/i,Ge=[`base`,`gray`,`grey`,`neutral`],Ke={css:`@tamagui/config/v5-css`,rn:`@tamagui/config/v5-rn`,reanimated:`@tamagui/config/v5-reanimated`,motion:`@tamagui/config/v5-motion`};function qe(e){return He.has(e)}function Je(e){return e===`dark`}function G(e,t){let n=new Map,r=t===`dark`?Je:qe;for(let t of e){let e=t.theme?.toLowerCase();(!e||Ue.test(e))&&n.set(t.path,t)}for(let t of e){let e=t.theme?.toLowerCase();e&&r(e)&&n.set(t.path,t)}return[...n.values()]}function Ye(e){return We.test(e.path)&&e.category===`shadow`}const Xe=new Set([`fontSize`,`blur`]),Ze=[`space`,`size`,`radius`,`zIndex`,`blur`,`fontSize`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`,`fontWeight`];function Qe(e){return/^px\(-?\d/.test(e)}function $e(e){if(e.category===`radius`&&e.tokenKey?.startsWith(`borderRadius`)){let t=e.tokenKey.replace(/^borderRadius/,``);return t?T([t]):e.tokenKey}return e.tokenKey??``}function et(e,t){if(e.category&&Xe.has(e.category)&&typeof e.tamaguiValue==`number`)return`px(${e.tamaguiValue})`;if(typeof e.tamaguiValue==`string`){let n=ft(e.tamaguiValue,t);return e.category===`dropShadow`?tt(n):n}return e.tamaguiValue}function tt(e){return e.includes(`drop-shadow(`)?e:e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.replace(/^inset\s+/i,``).split(/\s+/);if(t.length>=5){let[e,n,r]=t;return`drop-shadow(${e} ${n} ${r} ${t.slice(4).join(` `)})`}return`drop-shadow(${e.replace(/^inset\s+/i,``)})`}).join(` `)}function nt(e){let t={},n=q(e);for(let r of e){if(!r.category||r.category===`color`||!r.tokenKey||Ye(r))continue;let e=$e(r);if(!e)continue;let i=et(r,n);if(typeof i==`string`&&ut(i))continue;let a=t[r.category]??{};a[e]=i,t[r.category]=a}return t}function rt(e,t){let n={},r=(e,t)=>{let r=t.cssValue;typeof r!=`string`||r.length===0||Y(r)||r===`[object Object]`||(n[e]=r)},i=e=>{let t=e.path.replace(/^color\./i,``).replaceAll(`.`,``);return e.theme?`${e.theme}_${t}`:t};for(let t of e)t.tokenKey&&(t.primitive?r(i(t),t):r(t.tokenKey,t));for(let e of t)!e.tokenKey||!e.primitive||r(i(e),e);return n}function K(e,t=2){let n=` `.repeat(t),r=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return r.length===0?`{}`:`{\n${r.map(([e,t])=>{let r=typeof t==`string`&&Qe(t)?t:a(t);return`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${r}`}).join(`,
52
+ `)}\n${` `.repeat(Math.max(t-2,0))}}`}function it(e,t=2){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{\n${n}...theme\n${r}}`:`{\n${n}...theme,\n${i.map(([e,t])=>`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${t}`).join(`,
53
+ `)}\n${r}}`}const at=/^\{([^{}]+)\}$/,ot=/\{([^{}]+)\}/g,st=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/,ct=/var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g;function q(e){return{byPath:new Map(e.map(e=>[e.path,e])),byCssVar:new Map(e.map(e=>[(0,t.toThemeCssVar)(e.path),e]))}}function lt(e){if(typeof e==`string`)return at.exec(e.trim())?.[1]?.trim()}function J(e){if(typeof e==`string`)return st.exec(e.trim())?.[1]}function Y(e){return lt(e)!=null||J(e)!=null}function ut(e){return/var\(|\{[^{}]+\}/.test(e)}function dt(e,t){let n=pt(e,t.byPath,t.byCssVar);if(n.category!=null&&n.category!==`color`)return;let r=[n.cssValue,n.tamaguiValue];for(let e of r)if(typeof e==`string`&&e.length>0&&!Y(e))return e}function ft(e,t){return e.replace(ot,(e,n)=>{let r=t.byPath.get(n.trim());return r?dt(r,t)??e:e}).replace(ct,(e,n)=>{let r=t.byCssVar.get(n);return r?dt(r,t)??e:e})}function pt(e,t,n){let r=e,i=new Set;for(let e=0;e<8;e++){if(i.has(r.path))return r;i.add(r.path);let e=lt(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=J(r.value)??J(r.cssValue)??J(r.tamaguiValue);if(a){let e=n.get(a);if(!e||e.path===r.path)return r;r=e;continue}return r}return r}function mt(e){return/^[A-Z_$][\w$]*$/i.test(e)?`theme.${e}`:`theme[${a(e)}]`}function ht(e,t){return t<1?e:t+1-e}function gt(e,t){return e.length<2?!1:Z(e,t).some((t,n)=>t!==e[n])}function _t(e,t,n,r){let i=n[t];if(!i||r!==`dark`)return e;let a=Dt(i,t);return a.length<2||!gt(a.map(([,e])=>e),r)?e:ht(e,a[a.length-1][0])}function vt(e,t,n,r){let i=bt(e);if(!i)return;let a=_t(i.step,i.name,n,r);if(t&&i.name.toLowerCase()===t.toLowerCase())return`color${a}`;if(n[i.name])return`${i.name}${a}`}function yt(e){if(e>=1&&e<=12)return e;if(e>=100&&e<=900&&e%100==0)return e/100}function bt(e){let t=e.path.split(`.`).filter(Boolean),n=t.at(-1);if(n&&/^\d+$/.test(n)){let e=yt(Number(n)),r=t.at(-2);if(e!=null&&r&&!/^(?:color|colours?|palette)$/i.test(r))return{name:T([r]),step:e}}if(!e.tokenKey)return;let r=/^([A-Z]+)(\d{1,3})$/i.exec(e.tokenKey);if(!r)return;let[,i=``,a=``]=r,o=yt(Number(a));if(o!=null)return{name:i,step:o}}function xt(e,t,n,r){let i=e[t]??{};i[`${t}${n}`]=r,e[t]=i}function St(e){let t={};for(let n of e){if(typeof n.tamaguiValue!=`string`)continue;let e=bt(n);e&&xt(t,e.name,e.step,n.tamaguiValue)}return Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=3))}function X(e){let t={};for(let n of e){if(!n.primitive||typeof n.tamaguiValue!=`string`)continue;let e=bt(n);e&&xt(t,e.name,e.step,n.tamaguiValue)}let n=Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=2));return Object.keys(n).length>0?n:St(e)}function Z(e,t){if(e.length<2)return[...e];let n=Et(e[0]),r=Et(e[e.length-1]);if(n==null||r==null||n===r)return[...e];let i=n>r;return t===`light`?i?[...e]:e.toReversed():i?e.toReversed():[...e]}function Q(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Ct(e){let t=e.startsWith(`#`)?e.slice(1):``;if((t.length===3||t.length===4)&&(t=[...t].map(e=>e+e).join(``)),t.length===8&&(t=t.slice(0,6)),t.length!==6||/[^0-9a-f]/i.test(t))return;let n=Number.parseInt(t.slice(0,2),16)/255,r=Number.parseInt(t.slice(2,4),16)/255,i=Number.parseInt(t.slice(4,6),16)/255;return .2126*Q(n)+.7152*Q(r)+.0722*Q(i)}function $(e){let t=e.trim();if(t.endsWith(`%`)){let e=Number.parseFloat(t);return Number.isFinite(e)?e/100:void 0}let n=Number.parseFloat(t);return Number.isFinite(n)?n:void 0}function wt(e){return e>1?e/100:e}function Tt(e,t){let n=RegExp(`^${t}\\((.+)\\)$`,`i`).exec(e.trim());if(n?.[1])return n[1].split(/[\s,/]+/).filter(Boolean)}function Et(e){let t=e.trim();if(!t||t.startsWith(`var(`)||t.includes(`{`))return;let n=Ct(t);if(n!=null)return n;let r=Tt(t,`oklch`);if(r?.[0]){let e=$(r[0]);return e==null?void 0:wt(e)}let i=Tt(t,`hsla?`);if(i?.[2]){let e=$(i[2]);return e==null?void 0:wt(e)}let a=Tt(t,`rgba?`);if(a?.[0]&&a[1]&&a[2]){let e=$(a[0]),t=$(a[1]),n=$(a[2]);if(e==null||t==null||n==null)return;let r=(e,t)=>t.trim().endsWith(`%`)||e<=1?e:e/255;return .2126*Q(r(e,a[0]))+.7152*Q(r(t,a[1]))+.0722*Q(r(n,a[2]))}}function Dt(e,t){let n=[],r=t.toLowerCase();for(let[i,a]of Object.entries(e)){if(!i.toLowerCase().startsWith(r))continue;let e=i.slice(t.length);/^\d+$/.test(e)&&n.push([Number(e),a])}return n.sort(([e],[t])=>e-t),n}function Ot(e,t,n){let r=Dt(e,t);if(r.length===0)return e;let i=Z(r.map(([,e])=>e),n),a={};for(let[e,[n]]of r.entries())a[`${t}${n}`]=i[e]??r[e][1];return a}function kt(e){if(e.length>=12)return e.slice(0,12);let t=[...e],n=t.at(-1);if(n==null)return t;for(;t.length<12;)t.push(n);return t}function At(e,t,n){let r=Dt(e,t);if(!(r.length<2))return kt(Z(r.map(([,e])=>e),n))}function jt(e,t){let n=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),{name:e,scale:t}]));for(let e of Ge){let r=n.get(e);if(!r)continue;let i=At(r.scale,r.name,t);if(i)return{name:r.name,palette:i}}}function Mt(e){let t=e.filter(e=>e.category===`color`||e.primitive),n=X(G(t,`light`)),r=X(G(t,`dark`)),i=jt(n,`light`),a=jt(r,`dark`);return{lightPalette:i?.palette,darkPalette:a?.palette,lightBaseName:i?.name,darkBaseName:a?.name}}function Nt(e,t,n){let r=X(e),{byPath:i,byCssVar:o}=q(e),s={};for(let c of e){if(c.category!==`color`||!c.tokenKey||c.primitive||/^[A-Z]+\d{1,3}$/i.test(c.tokenKey)&&r[c.tokenKey.replace(/\d{1,3}$/,``)])continue;let e=pt(c,i,o),l=vt(e,t,r,n);if(l){s[c.tokenKey]=mt(l);continue}let u=e.tamaguiValue;Y(u)||Y(e.cssValue)||(typeof u==`string`||typeof u==`number`)&&(s[c.tokenKey]=a(u))}return s}function Pt(e){return e.replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${")}function Ft(e,t,n,r,i){let a=pt(e,t.byPath,t.byCssVar),o=vt(a,n,r,i);if(o)return{kind:`theme`,property:o};let s=dt(a,t);if(s)return{kind:`text`,value:s}}function It(e,t,n,r,i){let a=[],o=/\{([^{}]+)\}|var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g,s=0;for(let c of e.matchAll(o)){let o=c.index??0;o>s&&a.push({kind:`text`,value:e.slice(s,o)});let l=c[1]?t.byPath.get(c[1].trim()):c[2]?t.byCssVar.get(c[2]):void 0;if(!l)return;let u=Ft(l,t,n,r,i);if(!u)return;a.push(u),s=o+c[0].length}return s<e.length&&a.push({kind:`text`,value:e.slice(s)}),a}function Lt(e){return e.some(e=>e.kind===`theme`)?`\`${e.map(e=>e.kind===`theme`?`\${${mt(e.property)}}`:Pt(e.value)).join(``)}\``:a(e.map(e=>e.kind===`text`?e.value:``).join(``))}function Rt(e,t,n){let r=q(e),i=X(e.filter(e=>e.category===`color`)),a={};for(let o of e){if(!Ye(o)||!o.tokenKey)continue;let e=typeof o.tamaguiValue==`string`?o.tamaguiValue:o.cssValue;if(typeof e!=`string`||e.length===0)continue;let s=It(e,r,t,i,n);s&&(a[o.tokenKey]=Lt(s))}return a}function zt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);if(n.size===0)return;let r=[];for(let i of[...n].toSorted((e,t)=>e.localeCompare(t))){let n=Ot(e[i]??t[i]??{},i,`light`),a=Ot(t[i]??e[i]??{},i,`dark`);Object.keys(n).length!==0&&Object.keys(a).length!==0&&r.push(` ${i}: {
54
+ light: ${K(n,8)},
55
+ dark: ${K(a,8)}
56
56
  }`)}if(r.length!==0)return`{\n${r.join(`,
57
- `)}\n }`}function Lt(e){let t=new Set;for(let n of e)for(let e of Object.values(n)){for(let n of e.matchAll(/theme\.([A-Z_$][\w$]*)/gi))n[1]&&t.add(n[1]);for(let n of e.matchAll(/theme\[(['"])(.+?)\1\]/g))t.add(n[2])}return[...t]}function Rt(e,t){let n=new Set;for(let r of[e,t])for(let e of Object.values(r))for(let t of Object.keys(e))n.add(t);return[...n]}function zt(e,t){let n=Math.max(e?.length??0,t?.length??0);if(n===0)return[];let r=[];for(let e=1;e<=Math.min(n,12);e++)r.push(`color${e}`);return r}function Bt(e){let t=new Set;for(let n of Object.keys(e.lightSemantic))t.add(n);for(let n of Object.keys(e.darkSemantic))t.add(n);for(let n of Lt([e.lightSemantic,e.darkSemantic]))t.add(n);for(let n of Rt(e.lightScales,e.darkScales))t.add(n);for(let n of zt(e.lightPalette,e.darkPalette))t.add(n);return[...t].toSorted((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function Vt(e){return` ${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: string;`}function Ht(e,t){if(e.length!==0)return[`/**`,` * Theme values available on \`useTheme()\` and \`$\` style props for the ${t.specName||`design system`}.`,` *`," * Derived from design tokens mapped by `createV5Theme` and `getTheme`.",` *`,` * @see https://tamagui.dev/docs/guides/theme-builder#gettheme`,` */`,`export interface AppTheme {`,...e.map(Vt),`}`,``]}function Ut(e,t,n={}){let r=e.fonts??{},i=n.useDefaultConfig===!0,o=n.animations??`css`,s=n.includeTypeAugmentation!==!1,c=t.filter(e=>e.category===`color`),l=W(c,`light`),u=W(c,`dark`),d=X(l),f=X(u.length>0?u:l),{lightPalette:p,darkPalette:m,lightBaseName:h,darkBaseName:g}=kt(t),_=It(d,f),v=W(t,`light`),ee=W(t,`dark`),y=u.length>0?ee:v,b=u.length>0?g:h,x={...At(l,h),...Ft(v,h)},S={...At(u.length>0?u:l,b),...Ft(y,b)},C=Ht(Bt({lightSemantic:x,darkSemantic:S,lightScales:d,darkScales:f,lightPalette:p,darkPalette:m}),{specName:e.name}),te=rt(v),w=it(l,u),T=[];Object.keys(w).length>0&&T.push(` color: ${G(w,4)}`);for(let e of Qe){let t=te[e];t&&Object.keys(t).length>0&&T.push(` ${e}: ${G(t,4)}`)}let E=[];p&&E.push(` lightPalette: ${a(p)}`),m&&E.push(` darkPalette: ${a(m)}`),_&&E.push(` childrenThemes: ${_}`),(Object.keys(x).length>0||Object.keys(S).length>0)&&E.push(` getTheme: ({ theme, scheme }: { theme: any; scheme: "light" | "dark" }) => {
57
+ `)}\n }`}function Bt(e){let t=new Set;for(let n of e)for(let e of Object.values(n)){for(let n of e.matchAll(/theme\.([A-Z_$][\w$]*)/gi))n[1]&&t.add(n[1]);for(let n of e.matchAll(/theme\[(['"])(.+?)\1\]/g))t.add(n[2])}return[...t]}function Vt(e,t){let n=new Set;for(let r of[e,t])for(let e of Object.values(r))for(let t of Object.keys(e))n.add(t);return[...n]}function Ht(e,t){let n=Math.max(e?.length??0,t?.length??0);if(n===0)return[];let r=[];for(let e=1;e<=Math.min(n,12);e++)r.push(`color${e}`);return r}function Ut(e){let t=new Set;for(let n of Object.keys(e.lightSemantic))t.add(n);for(let n of Object.keys(e.darkSemantic))t.add(n);for(let n of Bt([e.lightSemantic,e.darkSemantic]))t.add(n);for(let n of Vt(e.lightScales,e.darkScales))t.add(n);for(let n of Ht(e.lightPalette,e.darkPalette))t.add(n);return[...t].toSorted((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function Wt(e){return` ${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: string;`}function Gt(e,t){if(e.length!==0)return[`/**`,` * Theme values available on \`useTheme()\` and \`$\` style props for the ${t.specName||`design system`}.`,` *`," * Derived from design tokens mapped by `createV5Theme` and `getTheme`.",` *`,` * @see https://tamagui.dev/docs/guides/theme-builder#gettheme`,` */`,`export interface AppTheme {`,...e.map(Wt),`}`,``]}function Kt(e,t,n={}){let r=e.fonts??{},i=n.useDefaultConfig===!0,o=n.animations??`css`,s=n.includeTypeAugmentation!==!1,c=t.filter(e=>e.category===`color`),l=G(c,`light`),u=G(c,`dark`),d=X(l),f=X(u.length>0?u:l),{lightPalette:p,darkPalette:m,lightBaseName:h,darkBaseName:g}=Mt(t),_=zt(d,f),v=G(t,`light`),ee=G(t,`dark`),y=u.length>0?ee:v,b=u.length>0?g:h,x={...Nt(l,h,`light`),...Rt(v,h,`light`)},S={...Nt(u.length>0?u:l,b,`dark`),...Rt(y,b,`dark`)},C=Gt(Ut({lightSemantic:x,darkSemantic:S,lightScales:d,darkScales:f,lightPalette:p,darkPalette:m}),{specName:e.name}),te=nt(v),w=rt(l,u),T=[];Object.keys(w).length>0&&T.push(` color: ${K(w,4)}`);for(let e of Ze){let t=te[e];t&&Object.keys(t).length>0&&T.push(` ${e}: ${K(t,4)}`)}let E=[];p&&E.push(` lightPalette: ${a(p)}`),m&&E.push(` darkPalette: ${a(m)}`),_&&E.push(` childrenThemes: ${_}`),(Object.keys(x).length>0||Object.keys(S).length>0)&&E.push(` getTheme: ({ theme, scheme }: { theme: any; scheme: "light" | "dark" }) => {
58
58
  return scheme === "dark"
59
- ? ${at(S,8)}
60
- : ${at(x,8)};
61
- }`);let D=[`import { isWeb } from '@tamagui/constants';`];i?D.push(`import { createV5Theme, defaultConfig, type CreateV5ThemeOptions } from "@tamagui/config/v5";`):D.push(`import { createV5Theme, type CreateV5ThemeOptions } from "@tamagui/config/v5";`),o!==!1&&D.push(`import { animations } from "${qe[o]}";`),n.importConfig&&D.push(`import userConfig from "${n.importConfig}";`);let O=[`createTamagui`,`px`];T.length>0&&O.push(`createTokens`);let k=Re(t,r);k.length>0&&O.push(`createFont`),D.push(`import { ${O.join(`, `)} } from "@tamagui/core";`);let A=[`/* eslint-disable */`,``,`/*`,` * Generated by @razorwind/tamagui — Do not edit by hand.`,` * `,` * @see https://tamagui.dev/docs/core/config-v5`,` */`,``,...D,``];T.length>0&&A.push(`const tokens = createTokens({`,T.join(`,
62
- `),`});`,``);let j=E.length>0?`createV5Theme({\n${E.join(`,
63
- `)}\n})`:`createV5Theme()`;A.push(`const themes = ${j};`,``);let M=new Map;if(k.length>0)for(let[e,t]of k.entries()){let n=Be(t.key,e);M.set(t.key,n),A.push(Ve(t,n),``)}let N=[];if(i&&N.push(` ...defaultConfig`),o!==!1&&N.push(` animations`),T.length>0&&(i?N.push(` tokens: {
59
+ ? ${it(S,8)}
60
+ : ${it(x,8)};
61
+ }`);let D=[`import { isWeb } from '@tamagui/constants';`];i?D.push(`import { createV5Theme, defaultConfig, type CreateV5ThemeOptions } from "@tamagui/config/v5";`):D.push(`import { createV5Theme, type CreateV5ThemeOptions } from "@tamagui/config/v5";`),o!==!1&&D.push(`import { animations } from "${Ke[o]}";`),n.importConfig&&D.push(`import userConfig from "${n.importConfig}";`);let O=[`createTamagui`,`px`];T.length>0&&O.push(`createTokens`);let k=Le(t,r);k.length>0&&O.push(`createFont`),D.push(`import { ${O.join(`, `)} } from "@tamagui/core";`);let A=[`/* eslint-disable */`,``,`/*`,` * Generated by @razorwind/tamagui — Do not edit by hand.`,` * `,` * @see https://tamagui.dev/docs/core/config-v5`,` */`,``,...D,``];T.length>0&&A.push(`const tokens = createTokens({`,T.join(`,
62
+ `),`});`,``);let ne=E.length>0?`createV5Theme({\n${E.join(`,
63
+ `)}\n})`:`createV5Theme()`;A.push(`const themes = ${ne};`,``);let j=new Map;if(k.length>0)for(let[e,t]of k.entries()){let n=ze(t.key,e);j.set(t.key,n),A.push(Be(t,n),``)}let M=[];if(i&&M.push(` ...defaultConfig`),o!==!1&&M.push(` animations`),T.length>0&&(i?M.push(` tokens: {
64
64
  ...defaultConfig.tokens,
65
65
  ...tokens,
66
66
  space: {
@@ -79,18 +79,18 @@ Re-run Razorwind generate when tokens change so \`${e.outputPath}\` stays aligne
79
79
  ...defaultConfig.tokens.zIndex,
80
80
  ...tokens.zIndex
81
81
  }
82
- }`):N.push(` tokens`)),N.push(` themes`),M.size>0){let e=[...M.entries()].map(([e,t])=>` ${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${t}`);i?N.push(` fonts: {
82
+ }`):M.push(` tokens`)),M.push(` themes`),j.size>0){let e=[...j.entries()].map(([e,t])=>` ${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${t}`);i?M.push(` fonts: {
83
83
  ...defaultConfig.fonts,
84
84
  ${e.join(`,
85
85
  `)}
86
- }`):N.push(` fonts: {
86
+ }`):M.push(` fonts: {
87
87
  ${e.join(`,
88
88
  `)}
89
- }`)}return n.shorthands&&N.push(` shorthands: ${G(n.shorthands,4)}`),n.media&&N.push(` media: ${a(n.media)}`),n.defaultFont&&N.push(` defaultFont: ${a(n.defaultFont)}`),A.push(``,...C??[],`/**
89
+ }`)}return n.shorthands&&M.push(` shorthands: ${K(n.shorthands,4)}`),n.media&&M.push(` media: ${a(n.media)}`),n.defaultFont&&M.push(` defaultFont: ${a(n.defaultFont)}`),A.push(``,...C??[],`/**
90
90
  * The Tamagui v5 config for the ${e.name||`design system`}.
91
91
  *
92
92
  * @see https://tamagui.dev/docs/core/config-v5
93
93
  */
94
- export const config = createTamagui({`,N.join(`,
94
+ export const config = createTamagui({`,M.join(`,
95
95
  `),n.importConfig?`, ...userConfig `:``,`});`,``,`export type AppConfig = typeof config;`,``),s&&A.push(`declare module "@tamagui/core" {`,` // eslint-disable-next-line @typescript-eslint/no-empty-object-type`,` interface TamaguiCustomConfig extends AppConfig {}`,`}`,``),A.push(`export default config;`,``),A.join(`
96
- `)}function Wt(e,r={}){let i=e.tokens&&Object.keys(e.tokens).length>0,a=e.fonts&&Object.keys(e.fonts).length>0;if(!i&&!a)return{};let o=i?O(e.tokens,r):[];if(o.length===0&&!a)return{};let s=r.outputPath??`tamagui.config.ts`,c=Ut(e,o,r),l=r.installGuide??He({outputPath:s}),u=(0,n.join)((0,n.dirname)(s),`INSTALL.md`);return{[s]:(0,t.createDocument)(s,c,{name:`razorwind-tamagui`},!1,`typescript`),[u]:(0,t.createDocument)(u,l,{name:`razorwind-tamagui`},!1,`markdown`)}}var Gt=(0,e.definePlugin)(e=>({name:`tamagui`,themeGeneration:`combined`,generate:async t=>Wt(t,e??{})}));exports.collectColorScales=X,exports.collectTamaguiFonts=Re,exports.colorLightness=$,exports.default=Gt,exports.flattenTokens=O,exports.fontVarName=Be,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateTamaguiConfig=Wt,exports.isPaletteGroup=v,exports.orderPaletteForScheme=bt,exports.renderInstallMd=He,exports.renderTamaguiConfig=Ut,exports.resolveTokenCategory=w,exports.resolveTokenSets=t.resolveTokenSets,exports.tamaguiFontKeyFromRole=z,exports.toCamelCaseKey=T,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toTamaguiValue=o,exports.toTokenKey=E,exports.typographyFontKey=be;
96
+ `)}function qt(e,r={}){let i=e.tokens&&Object.keys(e.tokens).length>0,a=e.fonts&&Object.keys(e.fonts).length>0;if(!i&&!a)return{};let o=i?O(e.tokens,r):[];if(o.length===0&&!a)return{};let s=r.outputPath??`tamagui.config.ts`,c=Kt(e,o,r),l=r.installGuide??Ve({outputPath:s}),u=(0,n.join)((0,n.dirname)(s),`INSTALL.md`);return{[s]:(0,t.createDocument)(s,c,{name:`razorwind-tamagui`},!1,`typescript`),[u]:(0,t.createDocument)(u,l,{name:`razorwind-tamagui`},!1,`markdown`)}}var Jt=(0,e.definePlugin)(e=>({name:`tamagui`,themeGeneration:`combined`,generate:async t=>qt(t,e??{})}));exports.collectColorScales=X,exports.collectTamaguiFonts=Le,exports.colorLightness=Et,exports.default=Jt,exports.flattenTokens=O,exports.flipPaletteStep=ht,exports.fontVarName=ze,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateTamaguiConfig=qt,exports.isPaletteGroup=v,exports.orderPaletteForScheme=Z,exports.renderInstallMd=Ve,exports.renderTamaguiConfig=Kt,exports.resolveTokenCategory=w,exports.resolveTokenSets=t.resolveTokenSets,exports.tamaguiFontKeyFromRole=B,exports.toCamelCaseKey=T,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toTamaguiValue=o,exports.toTokenKey=E,exports.typographyFontKey=ye;
package/dist/index.d.cts CHANGED
@@ -212,6 +212,14 @@ declare function renderInstallMd(options: {
212
212
  //#endregion
213
213
  //#region src/generate.d.ts
214
214
  type ColorScheme = "light" | "dark";
215
+ /**
216
+ * Mirror a palette step across a numbered scale (`1` ↔ `max`, `2` ↔ `max-1`).
217
+ *
218
+ * Dark palettes are emitted darkest-first (`color1` / `red1` are the darkest
219
+ * stops), so a DTCG alias `{color.red.7}` must read `theme.red3` on a 9-step
220
+ * scale to keep pointing at the original token color.
221
+ */
222
+ declare function flipPaletteStep(step: number, maxStep: number): number;
215
223
  /**
216
224
  * Collect color palettes for Tamagui `childrenThemes`.
217
225
  *
@@ -279,5 +287,5 @@ declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOpti
279
287
  */
280
288
  declare const _default: (options?: TamaguiPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
281
289
  //#endregion
282
- export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory, collectColorScales, collectTamaguiFonts, colorLightness, _default as default, flattenTokens, fontVarName, formatTokenValue, generateTamaguiConfig, isPaletteGroup, orderPaletteForScheme, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, tamaguiFontKeyFromRole, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey, typographyFontKey };
290
+ export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory, collectColorScales, collectTamaguiFonts, colorLightness, _default as default, flattenTokens, flipPaletteStep, fontVarName, formatTokenValue, generateTamaguiConfig, isPaletteGroup, orderPaletteForScheme, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, tamaguiFontKeyFromRole, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey, typographyFontKey };
283
291
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/fonts.ts","../src/format.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;;KA0BY;;;;KAMA;;;;UAkBK;;;;;;;;;EASf;;;;;;;EAQA,aAAa;;;;;;EAOb,aAAa;;;;;;EAOb,QAAQ;;;;EAKR;;;;EAKA;;;;;;;;EASA;;;;;EAMA,eAAe;;;;;;;EAQf;;;;;EAMA;;;;;UAMe;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA,WAAW;;EAEX;;EAEA;;EAEA;;;;EAIA;;;;;;;;;iBC3Dc,eAAe,MAAM;;;;iBAuFrB,qBACd,cACA,gBACC;;;;;;;iBAoEa,eAAe;;;;;;;;iBA0Bf,WAAW;;;;iBA6FX,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,wCACb;;;;;;;;;UCrSc;;EAEf;;EAEA;;EAEA;EACA,MAAM;EACN,YAAY;EACZ,QAAQ;EACR,eAAe;;EAEf;;;;;;;;;iBA4Lc,uBAAuB;;;;;;;;;iBAiCvB,kBAAkB;;;;;;;iBA2WlB,oBACd,QAAQ,aACR,QAAQ,QACP;;;;;;iBAsFa,YAAY,aAAa;;;;;;;;;iBC/rBzB,eAAe,gBAAgB;;;;;;;;iBCnC/B,gBAAgB;EAAW;;;;KCmCtC;;;;;;;iBA6iBW,mBACd,aAAa,cACZ,eAAe;;;;;;;iBAmCF,sBACd,2BACA,QAAQ;;;;;iBA+EM,eAAe;;;;;;;;;;;iBA2jBf,oBACd,MAAM,QACN,QAAQ,aACR,UAAS;;;;iBAyQK,sBACd,MAAM,QACN,UAAS,uBACR,wBAAwB,QAAQ"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/fonts.ts","../src/format.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;;KA0BY;;;;KAMA;;;;UAkBK;;;;;;;;;EASf;;;;;;;EAQA,aAAa;;;;;;EAOb,aAAa;;;;;;EAOb,QAAQ;;;;EAKR;;;;EAKA;;;;;;;;EASA;;;;;EAMA,eAAe;;;;;;;EAQf;;;;;EAMA;;;;;UAMe;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA,WAAW;;EAEX;;EAEA;;EAEA;;;;EAIA;;;;;;;;;iBC3Dc,eAAe,MAAM;;;;iBAuFrB,qBACd,cACA,gBACC;;;;;;;iBAoEa,eAAe;;;;;;;;iBA0Bf,WAAW;;;;iBA6FX,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,wCACb;;;;;;;;;UCrSc;;EAEf;;EAEA;;EAEA;EACA,MAAM;EACN,YAAY;EACZ,QAAQ;EACR,eAAe;;EAEf;;;;;;;;;iBA4Lc,uBAAuB;;;;;;;;;iBAiCvB,kBAAkB;;;;;;;iBA2WlB,oBACd,QAAQ,aACR,QAAQ,QACP;;;;;;iBAsFa,YAAY,aAAa;;;;;;;;;iBC/rBzB,eAAe,gBAAgB;;;;;;;;iBCnC/B,gBAAgB;EAAW;;;;KCmCtC;;;;;;;;iBA2bW,gBAAgB,cAAc;;;;;;;iBAgL9B,mBACd,aAAa,cACZ,eAAe;;;;;;;iBAmCF,sBACd,2BACA,QAAQ;;;;;iBA+EM,eAAe;;;;;;;;;;;iBAilBf,oBACd,MAAM,QACN,QAAQ,aACR,UAAS;;;;iBA0QK,sBACd,MAAM,QACN,UAAS,uBACR,wBAAwB,QAAQ"}
package/dist/index.d.mts CHANGED
@@ -212,6 +212,14 @@ declare function renderInstallMd(options: {
212
212
  //#endregion
213
213
  //#region src/generate.d.ts
214
214
  type ColorScheme = "light" | "dark";
215
+ /**
216
+ * Mirror a palette step across a numbered scale (`1` ↔ `max`, `2` ↔ `max-1`).
217
+ *
218
+ * Dark palettes are emitted darkest-first (`color1` / `red1` are the darkest
219
+ * stops), so a DTCG alias `{color.red.7}` must read `theme.red3` on a 9-step
220
+ * scale to keep pointing at the original token color.
221
+ */
222
+ declare function flipPaletteStep(step: number, maxStep: number): number;
215
223
  /**
216
224
  * Collect color palettes for Tamagui `childrenThemes`.
217
225
  *
@@ -279,5 +287,5 @@ declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOpti
279
287
  */
280
288
  declare const _default: (options?: TamaguiPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
281
289
  //#endregion
282
- export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory, collectColorScales, collectTamaguiFonts, colorLightness, _default as default, flattenTokens, fontVarName, formatTokenValue, generateTamaguiConfig, isPaletteGroup, orderPaletteForScheme, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, tamaguiFontKeyFromRole, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey, typographyFontKey };
290
+ export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory, collectColorScales, collectTamaguiFonts, colorLightness, _default as default, flattenTokens, flipPaletteStep, fontVarName, formatTokenValue, generateTamaguiConfig, isPaletteGroup, orderPaletteForScheme, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, tamaguiFontKeyFromRole, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey, typographyFontKey };
283
291
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,formatTokenValue as n,formatTokenValue as r,isObject as i,resolveTokenSets as a,toCssVar as o,toThemeCssVar as s}from"@razorwind/core/utils";import{basename as c,dirname as l,join as u}from"node:path";import{cssFontFamily as d,fontFamilyName as f}from"@razorwind/core/lib/fonts";function p(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`
2
- `,`\\n`).replaceAll(`\r`,`\\r`)}function m(e){return typeof e==`string`?`"${p(e)}"`:typeof e==`number`||typeof e==`boolean`?String(e):e==null?`undefined`:JSON.stringify(e)}function h(e,t){if(typeof e==`number`)return e;if(typeof e==`boolean`)return Number(e);if(i(e)&&typeof e.value==`number`&&typeof e.unit==`string`){let t=e.unit.toLowerCase();return t===`px`||t===``?e.value:t===`rem`?e.value*16:`${e.value}${e.unit}`}if(typeof e==`string`){let t=/^(-?\d+(?:\.\d+)?)px$/i.exec(e.trim());if(t)return Number(t[1]);let n=/^(-?\d+(?:\.\d+)?)rem$/i.exec(e.trim());if(n)return Number(n[1])*16;let r=Number(e);return!Number.isNaN(r)&&e.trim()!==``?r:e}return r(e,t)}const g=/^(?:font-size|fontSize)(?:\.|$)/i,_=/^(?:font-weight|fontWeight)(?:\.|$)/i,v=/^shadow(?:\.|$)/i,y=/^inset-shadow(?:\.|$)/i,b=/^drop-shadow(?:\.|$)/i,x=/^text-shadow(?:\.|$)/i,S=/^(?:blur|blur-?radius)(?:\.|$)/i,C=new Set([`color`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`]),ee=[{prefix:/^(?:color|colours?|palette)(?:\.|$)/i,category:`color`},{prefix:g,category:`fontSize`},{prefix:_,category:`fontWeight`},{prefix:b,category:`dropShadow`},{prefix:y,category:`insetShadow`},{prefix:x,category:`textShadow`},{prefix:v,category:`shadow`},{prefix:S,category:`blur`},{prefix:/^(?:space|spacing|gap)(?:\.|$)/i,category:`space`},{prefix:/^inset(?:\.|$)/i,category:`space`},{prefix:/^(?:size|sizing)(?:\.|$)/i,category:`size`},{prefix:/^(?:radius|rounded|radii)(?:\.|$)/i,category:`radius`},{prefix:/^(?:z-?index|zindex|elevation)(?:\.|$)/i,category:`zIndex`}];function te(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function w(e){return e===!0||e===`true`||e===1}function T(e){return w(e.palette)||w(e.$palette)?!0:j(e)===`palette`}function E(e,t){return(e===`palette`||e===`$palette`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function D(e){return e===!0||e===`true`||e===1}function O(e){return D(e.primitive)||D(e.$primitive)?!0:j(e)===`primitive`}function k(e,t){return(e===`primitive`||e===`$primitive`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function A(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function j(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function M(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function N(e,t){for(let{prefix:t,category:n}of ee)if(t.test(e))return n;if(t===`color`||t===`palette`)return`color`;if(t===`shadow`)return y.test(e)?`insetShadow`:b.test(e)?`dropShadow`:x.test(e)?`textShadow`:`shadow`;if(t===`dimension`){if(g.test(e))return`fontSize`;if(S.test(e))return`blur`;if(/(?:^|\.)(?:space|spacing|gap)(?:\.|$)/i.test(e)||/(?:^|\.)inset(?:\.|$)/i.test(e))return`space`;if(/radius|rounded/i.test(e))return`radius`;if(/z-?index|elevation/i.test(e))return`zIndex`;if(/(?:^|\.)(?:size|sizing)(?:\.|$)/i.test(e)||/(?:^|\.)(?:width|height)(?:\.|$)/i.test(e))return`size`}if(t===`number`&&/z-?index|elevation/i.test(e))return`zIndex`;if(t===`fontWeight`||_.test(e))return`fontWeight`}function P(e){return e.flatMap(e=>e.split(/[-_\s]+/)).filter(Boolean).map((e,t)=>{if(/^\d/.test(e))return e;let n=e.toLowerCase();return t===0?n:`${n.charAt(0).toUpperCase()}${n.slice(1)}`}).join(``)}function ne(e){let t=e.split(`.`).filter(Boolean),n=t[0];n&&/^(?:color|colours?|palette|primitive|space|spacing|gap|inset|shadow|inset-shadow|drop-shadow|text-shadow|font-size|fontSize|font-weight|fontWeight|size|sizing|radius|rounded|radii|z-?index|zindex|elevation|blur)$/i.test(n)&&t.shift();let r=t.length>0?t:e.split(`.`).slice(-1);return r.length===1&&/^(?:DEFAULT|default)$/i.test(r[0]??``)?`true`:P(r)}function re(e,t,r,a,o,s){if(!i(e))return;let c=o||O(e)||T(e),l=j(e,r);if(te(e)){let r=M(e),i=t.join(`.`),o=N(i,l)??(c||l===`primitive`||l===`palette`?`color`:void 0),u=n(r,l),d=o&&C.has(o)||l===`color`||l===`palette`||l===`primitive`||l===`shadow`?u:h(r,l);s.push({path:i,type:l===`palette`||l===`primitive`?`color`:l,value:r,cssValue:u,tamaguiValue:d,category:o,tokenKey:o?ne(i):void 0,description:A(e),theme:a,primitive:c});return}for(let[n,r]of Object.entries(e))n.startsWith(`$`)&&n!==`$palette`&&n!==`$primitive`||E(n,r)||k(n,r)||re(r,[...t,n],l,a,c,s)}function ie(e,t={}){let n=t.includeTypes?new Set(t.includeTypes):void 0,r=[];for(let t of a(e)){let e=t.id==="default"?void 0:t.id;re(t.tokens,[],void 0,e,!1,r)}return n?r.filter(e=>!e.type||n.has(e.type)):r}const ae=/^\{([^{}]+)\}$/,oe=/^(?:typography|type|text)$/i,se=/^(?:font|fonts|font-family|fontFamily)$/i,ce=/^(?:font-size|fontSize)$/i,le=/^(?:font-weight|fontWeight)$/i,ue=/^(?:line-height|lineHeight|leading)$/i,de=/^(?:letter-spacing|letterSpacing|tracking)$/i,fe=/^(?:[a-z]{2}(?:-[A-Z]{2})?|cn|zh|jp|ja|kr|ko|ar|he|th|hi|ru|french|mandarin|chinese|japanese|korean|arabic|hebrew)$/i,pe=[`fontFamily`,`font-family`,`family`],me=[`fontSize`,`font-size`,`size`],he=[`fontWeight`,`font-weight`,`weight`],ge=[`lineHeight`,`line-height`,`leading`],_e=[`letterSpacing`,`letter-spacing`,`tracking`],ve={1:12,2:14,3:16,4:18,5:20,6:24,7:28,8:32,9:40,10:48};function F(e){if(typeof e==`string`)return ae.exec(e.trim())?.[1]?.trim()}function I(e,t){let n=F(e);if(!n)return e;let r=t.get(n),i=new Set([n]);for(let e=0;e<8&&r;e++){let e=F(r.value);if(!e||i.has(e))return r.value;i.add(e),r=t.get(e)}return r?.value??e}function L(e,t){for(let n of t)if(e[n]!==void 0&&e[n]!==null)return e[n]}function ye(e){return(e.split(`,`)[0]?.trim()??e).replaceAll(/^["']|["']$/g,``)}function be(e){if(typeof e==`string`){let t=e.trim();return t.length===0||F(t)?void 0:t}if(Array.isArray(e)&&e.every(e=>typeof e==`string`)){let t=e.map(e=>e.trim()).filter(Boolean);return t.length>0?t.join(`, `):void 0}}function xe(e){return Number.isInteger(e)?e:Math.round(e*1e3)/1e3}function Se(e){if(e==null)return;let t=h(e);if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`){let e=/^(-?\d+(?:\.\d+)?)%$/.exec(t.trim());if(e)return Number.parseFloat(e[1])/100}}function Ce(e){if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`string`){let t=e.trim();if(t.length===0||F(t))return;let n=Number(t);return Number.isNaN(n)?t:String(n)}let t=h(e);if(typeof t==`number`&&Number.isFinite(t))return String(t);if(typeof t==`string`&&t.length>0)return t}function we(e,t){let n=Se(e);if(n!=null)return xe(t!=null&&n>0&&n<=4?n*t:n)}function R(e,t){return t.test(e.split(`.`)[0]??``)}function Te(e){return e.split(`.`).filter(Boolean).at(-1)??e}function Ee(e,t){let n=e.split(`.`).filter(Boolean);return n[0]&&t.test(n[0])&&n.shift(),n}function z(e){let t=e.flatMap(e=>e.split(`-`)).filter(Boolean);return t.length===0?`body`:t.map((e,t)=>t===0?`${e.charAt(0).toLowerCase()}${e.slice(1)}`:`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(``)}function B(e){switch(e.toLowerCase()){case`sans`:case`body`:case`serif`:return`body`;case`monospace`:case`mono`:return`mono`;default:return z([e])}}function De(e){return e.role?B(e.role):B(e.name)}function Oe(e){let t=Ee(e,oe);if(t.length===0)return`body`;let n=t.at(-1);return n&&t.length>=2&&fe.test(n)&&!n.includes(`_`)?`${t.slice(0,-1).join(`-`)}_${n}`:t.join(`-`)}function ke(e){return B(Ee(e,se)[0]??Te(e))}function Ae(e,t){let n=Ee(e,t);return n.length===0||n.length===1&&/^(?:DEFAULT|default)$/i.test(n[0])?`true`:z(n)}function je(e){return e.type===`typography`&&i(e.value)}function Me(e){return e.category===`fontSize`||e.category===`fontWeight`||Ne(e)||Pe(e)||Fe(e)||Ie(e)?!1:e.type===`fontFamily`||R(e.path,se)}function Ne(e){return e.category===`fontSize`||R(e.path,ce)}function Pe(e){return e.category===`fontWeight`||e.type===`fontWeight`||R(e.path,le)}function Fe(e){return R(e.path,ue)}function Ie(e){return R(e.path,de)}function Le(e,t){if(!e.has(t))return t;let n=2,r=`${t}${n}`;for(;e.has(r);)n++,r=`${t}${n}`;return r}function Re(e){let t=new Map;for(let n of Object.values(e)){let e=De(n);t.has(e)&&(e=Le(t,z([n.name]))),t.set(e,n)}return t}function ze(e,t,n){if(!e)return;let r=Object.values(e);if(r.length===0)return;if(n){let e=n.split(`.`).filter(Boolean).at(-1);if(e){let t=r.find(t=>t.role===e||t.name.toLowerCase()===e.toLowerCase());if(t)return t}}if(!t)return;let i=ye(t).toLowerCase();return r.find(e=>f(e).toLowerCase()===i||e.title.toLowerCase()===i||e.name.toLowerCase()===i)}function Be(e){let t=new Map;for(let n of e.files){let e=String(n.weight??400),r=c(n.path).replace(/\.[^.]+$/,``),i=t.get(e)??{};n.style===`italic`||n.style===`oblique`?i.italic=r:i.normal=r,t.set(e,i)}if(t.size!==0)return`{\n${[...t.entries()].toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0})).map(([e,t])=>{let n=[];return t.normal&&n.push(`normal: ${m(t.normal)}`),t.italic&&n.push(`italic: ${m(t.italic)}`),` ${e}: { ${n.join(`, `)} }`}).join(`,
3
- `)}\n }`}function V(e,t){return{...e,webFamily:d(t),nativeFamily:f(t),face:t.source===`local`?Be(t):e.face}}function H(e){return{key:e,webFamily:`system-ui, sans-serif`,nativeFamily:`system-ui`,size:{},lineHeight:{},weight:{},letterSpacing:{}}}function Ve(e,t){return{...e,webFamily:t,nativeFamily:ye(t)}}const He=/^(?:font-size|fontSize|font-weight|fontWeight|line-height|lineHeight|leading|letter-spacing|letterSpacing|tracking)$/i;function U(e,t){let n={true:e},r=F(t);if(!r)return n;let i=Ae(r,He);return i&&i!==`true`&&(n[i]=e),n}function Ue(e){return Object.keys(e.size).length>0?e:{...e,size:{...ve}}}function We(e,t,n,r){if(!i(t.value))return e;let a=L(t.value,pe),o=F(a),s=be(I(a,n)),c=ze(r,s,o),l=e;c?l=V(l,c):s&&(l=Ve(l,s));let u=L(t.value,me),d=Se(I(u,n));d!=null&&(l={...l,size:U(d,u)});let f=L(t.value,he),p=Ce(I(f,n));p&&(l={...l,weight:U(p,f)});let m=L(t.value,_e),h=Se(I(m,n));h!=null&&(l={...l,letterSpacing:U(h,m)});let g=L(t.value,ge),_=we(I(g,n),l.size.true??d);return _!=null&&(l={...l,lineHeight:U(_,g)}),Ge(l)}function Ge(e){let t=Object.keys(e.size);if(t.length===0)return e;let n=e=>{let n=e.true??Object.values(e)[0];if(n==null)return e;let r={...e};for(let e of t)r[e]??=n;return r};return{...e,lineHeight:Object.keys(e.lineHeight).length>0?n(e.lineHeight):e.lineHeight,weight:Object.keys(e.weight).length>0?n(e.weight):e.weight,letterSpacing:Object.keys(e.letterSpacing).length>0?n(e.letterSpacing):e.letterSpacing}}function Ke(e,t){let n=new Map(e.map(e=>[e.path,e])),r=new Map,i=e=>{r.set(e.key,e)};if(t)for(let[e,n]of Re(t))i(V(H(e),n));for(let a of e){if(!Me(a)||je(a))continue;let e=ke(a.path),o=be(I(a.value,n)),s=r.get(e)??H(e),c=ze(t,o,a.path),l=s;c?l=V(l,c):(o&&s.webFamily===H(e).webFamily||o&&!r.has(e))&&(l=Ve(l,o)),i(l)}for(let a of e){if(!je(a))continue;let e=Oe(a.path);i(We(r.get(e)??H(e),a,n,t))}return[...r.values()].map(Ue).toSorted((e,t)=>e.key.localeCompare(t.key))}function qe(e){return/^\d+$/.test(e)||/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}function W(e,t=4){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{}`:`{\n${i.map(([e,t])=>`${n}${qe(e)}: ${m(t)}`).join(`,
4
- `)}\n${r}}`}function Je(e,t){let n=`${e.split(`-`).filter(Boolean).map((e,t)=>t===0?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(``).replaceAll(/[^\w$]/g,``)||`font${t}`}Font`;return/^[A-Z_$]/i.test(n)?n:`font${t}`}function Ye(e,t){let n=m(e.webFamily),r=m(e.nativeFamily),i=[n===r?` family: ${n}`:` family: isWeb ? ${n} : ${r}`,` size: ${W(e.size)}`];return Object.keys(e.lineHeight).length>0&&i.push(` lineHeight: ${W(e.lineHeight)}`),Object.keys(e.weight).length>0&&i.push(` weight: ${W(e.weight)}`),Object.keys(e.letterSpacing).length>0&&i.push(` letterSpacing: ${W(e.letterSpacing)}`),e.face&&i.push(` face: ${e.face}`),`const ${t} = createFont({\n${i.join(`,
5
- `)}\n});`}function Xe(e){return`# Installing Tamagui Config
2
+ `,`\\n`).replaceAll(`\r`,`\\r`)}function m(e){return typeof e==`string`?`"${p(e)}"`:typeof e==`number`||typeof e==`boolean`?String(e):e==null?`undefined`:JSON.stringify(e)}function h(e,t){if(typeof e==`number`)return e;if(typeof e==`boolean`)return Number(e);if(i(e)&&typeof e.value==`number`&&typeof e.unit==`string`){let t=e.unit.toLowerCase();return t===`px`||t===``?e.value:t===`rem`?e.value*16:`${e.value}${e.unit}`}if(typeof e==`string`){let t=/^(-?\d+(?:\.\d+)?)px$/i.exec(e.trim());if(t)return Number(t[1]);let n=/^(-?\d+(?:\.\d+)?)rem$/i.exec(e.trim());if(n)return Number(n[1])*16;let r=Number(e);return!Number.isNaN(r)&&e.trim()!==``?r:e}return r(e,t)}const g=/^(?:font-size|fontSize)(?:\.|$)/i,_=/^(?:font-weight|fontWeight)(?:\.|$)/i,v=/^shadow(?:\.|$)/i,y=/^inset-shadow(?:\.|$)/i,b=/^drop-shadow(?:\.|$)/i,x=/^text-shadow(?:\.|$)/i,S=/^(?:blur|blur-?radius)(?:\.|$)/i,C=new Set([`color`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`]),ee=[{prefix:/^(?:color|colours?|palette)(?:\.|$)/i,category:`color`},{prefix:g,category:`fontSize`},{prefix:_,category:`fontWeight`},{prefix:b,category:`dropShadow`},{prefix:y,category:`insetShadow`},{prefix:x,category:`textShadow`},{prefix:v,category:`shadow`},{prefix:S,category:`blur`},{prefix:/^(?:space|spacing|gap)(?:\.|$)/i,category:`space`},{prefix:/^inset(?:\.|$)/i,category:`space`},{prefix:/^(?:size|sizing)(?:\.|$)/i,category:`size`},{prefix:/^(?:radius|rounded|radii)(?:\.|$)/i,category:`radius`},{prefix:/^(?:z-?index|zindex|elevation)(?:\.|$)/i,category:`zIndex`}];function te(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function w(e){return e===!0||e===`true`||e===1}function T(e){return w(e.palette)||w(e.$palette)?!0:j(e)===`palette`}function E(e,t){return(e===`palette`||e===`$palette`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function D(e){return e===!0||e===`true`||e===1}function O(e){return D(e.primitive)||D(e.$primitive)?!0:j(e)===`primitive`}function k(e,t){return(e===`primitive`||e===`$primitive`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function A(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function j(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function M(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function N(e,t){for(let{prefix:t,category:n}of ee)if(t.test(e))return n;if(t===`color`||t===`palette`)return`color`;if(t===`shadow`)return y.test(e)?`insetShadow`:b.test(e)?`dropShadow`:x.test(e)?`textShadow`:`shadow`;if(t===`dimension`){if(g.test(e))return`fontSize`;if(S.test(e))return`blur`;if(/(?:^|\.)(?:space|spacing|gap)(?:\.|$)/i.test(e)||/(?:^|\.)inset(?:\.|$)/i.test(e))return`space`;if(/radius|rounded/i.test(e))return`radius`;if(/z-?index|elevation/i.test(e))return`zIndex`;if(/(?:^|\.)(?:size|sizing)(?:\.|$)/i.test(e)||/(?:^|\.)(?:width|height)(?:\.|$)/i.test(e))return`size`}if(t===`number`&&/z-?index|elevation/i.test(e))return`zIndex`;if(t===`fontWeight`||_.test(e))return`fontWeight`}function P(e){return e.flatMap(e=>e.split(/[-_\s]+/)).filter(Boolean).map((e,t)=>{if(/^\d/.test(e))return e;let n=e.toLowerCase();return t===0?n:`${n.charAt(0).toUpperCase()}${n.slice(1)}`}).join(``)}function ne(e){let t=e.split(`.`).filter(Boolean),n=t[0];n&&/^(?:color|colours?|palette|primitive|space|spacing|gap|inset|shadow|inset-shadow|drop-shadow|text-shadow|font-size|fontSize|font-weight|fontWeight|size|sizing|radius|rounded|radii|z-?index|zindex|elevation|blur)$/i.test(n)&&t.shift();let r=t.length>0?t:e.split(`.`).slice(-1);return r.length===1&&/^(?:DEFAULT|default)$/i.test(r[0]??``)?`true`:P(r)}function re(e,t,r,a,o,s){if(!i(e))return;let c=o||O(e)||T(e),l=j(e,r);if(te(e)){let r=M(e),i=t.join(`.`),o=N(i,l)??(c||l===`primitive`||l===`palette`?`color`:void 0),u=n(r,l),d=o&&C.has(o)||l===`color`||l===`palette`||l===`primitive`||l===`shadow`?u:h(r,l);s.push({path:i,type:l===`palette`||l===`primitive`?`color`:l,value:r,cssValue:u,tamaguiValue:d,category:o,tokenKey:o?ne(i):void 0,description:A(e),theme:a,primitive:c});return}for(let[n,r]of Object.entries(e))n.startsWith(`$`)&&n!==`$palette`&&n!==`$primitive`||E(n,r)||k(n,r)||re(r,[...t,n],l,a,c,s)}function ie(e,t={}){let n=t.includeTypes?new Set(t.includeTypes):void 0,r=[];for(let t of a(e)){let e=t.id==="default"?void 0:t.id;re(t.tokens,[],void 0,e,!1,r)}return n?r.filter(e=>!e.type||n.has(e.type)):r}const ae=/^\{([^{}]+)\}$/,oe=/^(?:typography|type|text)$/i,se=/^(?:font|fonts|font-family|fontFamily)$/i,ce=/^(?:font-size|fontSize)$/i,le=/^(?:font-weight|fontWeight)$/i,ue=/^(?:line-height|lineHeight|leading)$/i,de=/^(?:letter-spacing|letterSpacing|tracking)$/i,fe=/^(?:[a-z]{2}(?:-[A-Z]{2})?|cn|zh|jp|ja|kr|ko|ar|he|th|hi|ru|french|mandarin|chinese|japanese|korean|arabic|hebrew)$/i,pe=[`fontFamily`,`font-family`,`family`],me=[`fontSize`,`font-size`,`size`],he=[`fontWeight`,`font-weight`,`weight`],ge=[`lineHeight`,`line-height`,`leading`],_e=[`letterSpacing`,`letter-spacing`,`tracking`],ve={1:12,2:14,3:16,4:18,5:20,6:24,7:28,8:32,9:40,10:48};function F(e){if(typeof e==`string`)return ae.exec(e.trim())?.[1]?.trim()}function I(e,t){let n=F(e);if(!n)return e;let r=t.get(n),i=new Set([n]);for(let e=0;e<8&&r;e++){let e=F(r.value);if(!e||i.has(e))return r.value;i.add(e),r=t.get(e)}return r?.value??e}function L(e,t){for(let n of t)if(e[n]!==void 0&&e[n]!==null)return e[n]}function ye(e){return(e.split(`,`)[0]?.trim()??e).replaceAll(/^["']|["']$/g,``)}function be(e){if(typeof e==`string`){let t=e.trim();return t.length===0||F(t)?void 0:t}if(Array.isArray(e)&&e.every(e=>typeof e==`string`)){let t=e.map(e=>e.trim()).filter(Boolean);return t.length>0?t.join(`, `):void 0}}function xe(e){return Number.isInteger(e)?e:Math.round(e*1e3)/1e3}function R(e){if(e==null)return;let t=h(e);if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`){let e=/^(-?\d+(?:\.\d+)?)%$/.exec(t.trim());if(e)return Number.parseFloat(e[1])/100}}function Se(e){if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`string`){let t=e.trim();if(t.length===0||F(t))return;let n=Number(t);return Number.isNaN(n)?t:String(n)}let t=h(e);if(typeof t==`number`&&Number.isFinite(t))return String(t);if(typeof t==`string`&&t.length>0)return t}function Ce(e,t){let n=R(e);if(n!=null)return xe(t!=null&&n>0&&n<=4?n*t:n)}function z(e,t){return t.test(e.split(`.`)[0]??``)}function we(e){return e.split(`.`).filter(Boolean).at(-1)??e}function B(e,t){let n=e.split(`.`).filter(Boolean);return n[0]&&t.test(n[0])&&n.shift(),n}function V(e){let t=e.flatMap(e=>e.split(`-`)).filter(Boolean);return t.length===0?`body`:t.map((e,t)=>t===0?`${e.charAt(0).toLowerCase()}${e.slice(1)}`:`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(``)}function H(e){switch(e.toLowerCase()){case`sans`:case`body`:case`serif`:return`body`;case`monospace`:case`mono`:return`mono`;default:return V([e])}}function Te(e){return e.role?H(e.role):H(e.name)}function Ee(e){let t=B(e,oe);if(t.length===0)return`body`;let n=t.at(-1);return n&&t.length>=2&&fe.test(n)&&!n.includes(`_`)?`${t.slice(0,-1).join(`-`)}_${n}`:t.join(`-`)}function De(e){return H(B(e,se)[0]??we(e))}function Oe(e,t){let n=B(e,t);return n.length===0||n.length===1&&/^(?:DEFAULT|default)$/i.test(n[0])?`true`:V(n)}function ke(e){return e.type===`typography`&&i(e.value)}function Ae(e){return e.category===`fontSize`||e.category===`fontWeight`||je(e)||Me(e)||Ne(e)||Pe(e)?!1:e.type===`fontFamily`||z(e.path,se)}function je(e){return e.category===`fontSize`||z(e.path,ce)}function Me(e){return e.category===`fontWeight`||e.type===`fontWeight`||z(e.path,le)}function Ne(e){return z(e.path,ue)}function Pe(e){return z(e.path,de)}function Fe(e,t){if(!e.has(t))return t;let n=2,r=`${t}${n}`;for(;e.has(r);)n++,r=`${t}${n}`;return r}function Ie(e){let t=new Map;for(let n of Object.values(e)){let e=Te(n);t.has(e)&&(e=Fe(t,V([n.name]))),t.set(e,n)}return t}function Le(e,t,n){if(!e)return;let r=Object.values(e);if(r.length===0)return;if(n){let e=n.split(`.`).filter(Boolean).at(-1);if(e){let t=r.find(t=>t.role===e||t.name.toLowerCase()===e.toLowerCase());if(t)return t}}if(!t)return;let i=ye(t).toLowerCase();return r.find(e=>f(e).toLowerCase()===i||e.title.toLowerCase()===i||e.name.toLowerCase()===i)}function Re(e){let t=new Map;for(let n of e.files){let e=String(n.weight??400),r=c(n.path).replace(/\.[^.]+$/,``),i=t.get(e)??{};n.style===`italic`||n.style===`oblique`?i.italic=r:i.normal=r,t.set(e,i)}if(t.size!==0)return`{\n${[...t.entries()].toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0})).map(([e,t])=>{let n=[];return t.normal&&n.push(`normal: ${m(t.normal)}`),t.italic&&n.push(`italic: ${m(t.italic)}`),` ${e}: { ${n.join(`, `)} }`}).join(`,
3
+ `)}\n }`}function ze(e,t){return{...e,webFamily:d(t),nativeFamily:f(t),face:t.source===`local`?Re(t):e.face}}function U(e){return{key:e,webFamily:`system-ui, sans-serif`,nativeFamily:`system-ui`,size:{},lineHeight:{},weight:{},letterSpacing:{}}}function Be(e,t){return{...e,webFamily:t,nativeFamily:ye(t)}}const Ve=/^(?:font-size|fontSize|font-weight|fontWeight|line-height|lineHeight|leading|letter-spacing|letterSpacing|tracking)$/i;function W(e,t){let n={true:e},r=F(t);if(!r)return n;let i=Oe(r,Ve);return i&&i!==`true`&&(n[i]=e),n}function He(e){return Object.keys(e.size).length>0?e:{...e,size:{...ve}}}function Ue(e,t,n,r){if(!i(t.value))return e;let a=L(t.value,pe),o=F(a),s=be(I(a,n)),c=Le(r,s,o),l=e;c?l=ze(l,c):s&&(l=Be(l,s));let u=L(t.value,me),d=R(I(u,n));d!=null&&(l={...l,size:W(d,u)});let f=L(t.value,he),p=Se(I(f,n));p&&(l={...l,weight:W(p,f)});let m=L(t.value,_e),h=R(I(m,n));h!=null&&(l={...l,letterSpacing:W(h,m)});let g=L(t.value,ge),_=Ce(I(g,n),l.size.true??d);return _!=null&&(l={...l,lineHeight:W(_,g)}),We(l)}function We(e){let t=Object.keys(e.size);if(t.length===0)return e;let n=e=>{let n=e.true??Object.values(e)[0];if(n==null)return e;let r={...e};for(let e of t)r[e]??=n;return r};return{...e,lineHeight:Object.keys(e.lineHeight).length>0?n(e.lineHeight):e.lineHeight,weight:Object.keys(e.weight).length>0?n(e.weight):e.weight,letterSpacing:Object.keys(e.letterSpacing).length>0?n(e.letterSpacing):e.letterSpacing}}function Ge(e,t){let n=new Map(e.map(e=>[e.path,e])),r=new Map,i=e=>{r.set(e.key,e)};if(t)for(let[e,n]of Ie(t))i(ze(U(e),n));for(let a of e){if(!Ae(a)||ke(a))continue;let e=De(a.path),o=be(I(a.value,n)),s=r.get(e)??U(e),c=Le(t,o,a.path),l=s;c?l=ze(l,c):(o&&s.webFamily===U(e).webFamily||o&&!r.has(e))&&(l=Be(l,o)),i(l)}for(let a of e){if(!ke(a))continue;let e=Ee(a.path);i(Ue(r.get(e)??U(e),a,n,t))}return[...r.values()].map(He).toSorted((e,t)=>e.key.localeCompare(t.key))}function Ke(e){return/^\d+$/.test(e)||/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}function G(e,t=4){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{}`:`{\n${i.map(([e,t])=>`${n}${Ke(e)}: ${m(t)}`).join(`,
4
+ `)}\n${r}}`}function qe(e,t){let n=`${e.split(`-`).filter(Boolean).map((e,t)=>t===0?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(``).replaceAll(/[^\w$]/g,``)||`font${t}`}Font`;return/^[A-Z_$]/i.test(n)?n:`font${t}`}function Je(e,t){let n=m(e.webFamily),r=m(e.nativeFamily),i=[n===r?` family: ${n}`:` family: isWeb ? ${n} : ${r}`,` size: ${G(e.size)}`];return Object.keys(e.lineHeight).length>0&&i.push(` lineHeight: ${G(e.lineHeight)}`),Object.keys(e.weight).length>0&&i.push(` weight: ${G(e.weight)}`),Object.keys(e.letterSpacing).length>0&&i.push(` letterSpacing: ${G(e.letterSpacing)}`),e.face&&i.push(` face: ${e.face}`),`const ${t} = createFont({\n${i.join(`,
5
+ `)}\n});`}function Ye(e){return`# Installing Tamagui Config
6
6
 
7
7
  Generated by \`@razorwind/tamagui\`.
8
8
 
@@ -48,19 +48,19 @@ export function App() {
48
48
  ## Regenerate
49
49
 
50
50
  Re-run Razorwind generate when tokens change so \`${e.outputPath}\` stays aligned with your design system.
51
- `}const Ze=new Set([`default`,`light`,`theme`]),Qe=/^base(?:[A-Z]\w*|[._-].+)?$/i,$e=/^ring(?:\.|$)/i,et=[`base`,`gray`,`grey`,`neutral`],tt={css:`@tamagui/config/v5-css`,rn:`@tamagui/config/v5-rn`,reanimated:`@tamagui/config/v5-reanimated`,motion:`@tamagui/config/v5-motion`};function nt(e){return Ze.has(e)}function rt(e){return e===`dark`}function G(e,t){let n=new Map,r=t===`dark`?rt:nt;for(let t of e){let e=t.theme?.toLowerCase();(!e||Qe.test(e))&&n.set(t.path,t)}for(let t of e){let e=t.theme?.toLowerCase();e&&r(e)&&n.set(t.path,t)}return[...n.values()]}function it(e){return $e.test(e.path)&&e.category===`shadow`}const at=new Set([`fontSize`,`blur`]),ot=[`space`,`size`,`radius`,`zIndex`,`blur`,`fontSize`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`,`fontWeight`];function st(e){return/^px\(-?\d/.test(e)}function ct(e){if(e.category===`radius`&&e.tokenKey?.startsWith(`borderRadius`)){let t=e.tokenKey.replace(/^borderRadius/,``);return t?P([t]):e.tokenKey}return e.tokenKey??``}function lt(e,t){if(e.category&&at.has(e.category)&&typeof e.tamaguiValue==`number`)return`px(${e.tamaguiValue})`;if(typeof e.tamaguiValue==`string`){let n=xt(e.tamaguiValue,t);return e.category===`dropShadow`?ut(n):n}return e.tamaguiValue}function ut(e){return e.includes(`drop-shadow(`)?e:e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.replace(/^inset\s+/i,``).split(/\s+/);if(t.length>=5){let[e,n,r]=t;return`drop-shadow(${e} ${n} ${r} ${t.slice(4).join(` `)})`}return`drop-shadow(${e.replace(/^inset\s+/i,``)})`}).join(` `)}function dt(e){let t={},n=q(e);for(let r of e){if(!r.category||r.category===`color`||!r.tokenKey||it(r))continue;let e=ct(r);if(!e)continue;let i=lt(r,n);if(typeof i==`string`&&yt(i))continue;let a=t[r.category]??{};a[e]=i,t[r.category]=a}return t}function ft(e,t){let n={},r=(e,t)=>{let r=t.cssValue;typeof r!=`string`||r.length===0||Y(r)||r===`[object Object]`||(n[e]=r)},i=e=>{let t=e.path.replace(/^color\./i,``).replaceAll(`.`,``);return e.theme?`${e.theme}_${t}`:t};for(let t of e)t.tokenKey&&(t.primitive?r(i(t),t):r(t.tokenKey,t));for(let e of t)!e.tokenKey||!e.primitive||r(i(e),e);return n}function K(e,t=2){let n=` `.repeat(t),r=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return r.length===0?`{}`:`{\n${r.map(([e,t])=>{let r=typeof t==`string`&&st(t)?t:m(t);return`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: ${r}`}).join(`,
52
- `)}\n${` `.repeat(Math.max(t-2,0))}}`}function pt(e,t=2){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{\n${n}...theme\n${r}}`:`{\n${n}...theme,\n${i.map(([e,t])=>`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: ${t}`).join(`,
53
- `)}\n${r}}`}const mt=/^\{([^{}]+)\}$/,ht=/\{([^{}]+)\}/g,gt=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/,_t=/var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g;function q(e){return{byPath:new Map(e.map(e=>[e.path,e])),byCssVar:new Map(e.map(e=>[s(e.path),e]))}}function vt(e){if(typeof e==`string`)return mt.exec(e.trim())?.[1]?.trim()}function J(e){if(typeof e==`string`)return gt.exec(e.trim())?.[1]}function Y(e){return vt(e)!=null||J(e)!=null}function yt(e){return/var\(|\{[^{}]+\}/.test(e)}function bt(e,t){let n=St(e,t.byPath,t.byCssVar);if(n.category!=null&&n.category!==`color`)return;let r=[n.cssValue,n.tamaguiValue];for(let e of r)if(typeof e==`string`&&e.length>0&&!Y(e))return e}function xt(e,t){return e.replace(ht,(e,n)=>{let r=t.byPath.get(n.trim());return r?bt(r,t)??e:e}).replace(_t,(e,n)=>{let r=t.byCssVar.get(n);return r?bt(r,t)??e:e})}function St(e,t,n){let r=e,i=new Set;for(let e=0;e<8;e++){if(i.has(r.path))return r;i.add(r.path);let e=vt(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=J(r.value)??J(r.cssValue)??J(r.tamaguiValue);if(a){let e=n.get(a);if(!e||e.path===r.path)return r;r=e;continue}return r}return r}function Ct(e){return/^[A-Z_$][\w$]*$/i.test(e)?`theme.${e}`:`theme[${m(e)}]`}function wt(e,t,n){let r=Et(e);if(r){if(t&&r.name.toLowerCase()===t.toLowerCase())return`color${r.step}`;if(n[r.name])return`${r.name}${r.step}`}}function Tt(e){if(e>=1&&e<=12)return e;if(e>=100&&e<=900&&e%100==0)return e/100}function Et(e){let t=e.path.split(`.`).filter(Boolean),n=t.at(-1);if(n&&/^\d+$/.test(n)){let e=Tt(Number(n)),r=t.at(-2);if(e!=null&&r&&!/^(?:color|colours?|palette)$/i.test(r))return{name:P([r]),step:e}}if(!e.tokenKey)return;let r=/^([A-Z]+)(\d{1,3})$/i.exec(e.tokenKey);if(!r)return;let[,i=``,a=``]=r,o=Tt(Number(a));if(o!=null)return{name:i,step:o}}function Dt(e,t,n,r){let i=e[t]??{};i[`${t}${n}`]=r,e[t]=i}function Ot(e){let t={};for(let n of e){if(typeof n.tamaguiValue!=`string`)continue;let e=Et(n);e&&Dt(t,e.name,e.step,n.tamaguiValue)}return Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=3))}function X(e){let t={};for(let n of e){if(!n.primitive||typeof n.tamaguiValue!=`string`)continue;let e=Et(n);e&&Dt(t,e.name,e.step,n.tamaguiValue)}let n=Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=2));return Object.keys(n).length>0?n:Ot(e)}function Z(e,t){if(e.length<2)return[...e];let n=Mt(e[0]),r=Mt(e[e.length-1]);if(n==null||r==null||n===r)return[...e];let i=n>r;return t===`light`?i?[...e]:e.toReversed():i?e.toReversed():[...e]}function Q(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function kt(e){let t=e.startsWith(`#`)?e.slice(1):``;if((t.length===3||t.length===4)&&(t=[...t].map(e=>e+e).join(``)),t.length===8&&(t=t.slice(0,6)),t.length!==6||/[^0-9a-f]/i.test(t))return;let n=Number.parseInt(t.slice(0,2),16)/255,r=Number.parseInt(t.slice(2,4),16)/255,i=Number.parseInt(t.slice(4,6),16)/255;return .2126*Q(n)+.7152*Q(r)+.0722*Q(i)}function $(e){let t=e.trim();if(t.endsWith(`%`)){let e=Number.parseFloat(t);return Number.isFinite(e)?e/100:void 0}let n=Number.parseFloat(t);return Number.isFinite(n)?n:void 0}function At(e){return e>1?e/100:e}function jt(e,t){let n=RegExp(`^${t}\\((.+)\\)$`,`i`).exec(e.trim());if(n?.[1])return n[1].split(/[\s,/]+/).filter(Boolean)}function Mt(e){let t=e.trim();if(!t||t.startsWith(`var(`)||t.includes(`{`))return;let n=kt(t);if(n!=null)return n;let r=jt(t,`oklch`);if(r?.[0]){let e=$(r[0]);return e==null?void 0:At(e)}let i=jt(t,`hsla?`);if(i?.[2]){let e=$(i[2]);return e==null?void 0:At(e)}let a=jt(t,`rgba?`);if(a?.[0]&&a[1]&&a[2]){let e=$(a[0]),t=$(a[1]),n=$(a[2]);if(e==null||t==null||n==null)return;let r=(e,t)=>t.trim().endsWith(`%`)||e<=1?e:e/255;return .2126*Q(r(e,a[0]))+.7152*Q(r(t,a[1]))+.0722*Q(r(n,a[2]))}}function Nt(e,t){let n=[],r=t.toLowerCase();for(let[i,a]of Object.entries(e)){if(!i.toLowerCase().startsWith(r))continue;let e=i.slice(t.length);/^\d+$/.test(e)&&n.push([Number(e),a])}return n.sort(([e],[t])=>e-t),n}function Pt(e,t,n){let r=Nt(e,t);if(r.length===0)return e;let i=Z(r.map(([,e])=>e),n),a={};for(let[e,[n]]of r.entries())a[`${t}${n}`]=i[e]??r[e][1];return a}function Ft(e){if(e.length>=12)return e.slice(0,12);let t=[...e],n=t.at(-1);if(n==null)return t;for(;t.length<12;)t.push(n);return t}function It(e,t,n){let r=Nt(e,t);if(!(r.length<2))return Ft(Z(r.map(([,e])=>e),n))}function Lt(e,t){let n=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),{name:e,scale:t}]));for(let e of et){let r=n.get(e);if(!r)continue;let i=It(r.scale,r.name,t);if(i)return{name:r.name,palette:i}}}function Rt(e){let t=e.filter(e=>e.category===`color`||e.primitive),n=X(G(t,`light`)),r=X(G(t,`dark`)),i=Lt(n,`light`),a=Lt(r,`dark`);return{lightPalette:i?.palette,darkPalette:a?.palette,lightBaseName:i?.name,darkBaseName:a?.name}}function zt(e,t){let n=X(e),{byPath:r,byCssVar:i}=q(e),a={};for(let o of e){if(o.category!==`color`||!o.tokenKey||o.primitive||/^[A-Z]+\d{1,3}$/i.test(o.tokenKey)&&n[o.tokenKey.replace(/\d{1,3}$/,``)])continue;let e=St(o,r,i),s=wt(e,t,n);if(s){a[o.tokenKey]=Ct(s);continue}let c=e.tamaguiValue;Y(c)||Y(e.cssValue)||(typeof c==`string`||typeof c==`number`)&&(a[o.tokenKey]=m(c))}return a}function Bt(e){return e.replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${")}function Vt(e,t,n,r){let i=St(e,t.byPath,t.byCssVar),a=wt(i,n,r);if(a)return{kind:`theme`,property:a};let o=bt(i,t);if(o)return{kind:`text`,value:o}}function Ht(e,t,n,r){let i=[],a=/\{([^{}]+)\}|var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g,o=0;for(let s of e.matchAll(a)){let a=s.index??0;a>o&&i.push({kind:`text`,value:e.slice(o,a)});let c=s[1]?t.byPath.get(s[1].trim()):s[2]?t.byCssVar.get(s[2]):void 0;if(!c)return;let l=Vt(c,t,n,r);if(!l)return;i.push(l),o=a+s[0].length}return o<e.length&&i.push({kind:`text`,value:e.slice(o)}),i}function Ut(e){return e.some(e=>e.kind===`theme`)?`\`${e.map(e=>e.kind===`theme`?`\${${Ct(e.property)}}`:Bt(e.value)).join(``)}\``:m(e.map(e=>e.kind===`text`?e.value:``).join(``))}function Wt(e,t){let n=q(e),r=X(e.filter(e=>e.category===`color`)),i={};for(let a of e){if(!it(a)||!a.tokenKey)continue;let e=typeof a.tamaguiValue==`string`?a.tamaguiValue:a.cssValue;if(typeof e!=`string`||e.length===0)continue;let o=Ht(e,n,t,r);o&&(i[a.tokenKey]=Ut(o))}return i}function Gt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);if(n.size===0)return;let r=[];for(let i of[...n].toSorted((e,t)=>e.localeCompare(t))){let n=Pt(e[i]??t[i]??{},i,`light`),a=Pt(t[i]??e[i]??{},i,`dark`);Object.keys(n).length!==0&&Object.keys(a).length!==0&&r.push(` ${i}: {
54
- light: ${K(n,8)},
55
- dark: ${K(a,8)}
51
+ `}const Xe=new Set([`default`,`light`,`theme`]),Ze=/^base(?:[A-Z]\w*|[._-].+)?$/i,Qe=/^ring(?:\.|$)/i,$e=[`base`,`gray`,`grey`,`neutral`],et={css:`@tamagui/config/v5-css`,rn:`@tamagui/config/v5-rn`,reanimated:`@tamagui/config/v5-reanimated`,motion:`@tamagui/config/v5-motion`};function tt(e){return Xe.has(e)}function nt(e){return e===`dark`}function K(e,t){let n=new Map,r=t===`dark`?nt:tt;for(let t of e){let e=t.theme?.toLowerCase();(!e||Ze.test(e))&&n.set(t.path,t)}for(let t of e){let e=t.theme?.toLowerCase();e&&r(e)&&n.set(t.path,t)}return[...n.values()]}function rt(e){return Qe.test(e.path)&&e.category===`shadow`}const it=new Set([`fontSize`,`blur`]),at=[`space`,`size`,`radius`,`zIndex`,`blur`,`fontSize`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`,`fontWeight`];function ot(e){return/^px\(-?\d/.test(e)}function st(e){if(e.category===`radius`&&e.tokenKey?.startsWith(`borderRadius`)){let t=e.tokenKey.replace(/^borderRadius/,``);return t?P([t]):e.tokenKey}return e.tokenKey??``}function ct(e,t){if(e.category&&it.has(e.category)&&typeof e.tamaguiValue==`number`)return`px(${e.tamaguiValue})`;if(typeof e.tamaguiValue==`string`){let n=xt(e.tamaguiValue,t);return e.category===`dropShadow`?lt(n):n}return e.tamaguiValue}function lt(e){return e.includes(`drop-shadow(`)?e:e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.replace(/^inset\s+/i,``).split(/\s+/);if(t.length>=5){let[e,n,r]=t;return`drop-shadow(${e} ${n} ${r} ${t.slice(4).join(` `)})`}return`drop-shadow(${e.replace(/^inset\s+/i,``)})`}).join(` `)}function ut(e){let t={},n=_t(e);for(let r of e){if(!r.category||r.category===`color`||!r.tokenKey||rt(r))continue;let e=st(r);if(!e)continue;let i=ct(r,n);if(typeof i==`string`&&yt(i))continue;let a=t[r.category]??{};a[e]=i,t[r.category]=a}return t}function dt(e,t){let n={},r=(e,t)=>{let r=t.cssValue;typeof r!=`string`||r.length===0||Y(r)||r===`[object Object]`||(n[e]=r)},i=e=>{let t=e.path.replace(/^color\./i,``).replaceAll(`.`,``);return e.theme?`${e.theme}_${t}`:t};for(let t of e)t.tokenKey&&(t.primitive?r(i(t),t):r(t.tokenKey,t));for(let e of t)!e.tokenKey||!e.primitive||r(i(e),e);return n}function q(e,t=2){let n=` `.repeat(t),r=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return r.length===0?`{}`:`{\n${r.map(([e,t])=>{let r=typeof t==`string`&&ot(t)?t:m(t);return`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: ${r}`}).join(`,
52
+ `)}\n${` `.repeat(Math.max(t-2,0))}}`}function ft(e,t=2){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{\n${n}...theme\n${r}}`:`{\n${n}...theme,\n${i.map(([e,t])=>`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: ${t}`).join(`,
53
+ `)}\n${r}}`}const pt=/^\{([^{}]+)\}$/,mt=/\{([^{}]+)\}/g,ht=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/,gt=/var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g;function _t(e){return{byPath:new Map(e.map(e=>[e.path,e])),byCssVar:new Map(e.map(e=>[s(e.path),e]))}}function vt(e){if(typeof e==`string`)return pt.exec(e.trim())?.[1]?.trim()}function J(e){if(typeof e==`string`)return ht.exec(e.trim())?.[1]}function Y(e){return vt(e)!=null||J(e)!=null}function yt(e){return/var\(|\{[^{}]+\}/.test(e)}function bt(e,t){let n=St(e,t.byPath,t.byCssVar);if(n.category!=null&&n.category!==`color`)return;let r=[n.cssValue,n.tamaguiValue];for(let e of r)if(typeof e==`string`&&e.length>0&&!Y(e))return e}function xt(e,t){return e.replace(mt,(e,n)=>{let r=t.byPath.get(n.trim());return r?bt(r,t)??e:e}).replace(gt,(e,n)=>{let r=t.byCssVar.get(n);return r?bt(r,t)??e:e})}function St(e,t,n){let r=e,i=new Set;for(let e=0;e<8;e++){if(i.has(r.path))return r;i.add(r.path);let e=vt(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=J(r.value)??J(r.cssValue)??J(r.tamaguiValue);if(a){let e=n.get(a);if(!e||e.path===r.path)return r;r=e;continue}return r}return r}function Ct(e){return/^[A-Z_$][\w$]*$/i.test(e)?`theme.${e}`:`theme[${m(e)}]`}function wt(e,t){return t<1?e:t+1-e}function Tt(e,t){return e.length<2?!1:Z(e,t).some((t,n)=>t!==e[n])}function Et(e,t,n,r){let i=n[t];if(!i||r!==`dark`)return e;let a=It(i,t);return a.length<2||!Tt(a.map(([,e])=>e),r)?e:wt(e,a[a.length-1][0])}function Dt(e,t,n,r){let i=kt(e);if(!i)return;let a=Et(i.step,i.name,n,r);if(t&&i.name.toLowerCase()===t.toLowerCase())return`color${a}`;if(n[i.name])return`${i.name}${a}`}function Ot(e){if(e>=1&&e<=12)return e;if(e>=100&&e<=900&&e%100==0)return e/100}function kt(e){let t=e.path.split(`.`).filter(Boolean),n=t.at(-1);if(n&&/^\d+$/.test(n)){let e=Ot(Number(n)),r=t.at(-2);if(e!=null&&r&&!/^(?:color|colours?|palette)$/i.test(r))return{name:P([r]),step:e}}if(!e.tokenKey)return;let r=/^([A-Z]+)(\d{1,3})$/i.exec(e.tokenKey);if(!r)return;let[,i=``,a=``]=r,o=Ot(Number(a));if(o!=null)return{name:i,step:o}}function At(e,t,n,r){let i=e[t]??{};i[`${t}${n}`]=r,e[t]=i}function jt(e){let t={};for(let n of e){if(typeof n.tamaguiValue!=`string`)continue;let e=kt(n);e&&At(t,e.name,e.step,n.tamaguiValue)}return Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=3))}function X(e){let t={};for(let n of e){if(!n.primitive||typeof n.tamaguiValue!=`string`)continue;let e=kt(n);e&&At(t,e.name,e.step,n.tamaguiValue)}let n=Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=2));return Object.keys(n).length>0?n:jt(e)}function Z(e,t){if(e.length<2)return[...e];let n=Ft(e[0]),r=Ft(e[e.length-1]);if(n==null||r==null||n===r)return[...e];let i=n>r;return t===`light`?i?[...e]:e.toReversed():i?e.toReversed():[...e]}function Q(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Mt(e){let t=e.startsWith(`#`)?e.slice(1):``;if((t.length===3||t.length===4)&&(t=[...t].map(e=>e+e).join(``)),t.length===8&&(t=t.slice(0,6)),t.length!==6||/[^0-9a-f]/i.test(t))return;let n=Number.parseInt(t.slice(0,2),16)/255,r=Number.parseInt(t.slice(2,4),16)/255,i=Number.parseInt(t.slice(4,6),16)/255;return .2126*Q(n)+.7152*Q(r)+.0722*Q(i)}function $(e){let t=e.trim();if(t.endsWith(`%`)){let e=Number.parseFloat(t);return Number.isFinite(e)?e/100:void 0}let n=Number.parseFloat(t);return Number.isFinite(n)?n:void 0}function Nt(e){return e>1?e/100:e}function Pt(e,t){let n=RegExp(`^${t}\\((.+)\\)$`,`i`).exec(e.trim());if(n?.[1])return n[1].split(/[\s,/]+/).filter(Boolean)}function Ft(e){let t=e.trim();if(!t||t.startsWith(`var(`)||t.includes(`{`))return;let n=Mt(t);if(n!=null)return n;let r=Pt(t,`oklch`);if(r?.[0]){let e=$(r[0]);return e==null?void 0:Nt(e)}let i=Pt(t,`hsla?`);if(i?.[2]){let e=$(i[2]);return e==null?void 0:Nt(e)}let a=Pt(t,`rgba?`);if(a?.[0]&&a[1]&&a[2]){let e=$(a[0]),t=$(a[1]),n=$(a[2]);if(e==null||t==null||n==null)return;let r=(e,t)=>t.trim().endsWith(`%`)||e<=1?e:e/255;return .2126*Q(r(e,a[0]))+.7152*Q(r(t,a[1]))+.0722*Q(r(n,a[2]))}}function It(e,t){let n=[],r=t.toLowerCase();for(let[i,a]of Object.entries(e)){if(!i.toLowerCase().startsWith(r))continue;let e=i.slice(t.length);/^\d+$/.test(e)&&n.push([Number(e),a])}return n.sort(([e],[t])=>e-t),n}function Lt(e,t,n){let r=It(e,t);if(r.length===0)return e;let i=Z(r.map(([,e])=>e),n),a={};for(let[e,[n]]of r.entries())a[`${t}${n}`]=i[e]??r[e][1];return a}function Rt(e){if(e.length>=12)return e.slice(0,12);let t=[...e],n=t.at(-1);if(n==null)return t;for(;t.length<12;)t.push(n);return t}function zt(e,t,n){let r=It(e,t);if(!(r.length<2))return Rt(Z(r.map(([,e])=>e),n))}function Bt(e,t){let n=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),{name:e,scale:t}]));for(let e of $e){let r=n.get(e);if(!r)continue;let i=zt(r.scale,r.name,t);if(i)return{name:r.name,palette:i}}}function Vt(e){let t=e.filter(e=>e.category===`color`||e.primitive),n=X(K(t,`light`)),r=X(K(t,`dark`)),i=Bt(n,`light`),a=Bt(r,`dark`);return{lightPalette:i?.palette,darkPalette:a?.palette,lightBaseName:i?.name,darkBaseName:a?.name}}function Ht(e,t,n){let r=X(e),{byPath:i,byCssVar:a}=_t(e),o={};for(let s of e){if(s.category!==`color`||!s.tokenKey||s.primitive||/^[A-Z]+\d{1,3}$/i.test(s.tokenKey)&&r[s.tokenKey.replace(/\d{1,3}$/,``)])continue;let e=St(s,i,a),c=Dt(e,t,r,n);if(c){o[s.tokenKey]=Ct(c);continue}let l=e.tamaguiValue;Y(l)||Y(e.cssValue)||(typeof l==`string`||typeof l==`number`)&&(o[s.tokenKey]=m(l))}return o}function Ut(e){return e.replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${")}function Wt(e,t,n,r,i){let a=St(e,t.byPath,t.byCssVar),o=Dt(a,n,r,i);if(o)return{kind:`theme`,property:o};let s=bt(a,t);if(s)return{kind:`text`,value:s}}function Gt(e,t,n,r,i){let a=[],o=/\{([^{}]+)\}|var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g,s=0;for(let c of e.matchAll(o)){let o=c.index??0;o>s&&a.push({kind:`text`,value:e.slice(s,o)});let l=c[1]?t.byPath.get(c[1].trim()):c[2]?t.byCssVar.get(c[2]):void 0;if(!l)return;let u=Wt(l,t,n,r,i);if(!u)return;a.push(u),s=o+c[0].length}return s<e.length&&a.push({kind:`text`,value:e.slice(s)}),a}function Kt(e){return e.some(e=>e.kind===`theme`)?`\`${e.map(e=>e.kind===`theme`?`\${${Ct(e.property)}}`:Ut(e.value)).join(``)}\``:m(e.map(e=>e.kind===`text`?e.value:``).join(``))}function qt(e,t,n){let r=_t(e),i=X(e.filter(e=>e.category===`color`)),a={};for(let o of e){if(!rt(o)||!o.tokenKey)continue;let e=typeof o.tamaguiValue==`string`?o.tamaguiValue:o.cssValue;if(typeof e!=`string`||e.length===0)continue;let s=Gt(e,r,t,i,n);s&&(a[o.tokenKey]=Kt(s))}return a}function Jt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);if(n.size===0)return;let r=[];for(let i of[...n].toSorted((e,t)=>e.localeCompare(t))){let n=Lt(e[i]??t[i]??{},i,`light`),a=Lt(t[i]??e[i]??{},i,`dark`);Object.keys(n).length!==0&&Object.keys(a).length!==0&&r.push(` ${i}: {
54
+ light: ${q(n,8)},
55
+ dark: ${q(a,8)}
56
56
  }`)}if(r.length!==0)return`{\n${r.join(`,
57
- `)}\n }`}function Kt(e){let t=new Set;for(let n of e)for(let e of Object.values(n)){for(let n of e.matchAll(/theme\.([A-Z_$][\w$]*)/gi))n[1]&&t.add(n[1]);for(let n of e.matchAll(/theme\[(['"])(.+?)\1\]/g))t.add(n[2])}return[...t]}function qt(e,t){let n=new Set;for(let r of[e,t])for(let e of Object.values(r))for(let t of Object.keys(e))n.add(t);return[...n]}function Jt(e,t){let n=Math.max(e?.length??0,t?.length??0);if(n===0)return[];let r=[];for(let e=1;e<=Math.min(n,12);e++)r.push(`color${e}`);return r}function Yt(e){let t=new Set;for(let n of Object.keys(e.lightSemantic))t.add(n);for(let n of Object.keys(e.darkSemantic))t.add(n);for(let n of Kt([e.lightSemantic,e.darkSemantic]))t.add(n);for(let n of qt(e.lightScales,e.darkScales))t.add(n);for(let n of Jt(e.lightPalette,e.darkPalette))t.add(n);return[...t].toSorted((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function Xt(e){return` ${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: string;`}function Zt(e,t){if(e.length!==0)return[`/**`,` * Theme values available on \`useTheme()\` and \`$\` style props for the ${t.specName||`design system`}.`,` *`," * Derived from design tokens mapped by `createV5Theme` and `getTheme`.",` *`,` * @see https://tamagui.dev/docs/guides/theme-builder#gettheme`,` */`,`export interface AppTheme {`,...e.map(Xt),`}`,``]}function Qt(e,t,n={}){let r=e.fonts??{},i=n.useDefaultConfig===!0,a=n.animations??`css`,o=n.includeTypeAugmentation!==!1,s=t.filter(e=>e.category===`color`),c=G(s,`light`),l=G(s,`dark`),u=X(c),d=X(l.length>0?l:c),{lightPalette:f,darkPalette:p,lightBaseName:h,darkBaseName:g}=Rt(t),_=Gt(u,d),v=G(t,`light`),y=G(t,`dark`),b=l.length>0?y:v,x=l.length>0?g:h,S={...zt(c,h),...Wt(v,h)},C={...zt(l.length>0?l:c,x),...Wt(b,x)},ee=Zt(Yt({lightSemantic:S,darkSemantic:C,lightScales:u,darkScales:d,lightPalette:f,darkPalette:p}),{specName:e.name}),te=dt(v),w=ft(c,l),T=[];Object.keys(w).length>0&&T.push(` color: ${K(w,4)}`);for(let e of ot){let t=te[e];t&&Object.keys(t).length>0&&T.push(` ${e}: ${K(t,4)}`)}let E=[];f&&E.push(` lightPalette: ${m(f)}`),p&&E.push(` darkPalette: ${m(p)}`),_&&E.push(` childrenThemes: ${_}`),(Object.keys(S).length>0||Object.keys(C).length>0)&&E.push(` getTheme: ({ theme, scheme }: { theme: any; scheme: "light" | "dark" }) => {
57
+ `)}\n }`}function Yt(e){let t=new Set;for(let n of e)for(let e of Object.values(n)){for(let n of e.matchAll(/theme\.([A-Z_$][\w$]*)/gi))n[1]&&t.add(n[1]);for(let n of e.matchAll(/theme\[(['"])(.+?)\1\]/g))t.add(n[2])}return[...t]}function Xt(e,t){let n=new Set;for(let r of[e,t])for(let e of Object.values(r))for(let t of Object.keys(e))n.add(t);return[...n]}function Zt(e,t){let n=Math.max(e?.length??0,t?.length??0);if(n===0)return[];let r=[];for(let e=1;e<=Math.min(n,12);e++)r.push(`color${e}`);return r}function Qt(e){let t=new Set;for(let n of Object.keys(e.lightSemantic))t.add(n);for(let n of Object.keys(e.darkSemantic))t.add(n);for(let n of Yt([e.lightSemantic,e.darkSemantic]))t.add(n);for(let n of Xt(e.lightScales,e.darkScales))t.add(n);for(let n of Zt(e.lightPalette,e.darkPalette))t.add(n);return[...t].toSorted((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function $t(e){return` ${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: string;`}function en(e,t){if(e.length!==0)return[`/**`,` * Theme values available on \`useTheme()\` and \`$\` style props for the ${t.specName||`design system`}.`,` *`," * Derived from design tokens mapped by `createV5Theme` and `getTheme`.",` *`,` * @see https://tamagui.dev/docs/guides/theme-builder#gettheme`,` */`,`export interface AppTheme {`,...e.map($t),`}`,``]}function tn(e,t,n={}){let r=e.fonts??{},i=n.useDefaultConfig===!0,a=n.animations??`css`,o=n.includeTypeAugmentation!==!1,s=t.filter(e=>e.category===`color`),c=K(s,`light`),l=K(s,`dark`),u=X(c),d=X(l.length>0?l:c),{lightPalette:f,darkPalette:p,lightBaseName:h,darkBaseName:g}=Vt(t),_=Jt(u,d),v=K(t,`light`),y=K(t,`dark`),b=l.length>0?y:v,x=l.length>0?g:h,S={...Ht(c,h,`light`),...qt(v,h,`light`)},C={...Ht(l.length>0?l:c,x,`dark`),...qt(b,x,`dark`)},ee=en(Qt({lightSemantic:S,darkSemantic:C,lightScales:u,darkScales:d,lightPalette:f,darkPalette:p}),{specName:e.name}),te=ut(v),w=dt(c,l),T=[];Object.keys(w).length>0&&T.push(` color: ${q(w,4)}`);for(let e of at){let t=te[e];t&&Object.keys(t).length>0&&T.push(` ${e}: ${q(t,4)}`)}let E=[];f&&E.push(` lightPalette: ${m(f)}`),p&&E.push(` darkPalette: ${m(p)}`),_&&E.push(` childrenThemes: ${_}`),(Object.keys(S).length>0||Object.keys(C).length>0)&&E.push(` getTheme: ({ theme, scheme }: { theme: any; scheme: "light" | "dark" }) => {
58
58
  return scheme === "dark"
59
- ? ${pt(C,8)}
60
- : ${pt(S,8)};
61
- }`);let D=[`import { isWeb } from '@tamagui/constants';`];i?D.push(`import { createV5Theme, defaultConfig, type CreateV5ThemeOptions } from "@tamagui/config/v5";`):D.push(`import { createV5Theme, type CreateV5ThemeOptions } from "@tamagui/config/v5";`),a!==!1&&D.push(`import { animations } from "${tt[a]}";`),n.importConfig&&D.push(`import userConfig from "${n.importConfig}";`);let O=[`createTamagui`,`px`];T.length>0&&O.push(`createTokens`);let k=Ke(t,r);k.length>0&&O.push(`createFont`),D.push(`import { ${O.join(`, `)} } from "@tamagui/core";`);let A=[`/* eslint-disable */`,``,`/*`,` * Generated by @razorwind/tamagui — Do not edit by hand.`,` * `,` * @see https://tamagui.dev/docs/core/config-v5`,` */`,``,...D,``];T.length>0&&A.push(`const tokens = createTokens({`,T.join(`,
59
+ ? ${ft(C,8)}
60
+ : ${ft(S,8)};
61
+ }`);let D=[`import { isWeb } from '@tamagui/constants';`];i?D.push(`import { createV5Theme, defaultConfig, type CreateV5ThemeOptions } from "@tamagui/config/v5";`):D.push(`import { createV5Theme, type CreateV5ThemeOptions } from "@tamagui/config/v5";`),a!==!1&&D.push(`import { animations } from "${et[a]}";`),n.importConfig&&D.push(`import userConfig from "${n.importConfig}";`);let O=[`createTamagui`,`px`];T.length>0&&O.push(`createTokens`);let k=Ge(t,r);k.length>0&&O.push(`createFont`),D.push(`import { ${O.join(`, `)} } from "@tamagui/core";`);let A=[`/* eslint-disable */`,``,`/*`,` * Generated by @razorwind/tamagui — Do not edit by hand.`,` * `,` * @see https://tamagui.dev/docs/core/config-v5`,` */`,``,...D,``];T.length>0&&A.push(`const tokens = createTokens({`,T.join(`,
62
62
  `),`});`,``);let j=E.length>0?`createV5Theme({\n${E.join(`,
63
- `)}\n})`:`createV5Theme()`;A.push(`const themes = ${j};`,``);let M=new Map;if(k.length>0)for(let[e,t]of k.entries()){let n=Je(t.key,e);M.set(t.key,n),A.push(Ye(t,n),``)}let N=[];if(i&&N.push(` ...defaultConfig`),a!==!1&&N.push(` animations`),T.length>0&&(i?N.push(` tokens: {
63
+ `)}\n})`:`createV5Theme()`;A.push(`const themes = ${j};`,``);let M=new Map;if(k.length>0)for(let[e,t]of k.entries()){let n=qe(t.key,e);M.set(t.key,n),A.push(Je(t,n),``)}let N=[];if(i&&N.push(` ...defaultConfig`),a!==!1&&N.push(` animations`),T.length>0&&(i?N.push(` tokens: {
64
64
  ...defaultConfig.tokens,
65
65
  ...tokens,
66
66
  space: {
@@ -86,12 +86,12 @@ ${e.join(`,
86
86
  }`):N.push(` fonts: {
87
87
  ${e.join(`,
88
88
  `)}
89
- }`)}return n.shorthands&&N.push(` shorthands: ${K(n.shorthands,4)}`),n.media&&N.push(` media: ${m(n.media)}`),n.defaultFont&&N.push(` defaultFont: ${m(n.defaultFont)}`),A.push(``,...ee??[],`/**
89
+ }`)}return n.shorthands&&N.push(` shorthands: ${q(n.shorthands,4)}`),n.media&&N.push(` media: ${m(n.media)}`),n.defaultFont&&N.push(` defaultFont: ${m(n.defaultFont)}`),A.push(``,...ee??[],`/**
90
90
  * The Tamagui v5 config for the ${e.name||`design system`}.
91
91
  *
92
92
  * @see https://tamagui.dev/docs/core/config-v5
93
93
  */
94
94
  export const config = createTamagui({`,N.join(`,
95
95
  `),n.importConfig?`, ...userConfig `:``,`});`,``,`export type AppConfig = typeof config;`,``),o&&A.push(`declare module "@tamagui/core" {`,` // eslint-disable-next-line @typescript-eslint/no-empty-object-type`,` interface TamaguiCustomConfig extends AppConfig {}`,`}`,``),A.push(`export default config;`,``),A.join(`
96
- `)}function $t(e,n={}){let r=e.tokens&&Object.keys(e.tokens).length>0,i=e.fonts&&Object.keys(e.fonts).length>0;if(!r&&!i)return{};let a=r?ie(e.tokens,n):[];if(a.length===0&&!i)return{};let o=n.outputPath??`tamagui.config.ts`,s=Qt(e,a,n),c=n.installGuide??Xe({outputPath:o}),d=u(l(o),`INSTALL.md`);return{[o]:t(o,s,{name:`razorwind-tamagui`},!1,`typescript`),[d]:t(d,c,{name:`razorwind-tamagui`},!1,`markdown`)}}var en=e(e=>({name:`tamagui`,themeGeneration:`combined`,generate:async t=>$t(t,e??{})}));export{X as collectColorScales,Ke as collectTamaguiFonts,Mt as colorLightness,en as default,ie as flattenTokens,Je as fontVarName,n as formatTokenValue,$t as generateTamaguiConfig,T as isPaletteGroup,Z as orderPaletteForScheme,Xe as renderInstallMd,Qt as renderTamaguiConfig,N as resolveTokenCategory,a as resolveTokenSets,B as tamaguiFontKeyFromRole,P as toCamelCaseKey,o as toCssVar,h as toTamaguiValue,ne as toTokenKey,Oe as typographyFontKey};
96
+ `)}function nn(e,n={}){let r=e.tokens&&Object.keys(e.tokens).length>0,i=e.fonts&&Object.keys(e.fonts).length>0;if(!r&&!i)return{};let a=r?ie(e.tokens,n):[];if(a.length===0&&!i)return{};let o=n.outputPath??`tamagui.config.ts`,s=tn(e,a,n),c=n.installGuide??Ye({outputPath:o}),d=u(l(o),`INSTALL.md`);return{[o]:t(o,s,{name:`razorwind-tamagui`},!1,`typescript`),[d]:t(d,c,{name:`razorwind-tamagui`},!1,`markdown`)}}var rn=e(e=>({name:`tamagui`,themeGeneration:`combined`,generate:async t=>nn(t,e??{})}));export{X as collectColorScales,Ge as collectTamaguiFonts,Ft as colorLightness,rn as default,ie as flattenTokens,wt as flipPaletteStep,qe as fontVarName,n as formatTokenValue,nn as generateTamaguiConfig,T as isPaletteGroup,Z as orderPaletteForScheme,Ye as renderInstallMd,tn as renderTamaguiConfig,N as resolveTokenCategory,a as resolveTokenSets,H as tamaguiFontKeyFromRole,P as toCamelCaseKey,o as toCssVar,h as toTamaguiValue,ne as toTokenKey,Ee as typographyFontKey};
97
97
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razorwind/tamagui",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "type": "module",
5
5
  "description": "Razorwind plugin that creates Tamagui theme tokens from Razorwind design tokens.",
6
6
  "repository": {
@@ -106,5 +106,5 @@
106
106
  "typescript": "^6.0.3"
107
107
  },
108
108
  "publishConfig": { "access": "public" },
109
- "gitHead": "46cad9adc5886956e4e8e76ba73a983771460244"
109
+ "gitHead": "de16f0cfe2e9c57fbac6f6e5bfd4bd05d9f23f2e"
110
110
  }