@razorwind/tamagui 0.0.54 → 0.0.56
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 +66 -77
- package/dist/index.d.cts +26 -50
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +26 -50
- package/dist/index.mjs +66 -77
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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
|
|
3
|
-
`)}\n }`}function
|
|
4
|
-
`)}\n${r}}`}function
|
|
5
|
-
`)}\n});`}function
|
|
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:T(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:T(e)===`primitive`}function x(e,t){return(e===`primitive`||e===`$primitive`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function S(e,t){return(e===`theme`||e===`$theme`)&&typeof t==`string`}function C(e){if(typeof e.theme==`string`&&e.theme.length>0)return e.theme;if(typeof e.$theme==`string`&&e.$theme.length>0)return e.$theme}function w(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function T(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function E(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 te(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 D(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`:D(r)}function O(e,n,r,i,a,s,c){if(!(0,t.isObject)(e))return;let l=a||b(e)||v(e),u=T(e,r),d=C(e)??s;if(g(e)){let r=E(e),a=n.join(`.`),s=te(a,u)??(l||u===`primitive`||u===`palette`?`color`:void 0),f=(0,t.formatTokenValue)(r,u),p=s&&m.has(s)||u===`color`||u===`palette`||u===`primitive`||u===`shadow`?f:o(r,u);c.push({path:a,type:u===`palette`||u===`primitive`?`color`:u,value:r,cssValue:f,tamaguiValue:p,category:s,tokenKey:s?ne(a):void 0,description:w(e),theme:i,...d?{childTheme:d}:{},...l?{primitive:!0}:{}});return}for(let[t,r]of Object.entries(e))t.startsWith(`$`)&&t!==`$palette`&&t!==`$primitive`||ee(t,r)||x(t,r)||S(t,r)||O(r,[...n,t],u,i,l,d,c)}function k(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;O(n.tokens,[],void 0,e,!1,void 0,i)}return r?i.filter(e=>!e.type||r.has(e.type)):i}const re=/^\{([^{}]+)\}$/,ie=/^(?:typography|type|text)$/i,A=/^(?:font|fonts|font-family|fontFamily)$/i,ae=/^(?:font-size|fontSize)$/i,oe=/^(?:font-weight|fontWeight)$/i,se=/^(?:line-height|lineHeight|leading)$/i,ce=/^(?:letter-spacing|letterSpacing|tracking)$/i,le=/^(?:[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,ue=[`fontFamily`,`font-family`,`family`],de=[`fontSize`,`font-size`,`size`],fe=[`fontWeight`,`font-weight`,`weight`],pe=[`lineHeight`,`line-height`,`leading`],me=[`letterSpacing`,`letter-spacing`,`tracking`],he={1:12,2:14,3:16,4:18,5:20,6:24,7:28,8:32,9:40,10:48};function j(e){if(typeof e==`string`)return re.exec(e.trim())?.[1]?.trim()}function M(e,t){let n=j(e);if(!n)return e;let r=t.get(n),i=new Set([n]);for(let e=0;e<8&&r;e++){let e=j(r.value);if(!e||i.has(e))return r.value;i.add(e),r=t.get(e)}return r?.value??e}function N(e,t){for(let n of t)if(e[n]!==void 0&&e[n]!==null)return e[n]}function ge(e){return(e.split(`,`)[0]?.trim()??e).replaceAll(/^["']|["']$/g,``)}function _e(e){if(typeof e==`string`){let t=e.trim();return t.length===0||j(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 ve(e){return Number.isInteger(e)?e:Math.round(e*1e3)/1e3}function P(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 ye(e){if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`string`){let t=e.trim();if(t.length===0||j(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 be(e,t){let n=P(e);if(n!=null)return ve(t!=null&&n>0&&n<=4?n*t:n)}function F(e,t){return t.test(e.split(`.`)[0]??``)}function xe(e){return e.split(`.`).filter(Boolean).at(-1)??e}function I(e,t){let n=e.split(`.`).filter(Boolean);return n[0]&&t.test(n[0])&&n.shift(),n}function L(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 R(e){switch(e.toLowerCase()){case`sans`:case`body`:case`serif`:return`body`;case`monospace`:case`mono`:return`mono`;default:return L([e])}}function Se(e){return e.role?R(e.role):R(e.name)}function Ce(e){let t=I(e,ie);if(t.length===0)return`body`;let n=t.at(-1);return n&&t.length>=2&&le.test(n)&&!n.includes(`_`)?`${t.slice(0,-1).join(`-`)}_${n}`:t.join(`-`)}function we(e){return R(I(e,A)[0]??xe(e))}function Te(e,t){let n=I(e,t);return n.length===0||n.length===1&&/^(?:DEFAULT|default)$/i.test(n[0])?`true`:L(n)}function Ee(e){return e.type===`typography`&&(0,t.isObject)(e.value)}function De(e){return e.category===`fontSize`||e.category===`fontWeight`||Oe(e)||ke(e)||Ae(e)||je(e)?!1:e.type===`fontFamily`||F(e.path,A)}function Oe(e){return e.category===`fontSize`||F(e.path,ae)}function ke(e){return e.category===`fontWeight`||e.type===`fontWeight`||F(e.path,oe)}function Ae(e){return F(e.path,se)}function je(e){return F(e.path,ce)}function Me(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 Ne(e){let t=new Map;for(let n of Object.values(e)){let e=Se(n);t.has(e)&&(e=Me(t,L([n.name]))),t.set(e,n)}return t}function Pe(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=ge(t).toLowerCase();return i.find(e=>(0,r.fontFamilyName)(e).toLowerCase()===a||e.title.toLowerCase()===a||e.name.toLowerCase()===a)}function Fe(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 z(e,t){return{...e,webFamily:(0,r.cssFontFamily)(t),nativeFamily:(0,r.fontFamilyName)(t),face:t.source===`local`?Fe(t):e.face}}function B(e){return{key:e,webFamily:`system-ui, sans-serif`,nativeFamily:`system-ui`,size:{},lineHeight:{},weight:{},letterSpacing:{}}}function Ie(e,t){return{...e,webFamily:t,nativeFamily:ge(t)}}const Le=/^(?:font-size|fontSize|font-weight|fontWeight|line-height|lineHeight|leading|letter-spacing|letterSpacing|tracking)$/i;function V(e,t){let n={true:e},r=j(t);if(!r)return n;let i=Te(r,Le);return i&&i!==`true`&&(n[i]=e),n}function Re(e){return Object.keys(e.size).length>0?e:{...e,size:{...he}}}function ze(e,n,r,i){if(!(0,t.isObject)(n.value))return e;let a=N(n.value,ue),o=j(a),s=_e(M(a,r)),c=Pe(i,s,o),l=e;c?l=z(l,c):s&&(l=Ie(l,s));let u=N(n.value,de),d=P(M(u,r));d!=null&&(l={...l,size:V(d,u)});let f=N(n.value,fe),p=ye(M(f,r));p&&(l={...l,weight:V(p,f)});let m=N(n.value,me),h=P(M(m,r));h!=null&&(l={...l,letterSpacing:V(h,m)});let g=N(n.value,pe),_=be(M(g,r),l.size.true??d);return _!=null&&(l={...l,lineHeight:V(_,g)}),Be(l)}function Be(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 Ve(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 Ne(t))i(z(B(e),n));for(let a of e){if(!De(a)||Ee(a))continue;let e=we(a.path),o=_e(M(a.value,n)),s=r.get(e)??B(e),c=Pe(t,o,a.path),l=s;c?l=z(l,c):(o&&s.webFamily===B(e).webFamily||o&&!r.has(e))&&(l=Ie(l,o)),i(l)}for(let a of e){if(!Ee(a))continue;let e=Ce(a.path);i(ze(r.get(e)??B(e),a,n,t))}return[...r.values()].map(Re).toSorted((e,t)=>e.key.localeCompare(t.key))}function He(e){return/^\d+$/.test(e)||/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}function H(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}${He(e)}: ${a(t)}`).join(`,
|
|
4
|
+
`)}\n${r}}`}function Ue(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 We(e,t){let n=a(e.webFamily),r=a(e.nativeFamily),i=[n===r?` family: ${n}`:` family: isWeb ? ${n} : ${r}`,` size: ${H(e.size)}`];return Object.keys(e.lineHeight).length>0&&i.push(` lineHeight: ${H(e.lineHeight)}`),Object.keys(e.weight).length>0&&i.push(` weight: ${H(e.weight)}`),Object.keys(e.letterSpacing).length>0&&i.push(` letterSpacing: ${H(e.letterSpacing)}`),e.face&&i.push(` face: ${e.face}`),`const ${t} = createFont({\n${i.join(`,
|
|
5
|
+
`)}\n});`}function Ge(e){return`# Installing Tamagui Config
|
|
6
6
|
|
|
7
7
|
Generated by \`@razorwind/tamagui\`.
|
|
8
8
|
|
|
9
9
|
## Files
|
|
10
10
|
|
|
11
|
-
- \`${e.outputPath}\` — Tamagui
|
|
11
|
+
- \`${e.outputPath}\` — Tamagui config (\`createTamagui\` + \`createThemes\` with light, dark, and nested semantic themes)
|
|
12
12
|
|
|
13
13
|
## Setup
|
|
14
14
|
|
|
@@ -48,80 +48,69 @@ 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
|
|
52
|
-
`)}\n${` `.repeat(Math.max(t-2,0))}}`}function
|
|
53
|
-
`)}\n${` `.repeat(Math.max(t-2,0))}}`}function
|
|
54
|
-
`)}\n${r}}`}const ht=/^\{([^{}]+)\}$/,gt=/\{([^{}]+)\}/g,_t=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/,vt=/var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g;function G(e){return{byPath:new Map(e.map(e=>[e.path,e])),byCssVar:new Map(e.map(e=>[(0,t.toThemeCssVar)(e.path),e]))}}function yt(e){if(typeof e==`string`)return ht.exec(e.trim())?.[1]?.trim()}function bt(e){if(typeof e==`string`)return _t.exec(e.trim())?.[1]}function xt(e){return yt(e)!=null||bt(e)!=null}function St(e){return/var\(|\{[^{}]+\}/.test(e)}function K(e,t){let n=q(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&&!xt(e))return e}function Ct(e,t){return e.replace(gt,(e,n)=>{let r=t.byPath.get(n.trim());return r?K(r,t)??e:e}).replace(vt,(e,n)=>{let r=t.byCssVar.get(n);return r?K(r,t)??e:e})}function q(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=yt(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=bt(r.value)??bt(r.cssValue)??bt(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 wt(e){return/^[A-Z_$][\w$]*$/i.test(e)?`theme.${e}`:`theme[${a(e)}]`}function Tt(e,t){return t<1?e:t+1-e}function Et(e,t){return e.length<2?!1:X(e,t).some((t,n)=>t!==e[n])}function Dt(e,t,n,r){let i=n[t];if(!i||r!==`dark`)return e;let a=$(i,t);return a.length<2||!Et(a.map(([,e])=>e),r)?e:Tt(e,a[a.length-1][0])}function Ot(e,t,n,r){let i=J(e);if(!i)return;let a=Dt(i.step,i.name,n,r);if(t&&i.name.toLowerCase()===t.toLowerCase()||n[i.name])return`${i.name}${a}`}function kt(e){if(e>=1&&e<=12)return e;if(e>=100&&e<=900&&e%100==0)return e/100}function J(e){let t=e.path.split(`.`).filter(Boolean),n=t.at(-1);if(n&&/^\d+$/.test(n)){let e=kt(Number(n)),r=t.at(-2);if(e!=null&&r&&!/^(?:color|colours?|palette)$/i.test(r))return{name:w([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=kt(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=J(n);e&&At(t,e.name,e.step,n.tamaguiValue)}return Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=3))}function Y(e){let t={};for(let n of e){if(!n.primitive||typeof n.tamaguiValue!=`string`)continue;let e=J(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 X(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 Z(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*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 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=Q(r[0]);return e==null?void 0:Nt(e)}let i=Pt(t,`hsla?`);if(i?.[2]){let e=Q(i[2]);return e==null?void 0:Nt(e)}let a=Pt(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 $(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 It(e,t,n){let r=$(e,t);if(r.length===0)return e;let i=X(r.map(([,e])=>e),n),a={};for(let[e,[n]]of r.entries())a[`${t}${n}`]=i[e]??r[e][1];return a}function Lt(e,t,n){let r=t[n];return e.find(([,e])=>e===r)?.[0]??e[n]?.[0]??n+1}function Rt(e,t,n,r){let i=$(e,n);if(i.length===0)return{};let a=X(i.map(([,e])=>e),r),o={};for(let[e,[r]]of i.entries()){let s=t[`${n}${Lt(i,a,e)}`];s&&(o[`${n}${r}`]=U(s))}return o}function zt(e,t,n,r){let i=$(e,n);if(i.length<2)return;let a=X(i.map(([,e])=>e),r),o=[];for(let[e]of i.entries()){let r=t[`${n}${Lt(i,a,e)}`];if(!r)return;o.push(U(r))}let s=[...o],c=s.at(-1);if(c!=null){for(;s.length<12;)s.push(c);return`[${s.join(`,`)}]`}}function Bt(e,t){return $(e,t).length>=2}function Vt(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 Ht(e,t,n){let r=$(e,t);if(!(r.length<2))return Vt(X(r.map(([,e])=>e),n))}function Ut(e){let t=new Map;for(let n of e){let e=n.childTheme?.trim();if(!e)continue;let r=e.toLowerCase();$e(r)||et(r)||t.has(r)||t.set(r,w([e]))}return[...t.values()].toSorted((e,t)=>e.localeCompare(t))}function Wt(e,t){let n=t.toLowerCase(),r=e.split(/(?=[A-Z])/).filter(Boolean).filter(e=>e.toLowerCase()!==n);if(r.length!==0)return w(r)}function Gt(e){return e.toLowerCase()===`base`}function Kt(e){return Ut(e).filter(e=>!Gt(e))}function qt(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}const Jt=[{alias:`background`,source:e=>`background${e}`},{alias:`backgroundDisabled`,source:e=>`background${e}Disabled`},{alias:`backgroundHover`,source:e=>`background${e}Hover`},{alias:`backgroundSubtle`,source:e=>e===`Primary`?`backgroundSecondary`:`background${e}Subtle`},{alias:`border`,source:e=>`border${e}`},{alias:`borderDisabled`,source:e=>`border${e}Disabled`},{alias:`borderHover`,source:e=>`border${e}Hover`},{alias:`borderSubtle`,source:e=>e===`Primary`?`borderSecondary`:`border${e}Subtle`},{alias:`foreground`,source:e=>`foreground${e}`},{alias:`foregroundDisabled`,source:e=>`foreground${e}Disabled`},{alias:`foregroundHover`,source:e=>`foreground${e}Hover`},{alias:`foregroundOn`,source:e=>`foregroundOn${e}`},{alias:`foregroundOnDisabled`,source:e=>`foregroundOn${e}Disabled`},{alias:`foregroundOnHover`,source:e=>`foregroundOn${e}Hover`}];function Yt(e,t,n){let r=new Set([...Object.keys(e),...Object.keys(t)]),i=[`Primary`,...n.map(qt)],a=[];for(let{alias:e,source:t}of Jt)i.some(e=>r.has(t(e)))&&a.push(e);return a}function Xt(e){let t={};for(let[n,r]of Object.entries(e)){if(Gt(n))continue;let e=Object.values(r);if(e.length===0)continue;let i={};for(let[t,r]of e.entries())i[`${n}${t+1}`]=r;Object.keys(i).length===1&&(i[`${n}2`]=e[0]),t[n]=i}return t}function Zt(e){let t=e.split(/(?=[A-Z])/).filter(Boolean),n=t.at(-1)?.toLowerCase();if((n===`primary`||n===`secondary`||n===`tertiary`)&&!(t.length<2))return{role:w(t.slice(0,-1)),rank:n}}function Qt(e){return e.category===`color`&&!e.primitive&&!!e.tokenKey}function $t(e,t,n){let r=new Map,i={};for(let a of e){if(!Qt(a)||!a.tokenKey)continue;let e=a.childTheme?.toLowerCase();if(e&&e!==`base`)continue;let o=dt(a,t,n);if(!o)continue;let s=Zt(a.tokenKey);if(s){let e=r.get(s.role)??{};e[s.rank]=o,r.set(s.role,e);continue}if(e===`base`){let e=Wt(a.tokenKey,`base`);e&&(i[e]=o)}}let a={...i};for(let[e,t]of r){t.primary&&(a[e]=t.primary);let n=t.secondary??t.tertiary;n&&(a[`${e}Subtle`]=n)}return a}function en(e,t){let n=G(e),r={};for(let i of Ut(e)){if(Gt(i)){let a=$t(e,n,t);Object.keys(a).length>0&&(r[i]=a);continue}let a={},o=i.toLowerCase();for(let r of e){if(!Qt(r)||r.childTheme?.toLowerCase()!==o)continue;let e=Wt(r.tokenKey,i);if(!e)continue;let s=dt(r,n,t);s&&(a[e]=s)}Object.keys(a).length>0&&(r[i]=a)}return r}function tn(e,t){let n=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),{name:e,scale:t}]));for(let e of Ze){let r=n.get(e);if(!r)continue;let i=Ht(r.scale,r.name,t);if(i)return{name:r.name,palette:i}}}function nn(e){let t=e.filter(e=>e.category===`color`||e.primitive),n=Y(V(t,`light`)),r=Y(V(t,`dark`)),i=tn(n,`light`),a=tn(r,`dark`);return{lightPalette:i?.palette,darkPalette:a?.palette,lightBaseName:i?.name,darkBaseName:a?.name}}function rn(e,t,n){let r=Y(e),{byPath:i,byCssVar:o}=G(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=q(c,i,o),l=Ot(e,t,r,n);if(l){s[c.tokenKey]=wt(l);continue}let u=e.tamaguiValue;xt(u)||xt(e.cssValue)||(typeof u==`string`||typeof u==`number`)&&(s[c.tokenKey]=a(u))}return s}function an(e){return e.replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${")}function on(e,t,n,r,i){let a=q(e,t.byPath,t.byCssVar),o=Ot(a,n,r,i);if(o)return{kind:`theme`,property:o};let s=K(a,t);if(s)return{kind:`text`,value:s}}function sn(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=on(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 cn(e){return e.some(e=>e.kind===`theme`)?`\`${e.map(e=>e.kind===`theme`?`\${${wt(e.property)}}`:an(e.value)).join(``)}\``:a(e.map(e=>e.kind===`text`?e.value:``).join(``))}function ln(e,t,n){let r=G(e),i=Y(e.filter(e=>e.category===`color`)),a={};for(let o of e){if(!tt(o)||!o.tokenKey)continue;let e=typeof o.tamaguiValue==`string`?o.tamaguiValue:o.cssValue;if(typeof e!=`string`||e.length===0)continue;let s=sn(e,r,t,i,n);s&&(a[o.tokenKey]=cn(s))}return a}function un(e,t,n,r,i){let a=new Set([...Object.keys(e),...Object.keys(t)]);if(a.size===0)return;let o=[];for(let s of[...a].toSorted((e,t)=>e.localeCompare(t))){let a=e[s]??t[s]??{},c=t[s]??e[s]??{};if(Object.keys(a).length===0||Object.keys(c).length===0)continue;let l=Bt(a,s)||Bt(c,s),u,d;if(i&&l?(u=Rt(a,n[s]??r[s]??{},s,`light`),d=Rt(c,r[s]??n[s]??{},s,`dark`),Object.keys(u).length===0&&(u=a),Object.keys(d).length===0&&(d=c)):l?(u=It(a,s,`light`),d=It(c,s,`dark`)):(u=a,d=c),Object.keys(u).length===0||Object.keys(d).length===0)continue;let f=l&&!i?(e,t)=>ft(e,t):pt;o.push(` ${s}: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
assign("backgroundHover", \`background\${role}Hover\`);
|
|
77
|
-
assign("backgroundSubtle", role === "Primary" ? "backgroundSecondary" : \`background\${role}Subtle\`);
|
|
78
|
-
assign("border", \`border\${role}\`);
|
|
79
|
-
assign("borderDisabled", \`border\${role}Disabled\`);
|
|
80
|
-
assign("borderHover", \`border\${role}Hover\`);
|
|
81
|
-
assign("borderSubtle", role === "Primary" ? "borderSecondary" : \`border\${role}Subtle\`);
|
|
82
|
-
assign("foreground", \`foreground\${role}\`);
|
|
83
|
-
assign("foregroundDisabled", \`foreground\${role}Disabled\`);
|
|
84
|
-
assign("foregroundHover", \`foreground\${role}Hover\`);
|
|
85
|
-
assign("foregroundOn", \`foregroundOn\${role}\`);
|
|
86
|
-
assign("foregroundOnDisabled", \`foregroundOn\${role}Disabled\`);
|
|
87
|
-
assign("foregroundOnHover", \`foregroundOn\${role}Hover\`);
|
|
88
|
-
return {
|
|
89
|
-
...values,
|
|
90
|
-
...overlay
|
|
91
|
-
};
|
|
92
|
-
}`}function _n(e){return` ${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: string;`}function vn(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(_n),`}`,``]}function yn(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=V(c,`light`),u=V(c,`dark`),d=u.length>0?u:l,f=lt(l,u),p=Object.keys(f).length>0,m=ut(l),h=ut(d),g=Y(l),_=Y(d),ee=Kt([...l,...d]),te={...Xt(en(l,f)),...g},ne={...Xt(en(d,f)),..._},{lightPalette:v,darkPalette:y,lightBaseName:b,darkBaseName:x}=nn(t),re=un(te,ne,m,h,p),S=p&&b?zt(g[b]??{},m[b]??{},b,`light`):void 0,ie=p&&x?zt(_[x]??{},h[x]??{},x,`dark`):void 0,C=V(t,`light`),w=V(t,`dark`),ae=u.length>0?w:C,T=u.length>0?x:b,E={...rn(l,b,`light`),...ln(C,b,`light`)},D={...rn(u.length>0?u:l,T,`dark`),...ln(ae,T,`dark`)},oe=vn(mn({lightSemantic:E,darkSemantic:D,lightScales:te,darkScales:ne,lightPalette:v,darkPalette:y,semanticRoles:ee}),{specName:e.name}),se=ct(C),O=[];Object.keys(f).length>0&&O.push(` color: ${ft(f,4)}`);for(let e of rt){let t=se[e];t&&Object.keys(t).length>0&&O.push(` ${e}: ${ft(t,4)}`)}let k=[];S?k.push(` lightPalette: ${S}`):v&&k.push(` lightPalette: ${a(v)}`),ie?k.push(` darkPalette: ${ie}`):y&&k.push(` darkPalette: ${a(y)}`),re&&k.push(` childrenThemes: ${re}`),(Object.keys(E).length>0||Object.keys(D).length>0)&&k.push(gn(E,D));let A=[`import { isWeb } from '@tamagui/constants';`];i?A.push(`import { createV5Theme, defaultConfig, type CreateV5ThemeOptions } from "@tamagui/config/v5";`):A.push(`import { createV5Theme, type CreateV5ThemeOptions } from "@tamagui/config/v5";`),o!==!1&&A.push(`import { animations } from "${Qe[o]}";`),n.importConfig&&A.push(`import userConfig from "${n.importConfig}";`);let ce=[`createTamagui`,`px`];O.length>0&&ce.push(`createTokens`);let le=Ue(t,r);le.length>0&&ce.push(`createFont`),A.push(`import { ${ce.join(`, `)} } from "@tamagui/core";`);let j=[`/* eslint-disable */`,``,`/*`,` * Generated by @razorwind/tamagui — Do not edit by hand.`,` * `,` * @see https://tamagui.dev/docs/core/config-v5`,` */`,``,...A,``];O.length>0&&j.push(`const tokens = createTokens({`,O.join(`,
|
|
93
|
-
`),`});`,``);let ue=k.length>0?`createV5Theme({\n${k.join(`,
|
|
94
|
-
`)}\n})`:`createV5Theme()`;(Object.keys(E).length>0||Object.keys(D).length>0)&&j.push(hn(ee),``),j.push(`const themes = ${ue};`,``);let de=new Map;if(le.length>0)for(let[e,t]of le.entries()){let n=Ge(t.key,e);de.set(t.key,n),j.push(Ke(t,n),``)}let M=[];if(i&&M.push(` ...defaultConfig`),o!==!1&&M.push(` animations`),O.length>0&&(i?M.push(` tokens: {
|
|
95
|
-
...defaultConfig.tokens,
|
|
96
|
-
...tokens,
|
|
97
|
-
space: {
|
|
98
|
-
...defaultConfig.tokens.space,
|
|
99
|
-
...tokens.space
|
|
100
|
-
},
|
|
101
|
-
size: {
|
|
102
|
-
...defaultConfig.tokens.size,
|
|
103
|
-
...tokens.size
|
|
104
|
-
},
|
|
105
|
-
radius: {
|
|
106
|
-
...defaultConfig.tokens.radius,
|
|
107
|
-
...tokens.radius
|
|
108
|
-
},
|
|
109
|
-
zIndex: {
|
|
110
|
-
...defaultConfig.tokens.zIndex,
|
|
111
|
-
...tokens.zIndex
|
|
51
|
+
`}const Ke=new Set([`default`,`light`,`theme`]),qe=/^base(?:[A-Z]\w*|[._-].+)?$/i,Je=/^ring(?:\.|$)/i,Ye={css:`@tamagui/config/v5-css`,rn:`@tamagui/config/v5-rn`,reanimated:`@tamagui/config/v5-reanimated`,motion:`@tamagui/config/v5-motion`};function Xe(e){return Ke.has(e)}function Ze(e){return e===`dark`}function U(e,t){let n=new Map,r=t===`dark`?Ze:Xe;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 Qe(e){return Je.test(e.path)&&e.category===`shadow`}const $e=new Set([`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`]);function et(e){return!e.primitive&&!!e.tokenKey&&(e.type===`shadow`||e.category!=null&&$e.has(e.category))}const tt=new Set([`fontSize`,`blur`]),nt=[`space`,`size`,`radius`,`zIndex`,`blur`,`fontSize`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`,`fontWeight`];function rt(e){return/^px\(-?\d/.test(e)}function it(e){if(e.category===`radius`&&e.tokenKey?.startsWith(`borderRadius`)){let t=e.tokenKey.replace(/^borderRadius/,``);return t?D([t]):e.tokenKey}return e.tokenKey??``}function at(e,t){let n=Q(e,t.byPath,t.byCssVar).tamaguiValue;if(e.category&&tt.has(e.category)&&typeof n==`number`)return`px(${n})`;if(typeof n==`string`){let r=Et(n,t);return e.category===`dropShadow`?ot(r):r}return n}function ot(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 st(e){let t={},n=St(e);for(let r of e){if(!r.category||r.category===`color`||!r.tokenKey||Qe(r))continue;let e=it(r);if(!e)continue;let i=at(r,n);if(typeof i==`string`&&Tt(i))continue;let a=t[r.category]??{};a[e]=i,t[r.category]=a}return t}function W(e){let t=e.path.replace(/^color\./i,``).replaceAll(`.`,``);return e.theme?`${e.theme}${t[0]?.toUpperCase()??``}${t.slice(1)}`:t}function G(e){return`tokens.color.${e}.val`}const ct=[`base`,`gray`,`grey`,`neutral`],lt=[`accent`,`brand`],ut=[`"#ffffff"`,`"#000000"`],dt=[`"#000000"`,`"#ffffff"`];function ft(e){if(e.category!==`color`||!e.primitive)return;let t=e.path.replace(/^color\./i,``).split(`.`).filter(Boolean),n=t.at(-1);if(!n||t.length<2)return;let r=Number(n);if(Number.isFinite(r))return{name:t.slice(0,-1).join(`.`).toLowerCase(),step:r}}function pt(e,t){let n=W(e);if(n in t)return G(n);let r=typeof e.cssValue==`string`&&e.cssValue.length>0?e.cssValue:typeof e.tamaguiValue==`string`?e.tamaguiValue:void 0;return r?a(r):`"#000000"`}function mt(e,t,n){let r=new Map;for(let t of e){let e=ft(t);if(!e)continue;let i=r.get(e.name)??[];i.push({step:e.step,expression:pt(t,n)}),r.set(e.name,i)}for(let e of t){let t=r.get(e);if(!t||t.length===0)continue;let n=new Map;for(let e of t.toSorted((e,t)=>e.step-t.step))n.set(e.step,e.expression);return[...n.values()]}}function K(e,t){return e.length>=2?e:e.length===1?[e[0],t[1]??`"#000000"`]:[...t]}function ht(e,t,n,r,i,a){let o=mt(e,n,r),s=mt(t,n,r);if(o&&s)return{light:K(o,i),dark:K(s,a)};if(o){let e=K(o,i);return{light:e,dark:[...e].toReversed()}}if(s){let e=K(s,a);return{light:[...e].toReversed(),dark:e}}return{light:[...i],dark:[...a]}}function gt(e,t){let n={},r=(e,t)=>{let r=t.cssValue;typeof r!=`string`||r.length===0||wt(r)||r===`[object Object]`||(n[e]=r)};for(let t of e)t.tokenKey&&(t.primitive?r(W(t),t):r(t.tokenKey,t));for(let e of t)!e.tokenKey||!e.primitive||r(W(e),e);return n}function q(e,t,n,r){let i=n[r];if(typeof i!=`string`)return!1;let a=Z(e,t);return a!=null&&a===i}function _t(e,t,n){if(e.tokenKey&&q(e,t,n,e.tokenKey))return G(e.tokenKey);let r=Q(e,t.byPath,t.byCssVar);if(r.tokenKey&&q(e,t,n,r.tokenKey))return G(r.tokenKey);if(r.primitive){let i=W(r);if(q(e,t,n,i))return G(i)}let i=Z(e,t);if(i)return a(i)}function J(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`&&rt(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 Y(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])=>`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${t}`).join(`,
|
|
53
|
+
`)}\n${` `.repeat(Math.max(t-2,0))}}`}const vt=/^\{([^{}]+)\}$/,yt=/\{([^{}]+)\}/g,bt=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/,xt=/var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g;function St(e){return{byPath:new Map(e.map(e=>[e.path,e])),byCssVar:new Map(e.map(e=>[(0,t.toThemeCssVar)(e.path),e]))}}function Ct(e){if(typeof e==`string`)return vt.exec(e.trim())?.[1]?.trim()}function X(e){if(typeof e==`string`)return bt.exec(e.trim())?.[1]}function wt(e){return Ct(e)!=null||X(e)!=null}function Tt(e){return/var\(|\{[^{}]+\}/.test(e)}function Z(e,t){let n=Q(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&&!wt(e))return e}function Et(e,t){return e.replace(yt,(e,n)=>{let r=t.byPath.get(n.trim());return r?Z(r,t)??e:e}).replace(xt,(e,n)=>{let r=t.byCssVar.get(n);return r?Z(r,t)??e:e})}function Q(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=Ct(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=X(r.value)??X(r.cssValue)??X(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 Dt(e,t){let n=t.toLowerCase(),r=e.split(/(?=[A-Z])/).filter(Boolean).filter(e=>e.toLowerCase()!==n);if(r.length!==0)return D(r)}function Ot(e){return e.category===`color`&&!e.primitive&&!!e.tokenKey}function kt(e){return et(e)&&D(e.path.split(`.`).filter(Boolean))||e.tokenKey}function At(e){let t=e.toLowerCase();return Xe(t)||Ze(t)}function jt(e,t,n){let r=kt(t);if(!r)return;let i=t.childTheme?.trim();if(!i||At(i)){e.base[r]=n;return}let a=D([i]),o=Dt(r,a);if(!o)return;let s=e.children[a]??{};s[o]=n,e.children[a]=s}function Mt(e,t){let n=typeof e.tamaguiValue==`string`?e.tamaguiValue:e.cssValue;if(typeof n!=`string`||n.length===0)return;let r=Et(n,t);return r.length===0||Tt(r)?void 0:a(e.category===`dropShadow`?ot(r):r)}function Nt(e,t){let n=St(e),r={base:{},children:{}};for(let i of e){if(Ot(i)){let e=_t(i,n,t);e&&jt(r,i,e);continue}if(!et(i))continue;let e=Mt(i,n);if(!e)continue;let a=i.childTheme?.trim();(a&&!At(a)||Qe(i))&&jt(r,i,e)}return r}function Pt(e){let t=new Set;for(let n of e){for(let e of Object.keys(n.base))t.add(e);for(let e of Object.values(n.children))for(let n of Object.keys(e))t.add(n)}return[...t].toSorted((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function Ft(e){return` ${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: string;`}function It(e,t){if(e.length!==0)return[`/**`,` * Theme values available on \`useTheme()\` and \`$\` style props for the ${t.specName||`design system`}.`,` *`," * Derived from semantic color tokens mapped by `createThemes`. Nested"," * themes (`light_primary`, `dark_danger`, …) come from each token's"," * `theme` / `$theme` property.",` *`,` * @see https://tamagui.dev/docs/intro/themes`,` */`,`export interface AppTheme {`,...e.map(Ft),`}`,``]}function Lt(e){return Object.keys(e).length>0}function Rt(e){return/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}function zt(e,t){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0));return`[\n${e.map(e=>`${n}${e}`).join(`,
|
|
54
|
+
`)}\n${r}]`}function $(e,t,n){let r=` `.repeat(n),i=` `.repeat(Math.max(n-2,0)),a=n+2;return`{
|
|
55
|
+
${r}light: ${zt(e,a)},
|
|
56
|
+
${r}dark: ${zt(t,a)}
|
|
57
|
+
${i}}`}function Bt(e,t,n){let r=` `.repeat(n),i=` `.repeat(Math.max(n-2,0)),a=n+2;return`{
|
|
58
|
+
${r}light: ${Y(e,a)},
|
|
59
|
+
${r}dark: ${Y(t,a)}
|
|
60
|
+
${i}}`}function Vt(e,t){let n=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t));if(n.length===0)return`{}`;let r=` `.repeat(t),i=` `.repeat(Math.max(t-2,0)),a=t+2;return`{\n${n.map(([e,t])=>`${r}${Rt(e)}: ${Y(t,a)}`).join(`,
|
|
61
|
+
`)}\n${i}}`}function Ht(e,t){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0));return`{\n${e.map(e=>`${n}${Rt(e)}: {}`).join(`,
|
|
62
|
+
`)}\n${r}}`}function Ut(e,t){return`const childThemeExtras: {
|
|
63
|
+
light: Record<string, Record<string, string>>;
|
|
64
|
+
dark: Record<string, Record<string, string>>;
|
|
65
|
+
} = {
|
|
66
|
+
light: ${Vt(e,4)},
|
|
67
|
+
dark: ${Vt(t,4)}
|
|
68
|
+
};`}function Wt(e,t,n){return Object.fromEntries(n.map(n=>[n,e.children[n]??t.children[n]??{}]))}function Gt(e,t,n,r,i){let a=[...new Set([...Object.keys(e.children),...Object.keys(t.children)])].toSorted((e,t)=>e.localeCompare(t)),o=a.includes(`accent`),s=a.filter(e=>e!==`accent`),c=Lt(e.base)||Lt(t.base);if(!c&&a.length===0)return{statements:[],hasThemes:!1};let l=ht(r,i,ct,n,ut,dt),u=ht(r,i,lt,n,l.light,l.dark),d=[],f=[` componentThemes: false`],p=[` palette: ${$(l.light,l.dark,6)}`];if(c&&p.push(` extra: ${Bt(e.base,t.base,6)}`),f.push(` base: {\n${p.join(`,
|
|
69
|
+
`)}\n }`),o){let n=e.children.accent??t.children.accent??{},r=t.children.accent??e.children.accent??{};f.push(` accent: {
|
|
70
|
+
palette: ${$(u.light,u.dark,6)},
|
|
71
|
+
extra: ${Bt(n,r,6)}
|
|
72
|
+
}`)}if(s.length>0){let n=Wt(e,t,s),r=Wt(t,e,s);d.push(Ut(n,r),``),f.push(` childrenThemes: ${Ht(s,4)}`);let i=o?` || child === "accent"`:``;f.push(` getTheme: ({ name, theme, scheme }) => {
|
|
73
|
+
const child = name.replace(/^(?:light|dark)_/, "");
|
|
74
|
+
if (child === name${i}) {
|
|
75
|
+
return theme;
|
|
112
76
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
77
|
+
|
|
78
|
+
const extras = childThemeExtras[scheme ?? "light"][child];
|
|
79
|
+
|
|
80
|
+
return extras ? { ...theme, ...extras } : theme;
|
|
81
|
+
}`)}return d.push(`const themes = createThemes({\n${f.join(`,
|
|
82
|
+
`)}\n});`),{statements:d,hasThemes:!0}}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=U(c,`light`),u=U(c,`dark`),d=u.length>0,f=gt(l,u),p=U(t,`light`),m=d?U(t,`dark`):p,h=Nt(p,f),g=Nt(m,f),{statements:_,hasThemes:v}=Gt(h,g,f,l,u),ee=It(Pt(d?[h,g]:[h]),{specName:e.name}),y=st(p),b=[];Object.keys(f).length>0&&b.push(` color: ${J(f,4)}`);for(let e of nt){let t=y[e];t&&Object.keys(t).length>0&&b.push(` ${e}: ${J(t,4)}`)}let x=[`import { isWeb } from '@tamagui/constants';`];i&&x.push(`import { defaultConfig } from "@tamagui/config/v5";`),o!==!1&&x.push(`import { animations } from "${Ye[o]}";`),n.importConfig&&x.push(`import userConfig from "${n.importConfig}";`),v&&x.push(`import { createThemes } from "@tamagui/theme-builder";`);let S=[`createTamagui`,`px`];b.length>0&&S.push(`createTokens`);let C=Ve(t,r);C.length>0&&S.push(`createFont`),x.push(`import { ${S.join(`, `)} } from "@tamagui/core";`);let w=[`/* eslint-disable */`,``,`/*`,` * Generated by @razorwind/tamagui — Do not edit by hand.`,` * `,` * @see https://tamagui.dev/docs/core/configuration`,` * @see https://tamagui.dev/docs/intro/themes`,` * @see https://tamagui.dev/docs/guides/theme-builder`,` */`,``,...x,``];b.length>0&&w.push(`const tokens = createTokens({`,b.join(`,
|
|
83
|
+
`),`});`,``),_.length>0&&w.push(..._,``);let T=new Map;if(C.length>0)for(let[e,t]of C.entries()){let n=Ue(t.key,e);T.set(t.key,n),w.push(We(t,n),``)}let E=[];if(i&&E.push(` ...defaultConfig`),o!==!1&&E.push(` animations`),b.length>0&&(i?E.push(` tokens: {
|
|
84
|
+
...defaultConfig.tokens,
|
|
85
|
+
...tokens,
|
|
86
|
+
space: {
|
|
87
|
+
...defaultConfig.tokens.space,
|
|
88
|
+
...tokens.space
|
|
89
|
+
},
|
|
90
|
+
size: {
|
|
91
|
+
...defaultConfig.tokens.size,
|
|
92
|
+
...tokens.size
|
|
93
|
+
},
|
|
94
|
+
radius: {
|
|
95
|
+
...defaultConfig.tokens.radius,
|
|
96
|
+
...tokens.radius
|
|
97
|
+
},
|
|
98
|
+
zIndex: {
|
|
99
|
+
...defaultConfig.tokens.zIndex,
|
|
100
|
+
...tokens.zIndex
|
|
101
|
+
}
|
|
102
|
+
}`):E.push(` tokens`)),v&&E.push(` themes`),T.size>0){let e=[...T.entries()].map(([e,t])=>` ${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${t}`);i?E.push(` fonts: {
|
|
103
|
+
...defaultConfig.fonts,
|
|
104
|
+
${e.join(`,
|
|
116
105
|
`)}
|
|
117
|
-
|
|
118
|
-
${e.join(`,
|
|
106
|
+
}`):E.push(` fonts: {
|
|
107
|
+
${e.join(`,
|
|
119
108
|
`)}
|
|
120
|
-
|
|
121
|
-
* The Tamagui
|
|
109
|
+
}`)}return n.shorthands&&E.push(` shorthands: ${J(n.shorthands,4)}`),n.media&&E.push(` media: ${a(n.media)}`),n.defaultFont&&E.push(` defaultFont: ${a(n.defaultFont)}`),w.push(``,...ee??[],`/**
|
|
110
|
+
* The Tamagui config for the ${e.name||`design system`}.
|
|
122
111
|
*
|
|
123
|
-
* @see https://tamagui.dev/docs/core/
|
|
112
|
+
* @see https://tamagui.dev/docs/core/configuration
|
|
124
113
|
*/
|
|
125
|
-
export const config = createTamagui({`,
|
|
126
|
-
`),n.importConfig?`, ...userConfig `:``,`});`,``,`export type AppConfig = typeof config;`,``),s&&
|
|
127
|
-
`)}function
|
|
114
|
+
export const config = createTamagui({`,E.join(`,
|
|
115
|
+
`),n.importConfig?`, ...userConfig `:``,`});`,``,`export type AppConfig = typeof config;`,``),s&&w.push(`declare module "@tamagui/core" {`,` // eslint-disable-next-line @typescript-eslint/no-empty-object-type`,` interface TamaguiCustomConfig extends AppConfig {}`,`}`,``),w.push(`export default config;`,``),w.join(`
|
|
116
|
+
`)}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?k(e.tokens,r):[];if(o.length===0&&!a)return{};let s=r.outputPath??`tamagui.config.ts`,c=Kt(e,o,r),l=r.installGuide??Ge({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.collectTamaguiFonts=Ve,exports.default=Jt,exports.flattenTokens=k,exports.fontVarName=Ue,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateTamaguiConfig=qt,exports.isPaletteGroup=v,exports.renderInstallMd=Ge,exports.renderTamaguiConfig=Kt,exports.resolveTokenCategory=te,exports.resolveTokenSets=t.resolveTokenSets,exports.tamaguiFontKeyFromRole=R,exports.toCamelCaseKey=D,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toTamaguiValue=o,exports.toTokenKey=ne,exports.typographyFontKey=Ce;
|
package/dist/index.d.cts
CHANGED
|
@@ -22,7 +22,7 @@ interface TamaguiPluginOptions {
|
|
|
22
22
|
* Output path written relative to the execution cwd.
|
|
23
23
|
*
|
|
24
24
|
* Light and dark schemes are always written to this single file — Tamagui
|
|
25
|
-
* `
|
|
25
|
+
* `createThemes` encodes both as `light` / `dark` plus nested children.
|
|
26
26
|
*
|
|
27
27
|
* @defaultValue `"tamagui.config.ts"`
|
|
28
28
|
*/
|
|
@@ -108,7 +108,7 @@ interface FlatToken {
|
|
|
108
108
|
*/
|
|
109
109
|
childTheme?: string;
|
|
110
110
|
/**
|
|
111
|
-
* True when an ancestor group is marked as a primitive (`primitive: true` or `$type: "primitive"` or `$type: "palette"`). Those scales feed
|
|
111
|
+
* True when an ancestor group is marked as a primitive (`primitive: true` or `$type: "primitive"` or `$type: "palette"`). Those scales feed `createTokens({ color })` and `createThemes` palettes, and are skipped when building semantic extras.
|
|
112
112
|
*/
|
|
113
113
|
primitive?: boolean;
|
|
114
114
|
}
|
|
@@ -209,78 +209,54 @@ declare function toTamaguiValue(value: unknown, type?: string): string | number;
|
|
|
209
209
|
/**
|
|
210
210
|
* Build Tamagui INSTALL.md for generated config file.
|
|
211
211
|
*
|
|
212
|
-
* @see https://tamagui.dev/docs/core/
|
|
212
|
+
* @see https://tamagui.dev/docs/core/configuration
|
|
213
213
|
*/
|
|
214
214
|
declare function renderInstallMd(options: {
|
|
215
215
|
outputPath: string;
|
|
216
216
|
}): string;
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/generate.d.ts
|
|
219
|
-
type ColorScheme = "light" | "dark";
|
|
220
|
-
/**
|
|
221
|
-
* Mirror a palette step across a numbered scale (`1` ↔ `max`, `2` ↔ `max-1`).
|
|
222
|
-
*
|
|
223
|
-
* Dark palettes are emitted darkest-first (`color1` / `red1` are the darkest
|
|
224
|
-
* stops), so a DTCG alias `{color.red.7}` must read `theme.red3` on a 9-step
|
|
225
|
-
* scale to keep pointing at the original token color.
|
|
226
|
-
*/
|
|
227
|
-
declare function flipPaletteStep(step: number, maxStep: number): number;
|
|
228
|
-
/**
|
|
229
|
-
* Collect color palettes for Tamagui `childrenThemes`.
|
|
230
|
-
*
|
|
231
|
-
* Groups marked `palette: true` (or `$type: "palette"`) win. When none are
|
|
232
|
-
* marked, numbered 1–12 (or 100–900) scales are used as a fallback.
|
|
233
|
-
*/
|
|
234
|
-
declare function collectColorScales(colorTokens: FlatToken[]): Record<string, Record<string, string>>;
|
|
235
219
|
/**
|
|
236
|
-
*
|
|
237
|
-
* lightest (`color1`–`color12`).
|
|
220
|
+
* Render a Tamagui config module from flattened design tokens.
|
|
238
221
|
*
|
|
239
|
-
*
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
*
|
|
244
|
-
* CSS variables and unresolved aliases return `undefined`.
|
|
245
|
-
*/
|
|
246
|
-
declare function colorLightness(color: string): number | undefined;
|
|
247
|
-
/**
|
|
248
|
-
* Render a Tamagui v5 config module from flattened design tokens.
|
|
222
|
+
* Light and dark token sets become `createThemes` extra maps. Semantic colors with
|
|
223
|
+
* a `theme` / `$theme` property are nested as `light_<name>` / `dark_<name>`,
|
|
224
|
+
* with the theme name stripped from the token key. Each typography token is
|
|
225
|
+
* emitted as its own `createFont` entry with that token's size, line height,
|
|
226
|
+
* and weight (not a shared type scale).
|
|
249
227
|
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* token's size, line height, and weight (not a shared type scale).
|
|
253
|
-
*
|
|
254
|
-
* @see https://tamagui.dev/docs/core/config-v5
|
|
228
|
+
* @see https://tamagui.dev/docs/core/configuration
|
|
229
|
+
* @see https://tamagui.dev/docs/intro/themes
|
|
255
230
|
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
256
231
|
*/
|
|
257
232
|
declare function renderTamaguiConfig(spec: Schema, tokens: FlatToken[], options?: TamaguiPluginOptions): string;
|
|
258
233
|
/**
|
|
259
|
-
* Generate a Tamagui
|
|
234
|
+
* Generate a Tamagui config file from a Razorwind schema.
|
|
260
235
|
*/
|
|
261
236
|
declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOptions): GeneratorFunctionResult<Schema, TamaguiPluginOptions>;
|
|
262
237
|
//#endregion
|
|
263
238
|
//#region src/index.d.ts
|
|
264
239
|
/**
|
|
265
|
-
* Razorwind plugin that turns design tokens into a Tamagui
|
|
266
|
-
* (`createTamagui` + `createTokens` + `
|
|
240
|
+
* Razorwind plugin that turns design tokens into a Tamagui config
|
|
241
|
+
* (`createTamagui` + `createTokens` + `createThemes` + `createFont`).
|
|
267
242
|
*
|
|
268
|
-
* Light and dark token sets are emitted as a single config
|
|
269
|
-
*
|
|
270
|
-
* `
|
|
271
|
-
* `
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* darkest-first.
|
|
243
|
+
* Light and dark token sets are emitted as a single config. Semantic colors
|
|
244
|
+
* and shadows (not marked `palette` / `primitive`) that declare `theme` /
|
|
245
|
+
* `$theme` become nested Tamagui themes via `createThemes` from
|
|
246
|
+
* `@tamagui/theme-builder` (`light_primary`, `dark_danger`, …), with the theme
|
|
247
|
+
* name stripped from the token key (`backgroundPrimarySubtle` + `theme: "primary"`
|
|
248
|
+
* → `backgroundSubtle`; `ringPrimarySubtle` → `ringSubtle` on `primary`).
|
|
249
|
+
* Untagged semantic colors land on `base.extra`. Primitive palettes stay on
|
|
250
|
+
* `createTokens({ color })` and feed `base.palette` / `accent.palette`.
|
|
277
251
|
*
|
|
278
252
|
* Typography tokens (`$type: "typography"`) each emit their own Tamagui
|
|
279
253
|
* `createFont` entry with that token's size, line height, and weight. Font
|
|
280
254
|
* keys keep the DTCG token name (`display-lg`). Names with a `_` suffix (or a
|
|
281
255
|
* nested language segment) become FontLanguage variants (`body_cn`).
|
|
282
256
|
*
|
|
283
|
-
* @see https://tamagui.dev/docs/core/
|
|
257
|
+
* @see https://tamagui.dev/docs/core/configuration
|
|
258
|
+
* @see https://tamagui.dev/docs/intro/themes
|
|
259
|
+
* @see https://tamagui.dev/docs/guides/theme-builder
|
|
284
260
|
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
285
261
|
*
|
|
286
262
|
* @example
|
|
@@ -295,5 +271,5 @@ declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOpti
|
|
|
295
271
|
*/
|
|
296
272
|
declare const _default: (options?: TamaguiPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
297
273
|
//#endregion
|
|
298
|
-
export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory,
|
|
274
|
+
export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory, collectTamaguiFonts, _default as default, flattenTokens, fontVarName, formatTokenValue, generateTamaguiConfig, isPaletteGroup, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, tamaguiFontKeyFromRole, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey, typographyFontKey };
|
|
299
275
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -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;;;;;EAKA;;;;EAIA;;;;;;;;;iBChEc,eAAe,MAAM;;;;iBAyGrB,qBACd,cACA,gBACC;;;;;;;iBAoEa,eAAe;;;;;;;;iBA0Bf,WAAW;;;;iBA2GX,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,wCACb;;;;;;;;;UCrUc;;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
|
|
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;;;;;EAKA;;;;EAIA;;;;;;;;;iBChEc,eAAe,MAAM;;;;iBAyGrB,qBACd,cACA,gBACC;;;;;;;iBAoEa,eAAe;;;;;;;;iBA0Bf,WAAW;;;;iBA2GX,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,wCACb;;;;;;;;;UCrUc;;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;;;;;;;;;;;;;;;;;iBC6kC3B,oBACd,MAAM,QACN,QAAQ,aACR,UAAS;;;;iBAgOK,sBACd,MAAM,QACN,UAAS,uBACR,wBAAwB,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -22,7 +22,7 @@ interface TamaguiPluginOptions {
|
|
|
22
22
|
* Output path written relative to the execution cwd.
|
|
23
23
|
*
|
|
24
24
|
* Light and dark schemes are always written to this single file — Tamagui
|
|
25
|
-
* `
|
|
25
|
+
* `createThemes` encodes both as `light` / `dark` plus nested children.
|
|
26
26
|
*
|
|
27
27
|
* @defaultValue `"tamagui.config.ts"`
|
|
28
28
|
*/
|
|
@@ -108,7 +108,7 @@ interface FlatToken {
|
|
|
108
108
|
*/
|
|
109
109
|
childTheme?: string;
|
|
110
110
|
/**
|
|
111
|
-
* True when an ancestor group is marked as a primitive (`primitive: true` or `$type: "primitive"` or `$type: "palette"`). Those scales feed
|
|
111
|
+
* True when an ancestor group is marked as a primitive (`primitive: true` or `$type: "primitive"` or `$type: "palette"`). Those scales feed `createTokens({ color })` and `createThemes` palettes, and are skipped when building semantic extras.
|
|
112
112
|
*/
|
|
113
113
|
primitive?: boolean;
|
|
114
114
|
}
|
|
@@ -209,78 +209,54 @@ declare function toTamaguiValue(value: unknown, type?: string): string | number;
|
|
|
209
209
|
/**
|
|
210
210
|
* Build Tamagui INSTALL.md for generated config file.
|
|
211
211
|
*
|
|
212
|
-
* @see https://tamagui.dev/docs/core/
|
|
212
|
+
* @see https://tamagui.dev/docs/core/configuration
|
|
213
213
|
*/
|
|
214
214
|
declare function renderInstallMd(options: {
|
|
215
215
|
outputPath: string;
|
|
216
216
|
}): string;
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/generate.d.ts
|
|
219
|
-
type ColorScheme = "light" | "dark";
|
|
220
|
-
/**
|
|
221
|
-
* Mirror a palette step across a numbered scale (`1` ↔ `max`, `2` ↔ `max-1`).
|
|
222
|
-
*
|
|
223
|
-
* Dark palettes are emitted darkest-first (`color1` / `red1` are the darkest
|
|
224
|
-
* stops), so a DTCG alias `{color.red.7}` must read `theme.red3` on a 9-step
|
|
225
|
-
* scale to keep pointing at the original token color.
|
|
226
|
-
*/
|
|
227
|
-
declare function flipPaletteStep(step: number, maxStep: number): number;
|
|
228
|
-
/**
|
|
229
|
-
* Collect color palettes for Tamagui `childrenThemes`.
|
|
230
|
-
*
|
|
231
|
-
* Groups marked `palette: true` (or `$type: "palette"`) win. When none are
|
|
232
|
-
* marked, numbered 1–12 (or 100–900) scales are used as a fallback.
|
|
233
|
-
*/
|
|
234
|
-
declare function collectColorScales(colorTokens: FlatToken[]): Record<string, Record<string, string>>;
|
|
235
219
|
/**
|
|
236
|
-
*
|
|
237
|
-
* lightest (`color1`–`color12`).
|
|
220
|
+
* Render a Tamagui config module from flattened design tokens.
|
|
238
221
|
*
|
|
239
|
-
*
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
*
|
|
244
|
-
* CSS variables and unresolved aliases return `undefined`.
|
|
245
|
-
*/
|
|
246
|
-
declare function colorLightness(color: string): number | undefined;
|
|
247
|
-
/**
|
|
248
|
-
* Render a Tamagui v5 config module from flattened design tokens.
|
|
222
|
+
* Light and dark token sets become `createThemes` extra maps. Semantic colors with
|
|
223
|
+
* a `theme` / `$theme` property are nested as `light_<name>` / `dark_<name>`,
|
|
224
|
+
* with the theme name stripped from the token key. Each typography token is
|
|
225
|
+
* emitted as its own `createFont` entry with that token's size, line height,
|
|
226
|
+
* and weight (not a shared type scale).
|
|
249
227
|
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* token's size, line height, and weight (not a shared type scale).
|
|
253
|
-
*
|
|
254
|
-
* @see https://tamagui.dev/docs/core/config-v5
|
|
228
|
+
* @see https://tamagui.dev/docs/core/configuration
|
|
229
|
+
* @see https://tamagui.dev/docs/intro/themes
|
|
255
230
|
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
256
231
|
*/
|
|
257
232
|
declare function renderTamaguiConfig(spec: Schema, tokens: FlatToken[], options?: TamaguiPluginOptions): string;
|
|
258
233
|
/**
|
|
259
|
-
* Generate a Tamagui
|
|
234
|
+
* Generate a Tamagui config file from a Razorwind schema.
|
|
260
235
|
*/
|
|
261
236
|
declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOptions): GeneratorFunctionResult<Schema, TamaguiPluginOptions>;
|
|
262
237
|
//#endregion
|
|
263
238
|
//#region src/index.d.ts
|
|
264
239
|
/**
|
|
265
|
-
* Razorwind plugin that turns design tokens into a Tamagui
|
|
266
|
-
* (`createTamagui` + `createTokens` + `
|
|
240
|
+
* Razorwind plugin that turns design tokens into a Tamagui config
|
|
241
|
+
* (`createTamagui` + `createTokens` + `createThemes` + `createFont`).
|
|
267
242
|
*
|
|
268
|
-
* Light and dark token sets are emitted as a single config
|
|
269
|
-
*
|
|
270
|
-
* `
|
|
271
|
-
* `
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* darkest-first.
|
|
243
|
+
* Light and dark token sets are emitted as a single config. Semantic colors
|
|
244
|
+
* and shadows (not marked `palette` / `primitive`) that declare `theme` /
|
|
245
|
+
* `$theme` become nested Tamagui themes via `createThemes` from
|
|
246
|
+
* `@tamagui/theme-builder` (`light_primary`, `dark_danger`, …), with the theme
|
|
247
|
+
* name stripped from the token key (`backgroundPrimarySubtle` + `theme: "primary"`
|
|
248
|
+
* → `backgroundSubtle`; `ringPrimarySubtle` → `ringSubtle` on `primary`).
|
|
249
|
+
* Untagged semantic colors land on `base.extra`. Primitive palettes stay on
|
|
250
|
+
* `createTokens({ color })` and feed `base.palette` / `accent.palette`.
|
|
277
251
|
*
|
|
278
252
|
* Typography tokens (`$type: "typography"`) each emit their own Tamagui
|
|
279
253
|
* `createFont` entry with that token's size, line height, and weight. Font
|
|
280
254
|
* keys keep the DTCG token name (`display-lg`). Names with a `_` suffix (or a
|
|
281
255
|
* nested language segment) become FontLanguage variants (`body_cn`).
|
|
282
256
|
*
|
|
283
|
-
* @see https://tamagui.dev/docs/core/
|
|
257
|
+
* @see https://tamagui.dev/docs/core/configuration
|
|
258
|
+
* @see https://tamagui.dev/docs/intro/themes
|
|
259
|
+
* @see https://tamagui.dev/docs/guides/theme-builder
|
|
284
260
|
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
285
261
|
*
|
|
286
262
|
* @example
|
|
@@ -295,5 +271,5 @@ declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOpti
|
|
|
295
271
|
*/
|
|
296
272
|
declare const _default: (options?: TamaguiPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
297
273
|
//#endregion
|
|
298
|
-
export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory,
|
|
274
|
+
export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory, collectTamaguiFonts, _default as default, flattenTokens, fontVarName, formatTokenValue, generateTamaguiConfig, isPaletteGroup, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, tamaguiFontKeyFromRole, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey, typographyFontKey };
|
|
299
275
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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,
|
|
3
|
-
`)}\n }`}function
|
|
4
|
-
`)}\n${r}}`}function
|
|
5
|
-
`)}\n});`}function
|
|
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`]),w=[{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 T(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function E(e){return e===!0||e===`true`||e===1}function D(e){return E(e.palette)||E(e.$palette)?!0:k(e)===`palette`}function ee(e,t){return(e===`palette`||e===`$palette`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function O(e){return e===!0||e===`true`||e===1}function te(e){return O(e.primitive)||O(e.$primitive)?!0:k(e)===`primitive`}function ne(e,t){return(e===`primitive`||e===`$primitive`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function re(e,t){return(e===`theme`||e===`$theme`)&&typeof t==`string`}function ie(e){if(typeof e.theme==`string`&&e.theme.length>0)return e.theme;if(typeof e.$theme==`string`&&e.$theme.length>0)return e.$theme}function ae(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function k(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function oe(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 se(e,t){for(let{prefix:t,category:n}of w)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 A(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 ce(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`:A(r)}function le(e,t,r,a,o,s,c){if(!i(e))return;let l=o||te(e)||D(e),u=k(e,r),d=ie(e)??s;if(T(e)){let r=oe(e),i=t.join(`.`),o=se(i,u)??(l||u===`primitive`||u===`palette`?`color`:void 0),s=n(r,u),f=o&&C.has(o)||u===`color`||u===`palette`||u===`primitive`||u===`shadow`?s:h(r,u);c.push({path:i,type:u===`palette`||u===`primitive`?`color`:u,value:r,cssValue:s,tamaguiValue:f,category:o,tokenKey:o?ce(i):void 0,description:ae(e),theme:a,...d?{childTheme:d}:{},...l?{primitive:!0}:{}});return}for(let[n,r]of Object.entries(e))n.startsWith(`$`)&&n!==`$palette`&&n!==`$primitive`||ee(n,r)||ne(n,r)||re(n,r)||le(r,[...t,n],u,a,l,d,c)}function ue(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;le(t.tokens,[],void 0,e,!1,void 0,r)}return n?r.filter(e=>!e.type||n.has(e.type)):r}const de=/^\{([^{}]+)\}$/,fe=/^(?:typography|type|text)$/i,pe=/^(?:font|fonts|font-family|fontFamily)$/i,me=/^(?:font-size|fontSize)$/i,he=/^(?:font-weight|fontWeight)$/i,ge=/^(?:line-height|lineHeight|leading)$/i,_e=/^(?:letter-spacing|letterSpacing|tracking)$/i,ve=/^(?:[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,ye=[`fontFamily`,`font-family`,`family`],be=[`fontSize`,`font-size`,`size`],xe=[`fontWeight`,`font-weight`,`weight`],Se=[`lineHeight`,`line-height`,`leading`],Ce=[`letterSpacing`,`letter-spacing`,`tracking`],we={1:12,2:14,3:16,4:18,5:20,6:24,7:28,8:32,9:40,10:48};function j(e){if(typeof e==`string`)return de.exec(e.trim())?.[1]?.trim()}function M(e,t){let n=j(e);if(!n)return e;let r=t.get(n),i=new Set([n]);for(let e=0;e<8&&r;e++){let e=j(r.value);if(!e||i.has(e))return r.value;i.add(e),r=t.get(e)}return r?.value??e}function N(e,t){for(let n of t)if(e[n]!==void 0&&e[n]!==null)return e[n]}function P(e){return(e.split(`,`)[0]?.trim()??e).replaceAll(/^["']|["']$/g,``)}function Te(e){if(typeof e==`string`){let t=e.trim();return t.length===0||j(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 Ee(e){return Number.isInteger(e)?e:Math.round(e*1e3)/1e3}function F(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 De(e){if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`string`){let t=e.trim();if(t.length===0||j(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 Oe(e,t){let n=F(e);if(n!=null)return Ee(t!=null&&n>0&&n<=4?n*t:n)}function I(e,t){return t.test(e.split(`.`)[0]??``)}function ke(e){return e.split(`.`).filter(Boolean).at(-1)??e}function L(e,t){let n=e.split(`.`).filter(Boolean);return n[0]&&t.test(n[0])&&n.shift(),n}function R(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 R([e])}}function Ae(e){return e.role?z(e.role):z(e.name)}function je(e){let t=L(e,fe);if(t.length===0)return`body`;let n=t.at(-1);return n&&t.length>=2&&ve.test(n)&&!n.includes(`_`)?`${t.slice(0,-1).join(`-`)}_${n}`:t.join(`-`)}function Me(e){return z(L(e,pe)[0]??ke(e))}function Ne(e,t){let n=L(e,t);return n.length===0||n.length===1&&/^(?:DEFAULT|default)$/i.test(n[0])?`true`:R(n)}function Pe(e){return e.type===`typography`&&i(e.value)}function Fe(e){return e.category===`fontSize`||e.category===`fontWeight`||Ie(e)||Le(e)||Re(e)||ze(e)?!1:e.type===`fontFamily`||I(e.path,pe)}function Ie(e){return e.category===`fontSize`||I(e.path,me)}function Le(e){return e.category===`fontWeight`||e.type===`fontWeight`||I(e.path,he)}function Re(e){return I(e.path,ge)}function ze(e){return I(e.path,_e)}function Be(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 Ve(e){let t=new Map;for(let n of Object.values(e)){let e=Ae(n);t.has(e)&&(e=Be(t,R([n.name]))),t.set(e,n)}return t}function He(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=P(t).toLowerCase();return r.find(e=>f(e).toLowerCase()===i||e.title.toLowerCase()===i||e.name.toLowerCase()===i)}function Ue(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 B(e,t){return{...e,webFamily:d(t),nativeFamily:f(t),face:t.source===`local`?Ue(t):e.face}}function V(e){return{key:e,webFamily:`system-ui, sans-serif`,nativeFamily:`system-ui`,size:{},lineHeight:{},weight:{},letterSpacing:{}}}function We(e,t){return{...e,webFamily:t,nativeFamily:P(t)}}const Ge=/^(?:font-size|fontSize|font-weight|fontWeight|line-height|lineHeight|leading|letter-spacing|letterSpacing|tracking)$/i;function H(e,t){let n={true:e},r=j(t);if(!r)return n;let i=Ne(r,Ge);return i&&i!==`true`&&(n[i]=e),n}function Ke(e){return Object.keys(e.size).length>0?e:{...e,size:{...we}}}function qe(e,t,n,r){if(!i(t.value))return e;let a=N(t.value,ye),o=j(a),s=Te(M(a,n)),c=He(r,s,o),l=e;c?l=B(l,c):s&&(l=We(l,s));let u=N(t.value,be),d=F(M(u,n));d!=null&&(l={...l,size:H(d,u)});let f=N(t.value,xe),p=De(M(f,n));p&&(l={...l,weight:H(p,f)});let m=N(t.value,Ce),h=F(M(m,n));h!=null&&(l={...l,letterSpacing:H(h,m)});let g=N(t.value,Se),_=Oe(M(g,n),l.size.true??d);return _!=null&&(l={...l,lineHeight:H(_,g)}),Je(l)}function Je(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 Ye(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 Ve(t))i(B(V(e),n));for(let a of e){if(!Fe(a)||Pe(a))continue;let e=Me(a.path),o=Te(M(a.value,n)),s=r.get(e)??V(e),c=He(t,o,a.path),l=s;c?l=B(l,c):(o&&s.webFamily===V(e).webFamily||o&&!r.has(e))&&(l=We(l,o)),i(l)}for(let a of e){if(!Pe(a))continue;let e=je(a.path);i(qe(r.get(e)??V(e),a,n,t))}return[...r.values()].map(Ke).toSorted((e,t)=>e.key.localeCompare(t.key))}function Xe(e){return/^\d+$/.test(e)||/^[A-Z_$][\w$]*$/i.test(e)?e:m(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}${Xe(e)}: ${m(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 Qe(e,t){let n=m(e.webFamily),r=m(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 $e(e){return`# Installing Tamagui Config
|
|
6
6
|
|
|
7
7
|
Generated by \`@razorwind/tamagui\`.
|
|
8
8
|
|
|
9
9
|
## Files
|
|
10
10
|
|
|
11
|
-
- \`${e.outputPath}\` — Tamagui
|
|
11
|
+
- \`${e.outputPath}\` — Tamagui config (\`createTamagui\` + \`createThemes\` with light, dark, and nested semantic themes)
|
|
12
12
|
|
|
13
13
|
## Setup
|
|
14
14
|
|
|
@@ -48,81 +48,70 @@ 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
|
|
52
|
-
`)}\n${` `.repeat(Math.max(t-2,0))}}`}function
|
|
53
|
-
`)}\n${` `.repeat(Math.max(t-2,0))}}`}function
|
|
54
|
-
`)}\n${r}}`}const wt=/^\{([^{}]+)\}$/,Tt=/\{([^{}]+)\}/g,Et=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/,Dt=/var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g;function G(e){return{byPath:new Map(e.map(e=>[e.path,e])),byCssVar:new Map(e.map(e=>[s(e.path),e]))}}function Ot(e){if(typeof e==`string`)return wt.exec(e.trim())?.[1]?.trim()}function kt(e){if(typeof e==`string`)return Et.exec(e.trim())?.[1]}function At(e){return Ot(e)!=null||kt(e)!=null}function jt(e){return/var\(|\{[^{}]+\}/.test(e)}function K(e,t){let n=q(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&&!At(e))return e}function Mt(e,t){return e.replace(Tt,(e,n)=>{let r=t.byPath.get(n.trim());return r?K(r,t)??e:e}).replace(Dt,(e,n)=>{let r=t.byCssVar.get(n);return r?K(r,t)??e:e})}function q(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=Ot(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=kt(r.value)??kt(r.cssValue)??kt(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 Nt(e){return/^[A-Z_$][\w$]*$/i.test(e)?`theme.${e}`:`theme[${m(e)}]`}function Pt(e,t){return t<1?e:t+1-e}function Ft(e,t){return e.length<2?!1:X(e,t).some((t,n)=>t!==e[n])}function It(e,t,n,r){let i=n[t];if(!i||r!==`dark`)return e;let a=$(i,t);return a.length<2||!Ft(a.map(([,e])=>e),r)?e:Pt(e,a[a.length-1][0])}function Lt(e,t,n,r){let i=J(e);if(!i)return;let a=It(i.step,i.name,n,r);if(t&&i.name.toLowerCase()===t.toLowerCase()||n[i.name])return`${i.name}${a}`}function Rt(e){if(e>=1&&e<=12)return e;if(e>=100&&e<=900&&e%100==0)return e/100}function J(e){let t=e.path.split(`.`).filter(Boolean),n=t.at(-1);if(n&&/^\d+$/.test(n)){let e=Rt(Number(n)),r=t.at(-2);if(e!=null&&r&&!/^(?:color|colours?|palette)$/i.test(r))return{name:D([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=Rt(Number(a));if(o!=null)return{name:i,step:o}}function zt(e,t,n,r){let i=e[t]??{};i[`${t}${n}`]=r,e[t]=i}function Bt(e){let t={};for(let n of e){if(typeof n.tamaguiValue!=`string`)continue;let e=J(n);e&&zt(t,e.name,e.step,n.tamaguiValue)}return Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=3))}function Y(e){let t={};for(let n of e){if(!n.primitive||typeof n.tamaguiValue!=`string`)continue;let e=J(n);e&&zt(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:Bt(e)}function X(e,t){if(e.length<2)return[...e];let n=Wt(e[0]),r=Wt(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 Vt(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 Ht(e){return e>1?e/100:e}function Ut(e,t){let n=RegExp(`^${t}\\((.+)\\)$`,`i`).exec(e.trim());if(n?.[1])return n[1].split(/[\s,/]+/).filter(Boolean)}function Wt(e){let t=e.trim();if(!t||t.startsWith(`var(`)||t.includes(`{`))return;let n=Vt(t);if(n!=null)return n;let r=Ut(t,`oklch`);if(r?.[0]){let e=Q(r[0]);return e==null?void 0:Ht(e)}let i=Ut(t,`hsla?`);if(i?.[2]){let e=Q(i[2]);return e==null?void 0:Ht(e)}let a=Ut(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 $(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 Gt(e,t,n){let r=$(e,t);if(r.length===0)return e;let i=X(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,t,n){let r=t[n];return e.find(([,e])=>e===r)?.[0]??e[n]?.[0]??n+1}function qt(e,t,n,r){let i=$(e,n);if(i.length===0)return{};let a=X(i.map(([,e])=>e),r),o={};for(let[e,[r]]of i.entries()){let s=t[`${n}${Kt(i,a,e)}`];s&&(o[`${n}${r}`]=H(s))}return o}function Jt(e,t,n,r){let i=$(e,n);if(i.length<2)return;let a=X(i.map(([,e])=>e),r),o=[];for(let[e]of i.entries()){let r=t[`${n}${Kt(i,a,e)}`];if(!r)return;o.push(H(r))}let s=[...o],c=s.at(-1);if(c!=null){for(;s.length<12;)s.push(c);return`[${s.join(`,`)}]`}}function Yt(e,t){return $(e,t).length>=2}function Xt(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=$(e,t);if(!(r.length<2))return Xt(X(r.map(([,e])=>e),n))}function Qt(e){let t=new Map;for(let n of e){let e=n.childTheme?.trim();if(!e)continue;let r=e.toLowerCase();lt(r)||ut(r)||t.has(r)||t.set(r,D([e]))}return[...t.values()].toSorted((e,t)=>e.localeCompare(t))}function $t(e,t){let n=t.toLowerCase(),r=e.split(/(?=[A-Z])/).filter(Boolean).filter(e=>e.toLowerCase()!==n);if(r.length!==0)return D(r)}function en(e){return e.toLowerCase()===`base`}function tn(e){return Qt(e).filter(e=>!en(e))}function nn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}const rn=[{alias:`background`,source:e=>`background${e}`},{alias:`backgroundDisabled`,source:e=>`background${e}Disabled`},{alias:`backgroundHover`,source:e=>`background${e}Hover`},{alias:`backgroundSubtle`,source:e=>e===`Primary`?`backgroundSecondary`:`background${e}Subtle`},{alias:`border`,source:e=>`border${e}`},{alias:`borderDisabled`,source:e=>`border${e}Disabled`},{alias:`borderHover`,source:e=>`border${e}Hover`},{alias:`borderSubtle`,source:e=>e===`Primary`?`borderSecondary`:`border${e}Subtle`},{alias:`foreground`,source:e=>`foreground${e}`},{alias:`foregroundDisabled`,source:e=>`foreground${e}Disabled`},{alias:`foregroundHover`,source:e=>`foreground${e}Hover`},{alias:`foregroundOn`,source:e=>`foregroundOn${e}`},{alias:`foregroundOnDisabled`,source:e=>`foregroundOn${e}Disabled`},{alias:`foregroundOnHover`,source:e=>`foregroundOn${e}Hover`}];function an(e,t,n){let r=new Set([...Object.keys(e),...Object.keys(t)]),i=[`Primary`,...n.map(nn)],a=[];for(let{alias:e,source:t}of rn)i.some(e=>r.has(t(e)))&&a.push(e);return a}function on(e){let t={};for(let[n,r]of Object.entries(e)){if(en(n))continue;let e=Object.values(r);if(e.length===0)continue;let i={};for(let[t,r]of e.entries())i[`${n}${t+1}`]=r;Object.keys(i).length===1&&(i[`${n}2`]=e[0]),t[n]=i}return t}function sn(e){let t=e.split(/(?=[A-Z])/).filter(Boolean),n=t.at(-1)?.toLowerCase();if((n===`primary`||n===`secondary`||n===`tertiary`)&&!(t.length<2))return{role:D(t.slice(0,-1)),rank:n}}function cn(e){return e.category===`color`&&!e.primitive&&!!e.tokenKey}function ln(e,t,n){let r=new Map,i={};for(let a of e){if(!cn(a)||!a.tokenKey)continue;let e=a.childTheme?.toLowerCase();if(e&&e!==`base`)continue;let o=xt(a,t,n);if(!o)continue;let s=sn(a.tokenKey);if(s){let e=r.get(s.role)??{};e[s.rank]=o,r.set(s.role,e);continue}if(e===`base`){let e=$t(a.tokenKey,`base`);e&&(i[e]=o)}}let a={...i};for(let[e,t]of r){t.primary&&(a[e]=t.primary);let n=t.secondary??t.tertiary;n&&(a[`${e}Subtle`]=n)}return a}function un(e,t){let n=G(e),r={};for(let i of Qt(e)){if(en(i)){let a=ln(e,n,t);Object.keys(a).length>0&&(r[i]=a);continue}let a={},o=i.toLowerCase();for(let r of e){if(!cn(r)||r.childTheme?.toLowerCase()!==o)continue;let e=$t(r.tokenKey,i);if(!e)continue;let s=xt(r,n,t);s&&(a[e]=s)}Object.keys(a).length>0&&(r[i]=a)}return r}function dn(e,t){let n=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),{name:e,scale:t}]));for(let e of st){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 fn(e){let t=e.filter(e=>e.category===`color`||e.primitive),n=Y(B(t,`light`)),r=Y(B(t,`dark`)),i=dn(n,`light`),a=dn(r,`dark`);return{lightPalette:i?.palette,darkPalette:a?.palette,lightBaseName:i?.name,darkBaseName:a?.name}}function pn(e,t,n){let r=Y(e),{byPath:i,byCssVar:a}=G(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=q(s,i,a),c=Lt(e,t,r,n);if(c){o[s.tokenKey]=Nt(c);continue}let l=e.tamaguiValue;At(l)||At(e.cssValue)||(typeof l==`string`||typeof l==`number`)&&(o[s.tokenKey]=m(l))}return o}function mn(e){return e.replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${")}function hn(e,t,n,r,i){let a=q(e,t.byPath,t.byCssVar),o=Lt(a,n,r,i);if(o)return{kind:`theme`,property:o};let s=K(a,t);if(s)return{kind:`text`,value:s}}function gn(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=hn(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 _n(e){return e.some(e=>e.kind===`theme`)?`\`${e.map(e=>e.kind===`theme`?`\${${Nt(e.property)}}`:mn(e.value)).join(``)}\``:m(e.map(e=>e.kind===`text`?e.value:``).join(``))}function vn(e,t,n){let r=G(e),i=Y(e.filter(e=>e.category===`color`)),a={};for(let o of e){if(!dt(o)||!o.tokenKey)continue;let e=typeof o.tamaguiValue==`string`?o.tamaguiValue:o.cssValue;if(typeof e!=`string`||e.length===0)continue;let s=gn(e,r,t,i,n);s&&(a[o.tokenKey]=_n(s))}return a}function yn(e,t,n,r,i){let a=new Set([...Object.keys(e),...Object.keys(t)]);if(a.size===0)return;let o=[];for(let s of[...a].toSorted((e,t)=>e.localeCompare(t))){let a=e[s]??t[s]??{},c=t[s]??e[s]??{};if(Object.keys(a).length===0||Object.keys(c).length===0)continue;let l=Yt(a,s)||Yt(c,s),u,d;if(i&&l?(u=qt(a,n[s]??r[s]??{},s,`light`),d=qt(c,r[s]??n[s]??{},s,`dark`),Object.keys(u).length===0&&(u=a),Object.keys(d).length===0&&(d=c)):l?(u=Gt(a,s,`light`),d=Gt(c,s,`dark`)):(u=a,d=c),Object.keys(u).length===0||Object.keys(d).length===0)continue;let f=l&&!i?(e,t)=>W(e,t):St;o.push(` ${s}: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
assign("backgroundHover", \`background\${role}Hover\`);
|
|
77
|
-
assign("backgroundSubtle", role === "Primary" ? "backgroundSecondary" : \`background\${role}Subtle\`);
|
|
78
|
-
assign("border", \`border\${role}\`);
|
|
79
|
-
assign("borderDisabled", \`border\${role}Disabled\`);
|
|
80
|
-
assign("borderHover", \`border\${role}Hover\`);
|
|
81
|
-
assign("borderSubtle", role === "Primary" ? "borderSecondary" : \`border\${role}Subtle\`);
|
|
82
|
-
assign("foreground", \`foreground\${role}\`);
|
|
83
|
-
assign("foregroundDisabled", \`foreground\${role}Disabled\`);
|
|
84
|
-
assign("foregroundHover", \`foreground\${role}Hover\`);
|
|
85
|
-
assign("foregroundOn", \`foregroundOn\${role}\`);
|
|
86
|
-
assign("foregroundOnDisabled", \`foregroundOn\${role}Disabled\`);
|
|
87
|
-
assign("foregroundOnHover", \`foregroundOn\${role}Hover\`);
|
|
88
|
-
return {
|
|
89
|
-
...values,
|
|
90
|
-
...overlay
|
|
91
|
-
};
|
|
92
|
-
}`}function En(e){return` ${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: string;`}function Dn(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(En),`}`,``]}function On(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=B(s,`light`),l=B(s,`dark`),u=l.length>0?l:c,d=yt(c,l),f=Object.keys(d).length>0,p=bt(c),h=bt(u),g=Y(c),_=Y(u),ee=tn([...c,...u]),te={...on(un(c,d)),...g},v={...on(un(u,d)),..._},{lightPalette:y,darkPalette:b,lightBaseName:x,darkBaseName:S}=fn(t),ne=yn(te,v,p,h,f),re=f&&x?Jt(g[x]??{},p[x]??{},x,`light`):void 0,ie=f&&S?Jt(_[S]??{},h[S]??{},S,`dark`):void 0,ae=B(t,`light`),oe=B(t,`dark`),se=l.length>0?oe:ae,ce=l.length>0?S:x,C={...pn(c,x,`light`),...vn(ae,x,`light`)},w={...pn(l.length>0?l:c,ce,`dark`),...vn(se,ce,`dark`)},le=Dn(Cn({lightSemantic:C,darkSemantic:w,lightScales:te,darkScales:v,lightPalette:y,darkPalette:b,semanticRoles:ee}),{specName:e.name}),ue=vt(ae),T=[];Object.keys(d).length>0&&T.push(` color: ${W(d,4)}`);for(let e of pt){let t=ue[e];t&&Object.keys(t).length>0&&T.push(` ${e}: ${W(t,4)}`)}let E=[];re?E.push(` lightPalette: ${re}`):y&&E.push(` lightPalette: ${m(y)}`),ie?E.push(` darkPalette: ${ie}`):b&&E.push(` darkPalette: ${m(b)}`),ne&&E.push(` childrenThemes: ${ne}`),(Object.keys(C).length>0||Object.keys(w).length>0)&&E.push(Tn(C,w));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 "${ct[a]}";`),n.importConfig&&D.push(`import userConfig from "${n.importConfig}";`);let O=[`createTamagui`,`px`];T.length>0&&O.push(`createTokens`);let k=$e(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(`,
|
|
93
|
-
`),`});`,``);let de=E.length>0?`createV5Theme({\n${E.join(`,
|
|
94
|
-
`)}\n})`:`createV5Theme()`;(Object.keys(C).length>0||Object.keys(w).length>0)&&A.push(wn(ee),``),A.push(`const themes = ${de};`,``);let j=new Map;if(k.length>0)for(let[e,t]of k.entries()){let n=tt(t.key,e);j.set(t.key,n),A.push(nt(t,n),``)}let M=[];if(i&&M.push(` ...defaultConfig`),a!==!1&&M.push(` animations`),T.length>0&&(i?M.push(` tokens: {
|
|
95
|
-
...defaultConfig.tokens,
|
|
96
|
-
...tokens,
|
|
97
|
-
space: {
|
|
98
|
-
...defaultConfig.tokens.space,
|
|
99
|
-
...tokens.space
|
|
100
|
-
},
|
|
101
|
-
size: {
|
|
102
|
-
...defaultConfig.tokens.size,
|
|
103
|
-
...tokens.size
|
|
104
|
-
},
|
|
105
|
-
radius: {
|
|
106
|
-
...defaultConfig.tokens.radius,
|
|
107
|
-
...tokens.radius
|
|
108
|
-
},
|
|
109
|
-
zIndex: {
|
|
110
|
-
...defaultConfig.tokens.zIndex,
|
|
111
|
-
...tokens.zIndex
|
|
51
|
+
`}const et=new Set([`default`,`light`,`theme`]),tt=/^base(?:[A-Z]\w*|[._-].+)?$/i,nt=/^ring(?:\.|$)/i,rt={css:`@tamagui/config/v5-css`,rn:`@tamagui/config/v5-rn`,reanimated:`@tamagui/config/v5-reanimated`,motion:`@tamagui/config/v5-motion`};function it(e){return et.has(e)}function at(e){return e===`dark`}function W(e,t){let n=new Map,r=t===`dark`?at:it;for(let t of e){let e=t.theme?.toLowerCase();(!e||tt.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 ot(e){return nt.test(e.path)&&e.category===`shadow`}const st=new Set([`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`]);function ct(e){return!e.primitive&&!!e.tokenKey&&(e.type===`shadow`||e.category!=null&&st.has(e.category))}const lt=new Set([`fontSize`,`blur`]),ut=[`space`,`size`,`radius`,`zIndex`,`blur`,`fontSize`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`,`fontWeight`];function dt(e){return/^px\(-?\d/.test(e)}function ft(e){if(e.category===`radius`&&e.tokenKey?.startsWith(`borderRadius`)){let t=e.tokenKey.replace(/^borderRadius/,``);return t?A([t]):e.tokenKey}return e.tokenKey??``}function pt(e,t){let n=$(e,t.byPath,t.byCssVar).tamaguiValue;if(e.category&<.has(e.category)&&typeof n==`number`)return`px(${n})`;if(typeof n==`string`){let r=Pt(n,t);return e.category===`dropShadow`?mt(r):r}return n}function mt(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 ht(e){let t={},n=At(e);for(let r of e){if(!r.category||r.category===`color`||!r.tokenKey||ot(r))continue;let e=ft(r);if(!e)continue;let i=pt(r,n);if(typeof i==`string`&&Nt(i))continue;let a=t[r.category]??{};a[e]=i,t[r.category]=a}return t}function G(e){let t=e.path.replace(/^color\./i,``).replaceAll(`.`,``);return e.theme?`${e.theme}${t[0]?.toUpperCase()??``}${t.slice(1)}`:t}function K(e){return`tokens.color.${e}.val`}const gt=[`base`,`gray`,`grey`,`neutral`],_t=[`accent`,`brand`],vt=[`"#ffffff"`,`"#000000"`],yt=[`"#000000"`,`"#ffffff"`];function bt(e){if(e.category!==`color`||!e.primitive)return;let t=e.path.replace(/^color\./i,``).split(`.`).filter(Boolean),n=t.at(-1);if(!n||t.length<2)return;let r=Number(n);if(Number.isFinite(r))return{name:t.slice(0,-1).join(`.`).toLowerCase(),step:r}}function xt(e,t){let n=G(e);if(n in t)return K(n);let r=typeof e.cssValue==`string`&&e.cssValue.length>0?e.cssValue:typeof e.tamaguiValue==`string`?e.tamaguiValue:void 0;return r?m(r):`"#000000"`}function St(e,t,n){let r=new Map;for(let t of e){let e=bt(t);if(!e)continue;let i=r.get(e.name)??[];i.push({step:e.step,expression:xt(t,n)}),r.set(e.name,i)}for(let e of t){let t=r.get(e);if(!t||t.length===0)continue;let n=new Map;for(let e of t.toSorted((e,t)=>e.step-t.step))n.set(e.step,e.expression);return[...n.values()]}}function q(e,t){return e.length>=2?e:e.length===1?[e[0],t[1]??`"#000000"`]:[...t]}function Ct(e,t,n,r,i,a){let o=St(e,n,r),s=St(t,n,r);if(o&&s)return{light:q(o,i),dark:q(s,a)};if(o){let e=q(o,i);return{light:e,dark:[...e].toReversed()}}if(s){let e=q(s,a);return{light:[...e].toReversed(),dark:e}}return{light:[...i],dark:[...a]}}function wt(e,t){let n={},r=(e,t)=>{let r=t.cssValue;typeof r!=`string`||r.length===0||Mt(r)||r===`[object Object]`||(n[e]=r)};for(let t of e)t.tokenKey&&(t.primitive?r(G(t),t):r(t.tokenKey,t));for(let e of t)!e.tokenKey||!e.primitive||r(G(e),e);return n}function J(e,t,n,r){let i=n[r];if(typeof i!=`string`)return!1;let a=Q(e,t);return a!=null&&a===i}function Tt(e,t,n){if(e.tokenKey&&J(e,t,n,e.tokenKey))return K(e.tokenKey);let r=$(e,t.byPath,t.byCssVar);if(r.tokenKey&&J(e,t,n,r.tokenKey))return K(r.tokenKey);if(r.primitive){let i=G(r);if(J(e,t,n,i))return K(i)}let i=Q(e,t);if(i)return m(i)}function Y(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`&&dt(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 X(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])=>`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: ${t}`).join(`,
|
|
53
|
+
`)}\n${` `.repeat(Math.max(t-2,0))}}`}const Et=/^\{([^{}]+)\}$/,Dt=/\{([^{}]+)\}/g,Ot=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/,kt=/var\((--[^),\s]+)(?:\s*,[^)]*)?\)/g;function At(e){return{byPath:new Map(e.map(e=>[e.path,e])),byCssVar:new Map(e.map(e=>[s(e.path),e]))}}function jt(e){if(typeof e==`string`)return Et.exec(e.trim())?.[1]?.trim()}function Z(e){if(typeof e==`string`)return Ot.exec(e.trim())?.[1]}function Mt(e){return jt(e)!=null||Z(e)!=null}function Nt(e){return/var\(|\{[^{}]+\}/.test(e)}function Q(e,t){let n=$(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&&!Mt(e))return e}function Pt(e,t){return e.replace(Dt,(e,n)=>{let r=t.byPath.get(n.trim());return r?Q(r,t)??e:e}).replace(kt,(e,n)=>{let r=t.byCssVar.get(n);return r?Q(r,t)??e:e})}function $(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=jt(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=Z(r.value)??Z(r.cssValue)??Z(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 Ft(e,t){let n=t.toLowerCase(),r=e.split(/(?=[A-Z])/).filter(Boolean).filter(e=>e.toLowerCase()!==n);if(r.length!==0)return A(r)}function It(e){return e.category===`color`&&!e.primitive&&!!e.tokenKey}function Lt(e){return ct(e)&&A(e.path.split(`.`).filter(Boolean))||e.tokenKey}function Rt(e){let t=e.toLowerCase();return it(t)||at(t)}function zt(e,t,n){let r=Lt(t);if(!r)return;let i=t.childTheme?.trim();if(!i||Rt(i)){e.base[r]=n;return}let a=A([i]),o=Ft(r,a);if(!o)return;let s=e.children[a]??{};s[o]=n,e.children[a]=s}function Bt(e,t){let n=typeof e.tamaguiValue==`string`?e.tamaguiValue:e.cssValue;if(typeof n!=`string`||n.length===0)return;let r=Pt(n,t);return r.length===0||Nt(r)?void 0:m(e.category===`dropShadow`?mt(r):r)}function Vt(e,t){let n=At(e),r={base:{},children:{}};for(let i of e){if(It(i)){let e=Tt(i,n,t);e&&zt(r,i,e);continue}if(!ct(i))continue;let e=Bt(i,n);if(!e)continue;let a=i.childTheme?.trim();(a&&!Rt(a)||ot(i))&&zt(r,i,e)}return r}function Ht(e){let t=new Set;for(let n of e){for(let e of Object.keys(n.base))t.add(e);for(let e of Object.values(n.children))for(let n of Object.keys(e))t.add(n)}return[...t].toSorted((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function Ut(e){return` ${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: string;`}function Wt(e,t){if(e.length!==0)return[`/**`,` * Theme values available on \`useTheme()\` and \`$\` style props for the ${t.specName||`design system`}.`,` *`," * Derived from semantic color tokens mapped by `createThemes`. Nested"," * themes (`light_primary`, `dark_danger`, …) come from each token's"," * `theme` / `$theme` property.",` *`,` * @see https://tamagui.dev/docs/intro/themes`,` */`,`export interface AppTheme {`,...e.map(Ut),`}`,``]}function Gt(e){return Object.keys(e).length>0}function Kt(e){return/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}function qt(e,t){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0));return`[\n${e.map(e=>`${n}${e}`).join(`,
|
|
54
|
+
`)}\n${r}]`}function Jt(e,t,n){let r=` `.repeat(n),i=` `.repeat(Math.max(n-2,0)),a=n+2;return`{
|
|
55
|
+
${r}light: ${qt(e,a)},
|
|
56
|
+
${r}dark: ${qt(t,a)}
|
|
57
|
+
${i}}`}function Yt(e,t,n){let r=` `.repeat(n),i=` `.repeat(Math.max(n-2,0)),a=n+2;return`{
|
|
58
|
+
${r}light: ${X(e,a)},
|
|
59
|
+
${r}dark: ${X(t,a)}
|
|
60
|
+
${i}}`}function Xt(e,t){let n=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t));if(n.length===0)return`{}`;let r=` `.repeat(t),i=` `.repeat(Math.max(t-2,0)),a=t+2;return`{\n${n.map(([e,t])=>`${r}${Kt(e)}: ${X(t,a)}`).join(`,
|
|
61
|
+
`)}\n${i}}`}function Zt(e,t){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0));return`{\n${e.map(e=>`${n}${Kt(e)}: {}`).join(`,
|
|
62
|
+
`)}\n${r}}`}function Qt(e,t){return`const childThemeExtras: {
|
|
63
|
+
light: Record<string, Record<string, string>>;
|
|
64
|
+
dark: Record<string, Record<string, string>>;
|
|
65
|
+
} = {
|
|
66
|
+
light: ${Xt(e,4)},
|
|
67
|
+
dark: ${Xt(t,4)}
|
|
68
|
+
};`}function $t(e,t,n){return Object.fromEntries(n.map(n=>[n,e.children[n]??t.children[n]??{}]))}function en(e,t,n,r,i){let a=[...new Set([...Object.keys(e.children),...Object.keys(t.children)])].toSorted((e,t)=>e.localeCompare(t)),o=a.includes(`accent`),s=a.filter(e=>e!==`accent`),c=Gt(e.base)||Gt(t.base);if(!c&&a.length===0)return{statements:[],hasThemes:!1};let l=Ct(r,i,gt,n,vt,yt),u=Ct(r,i,_t,n,l.light,l.dark),d=[],f=[` componentThemes: false`],p=[` palette: ${Jt(l.light,l.dark,6)}`];if(c&&p.push(` extra: ${Yt(e.base,t.base,6)}`),f.push(` base: {\n${p.join(`,
|
|
69
|
+
`)}\n }`),o){let n=e.children.accent??t.children.accent??{},r=t.children.accent??e.children.accent??{};f.push(` accent: {
|
|
70
|
+
palette: ${Jt(u.light,u.dark,6)},
|
|
71
|
+
extra: ${Yt(n,r,6)}
|
|
72
|
+
}`)}if(s.length>0){let n=$t(e,t,s),r=$t(t,e,s);d.push(Qt(n,r),``),f.push(` childrenThemes: ${Zt(s,4)}`);let i=o?` || child === "accent"`:``;f.push(` getTheme: ({ name, theme, scheme }) => {
|
|
73
|
+
const child = name.replace(/^(?:light|dark)_/, "");
|
|
74
|
+
if (child === name${i}) {
|
|
75
|
+
return theme;
|
|
112
76
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
77
|
+
|
|
78
|
+
const extras = childThemeExtras[scheme ?? "light"][child];
|
|
79
|
+
|
|
80
|
+
return extras ? { ...theme, ...extras } : theme;
|
|
81
|
+
}`)}return d.push(`const themes = createThemes({\n${f.join(`,
|
|
82
|
+
`)}\n});`),{statements:d,hasThemes:!0}}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=W(s,`light`),l=W(s,`dark`),u=l.length>0,d=wt(c,l),f=W(t,`light`),p=u?W(t,`dark`):f,h=Vt(f,d),g=Vt(p,d),{statements:_,hasThemes:v}=en(h,g,d,c,l),y=Wt(Ht(u?[h,g]:[h]),{specName:e.name}),b=ht(f),x=[];Object.keys(d).length>0&&x.push(` color: ${Y(d,4)}`);for(let e of ut){let t=b[e];t&&Object.keys(t).length>0&&x.push(` ${e}: ${Y(t,4)}`)}let S=[`import { isWeb } from '@tamagui/constants';`];i&&S.push(`import { defaultConfig } from "@tamagui/config/v5";`),a!==!1&&S.push(`import { animations } from "${rt[a]}";`),n.importConfig&&S.push(`import userConfig from "${n.importConfig}";`),v&&S.push(`import { createThemes } from "@tamagui/theme-builder";`);let C=[`createTamagui`,`px`];x.length>0&&C.push(`createTokens`);let w=Ye(t,r);w.length>0&&C.push(`createFont`),S.push(`import { ${C.join(`, `)} } from "@tamagui/core";`);let T=[`/* eslint-disable */`,``,`/*`,` * Generated by @razorwind/tamagui — Do not edit by hand.`,` * `,` * @see https://tamagui.dev/docs/core/configuration`,` * @see https://tamagui.dev/docs/intro/themes`,` * @see https://tamagui.dev/docs/guides/theme-builder`,` */`,``,...S,``];x.length>0&&T.push(`const tokens = createTokens({`,x.join(`,
|
|
83
|
+
`),`});`,``),_.length>0&&T.push(..._,``);let E=new Map;if(w.length>0)for(let[e,t]of w.entries()){let n=Ze(t.key,e);E.set(t.key,n),T.push(Qe(t,n),``)}let D=[];if(i&&D.push(` ...defaultConfig`),a!==!1&&D.push(` animations`),x.length>0&&(i?D.push(` tokens: {
|
|
84
|
+
...defaultConfig.tokens,
|
|
85
|
+
...tokens,
|
|
86
|
+
space: {
|
|
87
|
+
...defaultConfig.tokens.space,
|
|
88
|
+
...tokens.space
|
|
89
|
+
},
|
|
90
|
+
size: {
|
|
91
|
+
...defaultConfig.tokens.size,
|
|
92
|
+
...tokens.size
|
|
93
|
+
},
|
|
94
|
+
radius: {
|
|
95
|
+
...defaultConfig.tokens.radius,
|
|
96
|
+
...tokens.radius
|
|
97
|
+
},
|
|
98
|
+
zIndex: {
|
|
99
|
+
...defaultConfig.tokens.zIndex,
|
|
100
|
+
...tokens.zIndex
|
|
101
|
+
}
|
|
102
|
+
}`):D.push(` tokens`)),v&&D.push(` themes`),E.size>0){let e=[...E.entries()].map(([e,t])=>` ${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: ${t}`);i?D.push(` fonts: {
|
|
103
|
+
...defaultConfig.fonts,
|
|
104
|
+
${e.join(`,
|
|
116
105
|
`)}
|
|
117
|
-
|
|
118
|
-
${e.join(`,
|
|
106
|
+
}`):D.push(` fonts: {
|
|
107
|
+
${e.join(`,
|
|
119
108
|
`)}
|
|
120
|
-
|
|
121
|
-
* The Tamagui
|
|
109
|
+
}`)}return n.shorthands&&D.push(` shorthands: ${Y(n.shorthands,4)}`),n.media&&D.push(` media: ${m(n.media)}`),n.defaultFont&&D.push(` defaultFont: ${m(n.defaultFont)}`),T.push(``,...y??[],`/**
|
|
110
|
+
* The Tamagui config for the ${e.name||`design system`}.
|
|
122
111
|
*
|
|
123
|
-
* @see https://tamagui.dev/docs/core/
|
|
112
|
+
* @see https://tamagui.dev/docs/core/configuration
|
|
124
113
|
*/
|
|
125
|
-
export const config = createTamagui({`,
|
|
126
|
-
`),n.importConfig?`, ...userConfig `:``,`});`,``,`export type AppConfig = typeof config;`,``),o&&
|
|
127
|
-
`)}function
|
|
114
|
+
export const config = createTamagui({`,D.join(`,
|
|
115
|
+
`),n.importConfig?`, ...userConfig `:``,`});`,``,`export type AppConfig = typeof config;`,``),o&&T.push(`declare module "@tamagui/core" {`,` // eslint-disable-next-line @typescript-eslint/no-empty-object-type`,` interface TamaguiCustomConfig extends AppConfig {}`,`}`,``),T.push(`export default config;`,``),T.join(`
|
|
116
|
+
`)}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?ue(e.tokens,n):[];if(a.length===0&&!i)return{};let o=n.outputPath??`tamagui.config.ts`,s=tn(e,a,n),c=n.installGuide??$e({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{Ye as collectTamaguiFonts,rn as default,ue as flattenTokens,Ze as fontVarName,n as formatTokenValue,nn as generateTamaguiConfig,D as isPaletteGroup,$e as renderInstallMd,tn as renderTamaguiConfig,se as resolveTokenCategory,a as resolveTokenSets,z as tamaguiFontKeyFromRole,A as toCamelCaseKey,o as toCssVar,h as toTamaguiValue,ce as toTokenKey,je as typographyFontKey};
|
|
128
117
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/tamagui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind plugin that creates Tamagui theme tokens from Razorwind design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -85,18 +85,20 @@
|
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"@power-plant/core": "^0.0.91",
|
|
87
87
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
88
|
-
"@razorwind/core": "^0.0.
|
|
88
|
+
"@razorwind/core": "^0.0.59",
|
|
89
89
|
"@stryke/type-checks": "^0.6.44",
|
|
90
90
|
"@stryke/helpers": "^0.10.51",
|
|
91
91
|
"@stryke/string-format": "^0.17.53"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"@tamagui/config": ">=1.120.0",
|
|
95
|
+
"@tamagui/theme-builder": ">=1.120.0",
|
|
95
96
|
"react": ">=18",
|
|
96
97
|
"tamagui": ">=1.120.0"
|
|
97
98
|
},
|
|
98
99
|
"peerDependenciesMeta": {
|
|
99
100
|
"@tamagui/config": { "optional": true },
|
|
101
|
+
"@tamagui/theme-builder": { "optional": true },
|
|
100
102
|
"react": { "optional": true },
|
|
101
103
|
"tamagui": { "optional": true }
|
|
102
104
|
},
|
|
@@ -106,5 +108,5 @@
|
|
|
106
108
|
"typescript": "^6.0.3"
|
|
107
109
|
},
|
|
108
110
|
"publishConfig": { "access": "public" },
|
|
109
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "43b57170fcf1f25a7e928100915a6fcb58330db5"
|
|
110
112
|
}
|