@tamagui/core 1.0.1-beta.83 → 1.0.1-beta.87

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 (60) hide show
  1. package/dist/cjs/constants/rnw.js +7 -5
  2. package/dist/cjs/constants/rnw.js.map +2 -2
  3. package/dist/cjs/createComponent.js +18 -16
  4. package/dist/cjs/createComponent.js.map +2 -2
  5. package/dist/cjs/helpers/createPropMapper.js +2 -1
  6. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  7. package/dist/cjs/helpers/extendStaticConfig.js +1 -1
  8. package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
  9. package/dist/cjs/helpers/getSplitStyles.js +19 -18
  10. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  11. package/dist/cjs/helpers/getStylesAtomic.js +1 -43
  12. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  13. package/dist/cjs/helpers/insertStyleRule.js +40 -22
  14. package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
  15. package/dist/cjs/helpers/mergeProps.js +14 -4
  16. package/dist/cjs/helpers/mergeProps.js.map +2 -2
  17. package/dist/cjs/helpers/wrapThemeManagerContext.js.map +2 -2
  18. package/dist/cjs/hooks/useFeatures.js +4 -2
  19. package/dist/cjs/hooks/useFeatures.js.map +2 -2
  20. package/dist/cjs/hooks/useId.js +1 -1
  21. package/dist/cjs/hooks/useId.js.map +2 -2
  22. package/dist/cjs/views/Theme.js.map +2 -2
  23. package/dist/esm/constants/rnw.js +7 -2
  24. package/dist/esm/constants/rnw.js.map +2 -2
  25. package/dist/esm/createComponent.js +19 -16
  26. package/dist/esm/createComponent.js.map +2 -2
  27. package/dist/esm/helpers/createPropMapper.js +2 -1
  28. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  29. package/dist/esm/helpers/extendStaticConfig.js +1 -1
  30. package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
  31. package/dist/esm/helpers/getSplitStyles.js +20 -20
  32. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  33. package/dist/esm/helpers/getStylesAtomic.js +1 -44
  34. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  35. package/dist/esm/helpers/insertStyleRule.js +40 -22
  36. package/dist/esm/helpers/insertStyleRule.js.map +2 -2
  37. package/dist/esm/helpers/mergeProps.js +14 -4
  38. package/dist/esm/helpers/mergeProps.js.map +2 -2
  39. package/dist/esm/helpers/wrapThemeManagerContext.js.map +1 -1
  40. package/dist/esm/hooks/useFeatures.js +5 -3
  41. package/dist/esm/hooks/useFeatures.js.map +2 -2
  42. package/dist/esm/hooks/useId.js +1 -1
  43. package/dist/esm/hooks/useId.js.map +2 -2
  44. package/dist/esm/views/Theme.js.map +1 -1
  45. package/package.json +7 -7
  46. package/types/createComponent.d.ts.map +1 -1
  47. package/types/helpers/createPropMapper.d.ts.map +1 -1
  48. package/types/helpers/getSplitStyles.d.ts +1 -0
  49. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  50. package/types/helpers/getStylesAtomic.d.ts.map +1 -1
  51. package/types/helpers/insertStyleRule.d.ts.map +1 -1
  52. package/types/helpers/mergeProps.d.ts +1 -1
  53. package/types/helpers/mergeProps.d.ts.map +1 -1
  54. package/types/hooks/useFeatures.d.ts.map +1 -1
  55. package/types/hooks/useId.d.ts.map +1 -1
  56. package/types/views/Theme.d.ts.map +1 -1
  57. package/types/views/ThemeInverse.d.ts +0 -1
  58. package/types/views/ThemeInverse.d.ts.map +1 -1
  59. package/types/views/ThemeProvider.d.ts +0 -1
  60. package/types/views/ThemeProvider.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useFeatures.tsx"],
