@tamagui/theme 1.15.14 → 1.15.15

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.
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/addTheme.ts"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport {\n ensureThemeVariable,\n getConfig,\n getThemeCSSRules,\n proxyThemeToParents,\n updateConfig,\n} from '@tamagui/web'\nimport type { ThemeDefinition, ThemeParsed } from '@tamagui/web'\n\nexport function addTheme(props: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error('No config')\n }\n const theme = config.themes[props.name]\n if (!props.update && theme) {\n return { theme }\n }\n }\n\n const { name: themeName, theme: themeIn, insertCSS } = props\n const theme = { ...themeIn } as ThemeParsed\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n // @ts-ignore this works but should be fixed types\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `t_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AACtB,iBAMO;AAGA,SAAS,SAAS,OAKtB;AAfH;AAgBE,QAAM,aAAS,sBAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM,IAAI;AACtC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wCAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,mBAAe,gCAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,SAAS,IAAI;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,wBAAO;AACT,QAAI,WAAW;AACb,qBAAW,6BAAiB;AAAA;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,+BAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
6
5
  "names": ["theme"]
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './addTheme'\nexport * from './updateTheme'\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,uBAAd;AACA,wBAAc,0BADd;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/updateTheme.ts"],
4
- "sourcesContent": ["import { activeThemeManagers } from '@tamagui/web'\nimport type { ThemeDefinition } from '@tamagui/web'\n\nimport { addTheme } from './addTheme.js'\n\nexport function updateTheme({\n name,\n theme,\n}: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n}) {\n const next = addTheme({ name, theme, insertCSS: true, update: true })\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n activeThemeManagers.forEach((manager) => {\n if (manager.state.name === name) {\n manager.updateState({\n name,\n forceTheme: next.theme,\n })\n }\n })\n }\n\n return next\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AAGpC,sBAAyB;AAElB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,QAAM,WAAO,0BAAS,EAAE,MAAM,OAAO,WAAW,MAAM,QAAQ,KAAK,CAAC;AAEpE,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,mCAAoB,QAAQ,CAAC,YAAY;AACvC,UAAI,QAAQ,MAAM,SAAS,MAAM;AAC/B,gBAAQ,YAAY;AAAA,UAClB;AAAA,UACA,YAAY,KAAK;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/addTheme.ts"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport {\n ensureThemeVariable,\n getConfig,\n getThemeCSSRules,\n proxyThemeToParents,\n updateConfig,\n} from '@tamagui/web'\nimport type { ThemeDefinition, ThemeParsed } from '@tamagui/web'\n\nexport function addTheme(props: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error('No config')\n }\n const theme = config.themes[props.name]\n if (!props.update && theme) {\n return { theme }\n }\n }\n\n const { name: themeName, theme: themeIn, insertCSS } = props\n const theme = { ...themeIn } as ThemeParsed\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n // @ts-ignore this works but should be fixed types\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `t_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
5
4
  "mappings": "AAAA,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,SAAS,SAAS,OAKtB;AAfH;AAgBE,QAAM,SAAS,UAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM,IAAI;AACtC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wBAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,eAAe,oBAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,SAAS,IAAI;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,OAAO;AACT,QAAI,WAAW;AACb,iBAAW,iBAAiB;AAAA;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,eAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
6
5
  "names": ["theme"]
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/addTheme.ts"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport {\n ensureThemeVariable,\n getConfig,\n getThemeCSSRules,\n proxyThemeToParents,\n updateConfig,\n} from '@tamagui/web'\nimport type { ThemeDefinition, ThemeParsed } from '@tamagui/web'\n\nexport function addTheme(props: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error('No config')\n }\n const theme = config.themes[props.name]\n if (!props.update && theme) {\n return { theme }\n }\n }\n\n const { name: themeName, theme: themeIn, insertCSS } = props\n const theme = { ...themeIn } as ThemeParsed\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n // @ts-ignore this works but should be fixed types\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `t_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
5
4
  "mappings": "AAAA,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,SAAS,SAAS,OAKtB;AAfH;AAgBE,QAAM,SAAS,UAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM,IAAI;AACtC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wBAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,eAAe,oBAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,SAAS,IAAI;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,OAAO;AACT,QAAI,WAAW;AACb,iBAAW,iBAAiB;AAAA;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,eAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
