@razorwind/tamagui 0.0.39 → 0.0.41
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 +31 -22
- package/dist/index.d.cts +87 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +87 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +31 -22
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/
|
|
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,
|
|
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`]),ee=[{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 h(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function g(e){return e===!0||e===`true`||e===1}function _(e){return g(e.palette)||g(e.$palette)?!0:y(e)===`palette`}function te(e,t){return(e===`palette`||e===`$palette`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function v(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function y(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function b(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 x(e,t){for(let{prefix:t,category:n}of ee)if(t.test(e))return n;if(t===`color`||t===`palette`)return`color`;if(t===`shadow`)return 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 S(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 C(e){let t=e.split(`.`).filter(Boolean),n=t[0];n&&/^(?:color|colours?|palette|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`:S(r)}function w(e,n,r,i,a,s){if(!(0,t.isObject)(e))return;let c=a||_(e),l=y(e,r);if(h(e)){let r=b(e),a=n.join(`.`),u=x(a,l)??(c||l===`palette`?`color`:void 0),d=(0,t.formatTokenValue)(r,l),f=u&&m.has(u)||l===`color`||l===`palette`||l===`shadow`?d:o(r,l);s.push({path:a,type:l===`palette`?`color`:l,value:r,cssValue:d,tamaguiValue:f,category:u,tokenKey:u?C(a):void 0,description:v(e),theme:i,palette:c||void 0});return}for(let[t,r]of Object.entries(e))t.startsWith(`$`)&&t!==`$palette`||te(t,r)||w(r,[...n,t],l,i,c,s)}function T(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;w(n.tokens,[],void 0,e,!1,i)}return r?i.filter(e=>!e.type||r.has(e.type)):i}const E=/^\{([^{}]+)\}$/,D=/^(?:typography|type|text)$/i,ne=/^(?:font|fonts|font-family|fontFamily)$/i,re=/^(?:font-size|fontSize)$/i,ie=/^(?:font-weight|fontWeight)$/i,ae=/^(?:line-height|lineHeight|leading)$/i,oe=/^(?:letter-spacing|letterSpacing|tracking)$/i,se=/^(?:[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,ce=[`fontFamily`,`font-family`,`family`],le=[`fontSize`,`font-size`,`size`],ue=[`fontWeight`,`font-weight`,`weight`],de=[`lineHeight`,`line-height`,`leading`],fe=[`letterSpacing`,`letter-spacing`,`tracking`],pe={1:12,2:14,3:16,4:18,5:20,6:24,7:28,8:32,9:40,10:48};function O(e){if(typeof e==`string`)return E.exec(e.trim())?.[1]?.trim()}function k(e,t){let n=O(e);if(!n)return e;let r=t.get(n),i=new Set([n]);for(let e=0;e<8&&r;e++){let e=O(r.value);if(!e||i.has(e))return r.value;i.add(e),r=t.get(e)}return r?.value??e}function A(e,t){for(let n of t)if(e[n]!==void 0&&e[n]!==null)return e[n]}function me(e){return(e.split(`,`)[0]?.trim()??e).replaceAll(/^["']|["']$/g,``)}function he(e){if(typeof e==`string`){let t=e.trim();return t.length===0||O(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 ge(e){return Number.isInteger(e)?e:Math.round(e*1e3)/1e3}function j(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 _e(e){if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`string`){let t=e.trim();if(t.length===0||O(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 ve(e,t){let n=j(e);if(n!=null)return ge(t!=null&&n>0&&n<=4?n*t:n)}function M(e,t){return t.test(e.split(`.`)[0]??``)}function ye(e){return e.split(`.`).filter(Boolean).at(-1)??e}function N(e,t){let n=e.split(`.`).filter(Boolean);return n[0]&&t.test(n[0])&&n.shift(),n}function P(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 F(e){switch(e.toLowerCase()){case`heading`:case`title`:case`display`:return`heading`;case`mono`:case`monospace`:case`caption`:case`code`:return`mono`;case`sans`:case`body`:case`serif`:return`body`;default:return P([e])}}function be(e){return e.role?F(e.role):F(e.name)}function xe(e){let t=N(e,D);if(t.length===0)return`body`;let n=t.at(-1);return n&&t.length>=2&&se.test(n)&&!n.includes(`_`)?`${P(t.slice(0,-1))}_${n}`:P(t)}function Se(e){return F(N(e,ne)[0]??ye(e))}function I(e,t){let n=N(e,t);return n.length===0||n.length===1&&/^(?:DEFAULT|default)$/i.test(n[0])?`true`:P(n)}function Ce(e){return e.type===`typography`&&(0,t.isObject)(e.value)}function we(e){return e.category===`fontSize`||e.category===`fontWeight`||Te(e)||Ee(e)||De(e)||Oe(e)?!1:e.type===`fontFamily`||M(e.path,ne)}function Te(e){return e.category===`fontSize`||M(e.path,re)}function Ee(e){return e.category===`fontWeight`||e.type===`fontWeight`||M(e.path,ie)}function De(e){return M(e.path,ae)}function Oe(e){return M(e.path,oe)}function ke(e){let t=new Map;for(let n of Object.values(e)){let e=be(n),r=t.get(e);(!r||n.role===e&&r.role!==e)&&t.set(e,n)}return t}function Ae(e,t,n){if(!e)return;let i=Object.values(e);if(i.length===0)return;if(n){let e=n.split(`.`).filter(Boolean).at(-1);if(e){let t=i.find(t=>t.role===e||t.name.toLowerCase()===e.toLowerCase());if(t)return t}}if(!t)return;let a=me(t).toLowerCase();return i.find(e=>(0,r.fontFamilyName)(e).toLowerCase()===a||e.title.toLowerCase()===a||e.name.toLowerCase()===a)}function je(e){let t=new Map;for(let r of e.files){let e=String(r.weight??400),i=(0,n.basename)(r.path).replace(/\.[^.]+$/,``),a=t.get(e)??{};r.style===`italic`||r.style===`oblique`?a.italic=i:a.normal=i,t.set(e,a)}if(t.size!==0)return`{\n${[...t.entries()].toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0})).map(([e,t])=>{let n=[];return t.normal&&n.push(`normal: ${a(t.normal)}`),t.italic&&n.push(`italic: ${a(t.italic)}`),` ${e}: { ${n.join(`, `)} }`}).join(`,
|
|
3
|
+
`)}\n }`}function L(e,t){return{...e,webFamily:(0,r.cssFontFamily)(t),nativeFamily:(0,r.fontFamilyName)(t),face:t.source===`local`?je(t):e.face}}function R(e){return{key:e,webFamily:`system-ui, sans-serif`,nativeFamily:`system-ui`,size:{},lineHeight:{},weight:{},letterSpacing:{}}}function Me(e,t){return{...e,webFamily:t,nativeFamily:me(t)}}function Ne(e,t){let n={},r=[],i={},a={};for(let o of e){if(Te(o)){let e=j(k(o.value,t));e!=null&&(n[I(o.path,re)]=e);continue}if(Ee(o)){let e=_e(k(o.value,t));e&&(i[I(o.path,ie)]=e);continue}if(Oe(o)){let e=j(k(o.value,t));e!=null&&(a[I(o.path,oe)]=e);continue}De(o)&&r.push({key:I(o.path,ae),value:k(o.value,t)})}let o=n.true??n.base??Object.values(n)[0],s={};for(let e of r){let t=n[e.key]??o,r=ve(e.value,t);r!=null&&(s[e.key]=r)}return{size:n,lineHeight:s,weight:i,letterSpacing:a}}function z(e,t){return{...t,...e}}function B(e,t){return{...e,size:z(e.size,t.size),lineHeight:z(e.lineHeight,t.lineHeight),weight:z(e.weight,t.weight),letterSpacing:z(e.letterSpacing,t.letterSpacing)}}function Pe(e){return Object.keys(e.size).length>0?e:{...e,size:{...pe}}}function Fe(e,n,r,i){if(!(0,t.isObject)(n.value))return e;let a=A(n.value,ce),o=O(a),s=he(k(a,r)),c=Ae(i,s,o),l=e;c?l=L(l,c):s&&(l=Me(l,s));let u=j(k(A(n.value,le),r));u!=null&&(l={...l,size:{...l.size,true:u}});let d=_e(k(A(n.value,ue),r));d&&(l={...l,weight:{...l.weight,true:d}});let f=j(k(A(n.value,fe),r));f!=null&&(l={...l,letterSpacing:{...l.letterSpacing,true:f}});let p=ve(k(A(n.value,de),r),l.size.true??u);return p!=null&&(l={...l,lineHeight:{...l.lineHeight,true:p}}),l}function Ie(e,t){let n=new Map(e.map(e=>[e.path,e])),r=Ne(e,n),i=new Map,a=e=>{i.set(e.key,e)};if(t)for(let[e,n]of ke(t))a(B(L(R(e),n),r));for(let o of e){if(!we(o)||Ce(o))continue;let e=Se(o.path),s=he(k(o.value,n)),c=i.get(e)??R(e),l=Ae(t,s,o.path),u=c;l?u=L(u,l):(s&&c.webFamily===R(e).webFamily||s&&!i.has(e))&&(u=Me(u,s)),a(B(u,r))}for(let o of e){if(!Ce(o))continue;let e=xe(o.path);a(Fe(B(i.get(e)??R(e),r),o,n,t))}return[...i.values()].map(Pe).toSorted((e,t)=>e.key.localeCompare(t.key))}function Le(e){return/^\d+$/.test(e)||/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}function V(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}${Le(e)}: ${a(t)}`).join(`,
|
|
4
|
+
`)}\n${r}}`}function Re(e,t){let n=`${e.replaceAll(/\W/g,``)||`font${t}`}Font`;return/^[A-Z_]/i.test(n)?n:`font${t}`}function ze(e,t){let n=[` family: isWeb ? ${a(e.webFamily)} : ${a(e.nativeFamily)}`,` size: ${V(e.size)}`];return Object.keys(e.lineHeight).length>0&&n.push(` lineHeight: ${V(e.lineHeight)}`),Object.keys(e.weight).length>0&&n.push(` weight: ${V(e.weight)}`),Object.keys(e.letterSpacing).length>0&&n.push(` letterSpacing: ${V(e.letterSpacing)}`),e.face&&n.push(` face: ${e.face}`),`const ${t} = createFont({\n${n.join(`,
|
|
5
|
+
`)}\n});`}function Be(e){return`# Installing Tamagui Config
|
|
3
6
|
|
|
4
7
|
Generated by \`@razorwind/tamagui\`.
|
|
5
8
|
|
|
@@ -32,26 +35,32 @@ export function App() {
|
|
|
32
35
|
}
|
|
33
36
|
\`\`\`
|
|
34
37
|
|
|
35
|
-
3. Use
|
|
38
|
+
3. Use generated tokens with Tamagui style props
|
|
39
|
+
([styles](https://tamagui.dev/docs/intro/styles), [tokens](https://tamagui.dev/docs/core/tokens)):
|
|
40
|
+
|
|
41
|
+
- \`color="$primary"\` / \`padding="$sm"\` / \`borderRadius="$md"\`
|
|
42
|
+
- \`fontFamily="$body"\` / \`fontSize="$true"\` / \`fontWeight="$bold"\`
|
|
43
|
+
- Language variants: \`<FontLanguage body="cn">\` when a \`body_cn\` font is generated
|
|
44
|
+
- \`boxShadow="$shadow.sm"\` / \`boxShadow="$insetShadow.xs"\`
|
|
45
|
+
- \`textShadow="$textShadow.sm"\`
|
|
46
|
+
- \`filter="$dropShadow.sm"\`
|
|
36
47
|
|
|
37
48
|
## Regenerate
|
|
38
49
|
|
|
39
50
|
Re-run Razorwind generate when tokens change so \`${e.outputPath}\` stays aligned with your design system.
|
|
40
|
-
`}const
|
|
41
|
-
`)}\n${` `.repeat(Math.max(t-2,0))}}`}function
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
`}const Ve=new Set([`default`,`light`,`theme`]),He=/^base(?:[A-Z]\w*|[._-].+)?$/i,Ue=[`base`,`gray`,`grey`,`neutral`],We={css:`@tamagui/config/v5-css`,rn:`@tamagui/config/v5-rn`,reanimated:`@tamagui/config/v5-reanimated`,motion:`@tamagui/config/v5-motion`};function Ge(e){return Ve.has(e)}function Ke(e){return e===`dark`}function H(e,t){let n=new Map,r=t===`dark`?Ke:Ge;for(let t of e){let e=t.theme?.toLowerCase();(!e||He.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()]}const qe=new Set([`fontSize`,`blur`]),Je=[`space`,`size`,`radius`,`zIndex`,`blur`,`fontSize`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`,`fontWeight`];function Ye(e){return/^px\(-?\d/.test(e)}function Xe(e){if(e.category===`radius`&&e.tokenKey?.startsWith(`borderRadius`)){let t=e.tokenKey.replace(/^borderRadius/,``);return t?S([t]):e.tokenKey}return e.tokenKey??``}function Ze(e){return e.category&&qe.has(e.category)&&typeof e.tamaguiValue==`number`?`px(${e.tamaguiValue})`:e.category===`dropShadow`&&typeof e.tamaguiValue==`string`?Qe(e.tamaguiValue):e.tamaguiValue}function Qe(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 $e(e){let t={};for(let n of e){if(!n.category||n.category===`color`||!n.tokenKey)continue;let e=Xe(n);if(!e)continue;let r=t[n.category]??{};r[e]=Ze(n),t[n.category]=r}return t}function et(e,t){let n={},r=(e,t)=>{let r=t.cssValue;typeof r!=`string`||r.length===0||G(r)||r===`[object Object]`||(n[e]=r)},i=e=>{let t=e.path.replace(/^color\./i,``).replaceAll(`.`,``);return e.theme?`${e.theme}_${t}`:t};for(let t of e)t.tokenKey&&(t.palette?r(i(t),t):r(t.tokenKey,t));for(let e of t)!e.tokenKey||!e.palette||r(i(e),e);return n}function U(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`&&Ye(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 tt(e,t=2){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{\n${n}...theme\n${r}}`:`{\n${n}...theme,\n${i.map(([e,t])=>`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${t}`).join(`,
|
|
53
|
+
`)}\n${r}}`}const nt=/^\{([^{}]+)\}$/,rt=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/;function it(e){if(typeof e==`string`)return nt.exec(e.trim())?.[1]?.trim()}function W(e){if(typeof e==`string`)return rt.exec(e.trim())?.[1]}function G(e){return it(e)!=null||W(e)!=null}function at(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=it(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=W(r.value)??W(r.cssValue)??W(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 ot(e){return/^[A-Z_$][\w$]*$/i.test(e)?`theme.${e}`:`theme[${a(e)}]`}function st(e,t,n){let r=K(e);if(r){if(t&&r.name.toLowerCase()===t.toLowerCase())return`color${r.step}`;if(n[r.name])return`${r.name}${r.step}`}}function ct(e){if(e>=1&&e<=12)return e;if(e>=100&&e<=900&&e%100==0)return e/100}function K(e){let t=e.path.split(`.`).filter(Boolean),n=t.at(-1);if(n&&/^\d+$/.test(n)){let e=ct(Number(n)),r=t.at(-2);if(e!=null&&r&&!/^(?:color|colours?|palette)$/i.test(r))return{name:S([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=ct(Number(a));if(o!=null)return{name:i,step:o}}function lt(e,t,n,r){let i=e[t]??{};i[`${t}${n}`]=r,e[t]=i}function ut(e){let t={};for(let n of e){if(typeof n.tamaguiValue!=`string`)continue;let e=K(n);e&<(t,e.name,e.step,n.tamaguiValue)}return Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=3))}function q(e){let t={};for(let n of e){if(!n.palette||typeof n.tamaguiValue!=`string`)continue;let e=K(n);e&<(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:ut(e)}function J(e,t){if(e.length<2)return[...e];let n=Q(e[0]),r=Q(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 Y(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function dt(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*Y(n)+.7152*Y(r)+.0722*Y(i)}function X(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 ft(e){return e>1?e/100:e}function Z(e,t){let n=RegExp(`^${t}\\((.+)\\)$`,`i`).exec(e.trim());if(n?.[1])return n[1].split(/[\s,/]+/).filter(Boolean)}function Q(e){let t=e.trim();if(!t||t.startsWith(`var(`)||t.includes(`{`))return;let n=dt(t);if(n!=null)return n;let r=Z(t,`oklch`);if(r?.[0]){let e=X(r[0]);return e==null?void 0:ft(e)}let i=Z(t,`hsla?`);if(i?.[2]){let e=X(i[2]);return e==null?void 0:ft(e)}let a=Z(t,`rgba?`);if(a?.[0]&&a[1]&&a[2]){let e=X(a[0]),t=X(a[1]),n=X(a[2]);if(e==null||t==null||n==null)return;let r=(e,t)=>t.trim().endsWith(`%`)||e<=1?e:e/255;return .2126*Y(r(e,a[0]))+.7152*Y(r(t,a[1]))+.0722*Y(r(n,a[2]))}}function pt(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 mt(e,t,n){let r=pt(e,t);if(r.length===0)return e;let i=J(r.map(([,e])=>e),n),a={};for(let[e,[n]]of r.entries())a[`${t}${n}`]=i[e]??r[e][1];return a}function ht(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 gt(e,t,n){let r=pt(e,t);if(!(r.length<2))return ht(J(r.map(([,e])=>e),n))}function _t(e,t){let n=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),{name:e,scale:t}]));for(let e of Ue){let r=n.get(e);if(!r)continue;let i=gt(r.scale,r.name,t);if(i)return{name:r.name,palette:i}}}function vt(e){let t=e.filter(e=>e.category===`color`||e.palette),n=q(H(t,`light`)),r=q(H(t,`dark`)),i=_t(n,`light`),a=_t(r,`dark`);return{lightPalette:i?.palette,darkPalette:a?.palette,lightBaseName:i?.name,darkBaseName:a?.name}}function $(e,n){let r=q(e),i=new Map(e.map(e=>[e.path,e])),o=new Map(e.map(e=>[(0,t.toThemeCssVar)(e.path),e])),s={};for(let t of e){if(t.category!==`color`||!t.tokenKey||t.palette||/^[A-Z]+\d{1,3}$/i.test(t.tokenKey)&&r[t.tokenKey.replace(/\d{1,3}$/,``)])continue;let e=at(t,i,o),c=st(e,n,r);if(c){s[t.tokenKey]=ot(c);continue}let l=e.tamaguiValue;G(l)||G(e.cssValue)||(typeof l==`string`||typeof l==`number`)&&(s[t.tokenKey]=a(l))}return s}function yt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);if(n.size===0)return;let r=[];for(let i of[...n].toSorted((e,t)=>e.localeCompare(t))){let n=mt(e[i]??t[i]??{},i,`light`),a=mt(t[i]??e[i]??{},i,`dark`);Object.keys(n).length!==0&&Object.keys(a).length!==0&&r.push(` ${i}: {
|
|
54
|
+
light: ${U(n,8)},
|
|
55
|
+
dark: ${U(a,8)}
|
|
44
56
|
}`)}if(r.length!==0)return`{\n${r.join(`,
|
|
45
|
-
`)}\n }`}function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}`);let S=[];r?S.push(`import { createV5Theme, defaultConfig } from "@tamagui/config/v5";`):S.push(`import { createV5Theme } from "@tamagui/config/v5";`),i!==!1&&S.push(`import { animations } from "${x[i]}";`);let C=[`createTamagui`];y.length>0&&C.push(`createTokens`);let O=n?N(n):new Map;O.size>0&&C.push(`createFont`,`isWeb`),S.push(`import { ${C.join(`, `)} } from "tamagui";`);let M=[`/* eslint-disable */`,`/*`,` * Generated by @razorwind/tamagui — do not edit by hand.`,` * @see https://tamagui.dev/docs/core/config-v5`,` */`,``,...S,``];y.length>0&&M.push(`const tokens = createTokens({`,y.join(`,
|
|
53
|
-
`),`});`,``);let P=b.length>0?`createV5Theme({\n${b.join(`,
|
|
54
|
-
`)}\n})`:`createV5Theme()`;M.push(`const themes = ${P};`,``);let I=new Map;if(O.size>0){let e=0;for(let[t,n]of O){let r=`${t}Font`.replaceAll(/\W/g,``)||`font${e}`;I.set(t,r),M.push(F(n,r),``),e+=1}}let L=[];if(r&&L.push(` ...defaultConfig`),i!==!1&&L.push(` animations`),y.length>0&&(r?L.push(` tokens: {
|
|
57
|
+
`)}\n }`}function bt(e,t={},n){let r=t.useDefaultConfig!==!1,i=t.animations??`css`,o=t.includeTypeAugmentation!==!1,s=e.filter(e=>e.category===`color`),c=H(s,`light`),l=H(s,`dark`),u=q(c),d=q(l.length>0?l:c),{lightPalette:f,darkPalette:p,lightBaseName:m,darkBaseName:ee}=vt(e),h=yt(u,d),g=$(c,m),_=$(l.length>0?l:c,l.length>0?ee:m),te=$e(H(e,`light`)),v=et(c,l),y=[];Object.keys(v).length>0&&y.push(` color: ${U(v,4)}`);for(let e of Je){let t=te[e];t&&Object.keys(t).length>0&&y.push(` ${e}: ${U(t,4)}`)}let b=[];f&&b.push(` lightPalette: ${a(f)}`),p&&b.push(` darkPalette: ${a(p)}`),h&&b.push(` childrenThemes: ${h}`),(Object.keys(g).length>0||Object.keys(_).length>0)&&b.push(` getTheme: ({ theme, scheme }: Parameters<CreateV5ThemeOptions["getTheme"]>[0]) => {
|
|
58
|
+
return scheme === "dark"
|
|
59
|
+
? ${tt(_,8)}
|
|
60
|
+
: ${tt(g,8)};
|
|
61
|
+
}`);let x=[`import { isWeb } from '@tamagui/constants';`];r?x.push(`import { createV5Theme, defaultConfig, type CreateV5ThemeOptions } from "@tamagui/config/v5";`):x.push(`import { createV5Theme, type CreateV5ThemeOptions } from "@tamagui/config/v5";`),i!==!1&&x.push(`import { animations } from "${We[i]}";`);let S=[`createTamagui`,`px`];y.length>0&&S.push(`createTokens`);let C=Ie(H(e,`light`),n);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/config-v5`,` */`,``,...x,``];y.length>0&&w.push(`const tokens = createTokens({`,y.join(`,
|
|
62
|
+
`),`});`,``);let T=b.length>0?`createV5Theme({\n${b.join(`,
|
|
63
|
+
`)}\n})`:`createV5Theme()`;w.push(`const themes = ${T};`,``);let E=new Map;if(C.length>0)for(let[e,t]of C.entries()){let n=Re(t.key,e);E.set(t.key,n),w.push(ze(t,n),``)}let D=[];if(r&&D.push(` ...defaultConfig`),i!==!1&&D.push(` animations`),y.length>0&&(r?D.push(` tokens: {
|
|
55
64
|
...defaultConfig.tokens,
|
|
56
65
|
...tokens,
|
|
57
66
|
color: {
|
|
@@ -74,13 +83,13 @@ Re-run Razorwind generate when tokens change so \`${e.outputPath}\` stays aligne
|
|
|
74
83
|
...defaultConfig.tokens.zIndex,
|
|
75
84
|
...tokens.zIndex
|
|
76
85
|
}
|
|
77
|
-
}`):
|
|
86
|
+
}`):D.push(` tokens`)),D.push(` themes`),E.size>0){let e=[...E.entries()].map(([e,t])=>` ${/^[A-Z_$][\w$]*$/i.test(e)?e:a(e)}: ${t}`);r?D.push(` fonts: {
|
|
78
87
|
...defaultConfig.fonts,
|
|
79
88
|
${e.join(`,
|
|
80
89
|
`)}
|
|
81
|
-
}`):
|
|
90
|
+
}`):D.push(` fonts: {
|
|
82
91
|
${e.join(`,
|
|
83
92
|
`)}
|
|
84
|
-
}`)}return
|
|
85
|
-
`),`});`,``,`export type AppConfig = typeof config;`,``),o&&
|
|
86
|
-
`)}function
|
|
93
|
+
}`)}return w.push(`export const config = createTamagui({`,D.join(`,
|
|
94
|
+
`),`});`,``,`export type AppConfig = typeof config;`,``),o&&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(`
|
|
95
|
+
`)}function xt(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?T(e.tokens,r):[];if(o.length===0&&!a)return{};let s=r.outputPath??`tamagui.config.ts`,c=bt(o,r,e.fonts),l=r.installGuide??Be({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 St=(0,e.definePlugin)(e=>({name:`tamagui`,themeGeneration:`combined`,generate:async t=>xt(t,e??{})}));exports.collectColorScales=q,exports.collectTamaguiFonts=Ie,exports.colorLightness=Q,exports.default=St,exports.flattenTokens=T,exports.fontVarName=Re,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateTamaguiConfig=xt,exports.isPaletteGroup=_,exports.orderPaletteForScheme=J,exports.renderInstallMd=Be,exports.renderTamaguiConfig=bt,exports.resolveTokenCategory=x,exports.resolveTokenSets=t.resolveTokenSets,exports.tamaguiFontKeyFromRole=F,exports.toCamelCaseKey=S,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toTamaguiValue=o,exports.toTokenKey=C,exports.typographyFontKey=xe;
|
package/dist/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ type TamaguiAnimationDriver = "css" | "rn" | "reanimated" | "motion" | false;
|
|
|
12
12
|
/**
|
|
13
13
|
* Tamagui `createTokens` category keys we emit from DTCG tokens.
|
|
14
14
|
*/
|
|
15
|
-
type TamaguiTokenCategory = "color" | "space" | "size" | "radius" | "zIndex";
|
|
15
|
+
type TamaguiTokenCategory = "color" | "space" | "size" | "radius" | "zIndex" | "blur" | "fontSize" | "shadow" | "insetShadow" | "dropShadow" | "textShadow" | "fontWeight" | "boxShadow";
|
|
16
16
|
/**
|
|
17
17
|
* Options for the Razorwind Tamagui config generator.
|
|
18
18
|
*/
|
|
@@ -81,9 +81,21 @@ interface FlatToken {
|
|
|
81
81
|
description?: string;
|
|
82
82
|
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
83
83
|
theme?: string;
|
|
84
|
+
/**
|
|
85
|
+
* True when an ancestor group is marked as a palette (`palette: true` or
|
|
86
|
+
* `$type: "palette"`). Those scales feed Tamagui `childrenThemes` /
|
|
87
|
+
* `lightPalette` / `darkPalette`.
|
|
88
|
+
*/
|
|
89
|
+
palette?: boolean;
|
|
84
90
|
}
|
|
85
91
|
//#endregion
|
|
86
92
|
//#region src/flatten.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* True when a DTCG group is explicitly a color palette.
|
|
95
|
+
*
|
|
96
|
+
* Accepts `palette: true`, `$palette: true`, or `$type: "palette"`.
|
|
97
|
+
*/
|
|
98
|
+
declare function isPaletteGroup(node: Record<string, unknown>): boolean;
|
|
87
99
|
/**
|
|
88
100
|
* Map a DTCG token path + type onto a Tamagui `createTokens` category.
|
|
89
101
|
*/
|
|
@@ -108,6 +120,51 @@ declare function toTokenKey(path: string): string;
|
|
|
108
120
|
*/
|
|
109
121
|
declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<TamaguiPluginOptions, "includeTypes">): FlatToken[];
|
|
110
122
|
//#endregion
|
|
123
|
+
//#region src/fonts.d.ts
|
|
124
|
+
/**
|
|
125
|
+
* A Tamagui `createFont` definition assembled from DTCG typography tokens,
|
|
126
|
+
* font-family tokens, and `spec.fonts`.
|
|
127
|
+
*
|
|
128
|
+
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
129
|
+
*/
|
|
130
|
+
interface TamaguiFontDef {
|
|
131
|
+
/** Tamagui `fonts` object key (`body`, `heading`, `body_cn`, …). */
|
|
132
|
+
key: string;
|
|
133
|
+
/** CSS font-family stack used when `isWeb` is true. */
|
|
134
|
+
webFamily: string;
|
|
135
|
+
/** Family name used on native. */
|
|
136
|
+
nativeFamily: string;
|
|
137
|
+
size: Record<string, number>;
|
|
138
|
+
lineHeight: Record<string, number>;
|
|
139
|
+
weight: Record<string, string>;
|
|
140
|
+
letterSpacing: Record<string, number>;
|
|
141
|
+
/** Rendered `face` object literal for local fonts, when present. */
|
|
142
|
+
face?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Map a font role / family token name onto Tamagui's `body` / `heading` /
|
|
146
|
+
* `mono` keys.
|
|
147
|
+
*/
|
|
148
|
+
declare function tamaguiFontKeyFromRole(name: string): string;
|
|
149
|
+
/**
|
|
150
|
+
* Tamagui font key for a typography token. Nested language segments and
|
|
151
|
+
* `body_cn`-style names keep the `_` separator FontLanguage expects.
|
|
152
|
+
*
|
|
153
|
+
* @see https://tamagui.dev/docs/core/font-language
|
|
154
|
+
*/
|
|
155
|
+
declare function typographyFontKey(path: string): string;
|
|
156
|
+
/**
|
|
157
|
+
* Build Tamagui font definitions from typography tokens, font-family tokens,
|
|
158
|
+
* and `spec.fonts`. Each resulting entry is emitted via `createFont`.
|
|
159
|
+
*
|
|
160
|
+
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
161
|
+
*/
|
|
162
|
+
declare function collectTamaguiFonts(tokens: FlatToken[], fonts?: Fonts): TamaguiFontDef[];
|
|
163
|
+
/**
|
|
164
|
+
* Valid JS identifier used for the `const <name> = createFont(...)` binding.
|
|
165
|
+
*/
|
|
166
|
+
declare function fontVarName(key: string, index: number): string;
|
|
167
|
+
//#endregion
|
|
111
168
|
//#region src/format.d.ts
|
|
112
169
|
/**
|
|
113
170
|
* Convert a DTCG `$value` into a Tamagui token primitive.
|
|
@@ -128,18 +185,34 @@ declare function renderInstallMd(options: {
|
|
|
128
185
|
}): string;
|
|
129
186
|
//#endregion
|
|
130
187
|
//#region src/generate.d.ts
|
|
188
|
+
type ColorScheme = "light" | "dark";
|
|
131
189
|
/**
|
|
132
|
-
*
|
|
190
|
+
* Collect color palettes for Tamagui `childrenThemes`.
|
|
133
191
|
*
|
|
134
|
-
*
|
|
192
|
+
* Groups marked `palette: true` (or `$type: "palette"`) win. When none are
|
|
193
|
+
* marked, numbered 1–12 (or 100–900) scales are used as a fallback.
|
|
135
194
|
*/
|
|
136
195
|
declare function collectColorScales(colorTokens: FlatToken[]): Record<string, Record<string, string>>;
|
|
196
|
+
/**
|
|
197
|
+
* Tamagui v5 palettes: light runs lightest → darkest, dark runs darkest →
|
|
198
|
+
* lightest (`color1`–`color12`).
|
|
199
|
+
*
|
|
200
|
+
* @see https://tamagui.dev/docs/core/config-v5#base-colors-color1-12
|
|
201
|
+
*/
|
|
202
|
+
declare function orderPaletteForScheme(values: readonly string[], scheme: ColorScheme): string[];
|
|
203
|
+
/**
|
|
204
|
+
* Approximate perceptual lightness (0–1) for hex, rgb, hsl, and oklch colors.
|
|
205
|
+
* CSS variables and unresolved aliases return `undefined`.
|
|
206
|
+
*/
|
|
207
|
+
declare function colorLightness(color: string): number | undefined;
|
|
137
208
|
/**
|
|
138
209
|
* Render a Tamagui v5 config module from flattened design tokens.
|
|
139
210
|
*
|
|
140
211
|
* Light and dark token sets are combined into one `createV5Theme` call.
|
|
212
|
+
* Typography and font-family tokens are emitted as `createFont` entries.
|
|
141
213
|
*
|
|
142
214
|
* @see https://tamagui.dev/docs/core/config-v5
|
|
215
|
+
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
143
216
|
*/
|
|
144
217
|
declare function renderTamaguiConfig(tokens: FlatToken[], options?: TamaguiPluginOptions, fonts?: Fonts): string;
|
|
145
218
|
/**
|
|
@@ -150,13 +223,21 @@ declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOpti
|
|
|
150
223
|
//#region src/index.d.ts
|
|
151
224
|
/**
|
|
152
225
|
* Razorwind plugin that turns design tokens into a Tamagui v5 config
|
|
153
|
-
* (`createTamagui` + `createTokens` + `createV5Theme`).
|
|
226
|
+
* (`createTamagui` + `createTokens` + `createV5Theme` + `createFont`).
|
|
154
227
|
*
|
|
155
228
|
* Light and dark token sets are emitted as a single config: `createV5Theme`
|
|
156
229
|
* receives both `lightPalette` / `darkPalette` and `childrenThemes` with
|
|
157
|
-
* `{ light, dark }` palettes.
|
|
230
|
+
* `{ light, dark }` palettes. Groups marked `palette: true` become
|
|
231
|
+
* `childrenThemes`; palettes named `base`, `grey`, `gray`, or `neutral` also
|
|
232
|
+
* set `lightPalette` / `darkPalette` (`color1`–`color12`). Light palettes are
|
|
233
|
+
* ordered lightest-first; dark palettes darkest-first.
|
|
234
|
+
*
|
|
235
|
+
* Typography tokens (`$type: "typography"`) and font-family tokens each emit
|
|
236
|
+
* a Tamagui `createFont` entry. Names with a `_` suffix (or a nested language
|
|
237
|
+
* segment) become FontLanguage variants (`body_cn`).
|
|
158
238
|
*
|
|
159
239
|
* @see https://tamagui.dev/docs/core/config-v5
|
|
240
|
+
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
160
241
|
*
|
|
161
242
|
* @example
|
|
162
243
|
* ```ts
|
|
@@ -170,5 +251,5 @@ declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOpti
|
|
|
170
251
|
*/
|
|
171
252
|
declare const _default: (options?: TamaguiPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
172
253
|
//#endregion
|
|
173
|
-
export { type FlatToken, type TamaguiAnimationDriver, type TamaguiPluginOptions, type TamaguiTokenCategory, collectColorScales, _default as default, flattenTokens, formatTokenValue, generateTamaguiConfig, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey };
|
|
254
|
+
export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory, collectColorScales, collectTamaguiFonts, colorLightness, _default as default, flattenTokens, fontVarName, formatTokenValue, generateTamaguiConfig, isPaletteGroup, orderPaletteForScheme, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, tamaguiFontKeyFromRole, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey, typographyFontKey };
|
|
174
255
|
//# 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/format.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;;KAyBY;;;;KAMA;;;;
|
|
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":";;;;;;;;;;KAyBY;;;;KAMA;;;;UAkBK;;;;;;;;;EASf;;;;;;;EAQA,aAAa;;;;;;;;EASb;;;;;EAMA,eAAe;;;;;;;EAQf;;;;;EAMA;;;;;UAMe;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA,WAAW;;EAEX;;EAEA;;EAEA;;;;;;EAMA;;;;;;;;;iBCpCc,eAAe,MAAM;;;;iBA2DrB,qBACd,cACA,gBACC;;;;;;;iBAoEa,eAAe;;;;;;;;iBA0Bf,WAAW;;;;iBAqFX,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,wCACb;;;;;;;;;UCjQc;;EAEf;;EAEA;;EAEA;EACA,MAAM;EACN,YAAY;EACZ,QAAQ;EACR,eAAe;;EAEf;;;;;;iBAyLc,uBAAuB;;;;;;;iBAsCvB,kBAAkB;;;;;;;iBAkXlB,oBACd,QAAQ,aACR,QAAQ,QACP;;;;iBAuFa,YAAY,aAAa;;;;;;;;;iBCzsBzB,eAAe,gBAAgB;;;;;;;;iBCnC/B,gBAAgB;EAAW;;;;KCiCtC;;;;;;;iBA0cW,mBACd,aAAa,cACZ,eAAe;;;;;;;iBAmCF,sBACd,2BACA,QAAQ;;;;;iBA+EM,eAAe;;;;;;;;;;iBAsSf,oBACd,QAAQ,aACR,UAAS,sBACT,QAAQ;;;;iBA6NM,sBACd,MAAM,QACN,UAAS,uBACR,wBAAwB,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ type TamaguiAnimationDriver = "css" | "rn" | "reanimated" | "motion" | false;
|
|
|
12
12
|
/**
|
|
13
13
|
* Tamagui `createTokens` category keys we emit from DTCG tokens.
|
|
14
14
|
*/
|
|
15
|
-
type TamaguiTokenCategory = "color" | "space" | "size" | "radius" | "zIndex";
|
|
15
|
+
type TamaguiTokenCategory = "color" | "space" | "size" | "radius" | "zIndex" | "blur" | "fontSize" | "shadow" | "insetShadow" | "dropShadow" | "textShadow" | "fontWeight" | "boxShadow";
|
|
16
16
|
/**
|
|
17
17
|
* Options for the Razorwind Tamagui config generator.
|
|
18
18
|
*/
|
|
@@ -81,9 +81,21 @@ interface FlatToken {
|
|
|
81
81
|
description?: string;
|
|
82
82
|
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
83
83
|
theme?: string;
|
|
84
|
+
/**
|
|
85
|
+
* True when an ancestor group is marked as a palette (`palette: true` or
|
|
86
|
+
* `$type: "palette"`). Those scales feed Tamagui `childrenThemes` /
|
|
87
|
+
* `lightPalette` / `darkPalette`.
|
|
88
|
+
*/
|
|
89
|
+
palette?: boolean;
|
|
84
90
|
}
|
|
85
91
|
//#endregion
|
|
86
92
|
//#region src/flatten.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* True when a DTCG group is explicitly a color palette.
|
|
95
|
+
*
|
|
96
|
+
* Accepts `palette: true`, `$palette: true`, or `$type: "palette"`.
|
|
97
|
+
*/
|
|
98
|
+
declare function isPaletteGroup(node: Record<string, unknown>): boolean;
|
|
87
99
|
/**
|
|
88
100
|
* Map a DTCG token path + type onto a Tamagui `createTokens` category.
|
|
89
101
|
*/
|
|
@@ -108,6 +120,51 @@ declare function toTokenKey(path: string): string;
|
|
|
108
120
|
*/
|
|
109
121
|
declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<TamaguiPluginOptions, "includeTypes">): FlatToken[];
|
|
110
122
|
//#endregion
|
|
123
|
+
//#region src/fonts.d.ts
|
|
124
|
+
/**
|
|
125
|
+
* A Tamagui `createFont` definition assembled from DTCG typography tokens,
|
|
126
|
+
* font-family tokens, and `spec.fonts`.
|
|
127
|
+
*
|
|
128
|
+
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
129
|
+
*/
|
|
130
|
+
interface TamaguiFontDef {
|
|
131
|
+
/** Tamagui `fonts` object key (`body`, `heading`, `body_cn`, …). */
|
|
132
|
+
key: string;
|
|
133
|
+
/** CSS font-family stack used when `isWeb` is true. */
|
|
134
|
+
webFamily: string;
|
|
135
|
+
/** Family name used on native. */
|
|
136
|
+
nativeFamily: string;
|
|
137
|
+
size: Record<string, number>;
|
|
138
|
+
lineHeight: Record<string, number>;
|
|
139
|
+
weight: Record<string, string>;
|
|
140
|
+
letterSpacing: Record<string, number>;
|
|
141
|
+
/** Rendered `face` object literal for local fonts, when present. */
|
|
142
|
+
face?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Map a font role / family token name onto Tamagui's `body` / `heading` /
|
|
146
|
+
* `mono` keys.
|
|
147
|
+
*/
|
|
148
|
+
declare function tamaguiFontKeyFromRole(name: string): string;
|
|
149
|
+
/**
|
|
150
|
+
* Tamagui font key for a typography token. Nested language segments and
|
|
151
|
+
* `body_cn`-style names keep the `_` separator FontLanguage expects.
|
|
152
|
+
*
|
|
153
|
+
* @see https://tamagui.dev/docs/core/font-language
|
|
154
|
+
*/
|
|
155
|
+
declare function typographyFontKey(path: string): string;
|
|
156
|
+
/**
|
|
157
|
+
* Build Tamagui font definitions from typography tokens, font-family tokens,
|
|
158
|
+
* and `spec.fonts`. Each resulting entry is emitted via `createFont`.
|
|
159
|
+
*
|
|
160
|
+
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
161
|
+
*/
|
|
162
|
+
declare function collectTamaguiFonts(tokens: FlatToken[], fonts?: Fonts): TamaguiFontDef[];
|
|
163
|
+
/**
|
|
164
|
+
* Valid JS identifier used for the `const <name> = createFont(...)` binding.
|
|
165
|
+
*/
|
|
166
|
+
declare function fontVarName(key: string, index: number): string;
|
|
167
|
+
//#endregion
|
|
111
168
|
//#region src/format.d.ts
|
|
112
169
|
/**
|
|
113
170
|
* Convert a DTCG `$value` into a Tamagui token primitive.
|
|
@@ -128,18 +185,34 @@ declare function renderInstallMd(options: {
|
|
|
128
185
|
}): string;
|
|
129
186
|
//#endregion
|
|
130
187
|
//#region src/generate.d.ts
|
|
188
|
+
type ColorScheme = "light" | "dark";
|
|
131
189
|
/**
|
|
132
|
-
*
|
|
190
|
+
* Collect color palettes for Tamagui `childrenThemes`.
|
|
133
191
|
*
|
|
134
|
-
*
|
|
192
|
+
* Groups marked `palette: true` (or `$type: "palette"`) win. When none are
|
|
193
|
+
* marked, numbered 1–12 (or 100–900) scales are used as a fallback.
|
|
135
194
|
*/
|
|
136
195
|
declare function collectColorScales(colorTokens: FlatToken[]): Record<string, Record<string, string>>;
|
|
196
|
+
/**
|
|
197
|
+
* Tamagui v5 palettes: light runs lightest → darkest, dark runs darkest →
|
|
198
|
+
* lightest (`color1`–`color12`).
|
|
199
|
+
*
|
|
200
|
+
* @see https://tamagui.dev/docs/core/config-v5#base-colors-color1-12
|
|
201
|
+
*/
|
|
202
|
+
declare function orderPaletteForScheme(values: readonly string[], scheme: ColorScheme): string[];
|
|
203
|
+
/**
|
|
204
|
+
* Approximate perceptual lightness (0–1) for hex, rgb, hsl, and oklch colors.
|
|
205
|
+
* CSS variables and unresolved aliases return `undefined`.
|
|
206
|
+
*/
|
|
207
|
+
declare function colorLightness(color: string): number | undefined;
|
|
137
208
|
/**
|
|
138
209
|
* Render a Tamagui v5 config module from flattened design tokens.
|
|
139
210
|
*
|
|
140
211
|
* Light and dark token sets are combined into one `createV5Theme` call.
|
|
212
|
+
* Typography and font-family tokens are emitted as `createFont` entries.
|
|
141
213
|
*
|
|
142
214
|
* @see https://tamagui.dev/docs/core/config-v5
|
|
215
|
+
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
143
216
|
*/
|
|
144
217
|
declare function renderTamaguiConfig(tokens: FlatToken[], options?: TamaguiPluginOptions, fonts?: Fonts): string;
|
|
145
218
|
/**
|
|
@@ -150,13 +223,21 @@ declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOpti
|
|
|
150
223
|
//#region src/index.d.ts
|
|
151
224
|
/**
|
|
152
225
|
* Razorwind plugin that turns design tokens into a Tamagui v5 config
|
|
153
|
-
* (`createTamagui` + `createTokens` + `createV5Theme`).
|
|
226
|
+
* (`createTamagui` + `createTokens` + `createV5Theme` + `createFont`).
|
|
154
227
|
*
|
|
155
228
|
* Light and dark token sets are emitted as a single config: `createV5Theme`
|
|
156
229
|
* receives both `lightPalette` / `darkPalette` and `childrenThemes` with
|
|
157
|
-
* `{ light, dark }` palettes.
|
|
230
|
+
* `{ light, dark }` palettes. Groups marked `palette: true` become
|
|
231
|
+
* `childrenThemes`; palettes named `base`, `grey`, `gray`, or `neutral` also
|
|
232
|
+
* set `lightPalette` / `darkPalette` (`color1`–`color12`). Light palettes are
|
|
233
|
+
* ordered lightest-first; dark palettes darkest-first.
|
|
234
|
+
*
|
|
235
|
+
* Typography tokens (`$type: "typography"`) and font-family tokens each emit
|
|
236
|
+
* a Tamagui `createFont` entry. Names with a `_` suffix (or a nested language
|
|
237
|
+
* segment) become FontLanguage variants (`body_cn`).
|
|
158
238
|
*
|
|
159
239
|
* @see https://tamagui.dev/docs/core/config-v5
|
|
240
|
+
* @see https://tamagui.dev/docs/core/font-language#font-tokens
|
|
160
241
|
*
|
|
161
242
|
* @example
|
|
162
243
|
* ```ts
|
|
@@ -170,5 +251,5 @@ declare function generateTamaguiConfig(spec: Schema, options?: TamaguiPluginOpti
|
|
|
170
251
|
*/
|
|
171
252
|
declare const _default: (options?: TamaguiPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
172
253
|
//#endregion
|
|
173
|
-
export { type FlatToken, type TamaguiAnimationDriver, type TamaguiPluginOptions, type TamaguiTokenCategory, collectColorScales, _default as default, flattenTokens, formatTokenValue, generateTamaguiConfig, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey };
|
|
254
|
+
export { type FlatToken, type TamaguiAnimationDriver, type TamaguiFontDef, type TamaguiPluginOptions, type TamaguiTokenCategory, collectColorScales, collectTamaguiFonts, colorLightness, _default as default, flattenTokens, fontVarName, formatTokenValue, generateTamaguiConfig, isPaletteGroup, orderPaletteForScheme, renderInstallMd, renderTamaguiConfig, resolveTokenCategory, resolveTokenSets, tamaguiFontKeyFromRole, toCamelCaseKey, toCssVar, toTamaguiValue, toTokenKey, typographyFontKey };
|
|
174
255
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/format.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/fonts.ts","../src/format.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import{definePlugin as e}from"@razorwind/core/plugin";import{
|
|
2
|
-
`,`\\n`).replaceAll(`\r`,`\\r`)}function
|
|
1
|
+
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,formatTokenValue as n,formatTokenValue as r,isObject as i,resolveTokenSets as a,toCssVar as o,toThemeCssVar as s}from"@razorwind/core/utils";import{basename as c,dirname as l,join as u}from"node:path";import{cssFontFamily as d,fontFamilyName as f}from"@razorwind/core/lib/fonts";function p(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`
|
|
2
|
+
`,`\\n`).replaceAll(`\r`,`\\r`)}function m(e){return typeof e==`string`?`"${p(e)}"`:typeof e==`number`||typeof e==`boolean`?String(e):e==null?`undefined`:JSON.stringify(e)}function h(e,t){if(typeof e==`number`)return e;if(typeof e==`boolean`)return Number(e);if(i(e)&&typeof e.value==`number`&&typeof e.unit==`string`){let t=e.unit.toLowerCase();return t===`px`||t===``?e.value:t===`rem`?e.value*16:`${e.value}${e.unit}`}if(typeof e==`string`){let t=/^(-?\d+(?:\.\d+)?)px$/i.exec(e.trim());if(t)return Number(t[1]);let n=/^(-?\d+(?:\.\d+)?)rem$/i.exec(e.trim());if(n)return Number(n[1])*16;let r=Number(e);return!Number.isNaN(r)&&e.trim()!==``?r:e}return r(e,t)}const g=/^(?:font-size|fontSize)(?:\.|$)/i,_=/^(?:font-weight|fontWeight)(?:\.|$)/i,v=/^shadow(?:\.|$)/i,y=/^inset-shadow(?:\.|$)/i,b=/^drop-shadow(?:\.|$)/i,x=/^text-shadow(?:\.|$)/i,S=/^(?:blur|blur-?radius)(?:\.|$)/i,C=new Set([`color`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`]),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:ee(e)===`palette`}function O(e,t){return(e===`palette`||e===`$palette`)&&(typeof t==`boolean`||typeof t==`number`||typeof t==`string`)}function k(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function ee(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function te(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function ne(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 re(e){let t=e.split(`.`).filter(Boolean),n=t[0];n&&/^(?:color|colours?|palette|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 ie(e,t,r,a,o,s){if(!i(e))return;let c=o||D(e),l=ee(e,r);if(T(e)){let r=te(e),i=t.join(`.`),o=ne(i,l)??(c||l===`palette`?`color`:void 0),u=n(r,l),d=o&&C.has(o)||l===`color`||l===`palette`||l===`shadow`?u:h(r,l);s.push({path:i,type:l===`palette`?`color`:l,value:r,cssValue:u,tamaguiValue:d,category:o,tokenKey:o?re(i):void 0,description:k(e),theme:a,palette:c||void 0});return}for(let[n,r]of Object.entries(e))n.startsWith(`$`)&&n!==`$palette`||O(n,r)||ie(r,[...t,n],l,a,c,s)}function ae(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;ie(t.tokens,[],void 0,e,!1,r)}return n?r.filter(e=>!e.type||n.has(e.type)):r}const oe=/^\{([^{}]+)\}$/,se=/^(?:typography|type|text)$/i,ce=/^(?:font|fonts|font-family|fontFamily)$/i,le=/^(?:font-size|fontSize)$/i,ue=/^(?:font-weight|fontWeight)$/i,de=/^(?:line-height|lineHeight|leading)$/i,fe=/^(?:letter-spacing|letterSpacing|tracking)$/i,pe=/^(?:[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,me=[`fontFamily`,`font-family`,`family`],he=[`fontSize`,`font-size`,`size`],ge=[`fontWeight`,`font-weight`,`weight`],_e=[`lineHeight`,`line-height`,`leading`],ve=[`letterSpacing`,`letter-spacing`,`tracking`],ye={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 oe.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 be(e){return(e.split(`,`)[0]?.trim()??e).replaceAll(/^["']|["']$/g,``)}function xe(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 Se(e){return Number.isInteger(e)?e:Math.round(e*1e3)/1e3}function P(e){if(e==null)return;let t=h(e);if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`){let e=/^(-?\d+(?:\.\d+)?)%$/.exec(t.trim());if(e)return Number.parseFloat(e[1])/100}}function Ce(e){if(typeof e==`number`&&Number.isFinite(e))return String(e);if(typeof e==`string`){let t=e.trim();if(t.length===0||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 we(e,t){let n=P(e);if(n!=null)return Se(t!=null&&n>0&&n<=4?n*t:n)}function F(e,t){return t.test(e.split(`.`)[0]??``)}function Te(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`heading`:case`title`:case`display`:return`heading`;case`mono`:case`monospace`:case`caption`:case`code`:return`mono`;case`sans`:case`body`:case`serif`:return`body`;default:return L([e])}}function Ee(e){return e.role?R(e.role):R(e.name)}function De(e){let t=I(e,se);if(t.length===0)return`body`;let n=t.at(-1);return n&&t.length>=2&&pe.test(n)&&!n.includes(`_`)?`${L(t.slice(0,-1))}_${n}`:L(t)}function Oe(e){return R(I(e,ce)[0]??Te(e))}function z(e,t){let n=I(e,t);return n.length===0||n.length===1&&/^(?:DEFAULT|default)$/i.test(n[0])?`true`:L(n)}function ke(e){return e.type===`typography`&&i(e.value)}function Ae(e){return e.category===`fontSize`||e.category===`fontWeight`||je(e)||Me(e)||Ne(e)||Pe(e)?!1:e.type===`fontFamily`||F(e.path,ce)}function je(e){return e.category===`fontSize`||F(e.path,le)}function Me(e){return e.category===`fontWeight`||e.type===`fontWeight`||F(e.path,ue)}function Ne(e){return F(e.path,de)}function Pe(e){return F(e.path,fe)}function Fe(e){let t=new Map;for(let n of Object.values(e)){let e=Ee(n),r=t.get(e);(!r||n.role===e&&r.role!==e)&&t.set(e,n)}return t}function Ie(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=be(t).toLowerCase();return r.find(e=>f(e).toLowerCase()===i||e.title.toLowerCase()===i||e.name.toLowerCase()===i)}function Le(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`?Le(t):e.face}}function V(e){return{key:e,webFamily:`system-ui, sans-serif`,nativeFamily:`system-ui`,size:{},lineHeight:{},weight:{},letterSpacing:{}}}function Re(e,t){return{...e,webFamily:t,nativeFamily:be(t)}}function ze(e,t){let n={},r=[],i={},a={};for(let o of e){if(je(o)){let e=P(M(o.value,t));e!=null&&(n[z(o.path,le)]=e);continue}if(Me(o)){let e=Ce(M(o.value,t));e&&(i[z(o.path,ue)]=e);continue}if(Pe(o)){let e=P(M(o.value,t));e!=null&&(a[z(o.path,fe)]=e);continue}Ne(o)&&r.push({key:z(o.path,de),value:M(o.value,t)})}let o=n.true??n.base??Object.values(n)[0],s={};for(let e of r){let t=n[e.key]??o,r=we(e.value,t);r!=null&&(s[e.key]=r)}return{size:n,lineHeight:s,weight:i,letterSpacing:a}}function H(e,t){return{...t,...e}}function U(e,t){return{...e,size:H(e.size,t.size),lineHeight:H(e.lineHeight,t.lineHeight),weight:H(e.weight,t.weight),letterSpacing:H(e.letterSpacing,t.letterSpacing)}}function Be(e){return Object.keys(e.size).length>0?e:{...e,size:{...ye}}}function Ve(e,t,n,r){if(!i(t.value))return e;let a=N(t.value,me),o=j(a),s=xe(M(a,n)),c=Ie(r,s,o),l=e;c?l=B(l,c):s&&(l=Re(l,s));let u=P(M(N(t.value,he),n));u!=null&&(l={...l,size:{...l.size,true:u}});let d=Ce(M(N(t.value,ge),n));d&&(l={...l,weight:{...l.weight,true:d}});let f=P(M(N(t.value,ve),n));f!=null&&(l={...l,letterSpacing:{...l.letterSpacing,true:f}});let p=we(M(N(t.value,_e),n),l.size.true??u);return p!=null&&(l={...l,lineHeight:{...l.lineHeight,true:p}}),l}function He(e,t){let n=new Map(e.map(e=>[e.path,e])),r=ze(e,n),i=new Map,a=e=>{i.set(e.key,e)};if(t)for(let[e,n]of Fe(t))a(U(B(V(e),n),r));for(let o of e){if(!Ae(o)||ke(o))continue;let e=Oe(o.path),s=xe(M(o.value,n)),c=i.get(e)??V(e),l=Ie(t,s,o.path),u=c;l?u=B(u,l):(s&&c.webFamily===V(e).webFamily||s&&!i.has(e))&&(u=Re(u,s)),a(U(u,r))}for(let o of e){if(!ke(o))continue;let e=De(o.path);a(Ve(U(i.get(e)??V(e),r),o,n,t))}return[...i.values()].map(Be).toSorted((e,t)=>e.key.localeCompare(t.key))}function Ue(e){return/^\d+$/.test(e)||/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}function W(e,t=4){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{}`:`{\n${i.map(([e,t])=>`${n}${Ue(e)}: ${m(t)}`).join(`,
|
|
4
|
+
`)}\n${r}}`}function We(e,t){let n=`${e.replaceAll(/\W/g,``)||`font${t}`}Font`;return/^[A-Z_]/i.test(n)?n:`font${t}`}function Ge(e,t){let n=[` family: isWeb ? ${m(e.webFamily)} : ${m(e.nativeFamily)}`,` size: ${W(e.size)}`];return Object.keys(e.lineHeight).length>0&&n.push(` lineHeight: ${W(e.lineHeight)}`),Object.keys(e.weight).length>0&&n.push(` weight: ${W(e.weight)}`),Object.keys(e.letterSpacing).length>0&&n.push(` letterSpacing: ${W(e.letterSpacing)}`),e.face&&n.push(` face: ${e.face}`),`const ${t} = createFont({\n${n.join(`,
|
|
5
|
+
`)}\n});`}function Ke(e){return`# Installing Tamagui Config
|
|
3
6
|
|
|
4
7
|
Generated by \`@razorwind/tamagui\`.
|
|
5
8
|
|
|
@@ -32,26 +35,32 @@ export function App() {
|
|
|
32
35
|
}
|
|
33
36
|
\`\`\`
|
|
34
37
|
|
|
35
|
-
3. Use
|
|
38
|
+
3. Use generated tokens with Tamagui style props
|
|
39
|
+
([styles](https://tamagui.dev/docs/intro/styles), [tokens](https://tamagui.dev/docs/core/tokens)):
|
|
40
|
+
|
|
41
|
+
- \`color="$primary"\` / \`padding="$sm"\` / \`borderRadius="$md"\`
|
|
42
|
+
- \`fontFamily="$body"\` / \`fontSize="$true"\` / \`fontWeight="$bold"\`
|
|
43
|
+
- Language variants: \`<FontLanguage body="cn">\` when a \`body_cn\` font is generated
|
|
44
|
+
- \`boxShadow="$shadow.sm"\` / \`boxShadow="$insetShadow.xs"\`
|
|
45
|
+
- \`textShadow="$textShadow.sm"\`
|
|
46
|
+
- \`filter="$dropShadow.sm"\`
|
|
36
47
|
|
|
37
48
|
## Regenerate
|
|
38
49
|
|
|
39
50
|
Re-run Razorwind generate when tokens change so \`${e.outputPath}\` stays aligned with your design system.
|
|
40
|
-
`}const
|
|
41
|
-
`)}\n${` `.repeat(Math.max(t-2,0))}}`}function
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
`}const qe=new Set([`default`,`light`,`theme`]),Je=/^base(?:[A-Z]\w*|[._-].+)?$/i,Ye=[`base`,`gray`,`grey`,`neutral`],Xe={css:`@tamagui/config/v5-css`,rn:`@tamagui/config/v5-rn`,reanimated:`@tamagui/config/v5-reanimated`,motion:`@tamagui/config/v5-motion`};function Ze(e){return qe.has(e)}function Qe(e){return e===`dark`}function G(e,t){let n=new Map,r=t===`dark`?Qe:Ze;for(let t of e){let e=t.theme?.toLowerCase();(!e||Je.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()]}const $e=new Set([`fontSize`,`blur`]),et=[`space`,`size`,`radius`,`zIndex`,`blur`,`fontSize`,`shadow`,`insetShadow`,`dropShadow`,`textShadow`,`boxShadow`,`fontWeight`];function tt(e){return/^px\(-?\d/.test(e)}function nt(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 rt(e){return e.category&&$e.has(e.category)&&typeof e.tamaguiValue==`number`?`px(${e.tamaguiValue})`:e.category===`dropShadow`&&typeof e.tamaguiValue==`string`?it(e.tamaguiValue):e.tamaguiValue}function it(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 at(e){let t={};for(let n of e){if(!n.category||n.category===`color`||!n.tokenKey)continue;let e=nt(n);if(!e)continue;let r=t[n.category]??{};r[e]=rt(n),t[n.category]=r}return t}function ot(e,t){let n={},r=(e,t)=>{let r=t.cssValue;typeof r!=`string`||r.length===0||J(r)||r===`[object Object]`||(n[e]=r)},i=e=>{let t=e.path.replace(/^color\./i,``).replaceAll(`.`,``);return e.theme?`${e.theme}_${t}`:t};for(let t of e)t.tokenKey&&(t.palette?r(i(t),t):r(t.tokenKey,t));for(let e of t)!e.tokenKey||!e.palette||r(i(e),e);return n}function K(e,t=2){let n=` `.repeat(t),r=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return r.length===0?`{}`:`{\n${r.map(([e,t])=>{let r=typeof t==`string`&&tt(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 st(e,t=2){let n=` `.repeat(t),r=` `.repeat(Math.max(t-2,0)),i=Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t,void 0,{numeric:!0}));return i.length===0?`{\n${n}...theme\n${r}}`:`{\n${n}...theme,\n${i.map(([e,t])=>`${n}${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: ${t}`).join(`,
|
|
53
|
+
`)}\n${r}}`}const ct=/^\{([^{}]+)\}$/,lt=/^var\((--[^),\s]+)(?:\s*,[^)]*)?\)$/;function ut(e){if(typeof e==`string`)return ct.exec(e.trim())?.[1]?.trim()}function q(e){if(typeof e==`string`)return lt.exec(e.trim())?.[1]}function J(e){return ut(e)!=null||q(e)!=null}function dt(e,t,n){let r=e,i=new Set;for(let e=0;e<8;e++){if(i.has(r.path))return r;i.add(r.path);let e=ut(r.value);if(e){let n=t.get(e);if(!n||n.path===r.path)return r;r=n;continue}let a=q(r.value)??q(r.cssValue)??q(r.tamaguiValue);if(a){let e=n.get(a);if(!e||e.path===r.path)return r;r=e;continue}return r}return r}function ft(e){return/^[A-Z_$][\w$]*$/i.test(e)?`theme.${e}`:`theme[${m(e)}]`}function pt(e,t,n){let r=Y(e);if(r){if(t&&r.name.toLowerCase()===t.toLowerCase())return`color${r.step}`;if(n[r.name])return`${r.name}${r.step}`}}function mt(e){if(e>=1&&e<=12)return e;if(e>=100&&e<=900&&e%100==0)return e/100}function Y(e){let t=e.path.split(`.`).filter(Boolean),n=t.at(-1);if(n&&/^\d+$/.test(n)){let e=mt(Number(n)),r=t.at(-2);if(e!=null&&r&&!/^(?:color|colours?|palette)$/i.test(r))return{name:A([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=mt(Number(a));if(o!=null)return{name:i,step:o}}function ht(e,t,n,r){let i=e[t]??{};i[`${t}${n}`]=r,e[t]=i}function gt(e){let t={};for(let n of e){if(typeof n.tamaguiValue!=`string`)continue;let e=Y(n);e&&ht(t,e.name,e.step,n.tamaguiValue)}return Object.fromEntries(Object.entries(t).filter(([,e])=>Object.keys(e).length>=3))}function X(e){let t={};for(let n of e){if(!n.palette||typeof n.tamaguiValue!=`string`)continue;let e=Y(n);e&&ht(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:gt(e)}function Z(e,t){if(e.length<2)return[...e];let n=bt(e[0]),r=bt(e[e.length-1]);if(n==null||r==null||n===r)return[...e];let i=n>r;return t===`light`?i?[...e]:e.toReversed():i?e.toReversed():[...e]}function Q(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function _t(e){let t=e.startsWith(`#`)?e.slice(1):``;if((t.length===3||t.length===4)&&(t=[...t].map(e=>e+e).join(``)),t.length===8&&(t=t.slice(0,6)),t.length!==6||/[^0-9a-f]/i.test(t))return;let n=Number.parseInt(t.slice(0,2),16)/255,r=Number.parseInt(t.slice(2,4),16)/255,i=Number.parseInt(t.slice(4,6),16)/255;return .2126*Q(n)+.7152*Q(r)+.0722*Q(i)}function $(e){let t=e.trim();if(t.endsWith(`%`)){let e=Number.parseFloat(t);return Number.isFinite(e)?e/100:void 0}let n=Number.parseFloat(t);return Number.isFinite(n)?n:void 0}function vt(e){return e>1?e/100:e}function yt(e,t){let n=RegExp(`^${t}\\((.+)\\)$`,`i`).exec(e.trim());if(n?.[1])return n[1].split(/[\s,/]+/).filter(Boolean)}function bt(e){let t=e.trim();if(!t||t.startsWith(`var(`)||t.includes(`{`))return;let n=_t(t);if(n!=null)return n;let r=yt(t,`oklch`);if(r?.[0]){let e=$(r[0]);return e==null?void 0:vt(e)}let i=yt(t,`hsla?`);if(i?.[2]){let e=$(i[2]);return e==null?void 0:vt(e)}let a=yt(t,`rgba?`);if(a?.[0]&&a[1]&&a[2]){let e=$(a[0]),t=$(a[1]),n=$(a[2]);if(e==null||t==null||n==null)return;let r=(e,t)=>t.trim().endsWith(`%`)||e<=1?e:e/255;return .2126*Q(r(e,a[0]))+.7152*Q(r(t,a[1]))+.0722*Q(r(n,a[2]))}}function xt(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 St(e,t,n){let r=xt(e,t);if(r.length===0)return e;let i=Z(r.map(([,e])=>e),n),a={};for(let[e,[n]]of r.entries())a[`${t}${n}`]=i[e]??r[e][1];return a}function Ct(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 wt(e,t,n){let r=xt(e,t);if(!(r.length<2))return Ct(Z(r.map(([,e])=>e),n))}function Tt(e,t){let n=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),{name:e,scale:t}]));for(let e of Ye){let r=n.get(e);if(!r)continue;let i=wt(r.scale,r.name,t);if(i)return{name:r.name,palette:i}}}function Et(e){let t=e.filter(e=>e.category===`color`||e.palette),n=X(G(t,`light`)),r=X(G(t,`dark`)),i=Tt(n,`light`),a=Tt(r,`dark`);return{lightPalette:i?.palette,darkPalette:a?.palette,lightBaseName:i?.name,darkBaseName:a?.name}}function Dt(e,t){let n=X(e),r=new Map(e.map(e=>[e.path,e])),i=new Map(e.map(e=>[s(e.path),e])),a={};for(let o of e){if(o.category!==`color`||!o.tokenKey||o.palette||/^[A-Z]+\d{1,3}$/i.test(o.tokenKey)&&n[o.tokenKey.replace(/\d{1,3}$/,``)])continue;let e=dt(o,r,i),s=pt(e,t,n);if(s){a[o.tokenKey]=ft(s);continue}let c=e.tamaguiValue;J(c)||J(e.cssValue)||(typeof c==`string`||typeof c==`number`)&&(a[o.tokenKey]=m(c))}return a}function Ot(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);if(n.size===0)return;let r=[];for(let i of[...n].toSorted((e,t)=>e.localeCompare(t))){let n=St(e[i]??t[i]??{},i,`light`),a=St(t[i]??e[i]??{},i,`dark`);Object.keys(n).length!==0&&Object.keys(a).length!==0&&r.push(` ${i}: {
|
|
54
|
+
light: ${K(n,8)},
|
|
55
|
+
dark: ${K(a,8)}
|
|
44
56
|
}`)}if(r.length!==0)return`{\n${r.join(`,
|
|
45
|
-
`)}\n }`}function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}`);let x=[];r?x.push(`import { createV5Theme, defaultConfig } from "@tamagui/config/v5";`):x.push(`import { createV5Theme } from "@tamagui/config/v5";`),i!==!1&&x.push(`import { animations } from "${O[i]}";`);let S=[`createTamagui`];y.length>0&&S.push(`createTokens`);let C=n?B(n):new Map;C.size>0&&S.push(`createFont`,`isWeb`),x.push(`import { ${S.join(`, `)} } from "tamagui";`);let w=[`/* eslint-disable */`,`/*`,` * Generated by @razorwind/tamagui — do not edit by hand.`,` * @see https://tamagui.dev/docs/core/config-v5`,` */`,``,...x,``];y.length>0&&w.push(`const tokens = createTokens({`,y.join(`,
|
|
53
|
-
`),`});`,``);let T=b.length>0?`createV5Theme({\n${b.join(`,
|
|
54
|
-
`)}\n})`:`createV5Theme()`;w.push(`const themes = ${T};`,``);let E=new Map;if(C.size>0){let e=0;for(let[t,n]of C){let r=`${t}Font`.replaceAll(/\W/g,``)||`font${e}`;E.set(t,r),w.push(H(n,r),``),e+=1}}let D=[];if(r&&D.push(` ...defaultConfig`),i!==!1&&D.push(` animations`),y.length>0&&(r?D.push(` tokens: {
|
|
57
|
+
`)}\n }`}function kt(e,t={},n){let r=t.useDefaultConfig!==!1,i=t.animations??`css`,a=t.includeTypeAugmentation!==!1,o=e.filter(e=>e.category===`color`),s=G(o,`light`),c=G(o,`dark`),l=X(s),u=X(c.length>0?c:s),{lightPalette:d,darkPalette:f,lightBaseName:p,darkBaseName:h}=Et(e),g=Ot(l,u),_=Dt(s,p),v=Dt(c.length>0?c:s,c.length>0?h:p),y=at(G(e,`light`)),b=ot(s,c),x=[];Object.keys(b).length>0&&x.push(` color: ${K(b,4)}`);for(let e of et){let t=y[e];t&&Object.keys(t).length>0&&x.push(` ${e}: ${K(t,4)}`)}let S=[];d&&S.push(` lightPalette: ${m(d)}`),f&&S.push(` darkPalette: ${m(f)}`),g&&S.push(` childrenThemes: ${g}`),(Object.keys(_).length>0||Object.keys(v).length>0)&&S.push(` getTheme: ({ theme, scheme }: Parameters<CreateV5ThemeOptions["getTheme"]>[0]) => {
|
|
58
|
+
return scheme === "dark"
|
|
59
|
+
? ${st(v,8)}
|
|
60
|
+
: ${st(_,8)};
|
|
61
|
+
}`);let C=[`import { isWeb } from '@tamagui/constants';`];r?C.push(`import { createV5Theme, defaultConfig, type CreateV5ThemeOptions } from "@tamagui/config/v5";`):C.push(`import { createV5Theme, type CreateV5ThemeOptions } from "@tamagui/config/v5";`),i!==!1&&C.push(`import { animations } from "${Xe[i]}";`);let w=[`createTamagui`,`px`];x.length>0&&w.push(`createTokens`);let T=He(G(e,`light`),n);T.length>0&&w.push(`createFont`),C.push(`import { ${w.join(`, `)} } from "@tamagui/core";`);let E=[`/* eslint-disable */`,``,`/*`,` * Generated by @razorwind/tamagui — Do not edit by hand.`,` * `,` * @see https://tamagui.dev/docs/core/config-v5`,` */`,``,...C,``];x.length>0&&E.push(`const tokens = createTokens({`,x.join(`,
|
|
62
|
+
`),`});`,``);let D=S.length>0?`createV5Theme({\n${S.join(`,
|
|
63
|
+
`)}\n})`:`createV5Theme()`;E.push(`const themes = ${D};`,``);let O=new Map;if(T.length>0)for(let[e,t]of T.entries()){let n=We(t.key,e);O.set(t.key,n),E.push(Ge(t,n),``)}let k=[];if(r&&k.push(` ...defaultConfig`),i!==!1&&k.push(` animations`),x.length>0&&(r?k.push(` tokens: {
|
|
55
64
|
...defaultConfig.tokens,
|
|
56
65
|
...tokens,
|
|
57
66
|
color: {
|
|
@@ -74,14 +83,14 @@ Re-run Razorwind generate when tokens change so \`${e.outputPath}\` stays aligne
|
|
|
74
83
|
...defaultConfig.tokens.zIndex,
|
|
75
84
|
...tokens.zIndex
|
|
76
85
|
}
|
|
77
|
-
}`):
|
|
86
|
+
}`):k.push(` tokens`)),k.push(` themes`),O.size>0){let e=[...O.entries()].map(([e,t])=>` ${/^[A-Z_$][\w$]*$/i.test(e)?e:m(e)}: ${t}`);r?k.push(` fonts: {
|
|
78
87
|
...defaultConfig.fonts,
|
|
79
88
|
${e.join(`,
|
|
80
89
|
`)}
|
|
81
|
-
}`):
|
|
90
|
+
}`):k.push(` fonts: {
|
|
82
91
|
${e.join(`,
|
|
83
92
|
`)}
|
|
84
|
-
}`)}return
|
|
85
|
-
`),`});`,``,`export type AppConfig = typeof config;`,``),a&&
|
|
86
|
-
`)}function
|
|
93
|
+
}`)}return E.push(`export const config = createTamagui({`,k.join(`,
|
|
94
|
+
`),`});`,``,`export type AppConfig = typeof config;`,``),a&&E.push(`declare module "@tamagui/core" {`,` // eslint-disable-next-line @typescript-eslint/no-empty-object-type`,` interface TamaguiCustomConfig extends AppConfig {}`,`}`,``),E.push(`export default config;`,``),E.join(`
|
|
95
|
+
`)}function At(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?ae(e.tokens,n):[];if(a.length===0&&!i)return{};let o=n.outputPath??`tamagui.config.ts`,s=kt(a,n,e.fonts),c=n.installGuide??Ke({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 jt=e(e=>({name:`tamagui`,themeGeneration:`combined`,generate:async t=>At(t,e??{})}));export{X as collectColorScales,He as collectTamaguiFonts,bt as colorLightness,jt as default,ae as flattenTokens,We as fontVarName,n as formatTokenValue,At as generateTamaguiConfig,D as isPaletteGroup,Z as orderPaletteForScheme,Ke as renderInstallMd,kt as renderTamaguiConfig,ne as resolveTokenCategory,a as resolveTokenSets,R as tamaguiFontKeyFromRole,A as toCamelCaseKey,o as toCssVar,h as toTamaguiValue,re as toTokenKey,De as typographyFontKey};
|
|
87
96
|
//# 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.41",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind plugin that creates Tamagui theme tokens from Razorwind design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -85,8 +85,9 @@
|
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"@power-plant/core": "^0.0.90",
|
|
87
87
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
88
|
-
"@razorwind/core": "^0.0.
|
|
89
|
-
"@stryke/type-checks": "^0.6.41"
|
|
88
|
+
"@razorwind/core": "^0.0.52",
|
|
89
|
+
"@stryke/type-checks": "^0.6.41",
|
|
90
|
+
"@stryke/string-format": "^0.17.50"
|
|
90
91
|
},
|
|
91
92
|
"peerDependencies": {
|
|
92
93
|
"@tamagui/config": ">=1.120.0",
|
|
@@ -104,5 +105,5 @@
|
|
|
104
105
|
"typescript": "^6.0.3"
|
|
105
106
|
},
|
|
106
107
|
"publishConfig": { "access": "public" },
|
|
107
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "a72e2fb9b29f96e4f2c2241f622e56e6929f6dc9"
|
|
108
109
|
}
|