@tamagui/core 1.0.0-alpha.32 → 1.0.0-alpha.36

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.
Files changed (43) hide show
  1. package/dist/esm/constants/platform.js +2 -1
  2. package/dist/esm/constants/platform.js.map +1 -1
  3. package/dist/esm/createComponent.js +23 -19
  4. package/dist/esm/createComponent.js.map +1 -1
  5. package/dist/esm/createTamagui.js +2 -1
  6. package/dist/esm/createTamagui.js.map +1 -1
  7. package/dist/esm/helpers/createPropMapper.js +10 -8
  8. package/dist/esm/helpers/createPropMapper.js.map +1 -1
  9. package/dist/esm/helpers/extendStaticConfig.js +3 -2
  10. package/dist/esm/helpers/extendStaticConfig.js.map +1 -1
  11. package/dist/esm/helpers/getStylesAtomic.js +2 -1
  12. package/dist/esm/helpers/getStylesAtomic.js.map +1 -1
  13. package/dist/esm/helpers/isTamaguiElement.js +2 -1
  14. package/dist/esm/helpers/isTamaguiElement.js.map +1 -1
  15. package/dist/esm/helpers/themeable.js +1 -1
  16. package/dist/esm/helpers/themeable.js.map +1 -1
  17. package/dist/esm/hooks/useMedia.js +5 -3
  18. package/dist/esm/hooks/useMedia.js.map +1 -1
  19. package/dist/esm/hooks/usePressable.js +2 -1
  20. package/dist/esm/hooks/usePressable.js.map +1 -1
  21. package/dist/esm/hooks/useTheme.js +3 -2
  22. package/dist/esm/hooks/useTheme.js.map +1 -1
  23. package/dist/esm/views/TextAncestorContext.js +2 -1
  24. package/dist/esm/views/TextAncestorContext.js.map +1 -1
  25. package/dist/esm/views/Theme.js +2 -1
  26. package/dist/esm/views/Theme.js.map +1 -1
  27. package/dist/esm/views/ThemeManagerContext.js +2 -1
  28. package/dist/esm/views/ThemeManagerContext.js.map +1 -1
  29. package/dist/jsx/constants/platform.js +2 -1
  30. package/dist/jsx/createComponent.js +23 -19
  31. package/dist/jsx/createTamagui.js +2 -1
  32. package/dist/jsx/helpers/createPropMapper.js +10 -8
  33. package/dist/jsx/helpers/extendStaticConfig.js +3 -2
  34. package/dist/jsx/helpers/getStylesAtomic.js +2 -1
  35. package/dist/jsx/helpers/isTamaguiElement.js +2 -1
  36. package/dist/jsx/helpers/themeable.js +1 -1
  37. package/dist/jsx/hooks/useMedia.js +5 -3
  38. package/dist/jsx/hooks/usePressable.js +2 -1
  39. package/dist/jsx/hooks/useTheme.js +3 -2
  40. package/dist/jsx/views/TextAncestorContext.js +2 -1
  41. package/dist/jsx/views/Theme.js +2 -1
  42. package/dist/jsx/views/ThemeManagerContext.js +2 -1
  43. package/package.json +6 -6