6
5
  "names": ["theme"]
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './addTheme'\nexport * from './updateTheme'\n"],
5
4
  "mappings": "AAAA,cAAc;AACd,cAAc;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './addTheme'\nexport * from './updateTheme'\n"],
5
4
  "mappings": "AAAA,cAAc;AACd,cAAc;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/updateTheme.ts"],
4
- "sourcesContent": ["import { activeThemeManagers } from '@tamagui/web'\nimport type { ThemeDefinition } from '@tamagui/web'\n\nimport { addTheme } from './addTheme.js'\n\nexport function updateTheme({\n name,\n theme,\n}: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n}) {\n const next = addTheme({ name, theme, insertCSS: true, update: true })\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n activeThemeManagers.forEach((manager) => {\n if (manager.state.name === name) {\n manager.updateState({\n name,\n forceTheme: next.theme,\n })\n }\n })\n }\n\n return next\n}\n"],
5
4
  "mappings": "AAAA,SAAS,2BAA2B;AAGpC,SAAS,gBAAgB;AAElB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,QAAM,OAAO,SAAS,EAAE,MAAM,OAAO,WAAW,MAAM,QAAQ,KAAK,CAAC;AAEpE,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,wBAAoB,QAAQ,CAAC,YAAY;AACvC,UAAI,QAAQ,MAAM,SAAS,MAAM;AAC/B,gBAAQ,YAAY;AAAA,UAClB;AAAA,UACA,YAAY,KAAK;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/updateTheme.ts"],
4
- "sourcesContent": ["import { activeThemeManagers } from '@tamagui/web'\nimport type { ThemeDefinition } from '@tamagui/web'\n\nimport { addTheme } from './addTheme.js'\n\nexport function updateTheme({\n name,\n theme,\n}: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n}) {\n const next = addTheme({ name, theme, insertCSS: true, update: true })\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n activeThemeManagers.forEach((manager) => {\n if (manager.state.name === name) {\n manager.updateState({\n name,\n forceTheme: next.theme,\n })\n }\n })\n }\n\n return next\n}\n"],
5
4
  "mappings": "AAAA,SAAS,2BAA2B;AAGpC,SAAS,gBAAgB;AAElB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,QAAM,OAAO,SAAS,EAAE,MAAM,OAAO,WAAW,MAAM,QAAQ,KAAK,CAAC;AAEpE,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,wBAAoB,QAAQ,CAAC,YAAY;AACvC,UAAI,QAAQ,MAAM,SAAS,MAAM;AAC/B,gBAAQ,YAAY;AAAA,UAClB;AAAA,UACA,YAAY,KAAK;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/addTheme.ts"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport {\n ensureThemeVariable,\n getConfig,\n getThemeCSSRules,\n proxyThemeToParents,\n updateConfig,\n} from '@tamagui/web'\nimport type { ThemeDefinition, ThemeParsed } from '@tamagui/web'\n\nexport function addTheme(props: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error('No config')\n }\n const theme = config.themes[props.name]\n if (!props.update && theme) {\n return { theme }\n }\n }\n\n const { name: themeName, theme: themeIn, insertCSS } = props\n const theme = { ...themeIn } as ThemeParsed\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n // @ts-ignore this works but should be fixed types\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `t_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
5
4
  "mappings": "AAAA,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,SAAS,SAAS,OAKtB;AACD,QAAM,SAAS,UAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM,IAAI;AACtC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wBAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,eAAe,oBAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,SAAS,IAAI;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,OAAO;AACT,QAAI,WAAW;AACb,iBAAW,iBAAiB;AAAA;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,iBAAS,eAAe,YAAY,QAAQ;AAAA,MAC9C;AAAA,IACF;AAAA,EACF;AAEA,eAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