4
- "sourcesContent": ["import React, { RefObject } from 'react'\nimport { View, ViewStyle } from 'react-native'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getSubStyle } from '../helpers/getSplitStyles'\nimport {\n PseudoStyles,\n SplitStyleState,\n StaticConfigParsed,\n TamaguiComponentState,\n UseAnimationHook,\n UseAnimationProps,\n} from '../types'\nimport { addMediaQueryListener, mediaState, removeMediaQueryListener } from './useMedia'\n\ntype FeatureDefinition = {\n isEnabled: (props: any) => boolean\n Component: any\n}\n\ntype FeatureUtils = {\n forceUpdate: Function\n state: SplitStyleState\n setStateShallow: (next: Partial<TamaguiComponentState>) => void\n useAnimations?: UseAnimationHook\n pseudos: PseudoStyles\n style: ViewStyle | null | undefined\n staticConfig: StaticConfigParsed\n theme: any\n onDidAnimate?: () => void\n hostRef: RefObject<HTMLElement | View>\n}\n\nconst createDefinition = ({\n Component,\n propNames,\n}: {\n Component: (props: { _utils: FeatureUtils; [key: string]: any }) => void\n propNames: string[]\n}): FeatureDefinition => ({\n isEnabled: (props: any) => propNames.some((name) => !!props[name]),\n Component,\n})\n\nlet featureDefinitions: Record<string, FeatureDefinition> | null = null\n\ntype FeatureKeys = keyof ReturnType<typeof loadFeatures>\n\nexport const useFeatures = (props: any, utils?: FeatureUtils) => {\n if (!featureDefinitions) {\n featureDefinitions = loadFeatures()\n }\n const elements: JSX.Element[] = []\n const enabled: { [key in FeatureKeys]?: boolean } = {}\n for (const name in featureDefinitions) {\n const { isEnabled, Component } = featureDefinitions[name]\n if (isEnabled(props) && Component) {\n enabled[name] = true\n elements.push(<Component key={name} {...props} _utils={utils} />)\n }\n }\n return {\n elements,\n enabled,\n }\n}\n\nfunction loadFeatures() {\n return {\n // loads animations and sets state with the results\n animation: loadAnimationFeature(),\n\n // will update the parent whenever media query changes\n // no need on web, media queries are inserted and run in css\n mediaQuery: loadMediaQueryFeature(),\n } as const\n}\n\nfunction loadAnimationFeature() {\n return createDefinition({\n Component: ({ _utils, ...props }) => {\n const {\n state,\n useAnimations,\n pseudos,\n style: inStyle,\n setStateShallow,\n staticConfig,\n theme,\n onDidAnimate,\n } = _utils\n\n if (!useAnimations) {\n console.error('no useAnimations hook provided')\n return null\n }\n\n // we always have .animation set\n const propsWithAnimation = props as UseAnimationProps\n\n const res = useAnimations(propsWithAnimation, {\n state,\n pseudos,\n onDidAnimate,\n staticConfig,\n getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {\n // we have to merge such that transforms keys all exist\n const style = inStyle || {}\n\n const enterStyle = isEntering\n ? enterVariant && staticConfig.variants?.[enterVariant]['true']\n ? getSubStyle(\n staticConfig.variants?.[enterVariant]['true'],\n staticConfig,\n theme,\n props,\n state\n ) || pseudos.enterStyle\n : null || pseudos.enterStyle\n : null\n\n const exitStyle = isExiting\n ? exitVariant && staticConfig.variants?.[exitVariant]['true']\n ? getSubStyle(\n staticConfig.variants?.[exitVariant]['true'],\n staticConfig,\n theme,\n props,\n state\n ) || pseudos.exitStyle\n : null || pseudos.exitStyle\n : null\n\n // if you have hoverStyle={{ scale: 1.1 }} and don't have scale set on the base style\n // no animation will run! this is really confusing. this will look at all variants,\n // and fill in base styles if they don't exist. eg:\n // input:\n // base: {}\n // hoverStyle: { scale: 2 }\n // enterStyle: { x: 100 }\n // output:\n // base: { x: 0, scale: 1 }\n ensureBaseHasDefaults(\n style,\n enterStyle,\n pseudos.hoverStyle,\n pseudos.focusStyle,\n pseudos.pressStyle,\n pseudos.pressStyle\n )\n\n enterStyle && merge(style, enterStyle)\n state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle)\n state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle)\n state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle)\n exitStyle && merge(style, exitStyle)\n\n return style\n },\n //, delay\n })\n\n useIsomorphicLayoutEffect(() => {\n setStateShallow({\n animation: res,\n })\n }, [res])\n\n return null\n },\n propNames: ['animation'],\n })\n}\n\nconst defaults = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n opacity: 1,\n translateX: 0,\n translateY: 0,\n skew: 0,\n skewX: 0,\n skewY: 0,\n scale: 1,\n rotate: '0deg',\n rotateY: '0deg',\n rotateX: '0deg',\n}\n\nfunction ensureBaseHasDefaults(base: ViewStyle, ...pseudos: (ViewStyle | null | undefined)[]) {\n for (const pseudo of pseudos) {\n if (!pseudo) continue\n for (const key in pseudo) {\n const val = pseudo[key]\n if (key === 'transform') {\n for (const t of val) {\n const tkey = Object.keys(t)[0]\n const defaultVal = defaults[tkey]\n const tDefaultVal = { [tkey]: defaultVal } as any\n if (!base.transform) {\n base.transform = [tDefaultVal]\n } else {\n if (!base.transform.find((x) => x[tkey])) {\n base.transform.push(tDefaultVal)\n }\n }\n }\n } else {\n if (!(key in base)) {\n base[key] = defaults[key]\n }\n }\n }\n }\n}\n\nfunction merge(base: ViewStyle, next: ViewStyle) {\n if (!next.transform || !base.transform) {\n Object.assign(base, next)\n return\n }\n const { transform, ...rest } = next\n Object.assign(base, rest)\n for (const t of transform) {\n const key = Object.keys(t)[0]\n const existing = base.transform.find((x) => key in x)\n if (existing) {\n existing[key] = t[key]\n } else {\n base.transform.push(t)\n }\n }\n}\n\nfunction loadMediaQueryFeature() {\n const mediaPropNames = Object.keys(mediaState)\n\n return createDefinition({\n Component: (props: any) => {\n const mediaKeys = mediaPropNames.filter((x) => x in props)\n\n useIsomorphicLayoutEffect(() => {\n for (const key of mediaKeys) {\n addMediaQueryListener(key, props._utils.forceUpdate)\n }\n return () => {\n for (const key of mediaKeys) {\n removeMediaQueryListener(key, props._utils.forceUpdate)\n }\n }\n }, [mediaKeys.join(',')])\n\n return null\n },\n propNames: mediaPropNames,\n })\n}\n\n// TODO\n// measureLayout: createDefinition({\n// Component: (props) => {\n// console.log('measure', props)\n// return null\n// },\n// propNames: ['onLayout'],\n// }),\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AAGjC,sBAA0C;AAC1C,4BAA4B;AAS5B,sBAA4E;AAoB5E,MAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,MAIwB;AAAA,EACxB,WAAW,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MACF,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;AAExB,aAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;",
4
+ "sourcesContent": ["import React, { RefObject, startTransition } from 'react'\nimport { View, ViewStyle } from 'react-native'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getSubStyle } from '../helpers/getSplitStyles'\nimport {\n PseudoStyles,\n SplitStyleState,\n StaticConfigParsed,\n TamaguiComponentState,\n UseAnimationHook,\n UseAnimationProps,\n} from '../types'\nimport { addMediaQueryListener, mediaState, removeMediaQueryListener } from './useMedia'\n\ntype FeatureDefinition = {\n isEnabled: (props: any) => boolean\n Component: any\n}\n\ntype FeatureUtils = {\n forceUpdate: Function\n state: SplitStyleState\n setStateShallow: (next: Partial<TamaguiComponentState>) => void\n useAnimations?: UseAnimationHook\n pseudos: PseudoStyles\n style: ViewStyle | null | undefined\n staticConfig: StaticConfigParsed\n theme: any\n onDidAnimate?: () => void\n hostRef: RefObject<HTMLElement | View>\n}\n\nconst createDefinition = ({\n Component,\n propNames,\n}: {\n Component: (props: { _utils: FeatureUtils; [key: string]: any }) => void\n propNames: string[]\n}): FeatureDefinition => ({\n isEnabled: (props: any) => propNames.some((name) => !!props[name]),\n Component,\n})\n\nlet featureDefinitions: Record<string, FeatureDefinition> | null = null\n\ntype FeatureKeys = keyof ReturnType<typeof loadFeatures>\n\nexport const useFeatures = (props: any, utils?: FeatureUtils) => {\n if (!featureDefinitions) {\n featureDefinitions = loadFeatures()\n }\n const elements: JSX.Element[] = []\n const enabled: { [key in FeatureKeys]?: boolean } = {}\n for (const name in featureDefinitions) {\n const { isEnabled, Component } = featureDefinitions[name]\n if (isEnabled(props) && Component) {\n enabled[name] = true\n elements.push(<Component key={name} {...props} _utils={utils} />)\n }\n }\n return {\n elements,\n enabled,\n }\n}\n\nfunction loadFeatures() {\n return {\n // loads animations and sets state with the results\n animation: loadAnimationFeature(),\n\n // will update the parent whenever media query changes\n // no need on web, media queries are inserted and run in css\n mediaQuery: loadMediaQueryFeature(),\n } as const\n}\n\nfunction loadAnimationFeature() {\n return createDefinition({\n Component: ({ _utils, ...props }) => {\n const {\n state,\n useAnimations,\n pseudos,\n style: inStyle,\n setStateShallow,\n staticConfig,\n theme,\n onDidAnimate,\n } = _utils\n\n if (!useAnimations) {\n console.error('no useAnimations hook provided')\n return null\n }\n\n // we always have .animation set\n const propsWithAnimation = props as UseAnimationProps\n\n const res = useAnimations(propsWithAnimation, {\n state,\n pseudos,\n onDidAnimate,\n staticConfig,\n getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {\n // we have to merge such that transforms keys all exist\n const style = inStyle || {}\n\n const enterStyle = isEntering\n ? enterVariant && staticConfig.variants?.[enterVariant]['true']\n ? getSubStyle(\n staticConfig.variants?.[enterVariant]['true'],\n staticConfig,\n theme,\n props,\n state\n ) || pseudos.enterStyle\n : null || pseudos.enterStyle\n : null\n\n const exitStyle = isExiting\n ? exitVariant && staticConfig.variants?.[exitVariant]['true']\n ? getSubStyle(\n staticConfig.variants?.[exitVariant]['true'],\n staticConfig,\n theme,\n props,\n state\n ) || pseudos.exitStyle\n : null || pseudos.exitStyle\n : null\n\n // if you have hoverStyle={{ scale: 1.1 }} and don't have scale set on the base style\n // no animation will run! this is really confusing. this will look at all variants,\n // and fill in base styles if they don't exist. eg:\n // input:\n // base: {}\n // hoverStyle: { scale: 2 }\n // enterStyle: { x: 100 }\n // output:\n // base: { x: 0, scale: 1 }\n ensureBaseHasDefaults(\n style,\n enterStyle,\n pseudos.hoverStyle,\n pseudos.focusStyle,\n pseudos.pressStyle,\n pseudos.pressStyle\n )\n\n enterStyle && merge(style, enterStyle)\n state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle)\n state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle)\n state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle)\n exitStyle && merge(style, exitStyle)\n\n return style\n },\n //, delay\n })\n\n useIsomorphicLayoutEffect(() => {\n startTransition(() => {\n setStateShallow({\n animation: res,\n })\n })\n }, [res])\n\n return null\n },\n propNames: ['animation'],\n })\n}\n\nconst defaults = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n opacity: 1,\n translateX: 0,\n translateY: 0,\n skew: 0,\n skewX: 0,\n skewY: 0,\n scale: 1,\n rotate: '0deg',\n rotateY: '0deg',\n rotateX: '0deg',\n}\n\nfunction ensureBaseHasDefaults(base: ViewStyle, ...pseudos: (ViewStyle | null | undefined)[]) {\n for (const pseudo of pseudos) {\n if (!pseudo) continue\n for (const key in pseudo) {\n const val = pseudo[key]\n if (key === 'transform') {\n for (const t of val) {\n const tkey = Object.keys(t)[0]\n const defaultVal = defaults[tkey]\n const tDefaultVal = { [tkey]: defaultVal } as any\n if (!base.transform) {\n base.transform = [tDefaultVal]\n } else {\n if (!base.transform.find((x) => x[tkey])) {\n base.transform.push(tDefaultVal)\n }\n }\n }\n } else {\n if (!(key in base)) {\n base[key] = defaults[key]\n }\n }\n }\n }\n}\n\nfunction merge(base: ViewStyle, next: ViewStyle) {\n if (!next.transform || !base.transform) {\n Object.assign(base, next)\n return\n }\n const { transform, ...rest } = next\n Object.assign(base, rest)\n for (const t of transform) {\n const key = Object.keys(t)[0]\n const existing = base.transform.find((x) => key in x)\n if (existing) {\n existing[key] = t[key]\n } else {\n base.transform.push(t)\n }\n }\n}\n\nfunction loadMediaQueryFeature() {\n const mediaPropNames = Object.keys(mediaState)\n\n return createDefinition({\n Component: (props: any) => {\n const mediaKeys = mediaPropNames.filter((x) => x in props)\n\n useIsomorphicLayoutEffect(() => {\n for (const key of mediaKeys) {\n addMediaQueryListener(key, props._utils.forceUpdate)\n }\n return () => {\n for (const key of mediaKeys) {\n removeMediaQueryListener(key, props._utils.forceUpdate)\n }\n }\n }, [mediaKeys.join(',')])\n\n return null\n },\n propNames: mediaPropNames,\n })\n}\n\n// TODO\n// measureLayout: createDefinition({\n// Component: (props) => {\n// console.log('measure', props)\n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BAAU;AAE7C,SAAO,iBAAiB;AAAA,IACtB,WAAW,CAAC,UAAe;AACzB,YAAM,YAAY,eAAe,OAAO,CAAC,MAAM,KAAK,KAAK;AAEzD,qDAA0B,MAAM;AAC9B,mBAAW,OAAO,WAAW;AAC3B,qDAAsB,KAAK,MAAM,OAAO,WAAW;AAAA,QACrD;AACA,eAAO,MAAM;AACX,qBAAW,OAAO,WAAW;AAC3B,0DAAyB,KAAK,MAAM,OAAO,WAAW;AAAA,UACxD;AAAA,QACF;AAAA,MACF,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;AAExB,aAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -33,7 +33,7 @@ function genId() {
33
33
  function useId(providedId) {
34
34
  if (import_platform.isWeb) {
35
35
  if (typeof React.useId === "function") {
36
- let id3 = React.useId(providedId);
36
+ let id3 = React.useId();
37
37
  return providedId != null ? providedId : id3;
38
38
  }
39
39
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useId.tsx"],
4
- "sourcesContent": ["/*\n * Welcome to @reach/auto-id!\n\n * Let's see if we can make sense of why this hook exists and its\n * implementation.\n *\n * Some background:\n * 1. Accessibility APIs rely heavily on element IDs\n * 2. Requiring developers to put IDs on every element in Reach UI is both\n * cumbersome and error-prone\n * 3. With a component model, we can generate IDs for them!\n *\n * Solution 1: Generate random IDs.\n *\n * This works great as long as you don't server render your app. When React (in\n * the client) tries to reuse the markup from the server, the IDs won't match\n * and React will then recreate the entire DOM tree.\n *\n * Solution 2: Increment an integer\n *\n * This sounds great. Since we're rendering the exact same tree on the server\n * and client, we can increment a counter and get a deterministic result between\n * client and server. Also, JS integers can go up to nine-quadrillion. I'm\n * pretty sure the tab will be closed before an app never needs\n * 10 quadrillion IDs!\n *\n * Problem solved, right?\n *\n * Ah, but there's a catch! React's concurrent rendering makes this approach\n * non-deterministic. While the client and server will end up with the same\n * elements in the end, depending on suspense boundaries (and possibly some user\n * input during the initial render) the incrementing integers won't always match\n * up.\n *\n * Solution 3: Don't use IDs at all on the server; patch after first render.\n *\n * What we've done here is solution 2 with some tricks. With this approach, the\n * ID returned is an empty string on the first render. This way the server and\n * client have the same markup no matter how wild the concurrent rendering may\n * have gotten.\n *\n * After the render, we patch up the components with an incremented ID. This\n * causes a double render on any components with `useId`. Shouldn't be a problem\n * since the components using this hook should be small, and we're only updating\n * the ID attribute on the DOM, nothing big is happening.\n *\n * It doesn't have to be an incremented number, though--we could do generate\n * random strings instead, but incrementing a number is probably the cheapest\n * thing we can do.\n *\n * Additionally, we only do this patchup on the very first client render ever.\n * Any calls to `useId` that happen dynamically in the client will be\n * populated immediately with a value. So, we only get the double render after\n * server hydration and never again, SO BACK OFF ALRIGHT?\n */\n\nimport * as React from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\n\nlet serverHandoffComplete = false\nlet id = 0\nfunction genId() {\n return ++id\n}\n\n/* eslint-disable react-hooks/rules-of-hooks */\n\n/**\n * useId\n *\n * Autogenerate IDs to facilitate WAI-ARIA and server rendering.\n *\n * Note: The returned ID will initially be `null` and will update after a\n * component mounts. Users may need to supply their own ID if they need\n * consistent values for SSR.\n *\n * @see Docs https://reach.tech/auto-id\n */\nfunction useId(idFromProps: string): string\nfunction useId(idFromProps: number): number\nfunction useId(idFromProps: string | number): string | number\nfunction useId(idFromProps: string | undefined | null): string | undefined\nfunction useId(idFromProps: number | undefined | null): number | undefined\nfunction useId(idFromProps: string | number | undefined | null): string | number | undefined\nfunction useId(): string | undefined\n\nfunction useId(providedId?: number | string | undefined | null) {\n // TODO: Remove error flag when updating internal deps to React 18. None of\n // our tricks will play well with concurrent rendering anyway.\n\n // native doesn't support until next react-native version, need to remove eventually\n if (isWeb) {\n // @ts-expect-error\n if (typeof React.useId === 'function') {\n // @ts-expect-error\n let id = React.useId(providedId)\n return providedId != null ? providedId : id\n }\n }\n\n // If this instance isn't part of the initial render, we don't have to do the\n // double render/patch-up dance. We can just generate the ID and return it.\n let initialId = providedId ?? (serverHandoffComplete ? genId() : null)\n let [id, setId] = React.useState(initialId)\n\n useIsomorphicLayoutEffect(() => {\n if (id === null) {\n // Patch the ID after render. We do this in `useLayoutEffect` to avoid any\n // rendering flicker, though it'll make the first render slower (unlikely\n // to matter, but you're welcome to measure your app and let us know if\n // it's a problem).\n setId(genId())\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n React.useEffect(() => {\n if (serverHandoffComplete === false) {\n // Flag all future uses of `useId` to skip the update dance. This is in\n // `useEffect` because it goes after `useLayoutEffect`, ensuring we don't\n // accidentally bail out of the patch-up dance prematurely.\n serverHandoffComplete = true\n }\n }, [])\n\n return providedId ?? id ?? undefined\n}\n\nexport { useId }\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDA,YAAuB;AAEvB,sBAAiD;AAEjD,IAAI,wBAAwB;AAC5B,IAAI,KAAK;AACT,iBAAiB;AACf,SAAO,EAAE;AACX;AAuBA,eAAe,YAAiD;AAK9D,MAAI,uBAAO;AAET,QAAI,OAAO,MAAM,UAAU,YAAY;AAErC,UAAI,MAAK,MAAM,MAAM,UAAU;AAC/B,aAAO,cAAc,OAAO,aAAa;AAAA,IAC3C;AAAA,EACF;AAIA,MAAI,YAAY,cAAe,yBAAwB,MAAM,IAAI;AACjE,MAAI,CAAC,KAAI,SAAS,MAAM,SAAS,SAAS;AAE1C,iDAA0B,MAAM;AAC9B,QAAI,QAAO,MAAM;AAKf,YAAM,MAAM,CAAC;AAAA,IACf;AAAA,EAEF,GAAG,CAAC,CAAC;AAEL,QAAM,UAAU,MAAM;AACpB,QAAI,0BAA0B,OAAO;AAInC,8BAAwB;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,cAAc,OAAM;AAC7B;",
4
+ "sourcesContent": ["/*\n * Welcome to @reach/auto-id!\n\n * Let's see if we can make sense of why this hook exists and its\n * implementation.\n *\n * Some background:\n * 1. Accessibility APIs rely heavily on element IDs\n * 2. Requiring developers to put IDs on every element in Reach UI is both\n * cumbersome and error-prone\n * 3. With a component model, we can generate IDs for them!\n *\n * Solution 1: Generate random IDs.\n *\n * This works great as long as you don't server render your app. When React (in\n * the client) tries to reuse the markup from the server, the IDs won't match\n * and React will then recreate the entire DOM tree.\n *\n * Solution 2: Increment an integer\n *\n * This sounds great. Since we're rendering the exact same tree on the server\n * and client, we can increment a counter and get a deterministic result between\n * client and server. Also, JS integers can go up to nine-quadrillion. I'm\n * pretty sure the tab will be closed before an app never needs\n * 10 quadrillion IDs!\n *\n * Problem solved, right?\n *\n * Ah, but there's a catch! React's concurrent rendering makes this approach\n * non-deterministic. While the client and server will end up with the same\n * elements in the end, depending on suspense boundaries (and possibly some user\n * input during the initial render) the incrementing integers won't always match\n * up.\n *\n * Solution 3: Don't use IDs at all on the server; patch after first render.\n *\n * What we've done here is solution 2 with some tricks. With this approach, the\n * ID returned is an empty string on the first render. This way the server and\n * client have the same markup no matter how wild the concurrent rendering may\n * have gotten.\n *\n * After the render, we patch up the components with an incremented ID. This\n * causes a double render on any components with `useId`. Shouldn't be a problem\n * since the components using this hook should be small, and we're only updating\n * the ID attribute on the DOM, nothing big is happening.\n *\n * It doesn't have to be an incremented number, though--we could do generate\n * random strings instead, but incrementing a number is probably the cheapest\n * thing we can do.\n *\n * Additionally, we only do this patchup on the very first client render ever.\n * Any calls to `useId` that happen dynamically in the client will be\n * populated immediately with a value. So, we only get the double render after\n * server hydration and never again, SO BACK OFF ALRIGHT?\n */\n\nimport * as React from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\n\nlet serverHandoffComplete = false\nlet id = 0\nfunction genId() {\n return ++id\n}\n\n/* eslint-disable react-hooks/rules-of-hooks */\n\n/**\n * useId\n *\n * Autogenerate IDs to facilitate WAI-ARIA and server rendering.\n *\n * Note: The returned ID will initially be `null` and will update after a\n * component mounts. Users may need to supply their own ID if they need\n * consistent values for SSR.\n *\n * @see Docs https://reach.tech/auto-id\n */\nfunction useId(idFromProps: string): string\nfunction useId(idFromProps: number): number\nfunction useId(idFromProps: string | number): string | number\nfunction useId(idFromProps: string | undefined | null): string | undefined\nfunction useId(idFromProps: number | undefined | null): number | undefined\nfunction useId(idFromProps: string | number | undefined | null): string | number | undefined\nfunction useId(): string | undefined\n\nfunction useId(providedId?: number | string | undefined | null) {\n // TODO: Remove error flag when updating internal deps to React 18. None of\n // our tricks will play well with concurrent rendering anyway.\n\n // native doesn't support until next react-native version, need to remove eventually\n if (isWeb) {\n if (typeof React.useId === 'function') {\n let id = React.useId()\n return providedId != null ? providedId : id\n }\n }\n\n // If this instance isn't part of the initial render, we don't have to do the\n // double render/patch-up dance. We can just generate the ID and return it.\n let initialId = providedId ?? (serverHandoffComplete ? genId() : null)\n let [id, setId] = React.useState(initialId)\n\n useIsomorphicLayoutEffect(() => {\n if (id === null) {\n // Patch the ID after render. We do this in `useLayoutEffect` to avoid any\n // rendering flicker, though it'll make the first render slower (unlikely\n // to matter, but you're welcome to measure your app and let us know if\n // it's a problem).\n setId(genId())\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n React.useEffect(() => {\n if (serverHandoffComplete === false) {\n // Flag all future uses of `useId` to skip the update dance. This is in\n // `useEffect` because it goes after `useLayoutEffect`, ensuring we don't\n // accidentally bail out of the patch-up dance prematurely.\n serverHandoffComplete = true\n }\n }, [])\n\n return providedId ?? id ?? undefined\n}\n\nexport { useId }\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDA,YAAuB;AAEvB,sBAAiD;AAEjD,IAAI,wBAAwB;AAC5B,IAAI,KAAK;AACT,iBAAiB;AACf,SAAO,EAAE;AACX;AAuBA,eAAe,YAAiD;AAK9D,MAAI,uBAAO;AACT,QAAI,OAAO,MAAM,UAAU,YAAY;AACrC,UAAI,MAAK,MAAM,MAAM;AACrB,aAAO,cAAc,OAAO,aAAa;AAAA,IAC3C;AAAA,EACF;AAIA,MAAI,YAAY,cAAe,yBAAwB,MAAM,IAAI;AACjE,MAAI,CAAC,KAAI,SAAS,MAAM,SAAS,SAAS;AAE1C,iDAA0B,MAAM;AAC9B,QAAI,QAAO,MAAM;AAKf,YAAM,MAAM,CAAC;AAAA,IACf;AAAA,EAEF,GAAG,CAAC,CAAC;AAEL,QAAM,UAAU,MAAM;AACpB,QAAI,0BAA0B,OAAO;AAInC,8BAAwB;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,cAAc,OAAM;AAC7B;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../hooks/useTheme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n const missingTheme = !themes || !name || !theme\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => (missingTheme ? null : wrapThemeManagerContext(props.children, themeManager)),\n [props.children, themeManager]\n )\n\n if (missingTheme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n if (isWeb) {\n return (\n <span\n className={(!props.disableThemeClass\n ? [props.className, className].filter(Boolean)\n : []\n ).join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqC;AAErC,sBAAsB;AACtB,qCAAwC;AACxC,sBAAqC;AAIrC,qBAAM;AAEC,MAAM,QAAQ,uBAAK,gBAAe,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,0CACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,QAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;AAI1C,QAAM,WAAW,0BACf,MAAO,eAAe,OAAO,4DAAwB,MAAM,UAAU,YAAY,GACjF,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,cAAc;AAChB,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,uBAAO;AACT,WACE,mDAAC;AAAA,MACC,WAAY,EAAC,MAAM,oBACf,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAC3C,CAAC,GACH,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,CAAC;",
4
+ "sourcesContent": ["import React, { memo, useEffect, useMemo, useRef } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../hooks/useTheme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n const missingTheme = !themes || !name || !theme\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => (missingTheme ? null : wrapThemeManagerContext(props.children, themeManager)),\n [props.children, themeManager]\n )\n\n if (missingTheme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n if (isWeb) {\n return (\n <span\n className={(!props.disableThemeClass\n ? [props.className, className].filter(Boolean)\n : []\n ).join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwD;AAExD,sBAAsB;AACtB,qCAAwC;AACxC,sBAAqC;AAIrC,qBAAM;AAEC,MAAM,QAAQ,uBAAK,gBAAe,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,0CACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,QAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;AAI1C,QAAM,WAAW,0BACf,MAAO,eAAe,OAAO,4DAAwB,MAAM,UAAU,YAAY,GACjF,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,cAAc;AAChB,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,uBAAO;AACT,WACE,mDAAC;AAAA,MACC,WAAY,EAAC,MAAM,oBACf,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAC3C,CAAC,GACH,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,10 @@
1
- import * as RNW from "react-native-web";
2
- const rnw = RNW.TamaguiExports;
1
+ const interopRequire = (x) => "default" in x ? x.default : x;
2
+ const rnw = {};
3
+ if (process.env.IS_STATIC === "is_static") {
4
+ Object.assign(rnw, interopRequire(require("react-native-web/dist/cjs/tamagui-exports")));
5
+ } else if (process.env.TAMAGUI_TARGET === "web") {
6
+ Object.assign(rnw, interopRequire(require("react-native-web")).TamaguiExports);
7
+ }
3
8
  export {
4
9
  rnw
5
10
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/constants/rnw.tsx"],
4
- "sourcesContent": ["import * as RNW from 'react-native-web'\n\nexport const rnw = RNW.TamaguiExports\n\n// const interopRequire = (x: any) => ('default' in x ? x.default : x)\n// export const rnw: any = {}\n\n// // in static mode, require them directly since we can't import react-native-web at all (it has flow stuff in it)\n// if (process.env.IS_STATIC === 'is_static') {\n// Object.assign(rnw, interopRequire(require('react-native-web/dist/cjs/tamagui-exports')))\n// } else if (process.env.TAMAGUI_TARGET === 'web') {\n// Object.assign(rnw, interopRequire(require('react-native-web').TamaguiExports))\n// }\n"],
5
- "mappings": "AAAA;AAEO,MAAM,MAAM,IAAI;",
4
+ "sourcesContent": ["const interopRequire = (x: any) => ('default' in x ? x.default : x)\nexport const rnw: any = {}\n\n// in static mode, require them directly since we can't import react-native-web at all (it has flow stuff in it)\nif (process.env.IS_STATIC === 'is_static') {\n Object.assign(rnw, interopRequire(require('react-native-web/dist/cjs/tamagui-exports')))\n} else if (process.env.TAMAGUI_TARGET === 'web') {\n Object.assign(rnw, interopRequire(require('react-native-web')).TamaguiExports)\n}\n"],
5
+ "mappings": "AAAA,MAAM,iBAAiB,CAAC,MAAY,aAAa,IAAI,EAAE,UAAU;AAC1D,MAAM,MAAW,CAAC;AAGzB,IAAI,QAAQ,IAAI,cAAc,aAAa;AACzC,SAAO,OAAO,KAAK,eAAe,QAAQ,2CAA2C,CAAC,CAAC;AACzF,WAAW,QAAQ,IAAI,mBAAmB,OAAO;AAC/C,SAAO,OAAO,KAAK,eAAe,QAAQ,kBAAkB,CAAC,EAAE,cAAc;AAC/E;",
6
6
  "names": []
7
7
  }
@@ -37,6 +37,7 @@ import React, {
37
37
  createElement,
38
38
  forwardRef,
39
39
  memo,
40
+ startTransition,
40
41
  useCallback,
41
42
  useContext,
42
43
  useMemo,
@@ -116,14 +117,14 @@ function createComponent(configIn, ParentComponent) {
116
117
  var _a, _d, _e, _f;
117
118
  let props;
118
119
  if (tamaguiDefaultProps && !propsIn.asChild) {
119
- props = mergeProps(tamaguiDefaultProps, propsIn);
120
+ props = mergeProps(tamaguiDefaultProps, propsIn)[0];
120
121
  } else {
121
122
  props = propsIn;
122
123
  }
123
124
  const { Component, isText, isZStack } = staticConfig;
124
125
  const componentName = props.componentName || staticConfig.componentName;
125
126
  const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
126
- if (true) {
127
+ if (process.env.NODE_ENV === "development") {
127
128
  if (props["debug"]) {
128
129
  console.log("\u26A0\uFE0F", componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "debug on");
129
130
  console.log("props in:", {
@@ -131,8 +132,9 @@ function createComponent(configIn, ParentComponent) {
131
132
  props,
132
133
  ordered: Object.keys(props)
133
134
  });
134
- if (props["debug"] === "break")
135
+ if (props["debug"] === "break") {
135
136
  debugger;
137
+ }
136
138
  }
137
139
  }
138
140
  const forceUpdate = useForceUpdate();
@@ -420,9 +422,6 @@ function createComponent(configIn, ParentComponent) {
420
422
  }
421
423
  const _focusable = focusable != void 0 ? focusable : accessible;
422
424
  const role = viewProps.role;
423
- if (props["debug"]) {
424
- console.log("_focusable", focusable);
425
- }
426
425
  if (_focusable === false) {
427
426
  viewProps.tabIndex = "-1";
428
427
  }
@@ -444,7 +443,7 @@ function createComponent(configIn, ParentComponent) {
444
443
  viewProps.ref = forwardedRef;
445
444
  }
446
445
  }
447
- if (props["debug"]) {
446
+ if (process.env.NODE_ENV === "development" && props["debug"]) {
448
447
  console.log("viewProps", elementType, viewProps.role, viewProps.tabIndex);
449
448
  }
450
449
  if (!isText && isWeb) {
@@ -462,8 +461,10 @@ function createComponent(configIn, ParentComponent) {
462
461
  }
463
462
  useIsomorphicLayoutEffect(() => {
464
463
  if (typeof window !== "undefined" && (hasEnterStyle || props.animation)) {
465
- setStateShallow({
466
- mounted: true
464
+ startTransition(() => {
465
+ setStateShallow({
466
+ mounted: true
467
+ });
467
468
  });
468
469
  }
469
470
  internal.current.isMounted = true;
@@ -758,18 +759,19 @@ function createComponent(configIn, ParentComponent) {
758
759
  }
759
760
  continue;
760
761
  }
761
- prev = mergeProps(prev || {}, props);
762
+ prev = mergeProps(prev || {}, props)[0];
762
763
  DefaultProps.set(n, prev);
763
764
  }
764
765
  const ourDefaultsMerged = DefaultProps.get(staticConfig.componentName);
765
766
  if (ourDefaultsMerged) {
766
- defaultPropsIn = mergeProps(defaultPropsIn, ourDefaultsMerged);
767
+ defaultPropsIn = mergeProps(defaultPropsIn, ourDefaultsMerged)[0];
767
768
  }
768
769
  }
769
- if (process.env.NODE_ENV === "development" && defaultPropsIn["debug"] === "break") {
770
+ if (defaultPropsIn["debug"] === "break") {
770
771
  debugger;
771
772
  }
772
- initialSplitStyles = insertSplitStyles(defaultPropsIn, staticConfig, initialTheme, {
773
+ const [parentProps, parentClassNames] = mergeProps(defaultPropsIn, {}, true);
774
+ initialSplitStyles = insertSplitStyles(parentProps, staticConfig, initialTheme, {
773
775
  mounted: true,
774
776
  hover: false,
775
777
  press: false,
@@ -778,13 +780,14 @@ function createComponent(configIn, ParentComponent) {
778
780
  resolveVariablesAs: "both",
779
781
  keepVariantsAsProps: true
780
782
  }, void 0, staticConfig.defaultProps["debug"]);
781
- const defaults = mergeProps(component.defaultProps, initialSplitStyles.viewProps);
783
+ const [defaults, defaultsClassnames] = mergeProps(component.defaultProps, initialSplitStyles.viewProps, true);
784
+ initialSplitStyles.classNames = __spreadValues(__spreadValues(__spreadValues({}, parentClassNames), defaultsClassnames), initialSplitStyles.classNames);
782
785
  defaultNativeStyle = {};
783
786
  const validStyles2 = staticConfig.validStyles || stylePropsView;
784
787
  if (!isWeb) {
785
788
  for (const key in staticConfig.defaultProps) {
786
789
  const val = staticConfig.defaultProps[key];
787
- if (typeof val === "string" && val[0] === "$" || !validStyles2[key] || val[0] === "_") {
790
+ if (typeof val === "string" && val[0] === "$" || !validStyles2[key]) {
788
791
  defaults[key] = val;
789
792
  } else {
790
793
  defaultNativeStyle[key] = val;
@@ -893,7 +896,7 @@ function spacedChildren({
893
896
  }
894
897
  const final = [];
895
898
  for (const [index, child] of childrenList.entries()) {
896
- const isEmpty = child === null || child === void 0 || child === false || Array.isArray(child) && child.length === 0;
899
+ const isEmpty = child === null || child === void 0 || Array.isArray(child) && child.length === 0;
897
900
  if (isEmpty || !child || child["key"] && !isZStack) {
898
901
  final.push(child);
899
902
  } else {