@tamagui/create-theme 1.14.1 → 1.14.3

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/cjs/index.js CHANGED
@@ -1,2 +1,144 @@
1
- "use strict";var m=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var G=(t,e)=>{for(var r in e)m(t,r,{get:e[r],enumerable:!0})},N=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of K(e))!O.call(t,n)&&n!==r&&m(t,n,{get:()=>e[n],enumerable:!(s=E(e,n))||s.enumerable});return t};var v=t=>N(m({},"__esModule",{value:!0}),t);var D={};G(D,{addChildren:()=>$,applyMask:()=>h,createShiftMask:()=>f,createStrengthenMask:()=>b,createTheme:()=>y,createWeakenMask:()=>M});module.exports=v(D);const x=new WeakMap;function y(t,e,r){const s={...Object.fromEntries(Object.entries(e).map(([n,a])=>[n,V(t,a)])),...r==null?void 0:r.nonInheritedValues};return x.set(s,{palette:t,definition:e,cache:new Map}),s}const V=(t,e)=>{if(typeof e=="string")return e;const r=t.length-1,n=(e===0?!l(e):e>=0)?e:r+e,a=Math.min(Math.max(0,n),r);return t[a]};function $(t,e){const r={...t};for(const s in t){const n=e(s,t[s]);for(const a in n)r[`${s}_${a}`]=n[a]}return r}const f=({inverse:t}={})=>(e,{skip:r,max:s,palette:n,min:a=0,strength:o=1})=>{const i=Object.entries(e),p=s??(n?Object.values(n).length-1:1/0),g={};for(const[k,c]of i){if(typeof c=="string"||r&&k in r)continue;const d=c===0?!l(c):c>=0,w=d?1:-1,C=t?-1:1,u=c+o*w*C,P=d?Math.max(a,Math.min(p,u)):Math.min(-a,Math.max(-p,u));g[k]=P}return g},M=()=>f(),b=()=>f({inverse:!0});function l(t){return 1/t===-1/0}const T=new WeakMap;function h(t,e,r={}){const s=x.get(t);if(!s)throw new Error(process.env.NODE_ENV!=="production"?"No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme":"\u274C Err2");const n=T.get(e)??`${Math.random()}`;T.set(e,n);const a=`${n}${JSON.stringify(r)}`;if(s.cache.has(a))return s.cache.get(a);const o=e(s.definition,{palette:s.palette,...r}),i=y(s.palette,o);return s.cache.set(a,i),i}if(process.env.NODE_ENV==="development"){const t=["0","1","2","3","-3","-2","-1","-0"],e={bg:1,fg:-1},r=b(),s=M(),n=y(t,e);if(n.bg!=="1"||n.fg!=="-1")throw"\u274C";const a=h(n,r);if(a.bg!=="0"||a.fg!=="-0")throw"\u274C";const o=h(n,s);if(o.bg!=="2"||o.fg!=="-2")throw"\u274C";const i=h(n,s,{strength:2});if(i.bg!=="3"||i.fg!=="-3")throw"\u274C"}0&&(module.exports={addChildren,applyMask,createShiftMask,createStrengthenMask,createTheme,createWeakenMask});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var src_exports = {};
20
+ __export(src_exports, {
21
+ addChildren: () => addChildren,
22
+ applyMask: () => applyMask,
23
+ createShiftMask: () => createShiftMask,
24
+ createStrengthenMask: () => createStrengthenMask,
25
+ createTheme: () => createTheme,
26
+ createWeakenMask: () => createWeakenMask
27
+ });
28
+ module.exports = __toCommonJS(src_exports);
29
+ const THEME_INFO = /* @__PURE__ */ new WeakMap();
30
+ function createTheme(palette, definition, options) {
31
+ const theme = {
32
+ ...Object.fromEntries(
33
+ Object.entries(definition).map(([key, offset]) => {
34
+ return [key, getValue(palette, offset)];
35
+ })
36
+ ),
37
+ ...options == null ? void 0 : options.nonInheritedValues
38
+ };
39
+ THEME_INFO.set(theme, { palette, definition, cache: /* @__PURE__ */ new Map() });
40
+ return theme;
41
+ }
42
+ const getValue = (palette, value) => {
43
+ if (typeof value === "string")
44
+ return value;
45
+ const max = palette.length - 1;
46
+ const isPositive = value === 0 ? !isMinusZero(value) : value >= 0;
47
+ const next = isPositive ? value : max + value;
48
+ const index = Math.min(Math.max(0, next), max);
49
+ return palette[index];
50
+ };
51
+ function addChildren(themes, getChildren) {
52
+ const out = { ...themes };
53
+ for (const key in themes) {
54
+ const subThemes = getChildren(key, themes[key]);
55
+ for (const sKey in subThemes) {
56
+ out[`${key}_${sKey}`] = subThemes[sKey];
57
+ }
58
+ }
59
+ return out;
60
+ }
61
+ const createShiftMask = ({ inverse } = {}) => {
62
+ return (template, { skip, max: maxIn, palette, min = 0, strength = 1 }) => {
63
+ const values = Object.entries(template);
64
+ const max = maxIn ?? (palette ? Object.values(palette).length - 1 : Infinity);
65
+ const out = {};
66
+ for (const [key, value] of values) {
67
+ if (typeof value === "string")
68
+ continue;
69
+ if (skip && key in skip) {
70
+ continue;
71
+ }
72
+ const isPositive = value === 0 ? !isMinusZero(value) : value >= 0;
73
+ const direction = isPositive ? 1 : -1;
74
+ const invert = inverse ? -1 : 1;
75
+ const next = value + strength * direction * invert;
76
+ const clamped = isPositive ? Math.max(min, Math.min(max, next)) : Math.min(-min, Math.max(-max, next));
77
+ out[key] = clamped;
78
+ }
79
+ return out;
80
+ };
81
+ };
82
+ const createWeakenMask = () => createShiftMask();
83
+ const createStrengthenMask = () => createShiftMask({ inverse: true });
84
+ function isMinusZero(value) {
85
+ return 1 / value === -Infinity;
86
+ }
87
+ const MaskKeyCache = /* @__PURE__ */ new WeakMap();
88
+ function applyMask(theme, mask, options = {}) {
89
+ const info = THEME_INFO.get(theme);
90
+ if (!info) {
91
+ throw new Error(
92
+ process.env.NODE_ENV !== "production" ? `No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme` : `\u274C Err2`
93
+ );
94
+ }
95
+ const maskKey = MaskKeyCache.get(mask) ?? `${Math.random()}`;
96
+ MaskKeyCache.set(mask, maskKey);
97
+ const key = `${maskKey}${JSON.stringify(options)}`;
98
+ if (info.cache.has(key)) {
99
+ return info.cache.get(key);
100
+ }
101
+ const template = mask(info.definition, {
102
+ palette: info.palette,
103
+ ...options
104
+ });
105
+ const next = createTheme(info.palette, template);
106
+ info.cache.set(key, next);
107
+ return next;
108
+ }
109
+ if (process.env.NODE_ENV === "development") {
110
+ const palette = ["0", "1", "2", "3", "-3", "-2", "-1", "-0"];
111
+ const template = { bg: 1, fg: -1 };
112
+ const stongerMask = createStrengthenMask();
113
+ const weakerMask = createWeakenMask();
114
+ const theme = createTheme(palette, template);
115
+ if (theme.bg !== "1")
116
+ throw `\u274C`;
117
+ if (theme.fg !== "-1")
118
+ throw `\u274C`;
119
+ const str = applyMask(theme, stongerMask);
120
+ if (str.bg !== "0")
121
+ throw `\u274C`;
122
+ if (str.fg !== "-0")
123
+ throw `\u274C`;
124
+ const weak = applyMask(theme, weakerMask);
125
+ if (weak.bg !== "2")
126
+ throw `\u274C`;
127
+ if (weak.fg !== "-2")
128
+ throw `\u274C`;
129
+ const weak2 = applyMask(theme, weakerMask, { strength: 2 });
130
+ if (weak2.bg !== "3")
131
+ throw `\u274C`;
132
+ if (weak2.fg !== "-3")
133
+ throw `\u274C`;
134
+ }
135
+ // Annotate the CommonJS export names for ESM import in node:
136
+ 0 && (module.exports = {
137
+ addChildren,
138
+ applyMask,
139
+ createShiftMask,
140
+ createStrengthenMask,
141
+ createTheme,
142
+ createWeakenMask
143
+ });
2
144
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx"],
4
4
  "sourcesContent": ["import type { Variable } from '@tamagui/web'\n\nexport type ThemeMask = Record<string, string | number>\nexport type Palette = string[]\n\nexport type MaskOptions = {\n palette?: Palette\n skip?: Partial<ThemeMask>\n strength?: number\n max?: number\n min?: number\n}\n\ntype GenericTheme = { [key: string]: string | Variable }\ntype CreateMask = <A extends ThemeMask>(template: A, options: MaskOptions) => A\n\nconst THEME_INFO = new WeakMap<\n any,\n { palette: Palette; definition: ThemeMask; cache: Map<any, any> }\n>()\n\nexport function createTheme<\n Definition extends ThemeMask,\n Extras extends Record<string, string> = {}\n>(\n palette: Palette,\n definition: Definition,\n options?: {\n nonInheritedValues?: Extras\n }\n): {\n [key in keyof Definition | keyof Extras]: string\n} {\n const theme = {\n ...(Object.fromEntries(\n Object.entries(definition).map(([key, offset]) => {\n return [key, getValue(palette, offset)]\n })\n ) as any),\n ...options?.nonInheritedValues,\n }\n THEME_INFO.set(theme, { palette, definition, cache: new Map() })\n return theme\n}\n\nconst getValue = (palette: Palette, value: string | number) => {\n if (typeof value === 'string') return value\n const max = palette.length - 1\n const isPositive = value === 0 ? !isMinusZero(value) : value >= 0\n const next = isPositive ? value : max + value\n const index = Math.min(Math.max(0, next), max)\n return palette[index]\n}\n\ntype SubThemeKeys<ParentKeys, ChildKeys> = `${ParentKeys extends string\n ? ParentKeys\n : never}_${ChildKeys extends string ? ChildKeys : never}`\n\ntype ChildGetter<Name extends string | number | symbol, Theme extends GenericTheme> = (\n name: Name,\n theme: Theme\n) => { [key: string]: Theme }\n\nexport function addChildren<\n Themes extends { [key: string]: GenericTheme },\n GetChildren extends ChildGetter<keyof Themes, Themes[keyof Themes]>\n>(\n themes: Themes,\n getChildren: GetChildren\n): Themes & {\n [key in SubThemeKeys<keyof Themes, keyof ReturnType<GetChildren>>]: Themes[keyof Themes]\n} {\n const out = { ...themes }\n for (const key in themes) {\n const subThemes = getChildren(key, themes[key])\n for (const sKey in subThemes) {\n out[`${key}_${sKey}`] = subThemes[sKey] as any\n }\n }\n return out as any\n}\n\nexport const createShiftMask = ({ inverse }: { inverse?: boolean } = {}) => {\n return ((template, { skip, max: maxIn, palette, min = 0, strength = 1 }) => {\n const values = Object.entries(template)\n const max = maxIn ?? (palette ? Object.values(palette).length - 1 : Infinity)\n const out = {}\n for (const [key, value] of values) {\n if (typeof value === 'string') continue\n if (skip && key in skip) {\n continue\n }\n const isPositive = value === 0 ? !isMinusZero(value) : value >= 0\n const direction = isPositive ? 1 : -1\n const invert = inverse ? -1 : 1\n const next = value + strength * direction * invert\n const clamped = isPositive\n ? Math.max(min, Math.min(max, next))\n : Math.min(-min, Math.max(-max, next))\n\n out[key] = clamped\n }\n return out as typeof template\n }) as CreateMask\n}\n\nexport const createWeakenMask = () => createShiftMask()\nexport const createStrengthenMask = () => createShiftMask({ inverse: true })\n\nfunction isMinusZero(value) {\n return 1 / value === -Infinity\n}\n\nconst MaskKeyCache = new WeakMap<any, string>()\n\nexport function applyMask<Theme extends GenericTheme>(\n theme: Theme,\n mask: CreateMask,\n options: MaskOptions = {}\n): Theme {\n const info = THEME_INFO.get(theme)\n if (!info) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme`\n : `\u274C Err2`\n )\n }\n\n const maskKey = MaskKeyCache.get(mask) ?? `${Math.random()}`\n MaskKeyCache.set(mask, maskKey)\n\n const key = `${maskKey}${JSON.stringify(options)}`\n\n if (info.cache.has(key)) {\n return info.cache.get(key)\n }\n\n const template = mask(info.definition, {\n palette: info.palette,\n ...options,\n })\n const next = createTheme(info.palette, template) as Theme\n\n info.cache.set(key, next)\n\n return next\n}\n\n// --- tests ---\n\nif (process.env.NODE_ENV === 'development') {\n const palette = ['0', '1', '2', '3', '-3', '-2', '-1', '-0']\n const template = { bg: 1, fg: -1 }\n\n const stongerMask = createStrengthenMask()\n const weakerMask = createWeakenMask()\n\n const theme = createTheme(palette, template)\n if (theme.bg !== '1') throw `\u274C`\n if (theme.fg !== '-1') throw `\u274C`\n\n const str = applyMask(theme, stongerMask)\n if (str.bg !== '0') throw `\u274C`\n if (str.fg !== '-0') throw `\u274C`\n\n const weak = applyMask(theme, weakerMask)\n if (weak.bg !== '2') throw `\u274C`\n if (weak.fg !== '-2') throw `\u274C`\n\n const weak2 = applyMask(theme, weakerMask, { strength: 2 })\n if (weak2.bg !== '3') throw `\u274C`\n if (weak2.fg !== '-3') throw `\u274C`\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,cAAAC,EAAA,oBAAAC,EAAA,yBAAAC,EAAA,gBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAR,GAgBA,MAAMS,EAAa,IAAI,QAKhB,SAASH,EAIdI,EACAC,EACAC,EAKA,CACA,MAAMC,EAAQ,CACZ,GAAI,OAAO,YACT,OAAO,QAAQF,CAAU,EAAE,IAAI,CAAC,CAACG,EAAKC,CAAM,IACnC,CAACD,EAAKE,EAASN,EAASK,CAAM,CAAC,CACvC,CACH,EACA,GAAGH,GAAA,YAAAA,EAAS,kBACd,EACA,OAAAH,EAAW,IAAII,EAAO,CAAE,QAAAH,EAAS,WAAAC,EAAY,MAAO,IAAI,GAAM,CAAC,EACxDE,CACT,CAEA,MAAMG,EAAW,CAACN,EAAkBO,IAA2B,CAC7D,GAAI,OAAOA,GAAU,SAAU,OAAOA,EACtC,MAAMC,EAAMR,EAAQ,OAAS,EAEvBS,GADaF,IAAU,EAAI,CAACG,EAAYH,CAAK,EAAIA,GAAS,GACtCA,EAAQC,EAAMD,EAClCI,EAAQ,KAAK,IAAI,KAAK,IAAI,EAAGF,CAAI,EAAGD,CAAG,EAC7C,OAAOR,EAAQW,CAAK,CACtB,EAWO,SAASnB,EAIdoB,EACAC,EAGA,CACA,MAAMC,EAAM,CAAE,GAAGF,CAAO,EACxB,UAAWR,KAAOQ,EAAQ,CACxB,MAAMG,EAAYF,EAAYT,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AUH,EAAa,IAAIC,CAAI,GAAK,GAAG,KAAK,OAAO,IACzDD,EAAa,IAAIC,EAAME,CAAO,EAE9B,MAAM3B,EAAM,GAAG2B,IAAU,KAAK,UAAU7B,CAAO,IAE/C,GAAI4B,EAAK,MAAM,IAAI1B,CAAG,EACpB,OAAO0B,EAAK,MAAM,IAAI1B,CAAG,EAG3B,MAAMc,EAAWW,EAAKC,EAAK,WAAY,CACrC,QAASA,EAAK,QACd,GAAG5B,CACL,CAAC,EACKO,EAAOb,EAAYkC,EAAK,QAASZ,CAAQ,EAE/C,OAAAY,EAAK,MAAM,IAAI1B,EAAKK,CAAI,EAEjBA,CACT,CAIA,GAAI,QAAQ,IAAI,WAAa,cAAe,CAC1C,MAAMT,EAAU,CAAC,IAAK,IAAK,IAAK,IAAK,KAAM,KAAM,KAAM,IAAI,EACrDkB,EAAW,CAAE,GAAI,EAAG,GAAI,EAAG,EAE3Bc,EAAcrC,EAAqB,EACnCsC,EAAapC,EAAiB,EAE9BM,EAAQP,EAAYI,EAASkB,CAAQ,EAE3C,GADIf,EAAM,KAAO,KACbA,EAAM,KAAO,KAAM,KAAM,SAE7B,MAAM+B,EAAMzC,EAAUU,EAAO6B,CAAW,EAExC,GADIE,EAAI,KAAO,KACXA,EAAI,KAAO,KAAM,KAAM,SAE3B,MAAMC,EAAO1C,EAAUU,EAAO8B,CAAU,EAExC,GADIE,EAAK,KAAO,KACZA,EAAK,KAAO,KAAM,KAAM,SAE5B,MAAMC,EAAQ3C,EAAUU,EAAO8B,EAAY,CAAE,SAAU,CAAE,CAAC,EAE1D,GADIG,EAAM,KAAO,KACbA,EAAM,KAAO,KAAM,KAAM,QAC/B",
6
- "names": ["src_exports", "__export", "addChildren", "applyMask", "createShiftMask", "createStrengthenMask", "createTheme", "createWeakenMask", "__toCommonJS", "THEME_INFO", "palette", "definition", "options", "theme", "key", "offset", "getValue", "value", "max", "next", "isMinusZero", "index", "themes", "getChildren", "out", "subThemes", "sKey", "inverse", "template", "skip", "maxIn", "min", "strength", "values", "isPositive", "direction", "invert", "clamped", "MaskKeyCache", "mask", "info", "maskKey", "stongerMask", "weakerMask", "str", "weak", "weak2"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,MAAM,aAAa,oBAAI,QAGrB;AAEK,SAAS,YAId,SACA,YACA,SAKA;AACA,QAAM,QAAQ;AAAA,IACZ,GAAI,OAAO;AAAA,MACT,OAAO,QAAQ,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,MAAM,MAAM;AAChD,eAAO,CAAC,KAAK,SAAS,SAAS,MAAM,CAAC;AAAA,MACxC,CAAC;AAAA,IACH;AAAA,IACA,GAAG,mCAAS;AAAA,EACd;AACA,aAAW,IAAI,OAAO,EAAE,SAAS,YAAY,OAAO,oBAAI,IAAI,EAAE,CAAC;AAC/D,SAAO;AACT;AAEA,MAAM,WAAW,CAAC,SAAkB,UAA2B;AAC7D,MAAI,OAAO,UAAU;AAAU,WAAO;AACtC,QAAM,MAAM,QAAQ,SAAS;AAC7B,QAAM,aAAa,UAAU,IAAI,CAAC,YAAY,KAAK,IAAI,SAAS;AAChE,QAAM,OAAO,aAAa,QAAQ,MAAM;AACxC,QAAM,QAAQ,KAAK,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,GAAG;AAC7C,SAAO,QAAQ,KAAK;AACtB;AAWO,SAAS,YAId,QACA,aAGA;AACA,QAAM,MAAM,EAAE,GAAG,OAAO;AACxB,aAAW,OAAO,QAAQ;AACxB,UAAM,YAAY,YAAY,KAAK,OAAO,GAAG,CAAC;AAC9C,eAAW,QAAQ,WAAW;AAC5B,UAAI,GAAG,OAAO,MAAM,IAAI,UAAU,IAAI;AAAA,IACxC;AAAA,EACF;AACA,SAAO;AACT;AAEO,MAAM,kBAAkB,CAAC,EAAE,QAAQ,IAA2B,CAAC,MAAM;AAC1E,SAAQ,CAAC,UAAU,EAAE,MAAM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MAAM,IAAI,GAAG;AAAA,EAC3B;AAEA,QAAM,WAAW,KAAK,KAAK,YAAY;AAAA,IACrC,SAAS,KAAK;AAAA,IACd,GAAG;AAAA,EACL,CAAC;AACD,QAAM,OAAO,YAAY,KAAK,SAAS,QAAQ;AAE/C,OAAK,MAAM,IAAI,KAAK,IAAI;AAExB,SAAO;AACT;AAIA,IAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAM,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,MAAM,MAAM,MAAM,IAAI;AAC3D,QAAM,WAAW,EAAE,IAAI,GAAG,IAAI,GAAG;AAEjC,QAAM,cAAc,qBAAqB;AACzC,QAAM,aAAa,iBAAiB;AAEpC,QAAM,QAAQ,YAAY,SAAS,QAAQ;AAC3C,MAAI,MAAM,OAAO;AAAK,UAAM;AAC5B,MAAI,MAAM,OAAO;AAAM,UAAM;AAE7B,QAAM,MAAM,UAAU,OAAO,WAAW;AACxC,MAAI,IAAI,OAAO;AAAK,UAAM;AAC1B,MAAI,IAAI,OAAO;AAAM,UAAM;AAE3B,QAAM,OAAO,UAAU,OAAO,UAAU;AACxC,MAAI,KAAK,OAAO;AAAK,UAAM;AAC3B,MAAI,KAAK,OAAO;AAAM,UAAM;AAE5B,QAAM,QAAQ,UAAU,OAAO,YAAY,EAAE,UAAU,EAAE,CAAC;AAC1D,MAAI,MAAM,OAAO;AAAK,UAAM;AAC5B,MAAI,MAAM,OAAO;AAAM,UAAM;AAC/B;",
6
+ "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,2 +1,115 @@
1
- const k=new WeakMap;function d(s,e,r){const t={...Object.fromEntries(Object.entries(e).map(([n,a])=>[n,w(s,a)])),...r==null?void 0:r.nonInheritedValues};return k.set(t,{palette:s,definition:e,cache:new Map}),t}const w=(s,e)=>{if(typeof e=="string")return e;const r=s.length-1,n=(e===0?!x(e):e>=0)?e:r+e,a=Math.min(Math.max(0,n),r);return s[a]};function E(s,e){const r={...s};for(const t in s){const n=e(t,s[t]);for(const a in n)r[`${t}_${a}`]=n[a]}return r}const u=({inverse:s}={})=>(e,{skip:r,max:t,palette:n,min:a=0,strength:o=1})=>{const i=Object.entries(e),m=t??(n?Object.values(n).length-1:1/0),y={};for(const[f,c]of i){if(typeof c=="string"||r&&f in r)continue;const p=c===0?!x(c):c>=0,T=p?1:-1,M=s?-1:1,g=c+o*T*M,b=p?Math.max(a,Math.min(m,g)):Math.min(-a,Math.max(-m,g));y[f]=b}return y},C=()=>u(),P=()=>u({inverse:!0});function x(s){return 1/s===-1/0}const l=new WeakMap;function h(s,e,r={}){const t=k.get(s);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme":"\u274C Err2");const n=l.get(e)??`${Math.random()}`;l.set(e,n);const a=`${n}${JSON.stringify(r)}`;if(t.cache.has(a))return t.cache.get(a);const o=e(t.definition,{palette:t.palette,...r}),i=d(t.palette,o);return t.cache.set(a,i),i}if(process.env.NODE_ENV==="development"){const s=["0","1","2","3","-3","-2","-1","-0"],e={bg:1,fg:-1},r=P(),t=C(),n=d(s,e);if(n.bg!=="1"||n.fg!=="-1")throw"\u274C";const a=h(n,r);if(a.bg!=="0"||a.fg!=="-0")throw"\u274C";const o=h(n,t);if(o.bg!=="2"||o.fg!=="-2")throw"\u274C";const i=h(n,t,{strength:2});if(i.bg!=="3"||i.fg!=="-3")throw"\u274C"}export{E as addChildren,h as applyMask,u as createShiftMask,P as createStrengthenMask,d as createTheme,C as createWeakenMask};
1
+ const THEME_INFO = /* @__PURE__ */ new WeakMap();
2
+ function createTheme(palette, definition, options) {
3
+ const theme = {
4
+ ...Object.fromEntries(
5
+ Object.entries(definition).map(([key, offset]) => {
6
+ return [key, getValue(palette, offset)];
7
+ })
8
+ ),
9
+ ...options == null ? void 0 : options.nonInheritedValues
10
+ };
11
+ THEME_INFO.set(theme, { palette, definition, cache: /* @__PURE__ */ new Map() });
12
+ return theme;
13
+ }
14
+ const getValue = (palette, value) => {
15
+ if (typeof value === "string")
16
+ return value;
17
+ const max = palette.length - 1;
18
+ const isPositive = value === 0 ? !isMinusZero(value) : value >= 0;
19
+ const next = isPositive ? value : max + value;
20
+ const index = Math.min(Math.max(0, next), max);
21
+ return palette[index];
22
+ };
23
+ function addChildren(themes, getChildren) {
24
+ const out = { ...themes };
25
+ for (const key in themes) {
26
+ const subThemes = getChildren(key, themes[key]);
27
+ for (const sKey in subThemes) {
28
+ out[`${key}_${sKey}`] = subThemes[sKey];
29
+ }
30
+ }
31
+ return out;
32
+ }
33
+ const createShiftMask = ({ inverse } = {}) => {
34
+ return (template, { skip, max: maxIn, palette, min = 0, strength = 1 }) => {
35
+ const values = Object.entries(template);
36
+ const max = maxIn ?? (palette ? Object.values(palette).length - 1 : Infinity);
37
+ const out = {};
38
+ for (const [key, value] of values) {
39
+ if (typeof value === "string")
40
+ continue;
41
+ if (skip && key in skip) {
42
+ continue;
43
+ }
44
+ const isPositive = value === 0 ? !isMinusZero(value) : value >= 0;
45
+ const direction = isPositive ? 1 : -1;
46
+ const invert = inverse ? -1 : 1;
47
+ const next = value + strength * direction * invert;
48
+ const clamped = isPositive ? Math.max(min, Math.min(max, next)) : Math.min(-min, Math.max(-max, next));
49
+ out[key] = clamped;
50
+ }
51
+ return out;
52
+ };
53
+ };
54
+ const createWeakenMask = () => createShiftMask();
55
+ const createStrengthenMask = () => createShiftMask({ inverse: true });
56
+ function isMinusZero(value) {
57
+ return 1 / value === -Infinity;
58
+ }
59
+ const MaskKeyCache = /* @__PURE__ */ new WeakMap();
60
+ function applyMask(theme, mask, options = {}) {
61
+ const info = THEME_INFO.get(theme);
62
+ if (!info) {
63
+ throw new Error(
64
+ process.env.NODE_ENV !== "production" ? `No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme` : `\u274C Err2`
65
+ );
66
+ }
67
+ const maskKey = MaskKeyCache.get(mask) ?? `${Math.random()}`;
68
+ MaskKeyCache.set(mask, maskKey);
69
+ const key = `${maskKey}${JSON.stringify(options)}`;
70
+ if (info.cache.has(key)) {
71
+ return info.cache.get(key);
72
+ }
73
+ const template = mask(info.definition, {
74
+ palette: info.palette,
75
+ ...options
76
+ });
77
+ const next = createTheme(info.palette, template);
78
+ info.cache.set(key, next);
79
+ return next;
80
+ }
81
+ if (process.env.NODE_ENV === "development") {
82
+ const palette = ["0", "1", "2", "3", "-3", "-2", "-1", "-0"];
83
+ const template = { bg: 1, fg: -1 };
84
+ const stongerMask = createStrengthenMask();
85
+ const weakerMask = createWeakenMask();
86
+ const theme = createTheme(palette, template);
87
+ if (theme.bg !== "1")
88
+ throw `\u274C`;
89
+ if (theme.fg !== "-1")
90
+ throw `\u274C`;
91
+ const str = applyMask(theme, stongerMask);
92
+ if (str.bg !== "0")
93
+ throw `\u274C`;
94
+ if (str.fg !== "-0")
95
+ throw `\u274C`;
96
+ const weak = applyMask(theme, weakerMask);
97
+ if (weak.bg !== "2")
98
+ throw `\u274C`;
99
+ if (weak.fg !== "-2")
100
+ throw `\u274C`;
101
+ const weak2 = applyMask(theme, weakerMask, { strength: 2 });
102
+ if (weak2.bg !== "3")
103
+ throw `\u274C`;
104
+ if (weak2.fg !== "-3")
105
+ throw `\u274C`;
106
+ }
107
+ export {
108
+ addChildren,
109
+ applyMask,
110
+ createShiftMask,
111
+ createStrengthenMask,
112
+ createTheme,
113
+ createWeakenMask
114
+ };
2
115
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx"],
4
4
  "sourcesContent": ["import type { Variable } from '@tamagui/web'\n\nexport type ThemeMask = Record<string, string | number>\nexport type Palette = string[]\n\nexport type MaskOptions = {\n palette?: Palette\n skip?: Partial<ThemeMask>\n strength?: number\n max?: number\n min?: number\n}\n\ntype GenericTheme = { [key: string]: string | Variable }\ntype CreateMask = <A extends ThemeMask>(template: A, options: MaskOptions) => A\n\nconst THEME_INFO = new WeakMap<\n any,\n { palette: Palette; definition: ThemeMask; cache: Map<any, any> }\n>()\n\nexport function createTheme<\n Definition extends ThemeMask,\n Extras extends Record<string, string> = {}\n>(\n palette: Palette,\n definition: Definition,\n options?: {\n nonInheritedValues?: Extras\n }\n): {\n [key in keyof Definition | keyof Extras]: string\n} {\n const theme = {\n ...(Object.fromEntries(\n Object.entries(definition).map(([key, offset]) => {\n return [key, getValue(palette, offset)]\n })\n ) as any),\n ...options?.nonInheritedValues,\n }\n THEME_INFO.set(theme, { palette, definition, cache: new Map() })\n return theme\n}\n\nconst getValue = (palette: Palette, value: string | number) => {\n if (typeof value === 'string') return value\n const max = palette.length - 1\n const isPositive = value === 0 ? !isMinusZero(value) : value >= 0\n const next = isPositive ? value : max + value\n const index = Math.min(Math.max(0, next), max)\n return palette[index]\n}\n\ntype SubThemeKeys<ParentKeys, ChildKeys> = `${ParentKeys extends string\n ? ParentKeys\n : never}_${ChildKeys extends string ? ChildKeys : never}`\n\ntype ChildGetter<Name extends string | number | symbol, Theme extends GenericTheme> = (\n name: Name,\n theme: Theme\n) => { [key: string]: Theme }\n\nexport function addChildren<\n Themes extends { [key: string]: GenericTheme },\n GetChildren extends ChildGetter<keyof Themes, Themes[keyof Themes]>\n>(\n themes: Themes,\n getChildren: GetChildren\n): Themes & {\n [key in SubThemeKeys<keyof Themes, keyof ReturnType<GetChildren>>]: Themes[keyof Themes]\n} {\n const out = { ...themes }\n for (const key in themes) {\n const subThemes = getChildren(key, themes[key])\n for (const sKey in subThemes) {\n out[`${key}_${sKey}`] = subThemes[sKey] as any\n }\n }\n return out as any\n}\n\nexport const createShiftMask = ({ inverse }: { inverse?: boolean } = {}) => {\n return ((template, { skip, max: maxIn, palette, min = 0, strength = 1 }) => {\n const values = Object.entries(template)\n const max = maxIn ?? (palette ? Object.values(palette).length - 1 : Infinity)\n const out = {}\n for (const [key, value] of values) {\n if (typeof value === 'string') continue\n if (skip && key in skip) {\n continue\n }\n const isPositive = value === 0 ? !isMinusZero(value) : value >= 0\n const direction = isPositive ? 1 : -1\n const invert = inverse ? -1 : 1\n const next = value + strength * direction * invert\n const clamped = isPositive\n ? Math.max(min, Math.min(max, next))\n : Math.min(-min, Math.max(-max, next))\n\n out[key] = clamped\n }\n return out as typeof template\n }) as CreateMask\n}\n\nexport const createWeakenMask = () => createShiftMask()\nexport const createStrengthenMask = () => createShiftMask({ inverse: true })\n\nfunction isMinusZero(value) {\n return 1 / value === -Infinity\n}\n\nconst MaskKeyCache = new WeakMap<any, string>()\n\nexport function applyMask<Theme extends GenericTheme>(\n theme: Theme,\n mask: CreateMask,\n options: MaskOptions = {}\n): Theme {\n const info = THEME_INFO.get(theme)\n if (!info) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme`\n : `\u274C Err2`\n )\n }\n\n const maskKey = MaskKeyCache.get(mask) ?? `${Math.random()}`\n MaskKeyCache.set(mask, maskKey)\n\n const key = `${maskKey}${JSON.stringify(options)}`\n\n if (info.cache.has(key)) {\n return info.cache.get(key)\n }\n\n const template = mask(info.definition, {\n palette: info.palette,\n ...options,\n })\n const next = createTheme(info.palette, template) as Theme\n\n info.cache.set(key, next)\n\n return next\n}\n\n// --- tests ---\n\nif (process.env.NODE_ENV === 'development') {\n const palette = ['0', '1', '2', '3', '-3', '-2', '-1', '-0']\n const template = { bg: 1, fg: -1 }\n\n const stongerMask = createStrengthenMask()\n const weakerMask = createWeakenMask()\n\n const theme = createTheme(palette, template)\n if (theme.bg !== '1') throw `\u274C`\n if (theme.fg !== '-1') throw `\u274C`\n\n const str = applyMask(theme, stongerMask)\n if (str.bg !== '0') throw `\u274C`\n if (str.fg !== '-0') throw `\u274C`\n\n const weak = applyMask(theme, weakerMask)\n if (weak.bg !== '2') throw `\u274C`\n if (weak.fg !== '-2') throw `\u274C`\n\n const weak2 = applyMask(theme, weakerMask, { strength: 2 })\n if (weak2.bg !== '3') throw `\u274C`\n if (weak2.fg !== '-3') throw `\u274C`\n}\n"],
5
- "mappings": "AA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AU,CAAC,IAAK,IAAK,IAAK,IAAK,KAAM,KAAM,KAAM,IAAI,EACrDoB,EAAW,CAAE,GAAI,EAAG,GAAI,EAAG,EAE3BiB,EAAcN,EAAqB,EACnCO,EAAaR,EAAiB,EAE9B3B,EAAQJ,EAAYC,EAASoB,CAAQ,EAE3C,GADIjB,EAAM,KAAO,KACbA,EAAM,KAAO,KAAM,KAAM,SAE7B,MAAMoC,EAAMN,EAAU9B,EAAOkC,CAAW,EAExC,GADIE,EAAI,KAAO,KACXA,EAAI,KAAO,KAAM,KAAM,SAE3B,MAAMC,EAAOP,EAAU9B,EAAOmC,CAAU,EAExC,GADIE,EAAK,KAAO,KACZA,EAAK,KAAO,KAAM,KAAM,SAE5B,MAAMC,EAAQR,EAAU9B,EAAOmC,EAAY,CAAE,SAAU,CAAE,CAAC,EAE1D,GADIG,EAAM,KAAO,KACbA,EAAM,KAAO,KAAM,KAAM,QAC/B",
6
- "names": ["THEME_INFO", "createTheme", "palette", "definition", "options", "theme", "key", "offset", "getValue", "value", "max", "next", "isMinusZero", "index", "addChildren", "themes", "getChildren", "out", "subThemes", "sKey", "createShiftMask", "inverse", "template", "skip", "maxIn", "min", "strength", "values", "isPositive", "direction", "invert", "clamped", "createWeakenMask", "createStrengthenMask", "MaskKeyCache", "applyMask", "mask", "info", "maskKey", "stongerMask", "weakerMask", "str", "weak", "weak2"]
5
+ "mappings": "AAgBA,MAAM,aAAa,oBAAI,QAGrB;AAEK,SAAS,YAId,SACA,YACA,SAKA;AACA,QAAM,QAAQ;AAAA,IACZ,GAAI,OAAO;AAAA,MACT,OAAO,QAAQ,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,MAAM,MAAM;AAChD,eAAO,CAAC,KAAK,SAAS,SAAS,MAAM,CAAC;AAAA,MACxC,CAAC;AAAA,IACH;AAAA,IACA,GAAG,mCAAS;AAAA,EACd;AACA,aAAW,IAAI,OAAO,EAAE,SAAS,YAAY,OAAO,oBAAI,IAAI,EAAE,CAAC;AAC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AM,UAAU,OAAO,WAAW;AACxC,MAAI,IAAI,OAAO;AAAK,UAAM;AAC1B,MAAI,IAAI,OAAO;AAAM,UAAM;AAE3B,QAAM,OAAO,UAAU,OAAO,UAAU;AACxC,MAAI,KAAK,OAAO;AAAK,UAAM;AAC3B,MAAI,KAAK,OAAO;AAAM,UAAM;AAE5B,QAAM,QAAQ,UAAU,OAAO,YAAY,EAAE,UAAU,EAAE,CAAC;AAC1D,MAAI,MAAM,OAAO;AAAK,UAAM;AAC5B,MAAI,MAAM,OAAO;AAAM,UAAM;AAC/B;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,115 @@
1
- const k=new WeakMap;function d(s,e,r){const t={...Object.fromEntries(Object.entries(e).map(([n,a])=>[n,w(s,a)])),...r==null?void 0:r.nonInheritedValues};return k.set(t,{palette:s,definition:e,cache:new Map}),t}const w=(s,e)=>{if(typeof e=="string")return e;const r=s.length-1,n=(e===0?!x(e):e>=0)?e:r+e,a=Math.min(Math.max(0,n),r);return s[a]};function E(s,e){const r={...s};for(const t in s){const n=e(t,s[t]);for(const a in n)r[`${t}_${a}`]=n[a]}return r}const u=({inverse:s}={})=>(e,{skip:r,max:t,palette:n,min:a=0,strength:o=1})=>{const i=Object.entries(e),m=t??(n?Object.values(n).length-1:1/0),y={};for(const[f,c]of i){if(typeof c=="string"||r&&f in r)continue;const p=c===0?!x(c):c>=0,T=p?1:-1,M=s?-1:1,g=c+o*T*M,b=p?Math.max(a,Math.min(m,g)):Math.min(-a,Math.max(-m,g));y[f]=b}return y},C=()=>u(),P=()=>u({inverse:!0});function x(s){return 1/s===-1/0}const l=new WeakMap;function h(s,e,r={}){const t=k.get(s);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme":"\u274C Err2");const n=l.get(e)??`${Math.random()}`;l.set(e,n);const a=`${n}${JSON.stringify(r)}`;if(t.cache.has(a))return t.cache.get(a);const o=e(t.definition,{palette:t.palette,...r}),i=d(t.palette,o);return t.cache.set(a,i),i}if(process.env.NODE_ENV==="development"){const s=["0","1","2","3","-3","-2","-1","-0"],e={bg:1,fg:-1},r=P(),t=C(),n=d(s,e);if(n.bg!=="1"||n.fg!=="-1")throw"\u274C";const a=h(n,r);if(a.bg!=="0"||a.fg!=="-0")throw"\u274C";const o=h(n,t);if(o.bg!=="2"||o.fg!=="-2")throw"\u274C";const i=h(n,t,{strength:2});if(i.bg!=="3"||i.fg!=="-3")throw"\u274C"}export{E as addChildren,h as applyMask,u as createShiftMask,P as createStrengthenMask,d as createTheme,C as createWeakenMask};
1
+ const THEME_INFO = /* @__PURE__ */ new WeakMap();
2
+ function createTheme(palette, definition, options) {
3
+ const theme = {
4
+ ...Object.fromEntries(
5
+ Object.entries(definition).map(([key, offset]) => {
6
+ return [key, getValue(palette, offset)];
7
+ })
8
+ ),
9
+ ...options == null ? void 0 : options.nonInheritedValues
10
+ };
11
+ THEME_INFO.set(theme, { palette, definition, cache: /* @__PURE__ */ new Map() });
12
+ return theme;
13
+ }
14
+ const getValue = (palette, value) => {
15
+ if (typeof value === "string")
16
+ return value;
17
+ const max = palette.length - 1;
18
+ const isPositive = value === 0 ? !isMinusZero(value) : value >= 0;
19
+ const next = isPositive ? value : max + value;
20
+ const index = Math.min(Math.max(0, next), max);
21
+ return palette[index];
22
+ };
23
+ function addChildren(themes, getChildren) {
24
+ const out = { ...themes };
25
+ for (const key in themes) {
26
+ const subThemes = getChildren(key, themes[key]);
27
+ for (const sKey in subThemes) {
28
+ out[`${key}_${sKey}`] = subThemes[sKey];
29
+ }
30
+ }
31
+ return out;
32
+ }
33
+ const createShiftMask = ({ inverse } = {}) => {
34
+ return (template, { skip, max: maxIn, palette, min = 0, strength = 1 }) => {
35
+ const values = Object.entries(template);
36
+ const max = maxIn ?? (palette ? Object.values(palette).length - 1 : Infinity);
37
+ const out = {};
38
+ for (const [key, value] of values) {
39
+ if (typeof value === "string")
40
+ continue;
41
+ if (skip && key in skip) {
42
+ continue;
43
+ }
44
+ const isPositive = value === 0 ? !isMinusZero(value) : value >= 0;
45
+ const direction = isPositive ? 1 : -1;
46
+ const invert = inverse ? -1 : 1;
47
+ const next = value + strength * direction * invert;
48
+ const clamped = isPositive ? Math.max(min, Math.min(max, next)) : Math.min(-min, Math.max(-max, next));
49
+ out[key] = clamped;
50
+ }
51
+ return out;
52
+ };
53
+ };
54
+ const createWeakenMask = () => createShiftMask();
55
+ const createStrengthenMask = () => createShiftMask({ inverse: true });
56
+ function isMinusZero(value) {
57
+ return 1 / value === -Infinity;
58
+ }
59
+ const MaskKeyCache = /* @__PURE__ */ new WeakMap();
60
+ function applyMask(theme, mask, options = {}) {
61
+ const info = THEME_INFO.get(theme);
62
+ if (!info) {
63
+ throw new Error(
64
+ process.env.NODE_ENV !== "production" ? `No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme` : `\u274C Err2`
65
+ );
66
+ }
67
+ const maskKey = MaskKeyCache.get(mask) ?? `${Math.random()}`;
68
+ MaskKeyCache.set(mask, maskKey);
69
+ const key = `${maskKey}${JSON.stringify(options)}`;
70
+ if (info.cache.has(key)) {
71
+ return info.cache.get(key);
72
+ }
73
+ const template = mask(info.definition, {
74
+ palette: info.palette,
75
+ ...options
76
+ });
77
+ const next = createTheme(info.palette, template);
78
+ info.cache.set(key, next);
79
+ return next;
80
+ }
81
+ if (process.env.NODE_ENV === "development") {
82
+ const palette = ["0", "1", "2", "3", "-3", "-2", "-1", "-0"];
83
+ const template = { bg: 1, fg: -1 };
84
+ const stongerMask = createStrengthenMask();
85
+ const weakerMask = createWeakenMask();
86
+ const theme = createTheme(palette, template);
87
+ if (theme.bg !== "1")
88
+ throw `\u274C`;
89
+ if (theme.fg !== "-1")
90
+ throw `\u274C`;
91
+ const str = applyMask(theme, stongerMask);
92
+ if (str.bg !== "0")
93
+ throw `\u274C`;
94
+ if (str.fg !== "-0")
95
+ throw `\u274C`;
96
+ const weak = applyMask(theme, weakerMask);
97
+ if (weak.bg !== "2")
98
+ throw `\u274C`;
99
+ if (weak.fg !== "-2")
100
+ throw `\u274C`;
101
+ const weak2 = applyMask(theme, weakerMask, { strength: 2 });
102
+ if (weak2.bg !== "3")
103
+ throw `\u274C`;
104
+ if (weak2.fg !== "-3")
105
+ throw `\u274C`;
106
+ }
107
+ export {
108
+ addChildren,
109
+ applyMask,
110
+ createShiftMask,
111
+ createStrengthenMask,
112
+ createTheme,
113
+ createWeakenMask
114
+ };
2
115
  //# sourceMappingURL=index.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx"],
4
4
  "sourcesContent": ["import type { Variable } from '@tamagui/web'\n\nexport type ThemeMask = Record<string, string | number>\nexport type Palette = string[]\n\nexport type MaskOptions = {\n palette?: Palette\n skip?: Partial<ThemeMask>\n strength?: number\n max?: number\n min?: number\n}\n\ntype GenericTheme = { [key: string]: string | Variable }\ntype CreateMask = <A extends ThemeMask>(template: A, options: MaskOptions) => A\n\nconst THEME_INFO = new WeakMap<\n any,\n { palette: Palette; definition: ThemeMask; cache: Map<any, any> }\n>()\n\nexport function createTheme<\n Definition extends ThemeMask,\n Extras extends Record<string, string> = {}\n>(\n palette: Palette,\n definition: Definition,\n options?: {\n nonInheritedValues?: Extras\n }\n): {\n [key in keyof Definition | keyof Extras]: string\n} {\n const theme = {\n ...(Object.fromEntries(\n Object.entries(definition).map(([key, offset]) => {\n return [key, getValue(palette, offset)]\n })\n ) as any),\n ...options?.nonInheritedValues,\n }\n THEME_INFO.set(theme, { palette, definition, cache: new Map() })\n return theme\n}\n\nconst getValue = (palette: Palette, value: string | number) => {\n if (typeof value === 'string') return value\n const max = palette.length - 1\n const isPositive = value === 0 ? !isMinusZero(value) : value >= 0\n const next = isPositive ? value : max + value\n const index = Math.min(Math.max(0, next), max)\n return palette[index]\n}\n\ntype SubThemeKeys<ParentKeys, ChildKeys> = `${ParentKeys extends string\n ? ParentKeys\n : never}_${ChildKeys extends string ? ChildKeys : never}`\n\ntype ChildGetter<Name extends string | number | symbol, Theme extends GenericTheme> = (\n name: Name,\n theme: Theme\n) => { [key: string]: Theme }\n\nexport function addChildren<\n Themes extends { [key: string]: GenericTheme },\n GetChildren extends ChildGetter<keyof Themes, Themes[keyof Themes]>\n>(\n themes: Themes,\n getChildren: GetChildren\n): Themes & {\n [key in SubThemeKeys<keyof Themes, keyof ReturnType<GetChildren>>]: Themes[keyof Themes]\n} {\n const out = { ...themes }\n for (const key in themes) {\n const subThemes = getChildren(key, themes[key])\n for (const sKey in subThemes) {\n out[`${key}_${sKey}`] = subThemes[sKey] as any\n }\n }\n return out as any\n}\n\nexport const createShiftMask = ({ inverse }: { inverse?: boolean } = {}) => {\n return ((template, { skip, max: maxIn, palette, min = 0, strength = 1 }) => {\n const values = Object.entries(template)\n const max = maxIn ?? (palette ? Object.values(palette).length - 1 : Infinity)\n const out = {}\n for (const [key, value] of values) {\n if (typeof value === 'string') continue\n if (skip && key in skip) {\n continue\n }\n const isPositive = value === 0 ? !isMinusZero(value) : value >= 0\n const direction = isPositive ? 1 : -1\n const invert = inverse ? -1 : 1\n const next = value + strength * direction * invert\n const clamped = isPositive\n ? Math.max(min, Math.min(max, next))\n : Math.min(-min, Math.max(-max, next))\n\n out[key] = clamped\n }\n return out as typeof template\n }) as CreateMask\n}\n\nexport const createWeakenMask = () => createShiftMask()\nexport const createStrengthenMask = () => createShiftMask({ inverse: true })\n\nfunction isMinusZero(value) {\n return 1 / value === -Infinity\n}\n\nconst MaskKeyCache = new WeakMap<any, string>()\n\nexport function applyMask<Theme extends GenericTheme>(\n theme: Theme,\n mask: CreateMask,\n options: MaskOptions = {}\n): Theme {\n const info = THEME_INFO.get(theme)\n if (!info) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No info found for theme, you must pass the theme created by createThemeFromPalette directly to extendTheme`\n : `\u274C Err2`\n )\n }\n\n const maskKey = MaskKeyCache.get(mask) ?? `${Math.random()}`\n MaskKeyCache.set(mask, maskKey)\n\n const key = `${maskKey}${JSON.stringify(options)}`\n\n if (info.cache.has(key)) {\n return info.cache.get(key)\n }\n\n const template = mask(info.definition, {\n palette: info.palette,\n ...options,\n })\n const next = createTheme(info.palette, template) as Theme\n\n info.cache.set(key, next)\n\n return next\n}\n\n// --- tests ---\n\nif (process.env.NODE_ENV === 'development') {\n const palette = ['0', '1', '2', '3', '-3', '-2', '-1', '-0']\n const template = { bg: 1, fg: -1 }\n\n const stongerMask = createStrengthenMask()\n const weakerMask = createWeakenMask()\n\n const theme = createTheme(palette, template)\n if (theme.bg !== '1') throw `\u274C`\n if (theme.fg !== '-1') throw `\u274C`\n\n const str = applyMask(theme, stongerMask)\n if (str.bg !== '0') throw `\u274C`\n if (str.fg !== '-0') throw `\u274C`\n\n const weak = applyMask(theme, weakerMask)\n if (weak.bg !== '2') throw `\u274C`\n if (weak.fg !== '-2') throw `\u274C`\n\n const weak2 = applyMask(theme, weakerMask, { strength: 2 })\n if (weak2.bg !== '3') throw `\u274C`\n if (weak2.fg !== '-3') throw `\u274C`\n}\n"],
5
- "mappings": "AAgBA,MAAMA,EAAa,IAAI,QAKhB,SAASC,EAIdC,EACAC,EACAC,EAKA,CACA,MAAMC,EAAQ,CACZ,GAAI,OAAO,YACT,OAAO,QAAQF,CAAU,EAAE,IAAI,CAAC,CAACG,EAAKC,CAAM,IACnC,CAACD,EAAKE,EAASN,EAASK,CAAM,CAAC,CACvC,CACH,EACA,GAAGH,GAAA,YAAAA,EAAS,kBACd,EACA,OAAAJ,EAAW,IAAIK,EAAO,CAAE,QAAAH,EAAS,WAAAC,EAAY,MAAO,IAAI,GAAM,CAAC,EACxDE,CACT,CAEA,MAAMG,EAAW,CAACN,EAAkBO,IAA2B,CAC7D,GAAI,OAAOA,GAAU,SAAU,OAAOA,EACtC,MAAMC,EAAMR,EAAQ,OAAS,EAEvBS,GADaF,IAAU,EAAI,CAACG,EAAYH,CAAK,EAAIA,GAAS,GACtCA,EAAQC,EAAMD,EAClCI,EAAQ,KAAK,IAAI,KAAK,IA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["THEME_INFO", "createTheme", "palette", "definition", "options", "theme", "key", "offset", "getValue", "value", "max", "next", "isMinusZero", "index", "addChildren", "themes", "getChildren", "out", "subThemes", "sKey", "createShiftMask", "inverse", "template", "skip", "maxIn", "min", "strength", "values", "isPositive", "direction", "invert", "clamped", "createWeakenMask", "createStrengthenMask", "MaskKeyCache", "applyMask", "mask", "info", "maskKey", "stongerMask", "weakerMask", "str", "weak", "weak2"]
5
+ "mappings": "AAgBA,MAAM,aAAa,oBAAI,QAGrB;AAEK,SAAS,YAId,SACA,YACA,SAKA;AACA,QAAM,QAAQ;AAAA,IACZ,GAAI,OAAO;AAAA,MACT,OAAO,QAAQ,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,MAAM,MAAM;AAChD,eAAO,CAAC,KAAK,SAAS,SAAS,MAAM,CAAC;AAAA,MACxC,CAAC;AAAA,IACH;AAAA,IACA,GAAG,mCAAS;AAAA,EACd;AACA,aAAW,IAAI,OAAO,EAAE,SAAS,YAAY,OAAO,oBAAI,IAAI,EAAE,CAAC;AAC/D,SAAO;AACT;AAEA,MAAM,WAAW,CAAC,SAAkB,UAA2B;AAC7D,MAAI,OAAO,UAAU;AAAU,WAAO;AACtC,QAAM,MAAM,QAAQ,SAAS;AAC7B,QAAM,aAAa,UAAU,IAAI,CAAC,YAAY,KAAK,IAAI,SAAS;AAChE,QAAM,OAAO,aAAa,QAAQ,MAAM;AACxC,QAAM,QAAQ,KAAK,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,GAAG;AAC7C,SAAO,QAAQ,KAAK;AACtB;AAWO,SAAS,YAId,QACA,aAGA;AACA,QAAM,MAAM,EAAE,GAAG,OAAO;AACxB,aAAW,OAAO,QAAQ;AACxB,UAAM,YAAY,YAAY,KAAK,OAAO,GAAG,CAAC;AAC9C,eAAW,QAAQ,WAAW;AAC5B,UAAI,GAAG,OAAO,MAAM,IAAI,UAAU,IAAI;AAAA,IACxC;AAAA,EACF;AACA,SAAO;AACT;AAEO,MAAM,k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AU,KAAK,UAAU,OAAO;AAE/C,MAAI,KAAK,MAAM,IAAI,GAAG,GAAG;AACvB,WAAO,KAAK,MAAM,IAAI,GAAG;AAAA,EAC3B;AAEA,QAAM,WAAW,KAAK,KAAK,YAAY;AAAA,IACrC,SAAS,KAAK;AAAA,IACd,GAAG;AAAA,EACL,CAAC;AACD,QAAM,OAAO,YAAY,KAAK,SAAS,QAAQ;AAE/C,OAAK,MAAM,IAAI,KAAK,IAAI;AAExB,SAAO;AACT;AAIA,IAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAM,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,MAAM,MAAM,MAAM,IAAI;AAC3D,QAAM,WAAW,EAAE,IAAI,GAAG,IAAI,GAAG;AAEjC,QAAM,cAAc,qBAAqB;AACzC,QAAM,aAAa,iBAAiB;AAEpC,QAAM,QAAQ,YAAY,SAAS,QAAQ;AAC3C,MAAI,MAAM,OAAO;AAAK,UAAM;AAC5B,MAAI,MAAM,OAAO;AAAM,UAAM;AAE7B,QAAM,MAAM,UAAU,OAAO,WAAW;AACxC,MAAI,IAAI,OAAO;AAAK,UAAM;AAC1B,MAAI,IAAI,OAAO;AAAM,UAAM;AAE3B,QAAM,OAAO,UAAU,OAAO,UAAU;AACxC,MAAI,KAAK,OAAO;AAAK,UAAM;AAC3B,MAAI,KAAK,OAAO;AAAM,UAAM;AAE5B,QAAM,QAAQ,UAAU,OAAO,YAAY,EAAE,UAAU,EAAE,CAAC;AAC1D,MAAI,MAAM,OAAO;AAAK,UAAM;AAC5B,MAAI,MAAM,OAAO;AAAM,UAAM;AAC/B;",
6
+ "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/create-theme",
3
- "version": "1.14.1",
3
+ "version": "1.14.3",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -27,10 +27,10 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@tamagui/web": "1.14.1"
30
+ "@tamagui/web": "1.14.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@tamagui/build": "1.14.1"
33
+ "@tamagui/build": "1.14.3"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"