@cyclone-ui/theme-builder 0.0.40 → 0.0.42

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  # Changelog for Cyclone UI - Theme Builder
4
4
 
5
+ ## [0.0.42](https://github.com/storm-software/cyclone-ui/releases/tag/theme-builder%400.0.42) (11/06/2026)
6
+
7
+ ### Features
8
+
9
+ - **stepper:** Added the `details` property to `Stepper` component ([5d3ffa8f5](https://github.com/storm-software/cyclone-ui/commit/5d3ffa8f5))
10
+ - **monorepo:** Reduced the amount of tokens by removing extra theme border colors ([f01400d25](https://github.com/storm-software/cyclone-ui/commit/f01400d25))
11
+ - **kbd:** Added the `Kbd` keybord display components ([c8c84cb3e](https://github.com/storm-software/cyclone-ui/commit/c8c84cb3e))
12
+
5
13
  ## [0.0.39](https://github.com/storm-software/cyclone-ui/releases/tag/theme-builder%400.0.39) (11/05/2026)
6
14
 
7
15
  ### Features
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin");const t=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,n=/^oklch\(\s*([0-9.]+%?|none)\s+([0-9.]+|none)\s+([0-9.]+|none)(?:\s*\/\s*([0-9.%]+))?\s*\)$/i,r=/* @__PURE__ */ new Set([`$schema`,`$type`,`$description`,`$extensions`,`$extends`,`$deprecated`,`$root`,`$value`,`$ref`,`theme`,`group`,`semantic`,`palette`,`primitive`]);function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function a(e){return i(e)&&(`$value`in e||`$ref`in e)}function o(e){let t=e.trim();return t.startsWith(`{`)||t.startsWith(`var(`)}function s(e){return Math.min(1,Math.max(0,e))}function c(e){let t=s(e);return t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055}function l(e){let t=s(e);return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function u(e){return Math.round(c(e)*255).toString(16).padStart(2,`0`)}function d(e){return Math.round(s(e)*255).toString(16).padStart(2,`0`)}function f(e){return Math.round(s(e)*255).toString(16).padStart(2,`0`)}function p(e){let t=e.startsWith(`#`)?e.slice(1):e;return t.length===3||t.length===4?`#${[...t].map(e=>e+e).join(``)}`:`#${t}`}function m(e){if(typeof e==`string`){let n=e.trim();if(!t.test(n))return;let r=p(n).toLowerCase();return r.length===9&&r.endsWith(`ff`)?r.slice(0,7):r}if(i(e)){if(typeof e.hex==`string`&&t.test(e.hex)){let t=p(e.hex).toLowerCase().slice(0,7),n=v(e.alpha);return n!==void 0&&n<1?`${t}${f(n)}`:t}if(e.colorSpace===`srgb`&&Array.isArray(e.components)&&e.components.length>=3){let t=_(e.components[0]),n=_(e.components[1]),r=_(e.components[2]);if(t===void 0||n===void 0||r===void 0)return;let i=`#${d(t)}${d(n)}${d(r)}`,a=v(e.alpha);return a!==void 0&&a<1?`${i}${f(a)}`:i}}}function h(e,t,n){let r=n*Math.PI/180,i=t*Math.cos(r),a=t*Math.sin(r),o=e+.3963377774*i+.2158037573*a,s=e-.1055613458*i-.0638541728*a,c=e-.0894841775*i-1.291485548*a,l=o**3,u=s**3,d=c**3;return{red:4.0767416621*l-3.3077115913*u+.2309699292*d,green:-1.2684380046*l+2.6097574011*u-.3413193965*d,blue:-.0041960863*l-.7034186147*u+1.707614701*d}}function g(e,t,n,r){let{red:i,green:a,blue:o}=h(e,t,n),s=`#${u(i)}${u(a)}${u(o)}`;return r===void 0||r>=1?s:`${s}${f(r)}`}function _(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`||e===`none`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function v(e){if(typeof e==`number`&&Number.isFinite(e))return e>1?e/100:e;if(typeof e!=`string`)return;let t=Number.parseFloat(e);if(Number.isFinite(t))return e.includes(`%`)||t>1?t/100:t}function ee(e){let t=n.exec(e.trim());if(!t)return;let r=_(t[1]),i=_(t[2]),a=_(t[3]);if(r!==void 0&&i!==void 0&&a!==void 0)return t[1]?.includes(`%`)&&(r/=100),g(r,i,a,v(t[4]))}function te(e){if(!Array.isArray(e.components)||e.components.length<3)return;let t=_(e.components[0]),n=_(e.components[1]),r=_(e.components[2]);if(t!==void 0&&n!==void 0&&r!==void 0)return t>1&&(t/=100),g(t,n,r,v(e.alpha))}function y(e){if(typeof e==`string`)return o(e)?void 0:ee(e)??m(e)??void 0;if(i(e))return typeof e.colorSpace==`string`&&e.colorSpace.toLowerCase()===`oklch`?te(e):m(e)??void 0}function b(e){if(Array.isArray(e))return e.map(e=>b(e));if(!i(e)||!(`color`in e))return e;let t=y(e.color);return t?{...e,color:t}:e}function ne(e,t){if(t===`shadow`)return b(e);if(t===`border`&&i(e)&&`color`in e){let t=y(e.color);return t?{...e,color:t}:e}return t===`color`||t===void 0?y(e)??e:e}function x(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function re(e,t){if(`$ref`in e&&!(`$value`in e))return{...e};let n=x(e,t);return`$value`in e?{...e,$value:ne(e.$value,n)}:{...e}}function S(e,t){if(Array.isArray(e))return e.map(e=>S(e,t));if(!i(e))return e;if(a(e))return re(e,t);let n=typeof e.$type==`string`?e.$type:t,o={};for(let[t,i]of Object.entries(e))o[t]=r.has(t)||t.startsWith(`$`)?i:S(i,n);return o}const ie={dark:`#ffffff`,light:`#0c0c0d`},ae={dark:`#ffffff`,light:`#000000`};function oe(e){if(typeof e!=`string`)return;let t=/\b(dark|light)[\s-]+theme\b/i.exec(e)?.[1];return t?.toLowerCase()===`dark`?`dark`:t?.toLowerCase()===`light`?`light`:void 0}function se(e){if(i(e)&&i(e.color))return oe(e.color.$description)}const ce={name:`active`,brightness:1.45,useContrastPrimitive:!0},le={name:`active`,brightness:1.25},ue={name:`active`,brightness:1.125},de={name:`active`,brightness:1.4},fe={name:`active`,brightness:1.8,useContrastPrimitive:!0},C={name:`inactive`,brightness:.8},w={name:`inactive`,brightness:.5,useContrastPrimitive:!0},T={name:`disabled`,opacity:.35,saturation:.85,fadeOver:`oklch(0.3839 0.0045 286.26)`},E={lowSaturation:[ce,w,T],saturated:[le,C,T]},pe={lowSaturation:[ue,w,T],saturated:E.saturated},me={name:`inactive`,brightness:.9},D={...T,opacity:.675,saturation:.925},O={lowSaturation:[{name:`active`,brightness:1.3},me,D],saturated:[{name:`active`,brightness:1.25},me,D]},he=[`shadows`];function k(e){return Object.entries(e).filter(e=>!he.includes(e[0])&&i(e[1])&&!a(e[1])&&a(e[1].primary))}const A={lowSaturation:[fe,w,T],saturated:[de,C,T]},ge={primary:E,secondary:pe,link:E,outline:A},_e={foreground:{lowSaturation:[{name:`hovered`,brightness:1.25},...E.lowSaturation],saturated:[{name:`hovered`,brightness:1.15},...E.saturated]},background:{lowSaturation:[{name:`hovered`,brightness:1.25},...O.lowSaturation],saturated:[{name:`hovered`,brightness:1.15},...O.saturated]}},ve={outline:A},j=7.5,M=.01;function ye(e){return e.toLowerCase().endsWith(`-hovered`)||e.toLowerCase().endsWith(`-active`)||e.toLowerCase().endsWith(`-inactive`)||e.toLowerCase().endsWith(`-disabled`)}function be(e,t){let n=e;for(let e of t.split(`.`).filter(Boolean)){if(!i(n)||!(e in n))return;n=n[e]}return a(n)?n:void 0}function N(e,t,n=/* @__PURE__ */ new Set){let r=y(e);if(r)return r;if(typeof e!=`string`)return;let i=/^\{([^{}]+)\}$/.exec(e.trim());if(!i?.[1]||n.has(i[1]))return;n.add(i[1]);let a=be(t,i[1]);if(a&&`$value`in a)return N(a.$value,t,n)}function P(e,t){let n=p(e).toLowerCase(),r=n.slice(0,7),i=s((n.length===9?Number.parseInt(n.slice(7,9),16)/255:1)*t);return i>=1?r:`${r}${f(i)}`}function xe(e,t,n){let r=p(e).toLowerCase(),i=p(y(t)??t).toLowerCase(),a=s((r.length===9?Number.parseInt(r.slice(7,9),16)/255:1)*n),o=e=>d((Number.parseInt(r.slice(e,e+2),16)*a+Number.parseInt(i.slice(e,e+2),16)*(1-a))/255);return`#${o(1)}${o(3)}${o(5)}`}function F(e,t,n=!1){if(Array.isArray(e))return e.map(e=>F(e,t,n));if(!i(e))return e;if(n&&a(e)&&x(e)===`shadow`){let n=e.$value,r=e=>{if(!i(e)||!(`color`in e))return e;let n=N(e.color,t);return n?{...e,color:P(n,R(n)?.1:.15)}:e};return{...e,$value:Array.isArray(n)?n.map((e,t)=>t===n.length-1?r(e):e):r(n)}}let r={};for(let[i,a]of Object.entries(e))r[i]=F(a,t,n||i.toLowerCase()===`ring`);return r}const I={value:0,unit:`px`};function L(e,t){return{color:e,offsetX:I,offsetY:I,blur:I,spread:{value:t,unit:`px`}}}function Se(e){if(!i(e)||!i(e.color))return e;let t=e.color,n=i(e.ring)?{...e.ring}:{},r=!1;for(let[e]of k(t)){let t=`{color.${e}.primary}`,i=e=>L(`{color.elevated}`,e),a={[e]:[`${e} 3px focus ring with no gap`,[L(t,3)]],[`${e}-subtle`]:[`${e} 1px outline focus ring with no gap`,[L(t,1)]],[`${e}-offset`]:[`${e} 3px focus ring with a 3px gap`,[i(3),L(t,7)]],[`${e}-subtle-offset`]:[`${e} 1px focus ring with a 2px gap`,[i(2),L(t,3)]]};for(let[t,[i,o]]of Object.entries(a))t in n||(n[t]={$description:`Generated ${i}`,$type:`shadow`,$value:o,theme:e},r=!0)}return r?{...e,ring:n}:e}function R(e){return B(e).chroma<.02}function z(e){let t=p(e).toLowerCase();return t.slice(1,3)===t.slice(3,5)&&t.slice(3,5)===t.slice(5,7)}function B(e){let t=p(e).toLowerCase(),n=l(Number.parseInt(t.slice(1,3),16)/255),r=l(Number.parseInt(t.slice(3,5),16)/255),i=l(Number.parseInt(t.slice(5,7),16)/255),a=t.length===9?Number.parseInt(t.slice(7,9),16)/255:void 0,o=.4122214708*n+.5363325363*r+.0514459929*i,s=.2119034982*n+.6806995451*r+.1073969566*i,c=.0883024619*n+.2817188376*r+.6299787005*i,u=Math.cbrt(o),d=Math.cbrt(s),f=Math.cbrt(c),m=.2104542553*u+.793617785*d-.0040720468*f,h=1.9779984951*u-2.428592205*d+.4505937099*f,g=.0259040371*u+.7827717662*d-.808675766*f,_=Math.hypot(h,g),v=Math.atan2(g,h)*180/Math.PI;return v<0&&(v+=360),{lightness:m,chroma:_,hue:v,alpha:a}}function V({red:e,green:t,blue:n}){return e>=0&&e<=1&&t>=0&&t<=1&&n>=0&&n<=1}function H(e,t,n,r){if(V(h(e,t,n)))return g(e,t,n,r);let i=0,a=t;for(let t=0;t<32;t+=1){let t=(i+a)/2;V(h(e,t,n))?i=t:a=t}return g(e,i,n,r)}function U(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(s(n*t),r,i,a)}function Ce(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(s(n+t),r,i,a)}function we(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(n,r*s(t),i,a)}function W(e){let t=p(e).toLowerCase(),n=e=>{let n=Number.parseInt(t.slice(e,e+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(1)+.7152*n(3)+.0722*n(5)}function G(e,t){let n=W(e),r=W(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function K(e){let t=G(e,`#FAFAFA`);return t>=2?`#FAFAFA`:G(e,`#151518`)*.5>t?`#151518`:`#FAFAFA`}function Te(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e),o=t===`light`?1:-1,c=-o,l=n,u=n,d=e,f=e;for(let t=0;t<100;t+=1){if(l=s(l+o*M),d=H(l,r,i,a),G(d,f)>=j)return f===e?{secondary:d}:{secondary:d,onMuted:f};if(u=s(u+c*M),f=H(u,r,i,a),G(d,f)>=j)return{secondary:d,onMuted:f};if((l===0||l===1)&&(u===0||u===1))break}throw Error(`Unable to generate an accessible secondary pair for ${e}`)}function Ee(e,t){return t===`dark`?q(e):t===`light`?!J(e):B(e).lightness>=.5}function De(e,t){return!Ee(e,t)}const Oe=B(`#fefefe`).lightness,ke=B(`#262626`).lightness;function q(e){return B(e).lightness>=(R(e)?Oe:.75)}function J(e){return B(e).lightness<=(R(e)?ke:.25)}function Y(e){return e.name===`hovered`||e.name===`active`}function X(e,t){return t===`dark`?q(e):t===`light`&&J(e)}function Ae(e,t,n){return De(e,n)?t:2-t}function Z(e,t){return e.useContrastPrimitive&&t?ie[t]:void 0}function je(e,t,n){if(t.name===`hovered`&&Z(t,n)&&X(e,n))return n===`dark`?-.25:.25}function Me(e,t,n){let r=Z(t,n);return r&&n&&t.name===`active`&&X(e,n)?ae[n]:r}function Ne(e,t,n){return t.brightness===void 0?1:Z(t,n)?Y(t)?1:t.brightness:Ae(e,t.brightness,n)}function Pe(e,t,n){let r=je(e,t,n),i=r===void 0?Me(e,t,n):void 0,a=i??e;return r===void 0?t.brightness!==void 0&&!(i&&Y(t))&&(a=U(a,Ne(a,t,n))):a=Ce(e,r),t.saturation!==void 0&&!z(e)&&(a=we(a,t.saturation),t.fadeOver===void 0)?a:t.fadeOver===void 0?t.opacity===void 0?a:P(a,t.opacity):xe(a,t.fadeOver,t.opacity??1)}function Fe(e,t,n){let r=[],i=je(t,e,n),a=Me(t,e,n);if(i!==void 0)r.push(`${Math.round(Math.abs(i)*100)}% ${i<0?`darker`:`lighter`}`);else if(a&&Y(e))r.push(n&&a!==ie[n]?`pure ${n===`dark`?`white`:`black`}`:`${n} contrast primitive`);else if(e.brightness!==void 0){let i=Ne(t,e,n),a=Math.round((i-1)*100);r.push(a>=0?`${a}% brighter`:`${Math.abs(a)}% darker`)}return e.saturation!==void 0&&!z(t)&&r.push(`${Math.round(e.saturation*100)}% saturation`),e.fadeOver===void 0?e.opacity!==void 0&&(e.saturation===void 0||z(t))&&r.push(`${Math.round(e.opacity*100)}% opacity`):r.push(`${Math.round((e.opacity??1)*100)}% over ${e.fadeOver}`),r.join(`, `)||e.name}function Ie(e,t,n,r){let i=Fe(n,t,r),a=Pe(t,n,r);return{...e,$type:`color`,$value:a,$description:typeof e.$description==`string`?`${e.$description} (${n.name}, ${i})`:`${n.name} state at ${i}`}}function Q(e,t,n,r,i){let o={...e},s=r?[r]:Object.keys(e);for(let r of s){if(r.startsWith(`$`)||ye(r))continue;let s=e[r];if(!a(s))continue;let c=x(s);if(c&&c!==`color`)continue;let l=N(s.$value,t);if(!l)continue;let u=R(l)?n.lowSaturation:n.saturated,d=u.some(e=>e.name===`hovered`),f=u.flatMap(e=>e.name===`active`&&!d?[{...e,name:`hovered`},e]:[e]),p=oe(s.$description)??i;for(let e of f){let t=`${r}-${e.name}`;t in o||(o[t]=Ie(s,l,e,p))}}return o}function Le(e,t,n,r){let i=t.primary,o=a(i)&&N(i.$value,n),c=a(i)&&x(i);if(!a(i)||!o||c&&c!==`color`)return t;let l={...t};l.link??={...i,$type:`color`,$value:`{color.${e}.primary}`,$description:`Generated ${e} hyperlink text color (matches primary)`},t.group===`status`&&(l.outline??={...i,$type:`color`,$value:`{color.${e}.primary}`,$description:`Generated ${e} border and divider color (matches primary)`}),l[`on-primary`]??={...i,$type:`color`,$value:K(o),$description:`Generated text and icon color on ${e} primary backgrounds`},l.backdrop??={...i,$type:`color`,$value:P(U(o,.375),.45),$description:`Generated ${e} overlay backdrop color (primary, 30% darker at 75% opacity)`};let u;if(r&&!(`secondary`in t)){let t=Te(o,r);l.secondary={...i,$type:`color`,$value:t.secondary,$description:`Generated low-emphasis ${e} background for the ${r} theme`},u=t.onMuted??o}else if(a(t.secondary)){let e=N(t.secondary.$value,n);u=e&&K(e)}u&&!(`on-secondary`in t)&&(l[`on-secondary`]={...i,$type:`color`,$value:u,$description:`Generated text and icon color on ${e} secondary backgrounds`});let d=!(`border`in t)&&a(l.secondary)&&N(l.secondary.$value,n);if(d){let{lightness:t,chroma:n,hue:a,alpha:o}=B(d),c=r===`light`?-1:1;l.border={...i,$type:`color`,$value:H(s(t*(1+c*.15)),n,a,o),$description:`Generated ${e} border color for secondary backgrounds (secondary, 15% ${c>0?`brighter`:`darker`})`}}for(let[e,t]of Object.entries(ge))l=Q(l,n,t,e,r);for(let[t,n]of Object.entries(l))a(n)&&(l[t]={theme:e,group:e,...n});return l}function Re(e){let t={...e};for(let[n,r]of Object.entries(e)){let e=n.replace(/^on-/,``).replace(/-(?:hovered|active|inactive|disabled)$/i,``);e!==n&&a(r)&&!(`group`in r)&&(t[n]={...r,group:e})}return t}function ze(e){let t=e.base,n=e.brand;return!i(t)||a(t)||!i(n)||a(n)||Object.entries(n).some(([e,t])=>!r.has(e)&&!e.startsWith(`$`)&&a(t))?e:{...e,brand:{...t,...n}}}function $(e,t,n,o){if(Array.isArray(e))return e.map(e=>$(e,t,void 0,o));if(!i(e)||a(e))return e;let s={};for(let[n,i]of Object.entries(e))s[n]=r.has(n)||n.startsWith(`$`)?i:$(i,t,n,n===`dark`||n===`light`?n:o);let c=s;if(n===`color`){c=ze(c);for(let[e,n]of k(c))c[e]=Le(e,n,t,o);for(let[e,n]of Object.entries(c)){let r=a(n)&&typeof n.group==`string`?_e[n.group]:void 0;r&&(c=Q(c,t,r,e,o))}}for(let[e,n]of Object.entries(ve))a(c[e])&&(c=Q(c,t,n,e,o));return n===`color`?Re(c):c}function Be(e){let t=S(e),n=Se($(t,t,void 0,se(t)));return F(n,n)}var Ve=(0,e.definePlugin)(()=>({name:`cyclone-ui:tamagui-preprocessor`,preprocessors:[{name:`tamagui-preprocessor`,preprocessor:Be}]}));exports.default=Ve,exports.tamaguiPreprocessor=Be;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin");const t=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,n=/^oklch\(\s*([0-9.]+%?|none)\s+([0-9.]+|none)\s+([0-9.]+|none)(?:\s*\/\s*([0-9.%]+))?\s*\)$/i,r=/* @__PURE__ */ new Set([`$schema`,`$type`,`$description`,`$extensions`,`$extends`,`$deprecated`,`$root`,`$value`,`$ref`,`theme`,`group`,`semantic`,`palette`,`primitive`]);function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function a(e){return i(e)&&(`$value`in e||`$ref`in e)}function o(e){let t=e.trim();return t.startsWith(`{`)||t.startsWith(`var(`)}function s(e){return Math.min(1,Math.max(0,e))}function c(e){let t=s(e);return t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055}function l(e){let t=s(e);return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function u(e){return Math.round(c(e)*255).toString(16).padStart(2,`0`)}function d(e){return Math.round(s(e)*255).toString(16).padStart(2,`0`)}function f(e){return Math.round(s(e)*255).toString(16).padStart(2,`0`)}function p(e){let t=e.startsWith(`#`)?e.slice(1):e;return t.length===3||t.length===4?`#${[...t].map(e=>e+e).join(``)}`:`#${t}`}function m(e){if(typeof e==`string`){let n=e.trim();if(!t.test(n))return;let r=p(n).toLowerCase();return r.length===9&&r.endsWith(`ff`)?r.slice(0,7):r}if(i(e)){if(typeof e.hex==`string`&&t.test(e.hex)){let t=p(e.hex).toLowerCase().slice(0,7),n=v(e.alpha);return n!==void 0&&n<1?`${t}${f(n)}`:t}if(e.colorSpace===`srgb`&&Array.isArray(e.components)&&e.components.length>=3){let t=_(e.components[0]),n=_(e.components[1]),r=_(e.components[2]);if(t===void 0||n===void 0||r===void 0)return;let i=`#${d(t)}${d(n)}${d(r)}`,a=v(e.alpha);return a!==void 0&&a<1?`${i}${f(a)}`:i}}}function h(e,t,n){let r=n*Math.PI/180,i=t*Math.cos(r),a=t*Math.sin(r),o=e+.3963377774*i+.2158037573*a,s=e-.1055613458*i-.0638541728*a,c=e-.0894841775*i-1.291485548*a,l=o**3,u=s**3,d=c**3;return{red:4.0767416621*l-3.3077115913*u+.2309699292*d,green:-1.2684380046*l+2.6097574011*u-.3413193965*d,blue:-.0041960863*l-.7034186147*u+1.707614701*d}}function g(e,t,n,r){let{red:i,green:a,blue:o}=h(e,t,n),s=`#${u(i)}${u(a)}${u(o)}`;return r===void 0||r>=1?s:`${s}${f(r)}`}function _(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`||e===`none`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function v(e){if(typeof e==`number`&&Number.isFinite(e))return e>1?e/100:e;if(typeof e!=`string`)return;let t=Number.parseFloat(e);if(Number.isFinite(t))return e.includes(`%`)||t>1?t/100:t}function ee(e){let t=n.exec(e.trim());if(!t)return;let r=_(t[1]),i=_(t[2]),a=_(t[3]);if(r!==void 0&&i!==void 0&&a!==void 0)return t[1]?.includes(`%`)&&(r/=100),g(r,i,a,v(t[4]))}function te(e){if(!Array.isArray(e.components)||e.components.length<3)return;let t=_(e.components[0]),n=_(e.components[1]),r=_(e.components[2]);if(t!==void 0&&n!==void 0&&r!==void 0)return t>1&&(t/=100),g(t,n,r,v(e.alpha))}function y(e){if(typeof e==`string`)return o(e)?void 0:ee(e)??m(e)??void 0;if(i(e))return typeof e.colorSpace==`string`&&e.colorSpace.toLowerCase()===`oklch`?te(e):m(e)??void 0}function b(e){if(Array.isArray(e))return e.map(e=>b(e));if(!i(e)||!(`color`in e))return e;let t=y(e.color);return t?{...e,color:t}:e}function ne(e,t){if(t===`shadow`)return b(e);if(t===`border`&&i(e)&&`color`in e){let t=y(e.color);return t?{...e,color:t}:e}return t===`color`||t===void 0?y(e)??e:e}function x(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function re(e,t){if(`$ref`in e&&!(`$value`in e))return{...e};let n=x(e,t);return`$value`in e?{...e,$value:ne(e.$value,n)}:{...e}}function S(e,t){if(Array.isArray(e))return e.map(e=>S(e,t));if(!i(e))return e;if(a(e))return re(e,t);let n=typeof e.$type==`string`?e.$type:t,o={};for(let[t,i]of Object.entries(e))o[t]=r.has(t)||t.startsWith(`$`)?i:S(i,n);return o}const C={dark:`#ffffff`,light:`#0c0c0d`},ie={dark:`#ffffff`,light:`#000000`};function w(e){if(typeof e!=`string`)return;let t=/\b(dark|light)[\s-]+theme\b/i.exec(e)?.[1];return t?.toLowerCase()===`dark`?`dark`:t?.toLowerCase()===`light`?`light`:void 0}function ae(e){if(i(e)&&i(e.color))return w(e.color.$description)}const oe={name:`active`,brightness:1.45,useContrastPrimitive:!0},se={name:`active`,brightness:1.25},ce={name:`active`,brightness:1.175},le={name:`active`,brightness:1.8,useContrastPrimitive:!0},T={name:`inactive`,brightness:.8},E={name:`inactive`,brightness:.5,useContrastPrimitive:!0},D={name:`disabled`,opacity:.15,saturation:.85,fadeOver:`oklch(0.3839 0.0045 286.26)`},O={lowSaturation:[oe,E,D],saturated:[se,T,D]},ue={lowSaturation:[ce,E,D],saturated:O.saturated},de={name:`inactive`,brightness:.9},fe={...D,opacity:.25,saturation:.925},pe={lowSaturation:[{name:`active`,brightness:1.3},de,fe],saturated:[{name:`active`,brightness:1.25},de,fe]},me=[`shadows`];function k(e){return Object.entries(e).filter(e=>!me.includes(e[0])&&i(e[1])&&!a(e[1])&&a(e[1].primary))}const he={lowSaturation:[{name:`hovered`,brightness:1.4},le,E,D],saturated:[{name:`hovered`,brightness:1.2},{name:`active`,brightness:1.4},T,D]},A={lowSaturation:[{name:`hovered`,brightness:1.25},...O.lowSaturation],saturated:[{name:`hovered`,brightness:1.125},...O.saturated]},ge={primary:A,secondary:{lowSaturation:[{name:`hovered`,brightness:1.08},...ue.lowSaturation],saturated:A.saturated},link:A},_e={foreground:{lowSaturation:[{name:`hovered`,brightness:1.25},...O.lowSaturation],saturated:[{name:`hovered`,brightness:1.15},...O.saturated]},background:{lowSaturation:[{name:`hovered`,brightness:1.15},...pe.lowSaturation],saturated:[{name:`hovered`,brightness:1.15},...pe.saturated]}},ve={hairline:he},j=7.5,M=.01;function ye(e){return e.toLowerCase().endsWith(`-hovered`)||e.toLowerCase().endsWith(`-active`)||e.toLowerCase().endsWith(`-inactive`)||e.toLowerCase().endsWith(`-disabled`)}function be(e,t){let n=e;for(let e of t.split(`.`).filter(Boolean)){if(!i(n)||!(e in n))return;n=n[e]}return a(n)?n:void 0}function N(e,t,n=/* @__PURE__ */ new Set){let r=y(e);if(r)return r;if(typeof e!=`string`)return;let i=/^\{([^{}]+)\}$/.exec(e.trim());if(!i?.[1]||n.has(i[1]))return;n.add(i[1]);let a=be(t,i[1]);if(a&&`$value`in a)return N(a.$value,t,n)}function P(e,t){let n=p(e).toLowerCase(),r=n.slice(0,7),i=s((n.length===9?Number.parseInt(n.slice(7,9),16)/255:1)*t);return i>=1?r:`${r}${f(i)}`}function xe(e,t,n){let r=p(e).toLowerCase(),i=p(y(t)??t).toLowerCase(),a=s((r.length===9?Number.parseInt(r.slice(7,9),16)/255:1)*n),o=e=>d((Number.parseInt(r.slice(e,e+2),16)*a+Number.parseInt(i.slice(e,e+2),16)*(1-a))/255);return`#${o(1)}${o(3)}${o(5)}`}function F(e,t,n=!1){if(Array.isArray(e))return e.map(e=>F(e,t,n));if(!i(e))return e;if(n&&a(e)&&x(e)===`shadow`){let n=e.$value,r=e=>{if(!i(e)||!(`color`in e))return e;let n=N(e.color,t);return n?{...e,color:P(n,R(n)?.1:.15)}:e};return{...e,$value:Array.isArray(n)?n.map((e,t)=>t===n.length-1?r(e):e):r(n)}}let r={};for(let[i,a]of Object.entries(e))r[i]=F(a,t,n||i.toLowerCase()===`ring`);return r}const I={value:0,unit:`px`};function L(e,t){return{color:e,offsetX:I,offsetY:I,blur:I,spread:{value:t,unit:`px`}}}function Se(e){if(!i(e)||!i(e.color))return e;let t=e.color,n=i(e.ring)?{...e.ring}:{},r=!1;for(let[e]of k(t)){let t=`{color.${e}.primary}`,i=e=>L(`{color.elevated}`,e),a={[e]:[`${e} 3px focus ring with no gap`,[L(t,3)]],[`${e}-subtle`]:[`${e} 1px outline focus ring with no gap`,[L(t,1)]],[`${e}-offset`]:[`${e} 3px focus ring with a 3px gap`,[i(3),L(t,7)]],[`${e}-subtle-offset`]:[`${e} 1px focus ring with a 2px gap`,[i(2),L(t,3)]]};for(let[t,[i,o]]of Object.entries(a))t in n||(n[t]={$description:`Generated ${i}`,$type:`shadow`,$value:o,theme:e},r=!0)}return r?{...e,ring:n}:e}function R(e){return B(e).chroma<.02}function z(e){let t=p(e).toLowerCase();return t.slice(1,3)===t.slice(3,5)&&t.slice(3,5)===t.slice(5,7)}function B(e){let t=p(e).toLowerCase(),n=l(Number.parseInt(t.slice(1,3),16)/255),r=l(Number.parseInt(t.slice(3,5),16)/255),i=l(Number.parseInt(t.slice(5,7),16)/255),a=t.length===9?Number.parseInt(t.slice(7,9),16)/255:void 0,o=.4122214708*n+.5363325363*r+.0514459929*i,s=.2119034982*n+.6806995451*r+.1073969566*i,c=.0883024619*n+.2817188376*r+.6299787005*i,u=Math.cbrt(o),d=Math.cbrt(s),f=Math.cbrt(c),m=.2104542553*u+.793617785*d-.0040720468*f,h=1.9779984951*u-2.428592205*d+.4505937099*f,g=.0259040371*u+.7827717662*d-.808675766*f,_=Math.hypot(h,g),v=Math.atan2(g,h)*180/Math.PI;return v<0&&(v+=360),{lightness:m,chroma:_,hue:v,alpha:a}}function V({red:e,green:t,blue:n}){return e>=0&&e<=1&&t>=0&&t<=1&&n>=0&&n<=1}function H(e,t,n,r){if(V(h(e,t,n)))return g(e,t,n,r);let i=0,a=t;for(let t=0;t<32;t+=1){let t=(i+a)/2;V(h(e,t,n))?i=t:a=t}return g(e,i,n,r)}function U(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(s(n*t),r,i,a)}function Ce(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(s(n+t),r,i,a)}function we(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(n,r*s(t),i,a)}function W(e){let t=p(e).toLowerCase(),n=e=>{let n=Number.parseInt(t.slice(e,e+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(1)+.7152*n(3)+.0722*n(5)}function G(e,t){let n=W(e),r=W(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function K(e){let t=G(e,`#FAFAFA`);return t>=2?`#FAFAFA`:G(e,`#151518`)*.5>t?`#151518`:`#FAFAFA`}function Te(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e),o=t===`light`?1:-1,c=-o,l=n,u=n,d=e,f=e;for(let t=0;t<100;t+=1){if(l=s(l+o*M),d=H(l,r,i,a),G(d,f)>=j)return f===e?{secondary:d}:{secondary:d,onMuted:f};if(u=s(u+c*M),f=H(u,r,i,a),G(d,f)>=j)return{secondary:d,onMuted:f};if((l===0||l===1)&&(u===0||u===1))break}throw Error(`Unable to generate an accessible secondary pair for ${e}`)}function Ee(e,t){return t===`dark`?q(e):t===`light`?!J(e):B(e).lightness>=.5}function De(e,t){return!Ee(e,t)}const Oe=B(`#fefefe`).lightness,ke=B(`#262626`).lightness;function q(e){return B(e).lightness>=(R(e)?Oe:.75)}function J(e){return B(e).lightness<=(R(e)?ke:.25)}function Y(e){return e.name===`hovered`||e.name===`active`}function X(e,t){return t===`dark`?q(e):t===`light`&&J(e)}function Ae(e,t,n){return De(e,n)?t:2-t}function Z(e,t){return e.useContrastPrimitive&&t?C[t]:void 0}function je(e,t,n){if(t.name===`hovered`&&Z(t,n)&&X(e,n))return n===`dark`?-.25:.25}function Me(e,t,n){let r=Z(t,n);return r&&n&&t.name===`active`&&X(e,n)?ie[n]:r}function Ne(e,t,n){return t.brightness===void 0?1:Z(t,n)?Y(t)?1:t.brightness:Ae(e,t.brightness,n)}function Pe(e,t,n){let r=je(e,t,n),i=r===void 0?Me(e,t,n):void 0,a=i??e;return r===void 0?t.brightness!==void 0&&!(i&&Y(t))&&(a=U(a,Ne(a,t,n))):a=Ce(e,r),t.saturation!==void 0&&!z(e)&&(a=we(a,t.saturation),t.fadeOver===void 0)?a:t.fadeOver===void 0?t.opacity===void 0?a:P(a,t.opacity):xe(a,t.fadeOver,t.opacity??1)}function Fe(e,t,n){let r=[],i=je(t,e,n),a=Me(t,e,n);if(i!==void 0)r.push(`${Math.round(Math.abs(i)*100)}% ${i<0?`darker`:`lighter`}`);else if(a&&Y(e))r.push(n&&a!==C[n]?`pure ${n===`dark`?`white`:`black`}`:`${n} contrast primitive`);else if(e.brightness!==void 0){let i=Ne(t,e,n),a=Math.round((i-1)*100);r.push(a>=0?`${a}% brighter`:`${Math.abs(a)}% darker`)}return e.saturation!==void 0&&!z(t)&&r.push(`${Math.round(e.saturation*100)}% saturation`),e.fadeOver===void 0?e.opacity!==void 0&&(e.saturation===void 0||z(t))&&r.push(`${Math.round(e.opacity*100)}% opacity`):r.push(`${Math.round((e.opacity??1)*100)}% over ${e.fadeOver}`),r.join(`, `)||e.name}function Ie(e,t,n,r){let i=Fe(n,t,r),a=Pe(t,n,r);return{...e,$type:`color`,$value:a,$description:typeof e.$description==`string`?`${e.$description} (${n.name}, ${i})`:`${n.name} state at ${i}`}}function Q(e,t,n,r,i){let o={...e},s=r?[r]:Object.keys(e);for(let r of s){if(r.startsWith(`$`)||ye(r))continue;let s=e[r];if(!a(s))continue;let c=x(s);if(c&&c!==`color`)continue;let l=N(s.$value,t);if(!l)continue;let u=R(l)?n.lowSaturation:n.saturated,d=u.some(e=>e.name===`hovered`),f=u.flatMap(e=>e.name===`active`&&!d?[{...e,name:`hovered`},e]:[e]),p=w(s.$description)??i;for(let e of f){let t=`${r}-${e.name}`;t in o||(o[t]=Ie(s,l,e,p))}}return o}function Le(e,t,n,r){let i=t.primary,o=a(i)&&N(i.$value,n),c=a(i)&&x(i);if(!a(i)||!o||c&&c!==`color`)return t;let l={...t};l.link??={...i,$type:`color`,$value:`{color.${e}.primary}`,$description:`Generated ${e} hyperlink text color (matches primary)`},l[`on-primary`]??={...i,$type:`color`,$value:K(o),$description:`Generated text and icon color on ${e} primary backgrounds`},l.backdrop??={...i,$type:`color`,$value:P(U(o,.375),.15),$description:`Generated ${e} overlay backdrop color (primary, 30% darker at 75% opacity)`};let u;if(r&&!(`secondary`in t)){let t=Te(o,r);l.secondary={...i,$type:`color`,$value:t.secondary,$description:`Generated low-emphasis ${e} background for the ${r} theme`},u=t.onMuted??o}else if(a(t.secondary)){let e=N(t.secondary.$value,n);u=e&&K(e)}u&&!(`on-secondary`in t)&&(l[`on-secondary`]={...i,$type:`color`,$value:u,$description:`Generated text and icon color on ${e} secondary backgrounds`});let d=!(`border`in t)&&a(l.secondary)&&N(l.secondary.$value,n);if(d){let{lightness:t,chroma:n,hue:a,alpha:o}=B(d),c=r===`light`?-1:1;l.border={...i,$type:`color`,$value:H(s(t*(1+c*.25)),n,a,o),$description:`Generated ${e} border color for secondary backgrounds (secondary, 25% ${c>0?`brighter`:`darker`})`}}for(let[e,t]of Object.entries(ge))l=Q(l,n,t,e,r);for(let[t,n]of Object.entries(l))a(n)&&(l[t]={theme:e,group:e,...n});return l}function Re(e){let t={...e};for(let[n,r]of Object.entries(e)){let e=n.replace(/^on-/,``).replace(/-(?:hovered|active|inactive|disabled)$/i,``);e!==n&&a(r)&&!(`group`in r)&&(t[n]={...r,group:e})}return t}function ze(e){let t=e.base,n=e.brand;return!i(t)||a(t)||!i(n)||a(n)||Object.entries(n).some(([e,t])=>!r.has(e)&&!e.startsWith(`$`)&&a(t))?e:{...e,brand:{...t,...n}}}function $(e,t,n,o){if(Array.isArray(e))return e.map(e=>$(e,t,void 0,o));if(!i(e)||a(e))return e;let s={};for(let[n,i]of Object.entries(e))s[n]=r.has(n)||n.startsWith(`$`)?i:$(i,t,n,n===`dark`||n===`light`?n:o);let c=s;if(n===`color`){c=ze(c);for(let[e,n]of k(c))c[e]=Le(e,n,t,o);for(let[e,n]of Object.entries(c)){let r=a(n)&&typeof n.group==`string`?_e[n.group]:void 0;r&&(c=Q(c,t,r,e,o))}}for(let[e,n]of Object.entries(ve))a(c[e])&&(c=Q(c,t,n,e,o));return n===`color`?Re(c):c}function Be(e){let t=S(e),n=Se($(t,t,void 0,ae(t)));return F(n,n)}var Ve=(0,e.definePlugin)(()=>({name:`cyclone-ui:tamagui-preprocessor`,preprocessors:[{name:`tamagui-preprocessor`,preprocessor:Be}]}));exports.default=Ve,exports.tamaguiPreprocessor=Be;
@@ -2,15 +2,14 @@ import { PreprocessedTokens } from "style-dictionary/types";
2
2
  /**
3
3
  * Style Dictionary preprocessor: rewrite color `$value`s (and nested shadow
4
4
  * colors) to hex so generators emit `#rrggbb` / `#rrggbbaa` instead of
5
- * `oklch()`. Root colors (emphasis, ink, subtle, outline, backgrounds)
5
+ * `oklch()`. Root colors (emphasis, ink, subtle, hairline, backgrounds)
6
6
  * stay in the root light and dark themes without rings. For each color group
7
7
  * with a `primary` token (except excluded groups), a missing `secondary` background and `on-primary` /
8
8
  * `on-secondary` text colors are generated, a missing `border` is derived from
9
9
  * `secondary` (15% brighter, or darker in light themes), then hovered, active, inactive,
10
- * and disabled variants are added to the outline, `foreground` and
10
+ * and disabled variants are added to the `hairline`, `foreground` and
11
11
  * `background` group colors, and each theme color group's `primary`, `secondary`
12
- * `link` and `outline` (`link`, and `outline` in `status` groups, default to
13
- * `primary` when missing).
12
+ * and `link` (`link` defaults to `primary` when missing).
14
13
  * Low-saturation colors derive their states from the parent theme's contrast
15
14
  * primitive (backgrounds use a half-strength shift of their own lightness; hovered
16
15
  * colors already near that primitive shift toward the middle, while active
@@ -18,8 +17,8 @@ import { PreprocessedTokens } from "style-dictionary/types";
18
17
  * colors scale their own lightness. Foreground and background hovered states
19
18
  * take a smaller step than their active states. Tokens in a theme color group get the
20
19
  * group name as `theme` and `group`, unless already set; root state and `on-*`
21
- * tokens get their main token name as `group` (e.g. `outline-active` →
22
- * `outline`).
20
+ * tokens get their main token name as `group` (e.g. `hairline-active` →
21
+ * `hairline`).
23
22
  * Finally, focus rings are generated for each theme color group.
24
23
  */
25
24
  declare function tamaguiPreprocessor(dictionary: PreprocessedTokens): PreprocessedTokens;
@@ -1 +1 @@
1
- {"version":3,"file":"preprocessor.d.cts","names":[],"sources":["../src/preprocessor.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;iBA0kDgB,oBACd,YAAY,qBACX"}
1
+ {"version":3,"file":"preprocessor.d.cts","names":[],"sources":["../src/preprocessor.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAulDgB,oBACd,YAAY,qBACX"}
@@ -2,15 +2,14 @@ import { PreprocessedTokens } from "style-dictionary/types";
2
2
  /**
3
3
  * Style Dictionary preprocessor: rewrite color `$value`s (and nested shadow
4
4
  * colors) to hex so generators emit `#rrggbb` / `#rrggbbaa` instead of
5
- * `oklch()`. Root colors (emphasis, ink, subtle, outline, backgrounds)
5
+ * `oklch()`. Root colors (emphasis, ink, subtle, hairline, backgrounds)
6
6
  * stay in the root light and dark themes without rings. For each color group
7
7
  * with a `primary` token (except excluded groups), a missing `secondary` background and `on-primary` /
8
8
  * `on-secondary` text colors are generated, a missing `border` is derived from
9
9
  * `secondary` (15% brighter, or darker in light themes), then hovered, active, inactive,
10
- * and disabled variants are added to the outline, `foreground` and
10
+ * and disabled variants are added to the `hairline`, `foreground` and
11
11
  * `background` group colors, and each theme color group's `primary`, `secondary`
12
- * `link` and `outline` (`link`, and `outline` in `status` groups, default to
13
- * `primary` when missing).
12
+ * and `link` (`link` defaults to `primary` when missing).
14
13
  * Low-saturation colors derive their states from the parent theme's contrast
15
14
  * primitive (backgrounds use a half-strength shift of their own lightness; hovered
16
15
  * colors already near that primitive shift toward the middle, while active
@@ -18,8 +17,8 @@ import { PreprocessedTokens } from "style-dictionary/types";
18
17
  * colors scale their own lightness. Foreground and background hovered states
19
18
  * take a smaller step than their active states. Tokens in a theme color group get the
20
19
  * group name as `theme` and `group`, unless already set; root state and `on-*`
21
- * tokens get their main token name as `group` (e.g. `outline-active` →
22
- * `outline`).
20
+ * tokens get their main token name as `group` (e.g. `hairline-active` →
21
+ * `hairline`).
23
22
  * Finally, focus rings are generated for each theme color group.
24
23
  */
25
24
  declare function tamaguiPreprocessor(dictionary: PreprocessedTokens): PreprocessedTokens;
@@ -1,2 +1,2 @@
1
- import{definePlugin as e}from"@razorwind/core/plugin";const t=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,n=/^oklch\(\s*([0-9.]+%?|none)\s+([0-9.]+|none)\s+([0-9.]+|none)(?:\s*\/\s*([0-9.%]+))?\s*\)$/i,r=/* @__PURE__ */ new Set([`$schema`,`$type`,`$description`,`$extensions`,`$extends`,`$deprecated`,`$root`,`$value`,`$ref`,`theme`,`group`,`semantic`,`palette`,`primitive`]);function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function a(e){return i(e)&&(`$value`in e||`$ref`in e)}function o(e){let t=e.trim();return t.startsWith(`{`)||t.startsWith(`var(`)}function s(e){return Math.min(1,Math.max(0,e))}function c(e){let t=s(e);return t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055}function l(e){let t=s(e);return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function u(e){return Math.round(c(e)*255).toString(16).padStart(2,`0`)}function d(e){return Math.round(s(e)*255).toString(16).padStart(2,`0`)}function f(e){return Math.round(s(e)*255).toString(16).padStart(2,`0`)}function p(e){let t=e.startsWith(`#`)?e.slice(1):e;return t.length===3||t.length===4?`#${[...t].map(e=>e+e).join(``)}`:`#${t}`}function m(e){if(typeof e==`string`){let n=e.trim();if(!t.test(n))return;let r=p(n).toLowerCase();return r.length===9&&r.endsWith(`ff`)?r.slice(0,7):r}if(i(e)){if(typeof e.hex==`string`&&t.test(e.hex)){let t=p(e.hex).toLowerCase().slice(0,7),n=v(e.alpha);return n!==void 0&&n<1?`${t}${f(n)}`:t}if(e.colorSpace===`srgb`&&Array.isArray(e.components)&&e.components.length>=3){let t=_(e.components[0]),n=_(e.components[1]),r=_(e.components[2]);if(t===void 0||n===void 0||r===void 0)return;let i=`#${d(t)}${d(n)}${d(r)}`,a=v(e.alpha);return a!==void 0&&a<1?`${i}${f(a)}`:i}}}function h(e,t,n){let r=n*Math.PI/180,i=t*Math.cos(r),a=t*Math.sin(r),o=e+.3963377774*i+.2158037573*a,s=e-.1055613458*i-.0638541728*a,c=e-.0894841775*i-1.291485548*a,l=o**3,u=s**3,d=c**3;return{red:4.0767416621*l-3.3077115913*u+.2309699292*d,green:-1.2684380046*l+2.6097574011*u-.3413193965*d,blue:-.0041960863*l-.7034186147*u+1.707614701*d}}function g(e,t,n,r){let{red:i,green:a,blue:o}=h(e,t,n),s=`#${u(i)}${u(a)}${u(o)}`;return r===void 0||r>=1?s:`${s}${f(r)}`}function _(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`||e===`none`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function v(e){if(typeof e==`number`&&Number.isFinite(e))return e>1?e/100:e;if(typeof e!=`string`)return;let t=Number.parseFloat(e);if(Number.isFinite(t))return e.includes(`%`)||t>1?t/100:t}function ee(e){let t=n.exec(e.trim());if(!t)return;let r=_(t[1]),i=_(t[2]),a=_(t[3]);if(r!==void 0&&i!==void 0&&a!==void 0)return t[1]?.includes(`%`)&&(r/=100),g(r,i,a,v(t[4]))}function te(e){if(!Array.isArray(e.components)||e.components.length<3)return;let t=_(e.components[0]),n=_(e.components[1]),r=_(e.components[2]);if(t!==void 0&&n!==void 0&&r!==void 0)return t>1&&(t/=100),g(t,n,r,v(e.alpha))}function y(e){if(typeof e==`string`)return o(e)?void 0:ee(e)??m(e)??void 0;if(i(e))return typeof e.colorSpace==`string`&&e.colorSpace.toLowerCase()===`oklch`?te(e):m(e)??void 0}function b(e){if(Array.isArray(e))return e.map(e=>b(e));if(!i(e)||!(`color`in e))return e;let t=y(e.color);return t?{...e,color:t}:e}function ne(e,t){if(t===`shadow`)return b(e);if(t===`border`&&i(e)&&`color`in e){let t=y(e.color);return t?{...e,color:t}:e}return t===`color`||t===void 0?y(e)??e:e}function x(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function re(e,t){if(`$ref`in e&&!(`$value`in e))return{...e};let n=x(e,t);return`$value`in e?{...e,$value:ne(e.$value,n)}:{...e}}function S(e,t){if(Array.isArray(e))return e.map(e=>S(e,t));if(!i(e))return e;if(a(e))return re(e,t);let n=typeof e.$type==`string`?e.$type:t,o={};for(let[t,i]of Object.entries(e))o[t]=r.has(t)||t.startsWith(`$`)?i:S(i,n);return o}const ie={dark:`#ffffff`,light:`#0c0c0d`},ae={dark:`#ffffff`,light:`#000000`};function oe(e){if(typeof e!=`string`)return;let t=/\b(dark|light)[\s-]+theme\b/i.exec(e)?.[1];return t?.toLowerCase()===`dark`?`dark`:t?.toLowerCase()===`light`?`light`:void 0}function se(e){if(i(e)&&i(e.color))return oe(e.color.$description)}const ce={name:`active`,brightness:1.45,useContrastPrimitive:!0},le={name:`active`,brightness:1.25},ue={name:`active`,brightness:1.125},de={name:`active`,brightness:1.4},fe={name:`active`,brightness:1.8,useContrastPrimitive:!0},C={name:`inactive`,brightness:.8},w={name:`inactive`,brightness:.5,useContrastPrimitive:!0},T={name:`disabled`,opacity:.35,saturation:.85,fadeOver:`oklch(0.3839 0.0045 286.26)`},E={lowSaturation:[ce,w,T],saturated:[le,C,T]},pe={lowSaturation:[ue,w,T],saturated:E.saturated},me={name:`inactive`,brightness:.9},D={...T,opacity:.675,saturation:.925},O={lowSaturation:[{name:`active`,brightness:1.3},me,D],saturated:[{name:`active`,brightness:1.25},me,D]},he=[`shadows`];function k(e){return Object.entries(e).filter(e=>!he.includes(e[0])&&i(e[1])&&!a(e[1])&&a(e[1].primary))}const A={lowSaturation:[fe,w,T],saturated:[de,C,T]},ge={primary:E,secondary:pe,link:E,outline:A},_e={foreground:{lowSaturation:[{name:`hovered`,brightness:1.25},...E.lowSaturation],saturated:[{name:`hovered`,brightness:1.15},...E.saturated]},background:{lowSaturation:[{name:`hovered`,brightness:1.25},...O.lowSaturation],saturated:[{name:`hovered`,brightness:1.15},...O.saturated]}},ve={outline:A},j=7.5,M=.01;function ye(e){return e.toLowerCase().endsWith(`-hovered`)||e.toLowerCase().endsWith(`-active`)||e.toLowerCase().endsWith(`-inactive`)||e.toLowerCase().endsWith(`-disabled`)}function be(e,t){let n=e;for(let e of t.split(`.`).filter(Boolean)){if(!i(n)||!(e in n))return;n=n[e]}return a(n)?n:void 0}function N(e,t,n=/* @__PURE__ */ new Set){let r=y(e);if(r)return r;if(typeof e!=`string`)return;let i=/^\{([^{}]+)\}$/.exec(e.trim());if(!i?.[1]||n.has(i[1]))return;n.add(i[1]);let a=be(t,i[1]);if(a&&`$value`in a)return N(a.$value,t,n)}function P(e,t){let n=p(e).toLowerCase(),r=n.slice(0,7),i=s((n.length===9?Number.parseInt(n.slice(7,9),16)/255:1)*t);return i>=1?r:`${r}${f(i)}`}function xe(e,t,n){let r=p(e).toLowerCase(),i=p(y(t)??t).toLowerCase(),a=s((r.length===9?Number.parseInt(r.slice(7,9),16)/255:1)*n),o=e=>d((Number.parseInt(r.slice(e,e+2),16)*a+Number.parseInt(i.slice(e,e+2),16)*(1-a))/255);return`#${o(1)}${o(3)}${o(5)}`}function F(e,t,n=!1){if(Array.isArray(e))return e.map(e=>F(e,t,n));if(!i(e))return e;if(n&&a(e)&&x(e)===`shadow`){let n=e.$value,r=e=>{if(!i(e)||!(`color`in e))return e;let n=N(e.color,t);return n?{...e,color:P(n,R(n)?.1:.15)}:e};return{...e,$value:Array.isArray(n)?n.map((e,t)=>t===n.length-1?r(e):e):r(n)}}let r={};for(let[i,a]of Object.entries(e))r[i]=F(a,t,n||i.toLowerCase()===`ring`);return r}const I={value:0,unit:`px`};function L(e,t){return{color:e,offsetX:I,offsetY:I,blur:I,spread:{value:t,unit:`px`}}}function Se(e){if(!i(e)||!i(e.color))return e;let t=e.color,n=i(e.ring)?{...e.ring}:{},r=!1;for(let[e]of k(t)){let t=`{color.${e}.primary}`,i=e=>L(`{color.elevated}`,e),a={[e]:[`${e} 3px focus ring with no gap`,[L(t,3)]],[`${e}-subtle`]:[`${e} 1px outline focus ring with no gap`,[L(t,1)]],[`${e}-offset`]:[`${e} 3px focus ring with a 3px gap`,[i(3),L(t,7)]],[`${e}-subtle-offset`]:[`${e} 1px focus ring with a 2px gap`,[i(2),L(t,3)]]};for(let[t,[i,o]]of Object.entries(a))t in n||(n[t]={$description:`Generated ${i}`,$type:`shadow`,$value:o,theme:e},r=!0)}return r?{...e,ring:n}:e}function R(e){return B(e).chroma<.02}function z(e){let t=p(e).toLowerCase();return t.slice(1,3)===t.slice(3,5)&&t.slice(3,5)===t.slice(5,7)}function B(e){let t=p(e).toLowerCase(),n=l(Number.parseInt(t.slice(1,3),16)/255),r=l(Number.parseInt(t.slice(3,5),16)/255),i=l(Number.parseInt(t.slice(5,7),16)/255),a=t.length===9?Number.parseInt(t.slice(7,9),16)/255:void 0,o=.4122214708*n+.5363325363*r+.0514459929*i,s=.2119034982*n+.6806995451*r+.1073969566*i,c=.0883024619*n+.2817188376*r+.6299787005*i,u=Math.cbrt(o),d=Math.cbrt(s),f=Math.cbrt(c),m=.2104542553*u+.793617785*d-.0040720468*f,h=1.9779984951*u-2.428592205*d+.4505937099*f,g=.0259040371*u+.7827717662*d-.808675766*f,_=Math.hypot(h,g),v=Math.atan2(g,h)*180/Math.PI;return v<0&&(v+=360),{lightness:m,chroma:_,hue:v,alpha:a}}function V({red:e,green:t,blue:n}){return e>=0&&e<=1&&t>=0&&t<=1&&n>=0&&n<=1}function H(e,t,n,r){if(V(h(e,t,n)))return g(e,t,n,r);let i=0,a=t;for(let t=0;t<32;t+=1){let t=(i+a)/2;V(h(e,t,n))?i=t:a=t}return g(e,i,n,r)}function U(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(s(n*t),r,i,a)}function Ce(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(s(n+t),r,i,a)}function we(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(n,r*s(t),i,a)}function W(e){let t=p(e).toLowerCase(),n=e=>{let n=Number.parseInt(t.slice(e,e+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(1)+.7152*n(3)+.0722*n(5)}function G(e,t){let n=W(e),r=W(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function K(e){let t=G(e,`#FAFAFA`);return t>=2?`#FAFAFA`:G(e,`#151518`)*.5>t?`#151518`:`#FAFAFA`}function Te(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e),o=t===`light`?1:-1,c=-o,l=n,u=n,d=e,f=e;for(let t=0;t<100;t+=1){if(l=s(l+o*M),d=H(l,r,i,a),G(d,f)>=j)return f===e?{secondary:d}:{secondary:d,onMuted:f};if(u=s(u+c*M),f=H(u,r,i,a),G(d,f)>=j)return{secondary:d,onMuted:f};if((l===0||l===1)&&(u===0||u===1))break}throw Error(`Unable to generate an accessible secondary pair for ${e}`)}function Ee(e,t){return t===`dark`?q(e):t===`light`?!J(e):B(e).lightness>=.5}function De(e,t){return!Ee(e,t)}const Oe=B(`#fefefe`).lightness,ke=B(`#262626`).lightness;function q(e){return B(e).lightness>=(R(e)?Oe:.75)}function J(e){return B(e).lightness<=(R(e)?ke:.25)}function Y(e){return e.name===`hovered`||e.name===`active`}function X(e,t){return t===`dark`?q(e):t===`light`&&J(e)}function Ae(e,t,n){return De(e,n)?t:2-t}function Z(e,t){return e.useContrastPrimitive&&t?ie[t]:void 0}function je(e,t,n){if(t.name===`hovered`&&Z(t,n)&&X(e,n))return n===`dark`?-.25:.25}function Me(e,t,n){let r=Z(t,n);return r&&n&&t.name===`active`&&X(e,n)?ae[n]:r}function Ne(e,t,n){return t.brightness===void 0?1:Z(t,n)?Y(t)?1:t.brightness:Ae(e,t.brightness,n)}function Pe(e,t,n){let r=je(e,t,n),i=r===void 0?Me(e,t,n):void 0,a=i??e;return r===void 0?t.brightness!==void 0&&!(i&&Y(t))&&(a=U(a,Ne(a,t,n))):a=Ce(e,r),t.saturation!==void 0&&!z(e)&&(a=we(a,t.saturation),t.fadeOver===void 0)?a:t.fadeOver===void 0?t.opacity===void 0?a:P(a,t.opacity):xe(a,t.fadeOver,t.opacity??1)}function Fe(e,t,n){let r=[],i=je(t,e,n),a=Me(t,e,n);if(i!==void 0)r.push(`${Math.round(Math.abs(i)*100)}% ${i<0?`darker`:`lighter`}`);else if(a&&Y(e))r.push(n&&a!==ie[n]?`pure ${n===`dark`?`white`:`black`}`:`${n} contrast primitive`);else if(e.brightness!==void 0){let i=Ne(t,e,n),a=Math.round((i-1)*100);r.push(a>=0?`${a}% brighter`:`${Math.abs(a)}% darker`)}return e.saturation!==void 0&&!z(t)&&r.push(`${Math.round(e.saturation*100)}% saturation`),e.fadeOver===void 0?e.opacity!==void 0&&(e.saturation===void 0||z(t))&&r.push(`${Math.round(e.opacity*100)}% opacity`):r.push(`${Math.round((e.opacity??1)*100)}% over ${e.fadeOver}`),r.join(`, `)||e.name}function Ie(e,t,n,r){let i=Fe(n,t,r),a=Pe(t,n,r);return{...e,$type:`color`,$value:a,$description:typeof e.$description==`string`?`${e.$description} (${n.name}, ${i})`:`${n.name} state at ${i}`}}function Q(e,t,n,r,i){let o={...e},s=r?[r]:Object.keys(e);for(let r of s){if(r.startsWith(`$`)||ye(r))continue;let s=e[r];if(!a(s))continue;let c=x(s);if(c&&c!==`color`)continue;let l=N(s.$value,t);if(!l)continue;let u=R(l)?n.lowSaturation:n.saturated,d=u.some(e=>e.name===`hovered`),f=u.flatMap(e=>e.name===`active`&&!d?[{...e,name:`hovered`},e]:[e]),p=oe(s.$description)??i;for(let e of f){let t=`${r}-${e.name}`;t in o||(o[t]=Ie(s,l,e,p))}}return o}function Le(e,t,n,r){let i=t.primary,o=a(i)&&N(i.$value,n),c=a(i)&&x(i);if(!a(i)||!o||c&&c!==`color`)return t;let l={...t};l.link??={...i,$type:`color`,$value:`{color.${e}.primary}`,$description:`Generated ${e} hyperlink text color (matches primary)`},t.group===`status`&&(l.outline??={...i,$type:`color`,$value:`{color.${e}.primary}`,$description:`Generated ${e} border and divider color (matches primary)`}),l[`on-primary`]??={...i,$type:`color`,$value:K(o),$description:`Generated text and icon color on ${e} primary backgrounds`},l.backdrop??={...i,$type:`color`,$value:P(U(o,.375),.45),$description:`Generated ${e} overlay backdrop color (primary, 30% darker at 75% opacity)`};let u;if(r&&!(`secondary`in t)){let t=Te(o,r);l.secondary={...i,$type:`color`,$value:t.secondary,$description:`Generated low-emphasis ${e} background for the ${r} theme`},u=t.onMuted??o}else if(a(t.secondary)){let e=N(t.secondary.$value,n);u=e&&K(e)}u&&!(`on-secondary`in t)&&(l[`on-secondary`]={...i,$type:`color`,$value:u,$description:`Generated text and icon color on ${e} secondary backgrounds`});let d=!(`border`in t)&&a(l.secondary)&&N(l.secondary.$value,n);if(d){let{lightness:t,chroma:n,hue:a,alpha:o}=B(d),c=r===`light`?-1:1;l.border={...i,$type:`color`,$value:H(s(t*(1+c*.15)),n,a,o),$description:`Generated ${e} border color for secondary backgrounds (secondary, 15% ${c>0?`brighter`:`darker`})`}}for(let[e,t]of Object.entries(ge))l=Q(l,n,t,e,r);for(let[t,n]of Object.entries(l))a(n)&&(l[t]={theme:e,group:e,...n});return l}function Re(e){let t={...e};for(let[n,r]of Object.entries(e)){let e=n.replace(/^on-/,``).replace(/-(?:hovered|active|inactive|disabled)$/i,``);e!==n&&a(r)&&!(`group`in r)&&(t[n]={...r,group:e})}return t}function ze(e){let t=e.base,n=e.brand;return!i(t)||a(t)||!i(n)||a(n)||Object.entries(n).some(([e,t])=>!r.has(e)&&!e.startsWith(`$`)&&a(t))?e:{...e,brand:{...t,...n}}}function $(e,t,n,o){if(Array.isArray(e))return e.map(e=>$(e,t,void 0,o));if(!i(e)||a(e))return e;let s={};for(let[n,i]of Object.entries(e))s[n]=r.has(n)||n.startsWith(`$`)?i:$(i,t,n,n===`dark`||n===`light`?n:o);let c=s;if(n===`color`){c=ze(c);for(let[e,n]of k(c))c[e]=Le(e,n,t,o);for(let[e,n]of Object.entries(c)){let r=a(n)&&typeof n.group==`string`?_e[n.group]:void 0;r&&(c=Q(c,t,r,e,o))}}for(let[e,n]of Object.entries(ve))a(c[e])&&(c=Q(c,t,n,e,o));return n===`color`?Re(c):c}function Be(e){let t=S(e),n=Se($(t,t,void 0,se(t)));return F(n,n)}var Ve=e(()=>({name:`cyclone-ui:tamagui-preprocessor`,preprocessors:[{name:`tamagui-preprocessor`,preprocessor:Be}]}));export{Ve as default,Be as tamaguiPreprocessor};
1
+ import{definePlugin as e}from"@razorwind/core/plugin";const t=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,n=/^oklch\(\s*([0-9.]+%?|none)\s+([0-9.]+|none)\s+([0-9.]+|none)(?:\s*\/\s*([0-9.%]+))?\s*\)$/i,r=/* @__PURE__ */ new Set([`$schema`,`$type`,`$description`,`$extensions`,`$extends`,`$deprecated`,`$root`,`$value`,`$ref`,`theme`,`group`,`semantic`,`palette`,`primitive`]);function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function a(e){return i(e)&&(`$value`in e||`$ref`in e)}function o(e){let t=e.trim();return t.startsWith(`{`)||t.startsWith(`var(`)}function s(e){return Math.min(1,Math.max(0,e))}function c(e){let t=s(e);return t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055}function l(e){let t=s(e);return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function u(e){return Math.round(c(e)*255).toString(16).padStart(2,`0`)}function d(e){return Math.round(s(e)*255).toString(16).padStart(2,`0`)}function f(e){return Math.round(s(e)*255).toString(16).padStart(2,`0`)}function p(e){let t=e.startsWith(`#`)?e.slice(1):e;return t.length===3||t.length===4?`#${[...t].map(e=>e+e).join(``)}`:`#${t}`}function m(e){if(typeof e==`string`){let n=e.trim();if(!t.test(n))return;let r=p(n).toLowerCase();return r.length===9&&r.endsWith(`ff`)?r.slice(0,7):r}if(i(e)){if(typeof e.hex==`string`&&t.test(e.hex)){let t=p(e.hex).toLowerCase().slice(0,7),n=v(e.alpha);return n!==void 0&&n<1?`${t}${f(n)}`:t}if(e.colorSpace===`srgb`&&Array.isArray(e.components)&&e.components.length>=3){let t=_(e.components[0]),n=_(e.components[1]),r=_(e.components[2]);if(t===void 0||n===void 0||r===void 0)return;let i=`#${d(t)}${d(n)}${d(r)}`,a=v(e.alpha);return a!==void 0&&a<1?`${i}${f(a)}`:i}}}function h(e,t,n){let r=n*Math.PI/180,i=t*Math.cos(r),a=t*Math.sin(r),o=e+.3963377774*i+.2158037573*a,s=e-.1055613458*i-.0638541728*a,c=e-.0894841775*i-1.291485548*a,l=o**3,u=s**3,d=c**3;return{red:4.0767416621*l-3.3077115913*u+.2309699292*d,green:-1.2684380046*l+2.6097574011*u-.3413193965*d,blue:-.0041960863*l-.7034186147*u+1.707614701*d}}function g(e,t,n,r){let{red:i,green:a,blue:o}=h(e,t,n),s=`#${u(i)}${u(a)}${u(o)}`;return r===void 0||r>=1?s:`${s}${f(r)}`}function _(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`||e===`none`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function v(e){if(typeof e==`number`&&Number.isFinite(e))return e>1?e/100:e;if(typeof e!=`string`)return;let t=Number.parseFloat(e);if(Number.isFinite(t))return e.includes(`%`)||t>1?t/100:t}function ee(e){let t=n.exec(e.trim());if(!t)return;let r=_(t[1]),i=_(t[2]),a=_(t[3]);if(r!==void 0&&i!==void 0&&a!==void 0)return t[1]?.includes(`%`)&&(r/=100),g(r,i,a,v(t[4]))}function te(e){if(!Array.isArray(e.components)||e.components.length<3)return;let t=_(e.components[0]),n=_(e.components[1]),r=_(e.components[2]);if(t!==void 0&&n!==void 0&&r!==void 0)return t>1&&(t/=100),g(t,n,r,v(e.alpha))}function y(e){if(typeof e==`string`)return o(e)?void 0:ee(e)??m(e)??void 0;if(i(e))return typeof e.colorSpace==`string`&&e.colorSpace.toLowerCase()===`oklch`?te(e):m(e)??void 0}function b(e){if(Array.isArray(e))return e.map(e=>b(e));if(!i(e)||!(`color`in e))return e;let t=y(e.color);return t?{...e,color:t}:e}function ne(e,t){if(t===`shadow`)return b(e);if(t===`border`&&i(e)&&`color`in e){let t=y(e.color);return t?{...e,color:t}:e}return t===`color`||t===void 0?y(e)??e:e}function x(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function re(e,t){if(`$ref`in e&&!(`$value`in e))return{...e};let n=x(e,t);return`$value`in e?{...e,$value:ne(e.$value,n)}:{...e}}function S(e,t){if(Array.isArray(e))return e.map(e=>S(e,t));if(!i(e))return e;if(a(e))return re(e,t);let n=typeof e.$type==`string`?e.$type:t,o={};for(let[t,i]of Object.entries(e))o[t]=r.has(t)||t.startsWith(`$`)?i:S(i,n);return o}const C={dark:`#ffffff`,light:`#0c0c0d`},ie={dark:`#ffffff`,light:`#000000`};function w(e){if(typeof e!=`string`)return;let t=/\b(dark|light)[\s-]+theme\b/i.exec(e)?.[1];return t?.toLowerCase()===`dark`?`dark`:t?.toLowerCase()===`light`?`light`:void 0}function ae(e){if(i(e)&&i(e.color))return w(e.color.$description)}const oe={name:`active`,brightness:1.45,useContrastPrimitive:!0},se={name:`active`,brightness:1.25},ce={name:`active`,brightness:1.175},le={name:`active`,brightness:1.8,useContrastPrimitive:!0},T={name:`inactive`,brightness:.8},E={name:`inactive`,brightness:.5,useContrastPrimitive:!0},D={name:`disabled`,opacity:.15,saturation:.85,fadeOver:`oklch(0.3839 0.0045 286.26)`},O={lowSaturation:[oe,E,D],saturated:[se,T,D]},ue={lowSaturation:[ce,E,D],saturated:O.saturated},de={name:`inactive`,brightness:.9},fe={...D,opacity:.25,saturation:.925},pe={lowSaturation:[{name:`active`,brightness:1.3},de,fe],saturated:[{name:`active`,brightness:1.25},de,fe]},me=[`shadows`];function k(e){return Object.entries(e).filter(e=>!me.includes(e[0])&&i(e[1])&&!a(e[1])&&a(e[1].primary))}const he={lowSaturation:[{name:`hovered`,brightness:1.4},le,E,D],saturated:[{name:`hovered`,brightness:1.2},{name:`active`,brightness:1.4},T,D]},A={lowSaturation:[{name:`hovered`,brightness:1.25},...O.lowSaturation],saturated:[{name:`hovered`,brightness:1.125},...O.saturated]},ge={primary:A,secondary:{lowSaturation:[{name:`hovered`,brightness:1.08},...ue.lowSaturation],saturated:A.saturated},link:A},_e={foreground:{lowSaturation:[{name:`hovered`,brightness:1.25},...O.lowSaturation],saturated:[{name:`hovered`,brightness:1.15},...O.saturated]},background:{lowSaturation:[{name:`hovered`,brightness:1.15},...pe.lowSaturation],saturated:[{name:`hovered`,brightness:1.15},...pe.saturated]}},ve={hairline:he},j=7.5,M=.01;function ye(e){return e.toLowerCase().endsWith(`-hovered`)||e.toLowerCase().endsWith(`-active`)||e.toLowerCase().endsWith(`-inactive`)||e.toLowerCase().endsWith(`-disabled`)}function be(e,t){let n=e;for(let e of t.split(`.`).filter(Boolean)){if(!i(n)||!(e in n))return;n=n[e]}return a(n)?n:void 0}function N(e,t,n=/* @__PURE__ */ new Set){let r=y(e);if(r)return r;if(typeof e!=`string`)return;let i=/^\{([^{}]+)\}$/.exec(e.trim());if(!i?.[1]||n.has(i[1]))return;n.add(i[1]);let a=be(t,i[1]);if(a&&`$value`in a)return N(a.$value,t,n)}function P(e,t){let n=p(e).toLowerCase(),r=n.slice(0,7),i=s((n.length===9?Number.parseInt(n.slice(7,9),16)/255:1)*t);return i>=1?r:`${r}${f(i)}`}function xe(e,t,n){let r=p(e).toLowerCase(),i=p(y(t)??t).toLowerCase(),a=s((r.length===9?Number.parseInt(r.slice(7,9),16)/255:1)*n),o=e=>d((Number.parseInt(r.slice(e,e+2),16)*a+Number.parseInt(i.slice(e,e+2),16)*(1-a))/255);return`#${o(1)}${o(3)}${o(5)}`}function F(e,t,n=!1){if(Array.isArray(e))return e.map(e=>F(e,t,n));if(!i(e))return e;if(n&&a(e)&&x(e)===`shadow`){let n=e.$value,r=e=>{if(!i(e)||!(`color`in e))return e;let n=N(e.color,t);return n?{...e,color:P(n,R(n)?.1:.15)}:e};return{...e,$value:Array.isArray(n)?n.map((e,t)=>t===n.length-1?r(e):e):r(n)}}let r={};for(let[i,a]of Object.entries(e))r[i]=F(a,t,n||i.toLowerCase()===`ring`);return r}const I={value:0,unit:`px`};function L(e,t){return{color:e,offsetX:I,offsetY:I,blur:I,spread:{value:t,unit:`px`}}}function Se(e){if(!i(e)||!i(e.color))return e;let t=e.color,n=i(e.ring)?{...e.ring}:{},r=!1;for(let[e]of k(t)){let t=`{color.${e}.primary}`,i=e=>L(`{color.elevated}`,e),a={[e]:[`${e} 3px focus ring with no gap`,[L(t,3)]],[`${e}-subtle`]:[`${e} 1px outline focus ring with no gap`,[L(t,1)]],[`${e}-offset`]:[`${e} 3px focus ring with a 3px gap`,[i(3),L(t,7)]],[`${e}-subtle-offset`]:[`${e} 1px focus ring with a 2px gap`,[i(2),L(t,3)]]};for(let[t,[i,o]]of Object.entries(a))t in n||(n[t]={$description:`Generated ${i}`,$type:`shadow`,$value:o,theme:e},r=!0)}return r?{...e,ring:n}:e}function R(e){return B(e).chroma<.02}function z(e){let t=p(e).toLowerCase();return t.slice(1,3)===t.slice(3,5)&&t.slice(3,5)===t.slice(5,7)}function B(e){let t=p(e).toLowerCase(),n=l(Number.parseInt(t.slice(1,3),16)/255),r=l(Number.parseInt(t.slice(3,5),16)/255),i=l(Number.parseInt(t.slice(5,7),16)/255),a=t.length===9?Number.parseInt(t.slice(7,9),16)/255:void 0,o=.4122214708*n+.5363325363*r+.0514459929*i,s=.2119034982*n+.6806995451*r+.1073969566*i,c=.0883024619*n+.2817188376*r+.6299787005*i,u=Math.cbrt(o),d=Math.cbrt(s),f=Math.cbrt(c),m=.2104542553*u+.793617785*d-.0040720468*f,h=1.9779984951*u-2.428592205*d+.4505937099*f,g=.0259040371*u+.7827717662*d-.808675766*f,_=Math.hypot(h,g),v=Math.atan2(g,h)*180/Math.PI;return v<0&&(v+=360),{lightness:m,chroma:_,hue:v,alpha:a}}function V({red:e,green:t,blue:n}){return e>=0&&e<=1&&t>=0&&t<=1&&n>=0&&n<=1}function H(e,t,n,r){if(V(h(e,t,n)))return g(e,t,n,r);let i=0,a=t;for(let t=0;t<32;t+=1){let t=(i+a)/2;V(h(e,t,n))?i=t:a=t}return g(e,i,n,r)}function U(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(s(n*t),r,i,a)}function Ce(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(s(n+t),r,i,a)}function we(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e);return g(n,r*s(t),i,a)}function W(e){let t=p(e).toLowerCase(),n=e=>{let n=Number.parseInt(t.slice(e,e+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(1)+.7152*n(3)+.0722*n(5)}function G(e,t){let n=W(e),r=W(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function K(e){let t=G(e,`#FAFAFA`);return t>=2?`#FAFAFA`:G(e,`#151518`)*.5>t?`#151518`:`#FAFAFA`}function Te(e,t){let{lightness:n,chroma:r,hue:i,alpha:a}=B(e),o=t===`light`?1:-1,c=-o,l=n,u=n,d=e,f=e;for(let t=0;t<100;t+=1){if(l=s(l+o*M),d=H(l,r,i,a),G(d,f)>=j)return f===e?{secondary:d}:{secondary:d,onMuted:f};if(u=s(u+c*M),f=H(u,r,i,a),G(d,f)>=j)return{secondary:d,onMuted:f};if((l===0||l===1)&&(u===0||u===1))break}throw Error(`Unable to generate an accessible secondary pair for ${e}`)}function Ee(e,t){return t===`dark`?q(e):t===`light`?!J(e):B(e).lightness>=.5}function De(e,t){return!Ee(e,t)}const Oe=B(`#fefefe`).lightness,ke=B(`#262626`).lightness;function q(e){return B(e).lightness>=(R(e)?Oe:.75)}function J(e){return B(e).lightness<=(R(e)?ke:.25)}function Y(e){return e.name===`hovered`||e.name===`active`}function X(e,t){return t===`dark`?q(e):t===`light`&&J(e)}function Ae(e,t,n){return De(e,n)?t:2-t}function Z(e,t){return e.useContrastPrimitive&&t?C[t]:void 0}function je(e,t,n){if(t.name===`hovered`&&Z(t,n)&&X(e,n))return n===`dark`?-.25:.25}function Me(e,t,n){let r=Z(t,n);return r&&n&&t.name===`active`&&X(e,n)?ie[n]:r}function Ne(e,t,n){return t.brightness===void 0?1:Z(t,n)?Y(t)?1:t.brightness:Ae(e,t.brightness,n)}function Pe(e,t,n){let r=je(e,t,n),i=r===void 0?Me(e,t,n):void 0,a=i??e;return r===void 0?t.brightness!==void 0&&!(i&&Y(t))&&(a=U(a,Ne(a,t,n))):a=Ce(e,r),t.saturation!==void 0&&!z(e)&&(a=we(a,t.saturation),t.fadeOver===void 0)?a:t.fadeOver===void 0?t.opacity===void 0?a:P(a,t.opacity):xe(a,t.fadeOver,t.opacity??1)}function Fe(e,t,n){let r=[],i=je(t,e,n),a=Me(t,e,n);if(i!==void 0)r.push(`${Math.round(Math.abs(i)*100)}% ${i<0?`darker`:`lighter`}`);else if(a&&Y(e))r.push(n&&a!==C[n]?`pure ${n===`dark`?`white`:`black`}`:`${n} contrast primitive`);else if(e.brightness!==void 0){let i=Ne(t,e,n),a=Math.round((i-1)*100);r.push(a>=0?`${a}% brighter`:`${Math.abs(a)}% darker`)}return e.saturation!==void 0&&!z(t)&&r.push(`${Math.round(e.saturation*100)}% saturation`),e.fadeOver===void 0?e.opacity!==void 0&&(e.saturation===void 0||z(t))&&r.push(`${Math.round(e.opacity*100)}% opacity`):r.push(`${Math.round((e.opacity??1)*100)}% over ${e.fadeOver}`),r.join(`, `)||e.name}function Ie(e,t,n,r){let i=Fe(n,t,r),a=Pe(t,n,r);return{...e,$type:`color`,$value:a,$description:typeof e.$description==`string`?`${e.$description} (${n.name}, ${i})`:`${n.name} state at ${i}`}}function Q(e,t,n,r,i){let o={...e},s=r?[r]:Object.keys(e);for(let r of s){if(r.startsWith(`$`)||ye(r))continue;let s=e[r];if(!a(s))continue;let c=x(s);if(c&&c!==`color`)continue;let l=N(s.$value,t);if(!l)continue;let u=R(l)?n.lowSaturation:n.saturated,d=u.some(e=>e.name===`hovered`),f=u.flatMap(e=>e.name===`active`&&!d?[{...e,name:`hovered`},e]:[e]),p=w(s.$description)??i;for(let e of f){let t=`${r}-${e.name}`;t in o||(o[t]=Ie(s,l,e,p))}}return o}function Le(e,t,n,r){let i=t.primary,o=a(i)&&N(i.$value,n),c=a(i)&&x(i);if(!a(i)||!o||c&&c!==`color`)return t;let l={...t};l.link??={...i,$type:`color`,$value:`{color.${e}.primary}`,$description:`Generated ${e} hyperlink text color (matches primary)`},l[`on-primary`]??={...i,$type:`color`,$value:K(o),$description:`Generated text and icon color on ${e} primary backgrounds`},l.backdrop??={...i,$type:`color`,$value:P(U(o,.375),.15),$description:`Generated ${e} overlay backdrop color (primary, 30% darker at 75% opacity)`};let u;if(r&&!(`secondary`in t)){let t=Te(o,r);l.secondary={...i,$type:`color`,$value:t.secondary,$description:`Generated low-emphasis ${e} background for the ${r} theme`},u=t.onMuted??o}else if(a(t.secondary)){let e=N(t.secondary.$value,n);u=e&&K(e)}u&&!(`on-secondary`in t)&&(l[`on-secondary`]={...i,$type:`color`,$value:u,$description:`Generated text and icon color on ${e} secondary backgrounds`});let d=!(`border`in t)&&a(l.secondary)&&N(l.secondary.$value,n);if(d){let{lightness:t,chroma:n,hue:a,alpha:o}=B(d),c=r===`light`?-1:1;l.border={...i,$type:`color`,$value:H(s(t*(1+c*.25)),n,a,o),$description:`Generated ${e} border color for secondary backgrounds (secondary, 25% ${c>0?`brighter`:`darker`})`}}for(let[e,t]of Object.entries(ge))l=Q(l,n,t,e,r);for(let[t,n]of Object.entries(l))a(n)&&(l[t]={theme:e,group:e,...n});return l}function Re(e){let t={...e};for(let[n,r]of Object.entries(e)){let e=n.replace(/^on-/,``).replace(/-(?:hovered|active|inactive|disabled)$/i,``);e!==n&&a(r)&&!(`group`in r)&&(t[n]={...r,group:e})}return t}function ze(e){let t=e.base,n=e.brand;return!i(t)||a(t)||!i(n)||a(n)||Object.entries(n).some(([e,t])=>!r.has(e)&&!e.startsWith(`$`)&&a(t))?e:{...e,brand:{...t,...n}}}function $(e,t,n,o){if(Array.isArray(e))return e.map(e=>$(e,t,void 0,o));if(!i(e)||a(e))return e;let s={};for(let[n,i]of Object.entries(e))s[n]=r.has(n)||n.startsWith(`$`)?i:$(i,t,n,n===`dark`||n===`light`?n:o);let c=s;if(n===`color`){c=ze(c);for(let[e,n]of k(c))c[e]=Le(e,n,t,o);for(let[e,n]of Object.entries(c)){let r=a(n)&&typeof n.group==`string`?_e[n.group]:void 0;r&&(c=Q(c,t,r,e,o))}}for(let[e,n]of Object.entries(ve))a(c[e])&&(c=Q(c,t,n,e,o));return n===`color`?Re(c):c}function Be(e){let t=S(e),n=Se($(t,t,void 0,ae(t)));return F(n,n)}var Ve=e(()=>({name:`cyclone-ui:tamagui-preprocessor`,preprocessors:[{name:`tamagui-preprocessor`,preprocessor:Be}]}));export{Ve as default,Be as tamaguiPreprocessor};
2
2
  //# sourceMappingURL=preprocessor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"preprocessor.mjs","names":["HEX_RE","OKLCH_RE","RESERVED_KEYS","isPlainObject","value","isTokenNode","isAlias","trimmed","clamp01","toSrgb","clipped","channel","fromSrgb","hexChannel","srgbHexChannel","alphaHex","alpha","expandHex","hex","digit","colorValueToHex","expanded","parseAlpha","red","parseComponent","green","blue","oklchToLinearSrgb","hueRad","hue","a","chroma","b","l_","lightness","m_","s_","l3","m3","s3","oklchToHex","parsed","oklchStringToHex","match","oklchObjectToHex","convertColor","convertShadow","layer","color","convertValue","type","resolveType","token","inheritedType","mapTokenNode","walk","node","item","groupType","result","key","CONTRAST_PRIMITIVES","PURE_CONTRAST_COLORS","parentThemeFromDescription","description","theme","parentThemeFromDictionary","dictionary","LOW_SATURATION_COLOR_STATE_ACTIVE","COLOR_STATE_ACTIVE","SUBTLE_LOW_SATURATION_COLOR_STATE_ACTIVE","HAIRLINE_COLOR_STATE_ACTIVE","INCREASED_LOW_SATURATION_COLOR_STATE_ACTIVE","COLOR_STATE_INACTIVE","LOW_SATURATION_COLOR_STATE_INACTIVE","COLOR_STATE_DISABLED","DEFAULT_COLOR_STATE_VARIANTS","SUBTLE_COLOR_STATE_VARIANTS","BACKGROUND_COLOR_STATE_INACTIVE","BACKGROUND_COLOR_STATE_DISABLED","BACKGROUND_COLOR_STATE_VARIANTS","NONE_THEME_COLOR_KEYS","themeColorGroups","entry","OUTLINE_COLOR_STATE_VARIANTS","THEME_COLOR_STATE_VARIANTS","COLOR_STATE_TOKEN_GROUPS","COLOR_STATE_VARIANTS","MINIMUM_SUBTLE_CONTRAST_RATIO","SUBTLE_COLOR_LIGHTNESS_STEP","isStateVariantKey","getTokenAtPath","tree","part","path","resolveColorHex","direct","ref","seen","applyOpacity","rgb","opacity","applyFadeOver","foreground","base","background","offset","applyRingOpacity","inRingGroup","applyToLayer","isLowSaturation","index","ZERO","ringLayer","spread","addMissingRingTokens","ring","changed","name","ringColor","gap","variants","hexToOklch","isGreyscale","l","m","s","isInSrgbGamut","oklchToGamutMappedHex","minimumChroma","maximumChroma","candidateChroma","applyBrightness","factor","applyLightnessShift","shift","applySaturation","relativeLuminance","contrastRatio","firstLuminance","first","secondLuminance","second","lighter","darker","createOnColor","whiteContrast","createMutedColor","secondaryDirection","parentTheme","onMutedDirection","secondaryLightness","onMutedLightness","secondary","onMuted","isLightColor","isWhiteColor","isBlackColor","isDarkColor","LOW_SATURATION_WHITE_LIGHTNESS","LOW_SATURATION_BLACK_LIGHTNESS","isInteractionState","variant","isNearContrastPrimitive","directedBrightnessFactor","contrastPrimitive","contrastSideLightnessShift","stateContrastColor","primitive","stateBrightnessFactor","applyStateTransform","transformed","variantDetail","details","percent","createStateToken","detail","source","addColorStateTokens","group","names","onlyKey","baseVariants","hasHovered","tokenVariants","tokenParentTheme","variantKey","addThemeColorGroupTokens","onSecondary","pair","secondaryHex","direction","addColorTokenGroups","root","populateEmptyBrandTheme","brand","injectColorStateVariants","childKey","withStates","tokenKey","tamaguiPreprocessor","converted","withRings","preprocessor_default","definePlugin"],"sources":[],"mappings":""}
1
+ {"version":3,"file":"preprocessor.mjs","names":["HEX_RE","OKLCH_RE","RESERVED_KEYS","isPlainObject","value","isTokenNode","isAlias","trimmed","clamp01","toSrgb","clipped","channel","fromSrgb","hexChannel","srgbHexChannel","alphaHex","alpha","expandHex","hex","digit","colorValueToHex","expanded","parseAlpha","red","parseComponent","green","blue","oklchToLinearSrgb","hueRad","hue","a","chroma","b","l_","lightness","m_","s_","l3","m3","s3","oklchToHex","parsed","oklchStringToHex","match","oklchObjectToHex","convertColor","convertShadow","layer","color","convertValue","type","resolveType","token","inheritedType","mapTokenNode","walk","node","item","groupType","result","key","CONTRAST_PRIMITIVES","PURE_CONTRAST_COLORS","parentThemeFromDescription","description","theme","parentThemeFromDictionary","dictionary","LOW_SATURATION_COLOR_STATE_ACTIVE","COLOR_STATE_ACTIVE","SUBTLE_LOW_SATURATION_COLOR_STATE_ACTIVE","INCREASED_LOW_SATURATION_COLOR_STATE_ACTIVE","COLOR_STATE_INACTIVE","LOW_SATURATION_COLOR_STATE_INACTIVE","COLOR_STATE_DISABLED","DEFAULT_COLOR_STATE_VARIANTS","SUBTLE_COLOR_STATE_VARIANTS","BACKGROUND_COLOR_STATE_INACTIVE","BACKGROUND_COLOR_STATE_DISABLED","BACKGROUND_COLOR_STATE_VARIANTS","NONE_THEME_COLOR_KEYS","themeColorGroups","entry","HAIRLINE_COLOR_STATE_VARIANTS","THEME_COLOR_STATE_HOVERED_VARIANTS","THEME_COLOR_STATE_VARIANTS","COLOR_STATE_TOKEN_GROUPS","COLOR_STATE_VARIANTS","MINIMUM_SUBTLE_CONTRAST_RATIO","SUBTLE_COLOR_LIGHTNESS_STEP","isStateVariantKey","getTokenAtPath","tree","part","path","resolveColorHex","direct","ref","seen","applyOpacity","rgb","opacity","applyFadeOver","foreground","base","background","offset","applyRingOpacity","inRingGroup","applyToLayer","isLowSaturation","index","ZERO","ringLayer","spread","addMissingRingTokens","ring","changed","name","ringColor","gap","variants","hexToOklch","isGreyscale","l","m","s","isInSrgbGamut","oklchToGamutMappedHex","minimumChroma","maximumChroma","candidateChroma","applyBrightness","factor","applyLightnessShift","shift","applySaturation","relativeLuminance","contrastRatio","firstLuminance","first","secondLuminance","second","lighter","darker","createOnColor","whiteContrast","createMutedColor","secondaryDirection","parentTheme","onMutedDirection","secondaryLightness","onMutedLightness","secondary","onMuted","isLightColor","isWhiteColor","isBlackColor","isDarkColor","LOW_SATURATION_WHITE_LIGHTNESS","LOW_SATURATION_BLACK_LIGHTNESS","isInteractionState","variant","isNearContrastPrimitive","directedBrightnessFactor","contrastPrimitive","contrastSideLightnessShift","stateContrastColor","primitive","stateBrightnessFactor","applyStateTransform","transformed","variantDetail","details","percent","createStateToken","detail","source","addColorStateTokens","group","names","onlyKey","baseVariants","hasHovered","tokenVariants","tokenParentTheme","variantKey","addThemeColorGroupTokens","onSecondary","pair","secondaryHex","direction","addColorTokenGroups","root","populateEmptyBrandTheme","brand","injectColorStateVariants","childKey","withStates","tokenKey","tamaguiPreprocessor","converted","withRings","preprocessor_default","definePlugin"],"sources":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclone-ui/theme-builder",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -463,12 +463,7 @@ const COLOR_STATE_ACTIVE: ColorStateVariant = {
463
463
 
464
464
  const SUBTLE_LOW_SATURATION_COLOR_STATE_ACTIVE: ColorStateVariant = {
465
465
  name: "active",
466
- brightness: 1.125
467
- };
468
-
469
- const HAIRLINE_COLOR_STATE_ACTIVE: ColorStateVariant = {
470
- name: "active",
471
- brightness: 1.4
466
+ brightness: 1.175
472
467
  };
473
468
 
474
469
  const INCREASED_LOW_SATURATION_COLOR_STATE_ACTIVE: ColorStateVariant = {
@@ -490,7 +485,7 @@ const LOW_SATURATION_COLOR_STATE_INACTIVE: ColorStateVariant = {
490
485
 
491
486
  const COLOR_STATE_DISABLED: ColorStateVariant = {
492
487
  name: "disabled",
493
- opacity: 0.35,
488
+ opacity: 0.15,
494
489
  saturation: 0.85,
495
490
  fadeOver: "oklch(0.3839 0.0045 286.26)"
496
491
  };
@@ -530,7 +525,7 @@ const BACKGROUND_COLOR_STATE_INACTIVE: ColorStateVariant = {
530
525
 
531
526
  const BACKGROUND_COLOR_STATE_DISABLED: ColorStateVariant = {
532
527
  ...COLOR_STATE_DISABLED,
533
- opacity: 0.675,
528
+ opacity: 0.25,
534
529
  saturation: 0.925
535
530
  };
536
531
 
@@ -564,25 +559,52 @@ function themeColorGroups(
564
559
  );
565
560
  }
566
561
 
567
- const OUTLINE_COLOR_STATE_VARIANTS: ColorStateVariants = {
562
+ const HAIRLINE_COLOR_STATE_VARIANTS: ColorStateVariants = {
568
563
  lowSaturation: [
564
+ { name: "hovered", brightness: 1.4 },
569
565
  INCREASED_LOW_SATURATION_COLOR_STATE_ACTIVE,
570
566
  LOW_SATURATION_COLOR_STATE_INACTIVE,
571
567
  COLOR_STATE_DISABLED
572
568
  ],
573
569
  saturated: [
574
- HAIRLINE_COLOR_STATE_ACTIVE,
570
+ { name: "hovered", brightness: 1.2 },
571
+ {
572
+ name: "active",
573
+ brightness: 1.4
574
+ },
575
575
  COLOR_STATE_INACTIVE,
576
576
  COLOR_STATE_DISABLED
577
577
  ]
578
578
  };
579
579
 
580
+ /**
581
+ * Theme color group hovered states take about half the step of active, and
582
+ * never jump to the contrast primitive (so they stay distinct from active).
583
+ */
584
+ const THEME_COLOR_STATE_HOVERED_VARIANTS: ColorStateVariants = {
585
+ lowSaturation: [
586
+ { name: "hovered", brightness: 1.25 },
587
+ ...DEFAULT_COLOR_STATE_VARIANTS.lowSaturation
588
+ ],
589
+ saturated: [
590
+ { name: "hovered", brightness: 1.125 },
591
+ ...DEFAULT_COLOR_STATE_VARIANTS.saturated
592
+ ]
593
+ };
594
+
595
+ const SUBTLE_COLOR_STATE_HOVERED_VARIANTS: ColorStateVariants = {
596
+ lowSaturation: [
597
+ { name: "hovered", brightness: 1.08 },
598
+ ...SUBTLE_COLOR_STATE_VARIANTS.lowSaturation
599
+ ],
600
+ saturated: THEME_COLOR_STATE_HOVERED_VARIANTS.saturated
601
+ };
602
+
580
603
  /** State variants for the tokens inside each theme color group. */
581
604
  const THEME_COLOR_STATE_VARIANTS: Record<string, ColorStateVariants> = {
582
- primary: DEFAULT_COLOR_STATE_VARIANTS,
583
- secondary: SUBTLE_COLOR_STATE_VARIANTS,
584
- link: DEFAULT_COLOR_STATE_VARIANTS,
585
- outline: OUTLINE_COLOR_STATE_VARIANTS
605
+ primary: THEME_COLOR_STATE_HOVERED_VARIANTS,
606
+ secondary: SUBTLE_COLOR_STATE_HOVERED_VARIANTS,
607
+ link: THEME_COLOR_STATE_HOVERED_VARIANTS
586
608
  };
587
609
 
588
610
  /**
@@ -602,7 +624,7 @@ const FOREGROUND_COLOR_STATE_VARIANTS: ColorStateVariants = {
602
624
 
603
625
  const BACKGROUND_COLOR_STATE_HOVERED_VARIANTS: ColorStateVariants = {
604
626
  lowSaturation: [
605
- { name: "hovered", brightness: 1.25 },
627
+ { name: "hovered", brightness: 1.15 },
606
628
  ...BACKGROUND_COLOR_STATE_VARIANTS.lowSaturation
607
629
  ],
608
630
  saturated: [
@@ -619,7 +641,7 @@ const COLOR_STATE_TOKEN_GROUPS: Record<string, ColorStateVariants> = {
619
641
 
620
642
  /** Standalone color tokens that receive state variants. */
621
643
  const COLOR_STATE_VARIANTS: Record<string, ColorStateVariants> = {
622
- outline: OUTLINE_COLOR_STATE_VARIANTS
644
+ hairline: HAIRLINE_COLOR_STATE_VARIANTS
623
645
  };
624
646
 
625
647
  /** OKLCH chroma below which a color uses the low-saturation state variants. */
@@ -633,9 +655,9 @@ const SUBTLE_COLOR_LIGHTNESS_STEP = 0.01;
633
655
  const MAX_SUBTLE_COLOR_ADJUSTMENTS = 100;
634
656
  const SUBTLE_COLOR_GAMUT_SEARCH_ITERATIONS = 32;
635
657
  const BACKDROP_BRIGHTNESS = 0.375;
636
- const BACKDROP_OPACITY = 0.45;
658
+ const BACKDROP_OPACITY = 0.15;
637
659
  /** OKLCH lightness step for the rim around `secondary` backgrounds (brighter in dark, darker in light themes). */
638
- const BORDER_LIGHTNESS_STEP = 0.15;
660
+ const BORDER_LIGHTNESS_STEP = 0.25;
639
661
  /** OKLCH lightness shift for hovered colors already near the contrast primitive. */
640
662
  const CONTRAST_SIDE_ACTIVE_LIGHTNESS_SHIFT = 0.25;
641
663
 
@@ -1344,12 +1366,11 @@ function addColorStateTokens(
1344
1366
  /**
1345
1367
  * Fill in a theme color group (`color.danger`, …): generate a missing
1346
1368
  * `secondary` low-emphasis background from `primary` and the parent theme,
1347
- * missing `link` color and, for `status` groups, `outline` color (both
1348
- * aliasing `primary`), `on-primary` /
1369
+ * a missing `link` color (aliasing `primary`), `on-primary` /
1349
1370
  * `on-secondary` text colors, a `backdrop` overlay color (`primary` 30% darker
1350
1371
  * at 75% opacity, no state variants), a `border` color (`secondary` 15% brighter, or
1351
1372
  * 15% darker in light themes, no state variants), and state variants for `primary`, `secondary`,
1352
- * `link` and `outline`. Every token in the group gets the group name as
1373
+ * and `link`. Every token in the group gets the group name as
1353
1374
  * its `theme` and `group`, so Tamagui places it in that child theme (e.g.
1354
1375
  * `danger.on-primary` → `onPrimary` in the `danger` theme).
1355
1376
  */
@@ -1373,14 +1394,7 @@ function addThemeColorGroupTokens(
1373
1394
  $value: `{color.${name}.primary}`,
1374
1395
  $description: `Generated ${name} hyperlink text color (matches primary)`
1375
1396
  };
1376
- if (group.group === "status") {
1377
- result.outline ??= {
1378
- ...token,
1379
- $type: "color",
1380
- $value: `{color.${name}.primary}`,
1381
- $description: `Generated ${name} border and divider color (matches primary)`
1382
- };
1383
- }
1397
+
1384
1398
  result["on-primary"] ??= {
1385
1399
  ...token,
1386
1400
  $type: "color",
@@ -1457,7 +1471,7 @@ function addThemeColorGroupTokens(
1457
1471
 
1458
1472
  /**
1459
1473
  * Add a `group` (the main token name) to each state and `on-*` color token
1460
- * that does not define one, e.g. `outline-active` → `outline`.
1474
+ * that does not define one, e.g. `hairline-active` → `hairline`.
1461
1475
  */
1462
1476
  function addColorTokenGroups(
1463
1477
  group: Record<string, unknown>
@@ -1588,15 +1602,14 @@ function injectColorStateVariants(
1588
1602
  /**
1589
1603
  * Style Dictionary preprocessor: rewrite color `$value`s (and nested shadow
1590
1604
  * colors) to hex so generators emit `#rrggbb` / `#rrggbbaa` instead of
1591
- * `oklch()`. Root colors (emphasis, ink, subtle, outline, backgrounds)
1605
+ * `oklch()`. Root colors (emphasis, ink, subtle, hairline, backgrounds)
1592
1606
  * stay in the root light and dark themes without rings. For each color group
1593
1607
  * with a `primary` token (except excluded groups), a missing `secondary` background and `on-primary` /
1594
1608
  * `on-secondary` text colors are generated, a missing `border` is derived from
1595
1609
  * `secondary` (15% brighter, or darker in light themes), then hovered, active, inactive,
1596
- * and disabled variants are added to the outline, `foreground` and
1610
+ * and disabled variants are added to the `hairline`, `foreground` and
1597
1611
  * `background` group colors, and each theme color group's `primary`, `secondary`
1598
- * `link` and `outline` (`link`, and `outline` in `status` groups, default to
1599
- * `primary` when missing).
1612
+ * and `link` (`link` defaults to `primary` when missing).
1600
1613
  * Low-saturation colors derive their states from the parent theme's contrast
1601
1614
  * primitive (backgrounds use a half-strength shift of their own lightness; hovered
1602
1615
  * colors already near that primitive shift toward the middle, while active
@@ -1604,8 +1617,8 @@ function injectColorStateVariants(
1604
1617
  * colors scale their own lightness. Foreground and background hovered states
1605
1618
  * take a smaller step than their active states. Tokens in a theme color group get the
1606
1619
  * group name as `theme` and `group`, unless already set; root state and `on-*`
1607
- * tokens get their main token name as `group` (e.g. `outline-active` →
1608
- * `outline`).
1620
+ * tokens get their main token name as `group` (e.g. `hairline-active` →
1621
+ * `hairline`).
1609
1622
  * Finally, focus rings are generated for each theme color group.
1610
1623
  */
1611
1624
  export function tamaguiPreprocessor(