@@ -22,7 +22,7 @@ const useThemeName = /* @__PURE__ */ __name((opts) => {
22
22
  const [name, setName] = useState(parent.name);
23
23
  useIsomorphicLayoutEffect(() => {
24
24
  return parent.onChangeTheme((next, manager) => {
25
- setName(opts?.parent ? manager.parentName : next);
25
+ setName((opts == null ? void 0 : opts.parent) ? manager.parentName : next);
26
26
  });
27
27
  }, [parent]);
28
28
  return name || "light";
@@ -31,6 +31,7 @@ const useDefaultThemeName = /* @__PURE__ */ __name(() => {
31
31
  return useContext(ThemeContext)[GET_DEFAULT_THEME];
32
32
  }, "useDefaultThemeName");
33
33
  const useTheme = /* @__PURE__ */ __name(() => {
34
+ var _a;
34
35
  const forceUpdate = useForceUpdate();
35
36
  const manager = useContext(ThemeManagerContext);
36
37
  const themes = useContext(ThemeContext);
@@ -54,7 +55,7 @@ const useTheme = /* @__PURE__ */ __name(() => {
54
55
  useEffect(() => {
55
56
  return manager.onUpdate(state.current.uuid, forceUpdate);
56
57
  }, []);
57
- const theme = (manager.name ? themes[manager.name] : themes.light) ?? themes.light;
58
+ const theme = (_a = manager.name ? themes[manager.name] : themes.light) != null ? _a : themes.light;
58
59
  return useMemo(() => {
59
60
  return new Proxy(theme, {
60
61
  get(_, key) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useTheme.tsx"],
4
4
  "sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { Variable } from '../createVariable'\nimport { ThemeName, ThemeObject } from '../types'\nimport { ThemeContext } from '../views/ThemeContext'\nimport { ThemeManagerContext } from '../views/ThemeManagerContext'\nimport { GET_DEFAULT_THEME } from '../views/ThemeProvider'\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nconst areEqualSets = (a: Set<string>, b: Set<string>) => {\n if (a.size !== b.size) return false\n for (const val in a) {\n if (!b.has(val)) {\n return false\n }\n }\n return true\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent.name)\n\n useIsomorphicLayoutEffect(() => {\n return parent.onChangeTheme((next, manager) => {\n setName(opts?.parent ? manager.parentName : next)\n })\n }, [parent])\n\n return name || 'light'\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)[GET_DEFAULT_THEME] as any as ThemeName\n}\n\nexport const useTheme = (): ThemeObject => {\n const forceUpdate = useForceUpdate()\n const manager = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = manager.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n manager.track(st.uuid, st.keys)\n }\n })\n\n useEffect(() => {\n return manager.onUpdate(state.current.uuid, forceUpdate)\n }, [])\n\n const theme = (manager.name ? themes[manager.name] : themes.light) ?? themes.light\n\n return useMemo(\n () => {\n return new Proxy(theme, {\n get(_, key: string) {\n const name = manager.name\n if (!name) {\n return Reflect.get(_, key)\n }\n let activeTheme = themes[name]\n if (!activeTheme) {\n console.error('No theme by name', name, 'only:', themes, 'keeping current theme')\n activeTheme = theme\n }\n const val = activeTheme[key]\n if (process.env.NODE_ENV === 'development') {\n if (typeof val === 'undefined') {\n console.warn(`No theme value \"${String(key)}\" in`, activeTheme, themes)\n return null\n }\n if (!(val instanceof Variable)) {\n console.warn('Non variable!', val)\n }\n if (val.name !== key) {\n console.warn('Non-matching name for variable to key', key, val.name)\n }\n }\n if (state.current.isRendering) {\n state.current.keys.add(key)\n }\n return val\n },\n })\n },\n [\n /* if concurrent mode wanted put manager.name here */\n ]\n )\n}\n"],
5
- "mappings": ";;AAAA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAQA,MAAM,eAAe,wBAAC,GAAgB,MAAmB;AACvD,MAAI,EAAE,SAAS,EAAE;AAAM,WAAO;AAC9B,aAAW,OAAO,GAAG;AACnB,QAAI,CAAC,EAAE,IAAI,MAAM;AACf,aAAO;AAAA;AAAA;AAGX,SAAO;AAAA,GAPY;AAUd,MAAM,eAAe,wBAAC,SAA6B;AACxD,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,MAAM,WAAW,SAAS,OAAO;AAExC,4BAA0B,MAAM;AAC9B,WAAO,OAAO,cAAc,CAAC,MAAM,YAAY;AAC7C,cAAQ,MAAM,SAAS,QAAQ,aAAa;AAAA;AAAA,KAE7C,CAAC;AAEJ,SAAO,QAAQ;AAAA,GAVW;AAarB,MAAM,sBAAsB,6BAAM;AACvC,SAAO,WAAW,cAAc;AAAA,GADC;AAI5B,MAAM,WAAW,6BAAmB;AACzC,QAAM,cAAc;AACpB,QAAM,UAAU,WAAW;AAC3B,QAAM,SAAS,WAAW;AAC1B,QAAM,QAAQ;AACd,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,UAAU;AAAA,MACd,MAAM;AAAA,MACN,MAAM,IAAI;AAAA,MACV,aAAa;AAAA;AAAA;AAGjB,QAAM,QAAQ,cAAc;AAG5B,4BAA0B,MAAM;AAC9B,UAAM,KAAK,MAAM;AACjB,OAAG,cAAc;AACjB,UAAM,MAAM,QA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AACzD,wBAAc;AAAA;AAEhB,cAAM,MAAM,YAAY;AACxB,YAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAI,OAAO,QAAQ,aAAa;AAC9B,oBAAQ,KAAK,mBAAmB,OAAO,YAAY,aAAa;AAChE,mBAAO;AAAA;AAET,cAAI,CAAE,gBAAe,WAAW;AAC9B,oBAAQ,KAAK,iBAAiB;AAAA;AAEhC,cAAI,IAAI,SAAS,KAAK;AACpB,oBAAQ,KAAK,yCAAyC,KAAK,IAAI;AAAA;AAAA;AAGnE,YAAI,MAAM,QAAQ,aAAa;AAC7B,gBAAM,QAAQ,KAAK,IAAI;AAAA;AAEzB,eAAO;AAAA;AAAA;AAAA,KAIb;AAAA,GA/DoB;",
6
6
  "names": []
7
7
  }
@@ -1,9 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var _a, _b;
3
4
  import React, { createContext } from "react";
4
5
  import { rnw } from "../constants/rnw";
5
6
  const FallbackNativeContext = createContext(false);
6
- const TextAncestorContext = rnw?.TextAncestorContext ?? FallbackNativeContext;
7
+ const TextAncestorContext = (_b = (_a = rnw) == null ? void 0 : _a.TextAncestorContext) != null ? _b : FallbackNativeContext;
7
8
  const TextAncestorProvider = /* @__PURE__ */ __name((props) => {
8
9
  return /* @__PURE__ */ React.createElement(TextAncestorContext.Provider, {
9
10
  value: false
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/TextAncestorContext.tsx"],
4
4
  "sourcesContent": ["import React, { createContext } from 'react'\n\nimport { rnw } from '../constants/rnw'\n\nexport const FallbackNativeContext = createContext(false)\n\nexport const TextAncestorContext = rnw?.TextAncestorContext ?? FallbackNativeContext\n\nexport const TextAncestorProvider = (props) => {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AAEO,MAAM,wBAAwB,cAAc;AAE5C,MAAM,sBAAsB,KAAK,uBAAuB;AAExD,MAAM,uBAAuB,wBAAC,UAAU;AAC7C,SAAO,oCAAC,oBAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KAAQ,MAAM;AAAA,GADxB;",
5
+ "mappings": ";;AAAA;AAAA;AAEA;AAEO,MAAM,wBAAwB,cAAc;AAE5C,MAAM,sBAAsB,uCAAK,wBAAL,YAA4B;AAExD,MAAM,uBAAuB,wBAAC,UAAU;AAC7C,SAAO,oCAAC,oBAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KAAQ,MAAM;AAAA,GADxB;",
6
6
  "names": []
7
7
  }
@@ -7,6 +7,7 @@ import { useConstant } from "../hooks/useConstant";
7
7
  import { ThemeContext } from "./ThemeContext";
8
8
  import { ThemeManager, ThemeManagerContext } from "./ThemeManagerContext";
9
9
  const Theme = /* @__PURE__ */ __name((props) => {
10
+ var _a, _b;
10
11
  const parent = useContext(ThemeManagerContext);
11
12
  const themes = useContext(ThemeContext);
12
13
  const [parentName, setParentName] = useState(parent.name || "light");
@@ -53,7 +54,7 @@ const Theme = /* @__PURE__ */ __name((props) => {
53
54
  return contents;
54
55
  }
55
56
  if (name) {
56
- const color = themes[name]?.["color"]?.["variable"];
57
+ const color = (_b = (_a = themes[name]) == null ? void 0 : _a["color"]) == null ? void 0 : _b["variable"];
57
58
  return /* @__PURE__ */ React.createElement("div", {
58
59
  className: getThemeParentClassName(props.name),
59
60
  style: { display: "contents", color }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
4
  "sourcesContent": ["import React, { useContext, useState } from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getThemeParentClassName } from '../createTamagui'\nimport { useConstant } from '../hooks/useConstant'\nimport { ThemeName } from '../types'\nimport { ThemeContext } from './ThemeContext'\nimport { ThemeManager, ThemeManagerContext } from './ThemeManagerContext'\n\nexport type ThemeProps = {\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n children?: any\n}\n\nexport const Theme = (props: ThemeProps) => {\n const parent = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const [parentName, setParentName] = useState(parent.name || 'light')\n if (!themes) {\n console.warn('Error, no themes in context', props)\n return props.children\n }\n\n const nextNameParent = `${props.name}-${parentName}`\n const nextNameParentParent = `${props.name}-${parent.parentName}`\n const name = !props.name\n ? null\n : props.name in themes\n ? props.name\n : nextNameParent in themes\n ? nextNameParent\n : nextNameParentParent in themes\n ? nextNameParentParent\n : null\n const theme = name ? themes[name] : null\n const themeManager = useConstant<ThemeManager | null>(() => {\n if (!theme) {\n return null\n }\n const manager = new ThemeManager()\n if (name) {\n manager.setActiveTheme({ name, theme: themes[name], parentName })\n }\n return manager\n })\n\n useIsomorphicLayoutEffect(() => {\n if (!themeManager) {\n return\n }\n if (name) {\n themeManager.setActiveTheme({ name, theme, parentName })\n }\n return parent.onChangeTheme((next) => {\n if (next) {\n themeManager.setActiveTheme({ name: next, theme: themes[next], parentName })\n setParentName(next)\n }\n })\n }, [themes, name, parentName])\n\n if (!name || !theme) {\n return props.children\n }\n\n const contents = themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>\n {props.children}\n </ThemeManagerContext.Provider>\n ) : (\n props.children\n )\n\n if (isWeb) {\n if (props.disableThemeClass) {\n return contents\n }\n if (name) {\n const color = themes[name]?.['color']?.['variable']\n return (\n <div\n className={getThemeParentClassName(props.name)}\n // in order to provide currentColor, set color by default\n style={{ display: 'contents', color }}\n >\n {contents}\n </div>\n )\n }\n }\n\n return contents\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AAEA;AACA;AAQO,MAAM,QAAQ,wBAAC,UAAsB;AAC1C,QAAM,SAAS,WAAW;AAC1B,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,YAAY,iBAAiB,SAAS,OAAO,QAAQ;AAC5D,MAAI,CAAC,QAAQ;AACX,YAAQ,KAAK,+BAA+B;AAC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AAM;AAAA,QAEzC,OAAO,EAAE,SAAS,YAAY;AAAA,SAE7B;AAAA;AAAA;AAMT,SAAO;AAAA,GA7EY;",
6
6
  "names": []
7
7
  }
@@ -28,12 +28,13 @@ class ThemeManager {
28
28
  this.keys.set(uuid, keys);
29
29
  }
30
30
  update() {
31
+ var _a;
31
32
  if (!this.name) {
32
33
  this.keys.clear();
33
34
  }
34
35
  for (const [uuid, keys] of this.keys.entries()) {
35
36
  if (keys.size) {
36
- this.listeners.get(uuid)?.();
37
+ (_a = this.listeners.get(uuid)) == null ? void 0 : _a();
37
38
  }
38
39
  }
39
40
  this.themeListeners.forEach((cb) => cb(this.name, this));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeManagerContext.tsx"],
4
4
  "sourcesContent": ["import { createContext } from 'react'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport class ThemeManager {\n name: string | null = 'light'\n parentName: string | null = null\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n theme = null\n\n setActiveTheme({\n name,\n theme,\n parentName,\n }: {\n parentName?: string | null\n name: string | null\n theme?: any\n }) {\n if (name === this.name) return\n this.name = name\n this.theme = theme\n this.parentName = parentName || null\n this.update()\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n update() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager>(new ThemeManager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AK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,aAAa,cAAc;AAChC,SAAK;AAAA;AAAA,EAGP,MAAM,MAAW,MAAmB;AAClC,QAAI,CAAC,KAAK;AAAM;AAChB,SAAK,KAAK,IAAI,MAAM;AAAA;AAAA,EAGtB,SAAS;AAjCX;AAkCI,QAAI,CAAC,KAAK,MAAM;AACd,WAAK,KAAK;AAAA;AAEZ,eAAW,CAAC,MAAM,SAAS,KAAK,KAAK,WAAW;AAC9C,UAAI,KAAK,MAAM;AACb,mBAAK,UAAU,IAAI,UAAnB;AAAA;AAAA;AAGJ,SAAK,eAAe,QAAQ,CAAC,OAAO,GAAG,KAAK,MAAM;AAAA;AAAA,EAGpD,cAAc,IAAmB;AAC/B,SAAK,eAAe,IAAI;AACxB,WAAO,MAAM;AACX,WAAK,eAAe,OAAO;AAAA;AAAA;AAAA,EAI/B,SAAS,MAAW,IAAc;AAChC,SAAK,UAAU,IAAI,MAAM;AACzB,WAAO,MAAM;AACX,WAAK,UAAU,OAAO;AACtB,WAAK,KAAK,OAAO;AAAA;AAAA;AAAA;AApDhB;AAyDA,MAAM,sBAAsB,cAA4B,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,7 @@
1
+ var _a;
1
2
  import { useEffect, useLayoutEffect } from "react";
2
3
  import { Platform } from "react-native";
3
- const isWeb = process.env.TAMAGUI_TARGET === "web" ? true : Platform?.OS === "web";
4
+ const isWeb = process.env.TAMAGUI_TARGET === "web" ? true : ((_a = Platform) == null ? void 0 : _a.OS) === "web";
4
5
  const isSSR = isWeb && typeof window === "undefined";
5
6
  const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
6
7
  const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
@@ -58,13 +58,14 @@ function createComponent(configIn) {
58
58
  staticConfig = parseStaticConfig(configIn);
59
59
  }
60
60
  const { Component, validStyles, isText, isZStack } = staticConfig;
61
- const validStyleProps = validStyles ?? stylePropsView;
61
+ const validStyleProps = validStyles != null ? validStyles : stylePropsView;
62
62
  let defaultProps = null;
63
63
  let tamaguiConfig;
64
64
  let defaultsStyle;
65
65
  let defaultsClassName = "";
66
66
  let initialTheme;
67
67
  const component = forwardRef((props, forwardedRef) => {
68
+ var _a;
68
69
  const forceUpdate = useForceUpdate();
69
70
  const features = useFeatures(props, { forceUpdate });
70
71
  const theme = useTheme();
@@ -233,7 +234,7 @@ function createComponent(configIn) {
233
234
  ...!isWeb && {
234
235
  onPressOut: (e) => {
235
236
  unPress();
236
- onPressOut?.(e);
237
+ onPressOut == null ? void 0 : onPressOut(e);
237
238
  }
238
239
  },
239
240
  ...isWeb && !isTouchDevice && {
@@ -248,8 +249,8 @@ function createComponent(configIn) {
248
249
  if (Object.keys(next).length) {
249
250
  set(next);
250
251
  }
251
- onHoverIn?.(e);
252
- onMouseEnter?.(e);
252
+ onHoverIn == null ? void 0 : onHoverIn(e);
253
+ onMouseEnter == null ? void 0 : onMouseEnter(e);
253
254
  } : void 0,
254
255
  onMouseLeave: attachHover || attachPress ? (e) => {
255
256
  let next = {};
@@ -264,8 +265,8 @@ function createComponent(configIn) {
264
265
  if (Object.keys(next).length) {
265
266
  set(next);
266
267
  }
267
- onHoverOut?.(e);
268
- onMouseLeave?.(e);
268
+ onHoverOut == null ? void 0 : onHoverOut(e);
269
+ onMouseLeave == null ? void 0 : onMouseLeave(e);
269
270
  } : void 0
270
271
  },
271
272
  onMouseDown: attachPress ? (e) => {
@@ -273,14 +274,14 @@ function createComponent(configIn) {
273
274
  press: true,
274
275
  pressIn: true
275
276
  });
276
- onPressIn?.(e);
277
- onMouseDown?.(e);
277
+ onPressIn == null ? void 0 : onPressIn(e);
278
+ onMouseDown == null ? void 0 : onMouseDown(e);
278
279
  } : onPressIn,
279
280
  onClick: attachPress ? (e) => {
280
- onPress?.(e);
281
- onClick?.(e);
281
+ onPress == null ? void 0 : onPress(e);
282
+ onClick == null ? void 0 : onClick(e);
282
283
  unPress();
283
- onPressOut?.(e);
284
+ onPressOut == null ? void 0 : onPressOut(e);
284
285
  } : onPressOut
285
286
  } : null;
286
287
  if (events) {
@@ -300,7 +301,7 @@ function createComponent(configIn) {
300
301
  const childEls = spacedChildren({
301
302
  children,
302
303
  space,
303
- flexDirection: props.flexDirection || defaultProps?.flexDirection,
304
+ flexDirection: props.flexDirection || (defaultProps == null ? void 0 : defaultProps.flexDirection),
304
305
  isZStack
305
306
  });
306
307
  let content;
@@ -322,7 +323,7 @@ function createComponent(configIn) {
322
323
  viewProps["debug"] = true;
323
324
  console.log("\u{1F95A} props in:", props);
324
325
  console.log("\u{1F95A} props out:", viewProps);
325
- console.log(props.onClick?.toString());
326
+ console.log((_a = props.onClick) == null ? void 0 : _a.toString());
326
327
  console.log("\u{1F95A} etc:", { shouldAttach, ViewComponent, viewProps, styles, pseudos, content, childEls });
327
328
  if (isWeb) {
328
329
  console.log("\u{1F95A} component info", { staticConfig, tamaguiConfig });
@@ -335,6 +336,7 @@ function createComponent(configIn) {
335
336
  </>;
336
337
  });
337
338
  onConfiguredOnce((conf) => {
339
+ var _a;
338
340
  tamaguiConfig = conf;
339
341
  initialTheme = conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]];
340
342
  const next = getSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, true);
@@ -354,7 +356,7 @@ function createComponent(configIn) {
354
356
  ...component.defaultProps
355
357
  };
356
358
  if (process.env.NODE_ENV === "development") {
357
- if (staticConfig.defaultProps?.debug) {
359
+ if ((_a = staticConfig.defaultProps) == null ? void 0 : _a.debug) {
358
360
  console.log("tamagui debug component:", next, defaultsClassName, component.defaultProps);
359
361
  }
360
362
  }
@@ -370,7 +372,7 @@ function createComponent(configIn) {
370
372
  neverFlatten: true,
371
373
  defaultProps: {
372
374
  ...Component2.defaultProps,
373
- ...conf?.defaultProps
375
+ ...conf == null ? void 0 : conf.defaultProps
374
376
  }
375
377
  });
376
378
  return Component2;
@@ -387,10 +389,11 @@ const Spacer = createComponent({
387
389
  variants: {
388
390
  size: {
389
391
  "...size": (size, { tokens }) => {
392
+ var _a, _b;
390
393
  size = size == true ? "$true" : size;
391
394
  return {
392
- width: tokens.size[size] ?? size,
393
- height: tokens.size[size] ?? size
395
+ width: (_a = tokens.size[size]) != null ? _a : size,
396
+ height: (_b = tokens.size[size]) != null ? _b : size
394
397
  };
395
398
  }
396
399
  },
@@ -410,6 +413,7 @@ function spacedChildren({
410
413
  space,
411
414
  flexDirection
412
415
  }) {
416
+ var _a, _b;
413
417
  if (!space && !isZStack) {
414
418
  return children;
415
419
  }
@@ -423,9 +427,9 @@ function spacedChildren({
423
427
  if (child === null || child === void 0) {
424
428
  continue;
425
429
  }
426
- const key = `${child?.["key"] ?? index}`;
430
+ const key = `${(_a = child == null ? void 0 : child["key"]) != null ? _a : index}`;
427
431
  next.push(<Fragment key={key}>{isZStack ? <Absolute>{child}</Absolute> : child}</Fragment>);
428
- if (child?.["type"]?.["isVisuallyHidden"]) {
432
+ if ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isVisuallyHidden"]) {
429
433
  continue;
430
434
  }
431
435
  if (index !== len - 1) {
@@ -31,6 +31,7 @@ function createTamagui(config) {
31
31
  defaultActive: config.mediaQueryDefaultActive
32
32
  });
33
33
  const themeConfig = (() => {
34
+ var _a;
34
35
  let cssRules = [];
35
36
  const varsByValue = new Map();
36
37
  if (isWeb) {
@@ -68,7 +69,7 @@ function createTamagui(config) {
68
69
  for (const themeKey in theme) {
69
70
  if (isWeb) {
70
71
  const val = theme[themeKey];
71
- const varName = val instanceof Variable ? val.name : varsByValue[val]?.name;
72
+ const varName = val instanceof Variable ? val.name : (_a = varsByValue[val]) == null ? void 0 : _a.name;
72
73
  vars += `--${themeKey}:${varName ? `var(--${varName});` : `${val}`};`;
73
74
  }
74
75
  ensureThemeVariable(theme, themeKey);
@@ -9,6 +9,7 @@ const createPropMapper = /* @__PURE__ */ __name((c) => {
9
9
  let variantsParsed;
10
10
  const defaultProps = c.defaultProps || {};
11
11
  return (key, value, theme, props) => {
12
+ var _a, _b;
12
13
  const conf = getTamagui();
13
14
  if (!conf) {
14
15
  console.trace("no conf! err");
@@ -18,9 +19,9 @@ const createPropMapper = /* @__PURE__ */ __name((c) => {
18
19
  variantsParsed = parseVariants(variants, conf);
19
20
  }
20
21
  let fontFamily = props.fontFamily || defaultProps.fontFamily || "$body";
21
- const variant = variantsParsed?.[key];
22
+ const variant = variantsParsed == null ? void 0 : variantsParsed[key];
22
23
  if (variant && typeof value !== "undefined") {
23
- const val = value === true ? variant["$true"] || variant["true"] : variant[value] ?? variant["..."] ?? value;
24
+ const val = value === true ? variant["$true"] || variant["true"] : (_b = (_a = variant[value]) != null ? _a : variant["..."]) != null ? _b : value;
24
25
  const res = typeof val === "function" ? val(value, { tokens: conf.tokensParsed, theme, props }) : isObj(val) ? { ...val } : val;
25
26
  if (isObj(res)) {
26
27
  resolveTokens(res, conf, theme, fontFamily);
@@ -64,30 +65,31 @@ const resolveTokens = /* @__PURE__ */ __name((res, conf, theme, fontFamily) => {
64
65
  }
65
66
  }, "resolveTokens");
66
67
  const getToken = /* @__PURE__ */ __name((key, value, { tokensParsed, themeParsed }, theme, fontFamily = "$body") => {
68
+ var _a, _b, _c, _d, _e, _f, _g;
67
69
  if (themeParsed[value]) {
68
70
  if (isWeb && themeParsed[value].variable) {
69
71
  return themeParsed[value].variable;
70
72
  } else {
71
73
  if (value && value[0] === "$") {
72
- return theme[`${value.slice(1)}`]?.val || themeParsed[value]?.val;
74
+ return ((_a = theme[`${value.slice(1)}`]) == null ? void 0 : _a.val) || ((_b = themeParsed[value]) == null ? void 0 : _b.val);
73
75
  }
74
76
  }
75
77
  }
76
78
  let valOrVar;
77
79
  if (key === "fontFamily") {
78
- valOrVar = tokensParsed.font[value]?.family || value;
80
+ valOrVar = ((_c = tokensParsed.font[value]) == null ? void 0 : _c.family) || value;
79
81
  }
80
82
  if (key === "fontSize") {
81
- valOrVar = tokensParsed.font[fontFamily]?.size[value] || value;
83
+ valOrVar = ((_d = tokensParsed.font[fontFamily]) == null ? void 0 : _d.size[value]) || value;
82
84
  }
83
85
  if (key === "lineHeight") {
84
- valOrVar = tokensParsed.font[fontFamily]?.lineHeight[value] || value;
86
+ valOrVar = ((_e = tokensParsed.font[fontFamily]) == null ? void 0 : _e.lineHeight[value]) || value;
85
87
  }
86
88
  if (key === "letterSpacing") {
87
- valOrVar = tokensParsed.font[fontFamily]?.letterSpacing[value] || value;
89
+ valOrVar = ((_f = tokensParsed.font[fontFamily]) == null ? void 0 : _f.letterSpacing[value]) || value;
88
90
  }
89
91
  if (key === "fontWeight") {
90
- valOrVar = tokensParsed.font[fontFamily]?.weight[value] || value;
92
+ valOrVar = ((_g = tokensParsed.font[fontFamily]) == null ? void 0 : _g.weight[value]) || value;
91
93
  }
92
94
  if (typeof valOrVar !== "undefined") {
93
95
  if (valOrVar instanceof Variable) {
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { createPropMapper } from "./createPropMapper";
4
4
  function extendStaticConfig(Component, config = {}) {
5
+ var _a, _b;
5
6
  const parent = Component || {};
6
7
  if (!parent.staticConfig) {
7
8
  parent.staticConfig = {
@@ -28,8 +29,8 @@ function extendStaticConfig(Component, config = {}) {
28
29
  isZStack: config.isZStack || parent.staticConfig.isZStack,
29
30
  variants,
30
31
  isText: config.isText || parent.staticConfig.isText || false,
31
- neverFlatten: config.neverFlatten ?? parent.staticConfig.neverFlatten,
32
- ensureOverriddenProp: config.ensureOverriddenProp ?? parent.staticConfig.ensureOverriddenProp,
32
+ neverFlatten: (_a = config.neverFlatten) != null ? _a : parent.staticConfig.neverFlatten,
33
+ ensureOverriddenProp: (_b = config.ensureOverriddenProp) != null ? _b : parent.staticConfig.ensureOverriddenProp,
33
34
  validStyles: config.validStyles ? {
34
35
  ...parent.staticConfig.validStyles,
35
36
  ...config.validStyles
@@ -34,12 +34,13 @@ function getStylesAtomic(style, avoidCollection = false) {
34
34
  __name(getStylesAtomic, "getStylesAtomic");
35
35
  const importantRegex = /\!important*/g;
36
36
  function getAtomicStyle(style, pseudo, avoidCollection) {
37
+ var _a;
37
38
  if (style == null || typeof style !== "object") {
38
39
  throw new Error(`Wrong style type: "${typeof style}": ${style}`);
39
40
  }
40
41
  for (const key in borderDefaults) {
41
42
  if (key in style) {
42
- style[borderDefaults[key]] = style[borderDefaults[key]] ?? "solid";
43
+ style[borderDefaults[key]] = (_a = style[borderDefaults[key]]) != null ? _a : "solid";
43
44
  }
44
45
  }
45
46
  const all = generateStyle(style);
@@ -2,7 +2,8 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { isValidElement } from "react";
4
4
  const isTamaguiElement = /* @__PURE__ */ __name((child) => {
5
- return isValidElement(child) && !!child.type["staticConfig"]?.parsed;
5
+ var _a;
6
+ return isValidElement(child) && !!((_a = child.type["staticConfig"]) == null ? void 0 : _a.parsed);
6
7
  }, "isTamaguiElement");
7
8
  export {
8
9
  isTamaguiElement
@@ -15,7 +15,7 @@ const themeable = /* @__PURE__ */ __name(function graphql(component) {
15
15
  return el;
16
16
  }, "WithTheme"));
17
17
  const withTheme = withThemeComponent;
18
- withTheme.displayName = `Themed(${component?.displayName || component?.name || "Anonymous"})`;
18
+ withTheme.displayName = `Themed(${(component == null ? void 0 : component.displayName) || (component == null ? void 0 : component.name) || "Anonymous"})`;
19
19
  return withTheme;
20
20
  }, "graphql");
21
21
  export {
@@ -12,7 +12,8 @@ const addMediaQueryListener = /* @__PURE__ */ __name((key, cb) => {
12
12
  mediaQueryListeners[key].add(cb);
13
13
  }, "addMediaQueryListener");
14
14
  const removeMediaQueryListener = /* @__PURE__ */ __name((key, cb) => {
15
- mediaQueryListeners[key]?.delete(cb);
15
+ var _a;
16
+ (_a = mediaQueryListeners[key]) == null ? void 0 : _a.delete(cb);
16
17
  }, "removeMediaQueryListener");
17
18
  let conf = null;
18
19
  const mediaQueryConfig = new Proxy({}, {
@@ -47,6 +48,7 @@ const configureMedia = /* @__PURE__ */ __name(({
47
48
  queries,
48
49
  defaultActive = ["sm", "xs"]
49
50
  } = {}) => {
51
+ var _a;
50
52
  if (conf) {
51
53
  console.warn(`Already configured mediaQueries once (you may have called getMedia() before configureMedia())`);
52
54
  }
@@ -68,7 +70,7 @@ const configureMedia = /* @__PURE__ */ __name(({
68
70
  return;
69
71
  mediaState[key] = next;
70
72
  const listeners = mediaQueryListeners[key];
71
- if (listeners?.size) {
73
+ if (listeners == null ? void 0 : listeners.size) {
72
74
  for (const cb of [...listeners]) {
73
75
  cb();
74
76
  }
@@ -76,7 +78,7 @@ const configureMedia = /* @__PURE__ */ __name(({
76
78
  });
77
79
  } catch (err) {
78
80
  console.error("Error running media query", str, err.message, err.stack);
79
- const isDefaultActive = defaultActive?.includes(key) ?? true;
81
+ const isDefaultActive = (_a = defaultActive == null ? void 0 : defaultActive.includes(key)) != null ? _a : true;
80
82
  mediaState[key] = isDefaultActive;
81
83
  }
82
84
  }
@@ -1,7 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var _a, _b;
3
4
  import { Pressable } from "react-native";
4
- const getPressable = Pressable?.["type"]?.["render"];
5
+ const getPressable = (_b = (_a = Pressable) == null ? void 0 : _a["type"]) == null ? void 0 : _b["render"];
5
6
  const usePressable = /* @__PURE__ */ __name((props) => {
6
7
  const out = getPressable(props);
7
8
  const { children, style, ...pressableProps } = out.props;
@@ -22,7 +22,7 @@ const useThemeName = /* @__PURE__ */ __name((opts) => {
22
22
  const [name, setName] = useState(parent.name);
23
23
  useIsomorphicLayoutEffect(() => {
24
24
  return parent.onChangeTheme((next, manager) => {
25
- setName(opts?.parent ? manager.parentName : next);
25
+ setName((opts == null ? void 0 : opts.parent) ? manager.parentName : next);
26
26
  });
27
27
  }, [parent]);
28
28
  return name || "light";
@@ -31,6 +31,7 @@ const useDefaultThemeName = /* @__PURE__ */ __name(() => {
31
31
  return useContext(ThemeContext)[GET_DEFAULT_THEME];
32
32
  }, "useDefaultThemeName");
33
33
  const useTheme = /* @__PURE__ */ __name(() => {
34
+ var _a;
34
35
  const forceUpdate = useForceUpdate();
35
36
  const manager = useContext(ThemeManagerContext);
36
37
  const themes = useContext(ThemeContext);
@@ -54,7 +55,7 @@ const useTheme = /* @__PURE__ */ __name(() => {
54
55
  useEffect(() => {
55
56
  return manager.onUpdate(state.current.uuid, forceUpdate);
56
57
  }, []);
57
- const theme = (manager.name ? themes[manager.name] : themes.light) ?? themes.light;
58
+ const theme = (_a = manager.name ? themes[manager.name] : themes.light) != null ? _a : themes.light;
58
59
  return useMemo(() => {
59
60
  return new Proxy(theme, {
60
61
  get(_, key) {
@@ -1,9 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var _a, _b;
3
4
  import { createContext } from "react";
4
5
  import { rnw } from "../constants/rnw";
5
6
  const FallbackNativeContext = createContext(false);
6
- const TextAncestorContext = rnw?.TextAncestorContext ?? FallbackNativeContext;
7
+ const TextAncestorContext = (_b = (_a = rnw) == null ? void 0 : _a.TextAncestorContext) != null ? _b : FallbackNativeContext;
7
8
  const TextAncestorProvider = /* @__PURE__ */ __name((props) => {
8
9
  return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>;
9
10
  }, "TextAncestorProvider");
@@ -7,6 +7,7 @@ import { useConstant } from "../hooks/useConstant";
7
7
  import { ThemeContext } from "./ThemeContext";
8
8
  import { ThemeManager, ThemeManagerContext } from "./ThemeManagerContext";
9
9
  const Theme = /* @__PURE__ */ __name((props) => {
10
+ var _a, _b;
10
11
  const parent = useContext(ThemeManagerContext);
11
12
  const themes = useContext(ThemeContext);
12
13
  const [parentName, setParentName] = useState(parent.name || "light");
@@ -51,7 +52,7 @@ const Theme = /* @__PURE__ */ __name((props) => {
51
52
  return contents;
52
53
  }
53
54
  if (name) {
54
- const color = themes[name]?.["color"]?.["variable"];
55
+ const color = (_b = (_a = themes[name]) == null ? void 0 : _a["color"]) == null ? void 0 : _b["variable"];
55
56
  return <div className={getThemeParentClassName(props.name)} style={{ display: "contents", color }}>{contents}</div>;
56
57
  }
57
58
  }
@@ -28,12 +28,13 @@ class ThemeManager {
28
28
  this.keys.set(uuid, keys);
29
29
  }
30
30
  update() {
31
+ var _a;
31
32
  if (!this.name) {
32
33
  this.keys.clear();
33
34
  }
34
35
  for (const [uuid, keys] of this.keys.entries()) {
35
36
  if (keys.size) {
36
- this.listeners.get(uuid)?.();
37
+ (_a = this.listeners.get(uuid)) == null ? void 0 : _a();
37
38
  }
38
39
  }
39
40
  this.themeListeners.forEach((cb) => cb(this.name, this));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "1.0.0-alpha.32",
3
+ "version": "1.0.0-alpha.36",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -14,10 +14,10 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "@tamagui/helpers": "^1.0.0-alpha.32",
17
+ "@tamagui/helpers": "^1.0.0-alpha.36",
18
18
  "@tamagui/ow": "^0.28.1",
19
- "@tamagui/use-debounce": "^1.0.0-alpha.32",
20
- "@tamagui/use-force-update": "^1.0.0-alpha.32",
19
+ "@tamagui/use-debounce": "^1.0.0-alpha.36",
20
+ "@tamagui/use-force-update": "^1.0.0-alpha.36",
21
21
  "react": "*",
22
22
  "react-dom": "*"
23
23
  },
@@ -25,7 +25,7 @@
25
25
  "react-native-web": "*"
26
26
  },
27
27
  "devDependencies": {
28
- "@tamagui/build": "^1.0.0-alpha.32",
28
+ "@tamagui/build": "^1.0.0-alpha.36",
29
29
  "@types/react": "^17.0.35",
30
30
  "esbuild": "^0.13.12",
31
31
  "react-native-web": "^0.17.5",
@@ -37,5 +37,5 @@
37
37
  "engines": {
38
38
  "node": ">=16"
39
39
  },
40
- "gitHead": "08084d0e70828a4d5fd18267d85db282a3a189d9"
40
+ "gitHead": "d5b75feefe9694ee2f107b69c1be98a5f107eada"
41
41
  }