6
5
  "names": ["theme"]
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/addTheme.ts"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport {\n ensureThemeVariable,\n getConfig,\n getThemeCSSRules,\n proxyThemeToParents,\n updateConfig,\n} from '@tamagui/web'\nimport type { ThemeDefinition, ThemeParsed } from '@tamagui/web'\n\nexport function addTheme(props: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error('No config')\n }\n const theme = config.themes[props.name]\n if (!props.update && theme) {\n return { theme }\n }\n }\n\n const { name: themeName, theme: themeIn, insertCSS } = props\n const theme = { ...themeIn } as ThemeParsed\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n // @ts-ignore this works but should be fixed types\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `t_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
5
4
  "mappings": "AAAA,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,SAAS,SAAS,OAKtB;AACD,QAAM,SAAS,UAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM,IAAI;AACtC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wBAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,eAAe,oBAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,SAAS,IAAI;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,OAAO;AACT,QAAI,WAAW;AACb,iBAAW,iBAAiB;AAAA;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,iBAAS,eAAe,YAAY,QAAQ;AAAA,MAC9C;AAAA,IACF;AAAA,EACF;AAEA,eAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
6
5
  "names": ["theme"]
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './addTheme'\nexport * from './updateTheme'\n"],
5
4
  "mappings": "AAAA,cAAc;AACd,cAAc;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './addTheme'\nexport * from './updateTheme'\n"],
5
4
  "mappings": "AAAA,cAAc;AACd,cAAc;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/updateTheme.ts"],
4
- "sourcesContent": ["import { activeThemeManagers } from '@tamagui/web'\nimport type { ThemeDefinition } from '@tamagui/web'\n\nimport { addTheme } from './addTheme.js'\n\nexport function updateTheme({\n name,\n theme,\n}: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n}) {\n const next = addTheme({ name, theme, insertCSS: true, update: true })\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n activeThemeManagers.forEach((manager) => {\n if (manager.state.name === name) {\n manager.updateState({\n name,\n forceTheme: next.theme,\n })\n }\n })\n }\n\n return next\n}\n"],
5
4
  "mappings": "AAAA,SAAS,2BAA2B;AAGpC,SAAS,gBAAgB;AAElB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,QAAM,OAAO,SAAS,EAAE,MAAM,OAAO,WAAW,MAAM,QAAQ,KAAK,CAAC;AAEpE,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,wBAAoB,QAAQ,CAAC,YAAY;AACvC,UAAI,QAAQ,MAAM,SAAS,MAAM;AAC/B,gBAAQ,YAAY;AAAA,UAClB;AAAA,UACA,YAAY,KAAK;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/updateTheme.ts"],
4
- "sourcesContent": ["import { activeThemeManagers } from '@tamagui/web'\nimport type { ThemeDefinition } from '@tamagui/web'\n\nimport { addTheme } from './addTheme.js'\n\nexport function updateTheme({\n name,\n theme,\n}: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n}) {\n const next = addTheme({ name, theme, insertCSS: true, update: true })\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n activeThemeManagers.forEach((manager) => {\n if (manager.state.name === name) {\n manager.updateState({\n name,\n forceTheme: next.theme,\n })\n }\n })\n }\n\n return next\n}\n"],
5
4
  "mappings": "AAAA,SAAS,2BAA2B;AAGpC,SAAS,gBAAgB;AAElB,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,QAAM,OAAO,SAAS,EAAE,MAAM,OAAO,WAAW,MAAM,QAAQ,KAAK,CAAC;AAEpE,MAAI,QAAQ,IAAI,mBAAmB,UAAU;AAC3C,wBAAoB,QAAQ,CAAC,YAAY;AACvC,UAAI,QAAQ,MAAM,SAAS,MAAM;AAC/B,gBAAQ,YAAY;AAAA,UAClB;AAAA,UACA,YAAY,KAAK;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;",
6
5
  "names": []
7
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/theme",
3
- "version": "1.15.14",
3
+ "version": "1.15.15",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
6
  "types": "./types/index.d.ts",
@@ -17,14 +17,14 @@
17
17
  "watch": "tamagui-build --watch"
18
18
  },
19
19
  "dependencies": {
20
- "@tamagui/constants": "1.15.14",
21
- "@tamagui/web": "1.15.14"
20
+ "@tamagui/constants": "1.15.15",
21
+ "@tamagui/web": "1.15.15"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "*"
25
25
  },
26
26
  "devDependencies": {
27
- "@tamagui/build": "1.15.14",
27
+ "@tamagui/build": "1.15.15",
28
28
  "react": "^18.2.0"
29
29
  },
30
30
  "publishConfig": {