@tamagui/core 1.0.1-beta.46 → 1.0.1-beta.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Tamagui.js +3 -0
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/ThemeManager.js.map +2 -2
- package/dist/cjs/conf.js +0 -4
- package/dist/cjs/conf.js.map +2 -2
- package/dist/cjs/createComponent.js +172 -167
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +71 -29
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +3 -1
- package/dist/cjs/createTheme.js.map +2 -2
- package/dist/cjs/createTokens.js +4 -19
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createVariable.js +22 -8
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js +57 -0
- package/dist/cjs/createVariables.js.map +7 -0
- package/dist/cjs/helpers/createPropMapper.js +81 -51
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/generateAtomicStyles.js +41 -36
- package/dist/cjs/helpers/generateAtomicStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +36 -5
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStackSize.js +4 -4
- package/dist/cjs/helpers/getStackSize.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +9 -2
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +2 -0
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/validate.js +2 -2
- package/dist/cjs/helpers/validate.js.map +2 -2
- package/dist/cjs/hooks/useIsMounted.js +2 -2
- package/dist/cjs/hooks/useIsMounted.js.map +2 -2
- package/dist/cjs/index.js +2 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/styled.js +5 -0
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Slot.js +5 -8
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/cjs/views/Theme.js +3 -2
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/esm/Tamagui.js +3 -0
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/ThemeManager.js.map +2 -2
- package/dist/esm/conf.js +0 -4
- package/dist/esm/conf.js.map +2 -2
- package/dist/esm/createComponent.js +172 -168
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +70 -29
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTheme.js +3 -1
- package/dist/esm/createTheme.js.map +2 -2
- package/dist/esm/createTokens.js +3 -17
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createVariable.js +22 -7
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js +35 -0
- package/dist/esm/createVariables.js.map +7 -0
- package/dist/esm/helpers/createPropMapper.js +70 -51
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/generateAtomicStyles.js +41 -36
- package/dist/esm/helpers/generateAtomicStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +37 -6
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStackSize.js +1 -1
- package/dist/esm/helpers/getStackSize.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +7 -1
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +2 -0
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/validate.js +2 -2
- package/dist/esm/helpers/validate.js.map +2 -2
- package/dist/esm/hooks/useIsMounted.js +1 -1
- package/dist/esm/hooks/useIsMounted.js.map +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/styled.js +5 -0
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/Slot.js +5 -8
- package/dist/esm/views/Slot.js.map +2 -2
- package/dist/esm/views/Theme.js +3 -2
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/jsx/Tamagui.js +3 -0
- package/dist/jsx/conf.js +0 -4
- package/dist/jsx/createComponent.js +172 -168
- package/dist/jsx/createTamagui.js +70 -29
- package/dist/jsx/createTheme.js +3 -1
- package/dist/jsx/createTokens.js +3 -17
- package/dist/jsx/createVariable.js +22 -7
- package/dist/jsx/createVariables.js +34 -0
- package/dist/jsx/helpers/createPropMapper.js +70 -51
- package/dist/jsx/helpers/generateAtomicStyles.js +41 -36
- package/dist/jsx/helpers/getSplitStyles.js +37 -6
- package/dist/jsx/helpers/getStackSize.js +1 -1
- package/dist/jsx/helpers/getStylesAtomic.js +7 -1
- package/dist/jsx/helpers/insertStyleRule.js +2 -0
- package/dist/jsx/helpers/validate.js +2 -2
- package/dist/jsx/hooks/useIsMounted.js +1 -1
- package/dist/jsx/index.js +2 -2
- package/dist/jsx/styled.js +5 -0
- package/dist/jsx/views/Slot.js +5 -8
- package/dist/jsx/views/Theme.js +3 -2
- package/package.json +5 -5
- package/reset.css +1 -1
- package/types/ThemeManager.d.ts.map +1 -1
- package/types/conf.d.ts +1 -1
- package/types/conf.d.ts.map +1 -1
- package/types/createComponent.d.ts +1 -0
- package/types/createComponent.d.ts.map +1 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/createTheme.d.ts +1 -1
- package/types/createTheme.d.ts.map +1 -1
- package/types/createTokens.d.ts +0 -1
- package/types/createTokens.d.ts.map +1 -1
- package/types/createVariable.d.ts +15 -13
- package/types/createVariable.d.ts.map +1 -1
- package/types/createVariables.d.ts +10 -0
- package/types/createVariables.d.ts.map +1 -0
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/generateAtomicStyles.d.ts.map +1 -1
- package/types/helpers/getSize.d.ts +1 -1
- package/types/helpers/getSize.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStackSize.d.ts +4 -5
- package/types/helpers/getStackSize.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts +5 -0
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getVariantExtras.d.ts +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/hooks/useIsMounted.d.ts.map +1 -1
- package/types/index.d.ts +2 -1
- package/types/index.d.ts.map +1 -1
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +10 -7
- package/types/types.d.ts.map +1 -1
- package/types/views/Slot.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
package/dist/esm/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Image, Text, TextInput } from 'react-native'\n\nimport { createComponent } from './createComponent'\nimport { RNComponents } from './helpers/RNComponents'\nimport {\n GetProps,\n GetVariantValues,\n MediaProps,\n PseudoProps,\n StaticConfig,\n StylableComponent,\n TamaguiComponent,\n VariantDefinitions,\n VariantSpreadFunction,\n} from './types'\
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AACA;
|
|
4
|
+
"sourcesContent": ["import { Image, Text, TextInput } from 'react-native'\n\nimport { createComponent } from './createComponent'\nimport { RNComponents } from './helpers/RNComponents'\nimport {\n GetProps,\n GetVariantValues,\n MediaProps,\n PseudoProps,\n StaticConfig,\n StylableComponent,\n TamaguiComponent,\n VariantDefinitions,\n VariantSpreadFunction,\n} from './types'\n\n// TODO may be able to use this in the options?: arg below directly\nexport type StyledOptions<ParentComponent extends StylableComponent> = GetProps<ParentComponent> & {\n name?: string\n variants?: VariantDefinitions<ParentComponent> | undefined\n defaultVariants?: { [key: string]: any }\n}\n\nexport function styled<\n ParentComponent extends StylableComponent,\n Variants extends VariantDefinitions<ParentComponent> | void = VariantDefinitions<ParentComponent> | void\n>(\n Component: ParentComponent,\n // this should be Partial<GetProps<ParentComponent>> but causes excessively deep type issues\n options?: GetProps<ParentComponent> & {\n name?: string\n variants?: Variants | undefined\n // thought i had this typed, but can't get it linked\n defaultVariants?: { [key: string]: any }\n },\n staticExtractionOptions?: Partial<StaticConfig>\n) {\n // for now wrapping a styled() around an extractable() HOC (like Button) isn't allowed\n if (process.env.NODE_ENV === 'development') {\n if (Component['staticConfig'] && Component['staticConfig'].isExtractable) {\n console.warn(\n `Warning: Wrapping styled() around an extractable HOC component isn't allowed yet. Support for this is on the roadmap, see: https://github.com/tamagui/tamagui/issues/88.`\n )\n // return (props) => {\n // // @ts-ignore\n // return <Component {...options} {...props} />\n // }\n }\n }\n\n const staticConfigProps = (() => {\n if (options) {\n const { variants, name, defaultVariants, ...defaultProps } = options\n if (defaultVariants) {\n Object.assign(defaultProps, defaultVariants)\n }\n const isReactNativeWeb =\n 'staticConfig' in Component\n ? Component.staticConfig.isReactNativeWeb\n : RNComponents.has(Component)\n const reactNativeWebComponent = isReactNativeWeb\n ? Component['staticConfig']?.reactNativeWebComponent || Component\n : null\n const isTamagui = !isReactNativeWeb && 'staticConfig' in Component\n const Comp = reactNativeWebComponent || (Component as any)\n const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false))\n const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false))\n const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false))\n\n const conf: Partial<StaticConfig> = {\n ...staticExtractionOptions,\n ...(!isTamagui && {\n Component: Comp,\n }),\n isTamagui,\n // this type gets messed up by options?: Partial<GetProps<ParentComponent>> above\n // take away the Partial<> and it's fine\n variants,\n defaultProps,\n defaultVariants,\n componentName: name,\n isReactNativeWeb,\n // for nesting multiple levels of rnw styled() need keep use the OG component\n reactNativeWebComponent,\n isInput,\n isText,\n isImage,\n }\n\n return conf\n }\n return {}\n })()\n\n const component = createComponent(staticConfigProps, Component)\n\n // get parent props without pseudos and medias so we can rebuild both with new variants\n type ParentPropsBase = ParentComponent extends TamaguiComponent<any, any, infer P>\n ? P\n : GetProps<ParentComponent>\n type ParentVariants = ParentComponent extends TamaguiComponent<any, any, any, infer V> ? V : {}\n\n type OurVariants = Variants extends void\n ? {}\n : {\n [Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>\n ? Val\n : GetVariantValues<keyof Variants[Key]>\n }\n\n type VariantProps = Omit<ParentVariants, keyof OurVariants> & OurVariants\n type OurPropsBase = ParentPropsBase & VariantProps\n\n type Props = Variants extends void\n ? GetProps<ParentComponent>\n : // start with base props\n OurPropsBase &\n // add in media (+ pseudos nested)\n MediaProps<Partial<OurPropsBase>> &\n // add in pseudos\n PseudoProps<Partial<OurPropsBase>>\n\n return component as TamaguiComponent<\n Props,\n // TODO infer ref\n any,\n ParentPropsBase,\n ParentVariants & OurVariants\n >\n}\n\n// breaking...\n// TODO see core/types.ts bug\n\n// export const XStack = styled(Stack, {\n// variants: {\n// horizontal: {\n// true: {\n// // flexDirection: 'row',\n// width: 0,\n// },\n// },\n// },\n// })\n\n// const Separator = styled(Stack, {\n// variants: {\n// vertical: {\n// true: {\n// flexDirection: 'row',\n// },\n// },\n// },\n// <--- have to add as const to get working???\n// })\n\n// type props = GetProps<typeof XStack>\n// type variants = typeof XStack extends TamaguiComponent<any, infer Variants> ? Variants : never\n// type variants2 = typeof Separator extends TamaguiComponent<any, infer Variants> ? Variants : never\n\n// const x = <XStack horizontal />\n// const x2 = <Separator vertical />\n"],
|
|
5
|
+
"mappings": ";;AAAA;AAEA;AACA;AAoBO,gBAIL,WAEA,SAMA,yBACA;AAEA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,UAAU,mBAAmB,UAAU,gBAAgB,eAAe;AACxE,cAAQ,KACN,0KACF;AAAA,IAKF;AAAA,EACF;AAEA,QAAM,oBAAqB,OAAM;AAlDnC;AAmDI,QAAI,SAAS;AACX,YAAM,EAAE,UAAU,MAAM,oBAAoB,iBAAiB;AAC7D,UAAI,iBAAiB;AACnB,eAAO,OAAO,cAAc,eAAe;AAAA,MAC7C;AACA,YAAM,mBACJ,kBAAkB,YACd,UAAU,aAAa,mBACvB,aAAa,IAAI,SAAS;AAChC,YAAM,0BAA0B,mBAC5B,iBAAU,oBAAV,mBAA2B,4BAA2B,YACtD;AACJ,YAAM,YAAY,CAAC,oBAAoB,kBAAkB;AACzD,YAAM,OAAO,2BAA4B;AACzC,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,QAAQ;AAC1E,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,YAAY;AAC9E,YAAM,SAAS,CAAC,CAAE,cAAa,UAAW,EAAC,YAAY,WAAW,SAAS,OAAO;AAElF,YAAM,OAA8B;AAAA,QAClC,GAAG;AAAA,QACH,GAAI,CAAC,aAAa;AAAA,UAChB,WAAW;AAAA,QACb;AAAA,QACA;AAAA,QAGA;AAAA,QACA;AAAA,QACA;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QAEA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AACA,WAAO,CAAC;AAAA,EACV,GAAG;AAEH,QAAM,YAAY,gBAAgB,mBAAmB,SAAS;AA4B9D,SAAO;AAOT;AA1GgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/views/Slot.js
CHANGED
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { composeRefs } from "@tamagui/compose-refs";
|
|
4
4
|
import * as React from "react";
|
|
5
|
+
import { isWeb } from "../constants/platform";
|
|
5
6
|
const Slot = React.forwardRef((props, forwardedRef) => {
|
|
6
7
|
const { children, ...slotProps } = props;
|
|
7
8
|
return /* @__PURE__ */ React.createElement(SlotClone, {
|
|
@@ -25,15 +26,11 @@ SlotClone.displayName = "SlotClone";
|
|
|
25
26
|
const Slottable = /* @__PURE__ */ __name(({ children }) => {
|
|
26
27
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
27
28
|
}, "Slottable");
|
|
28
|
-
|
|
29
|
-
return React.isValidElement(child);
|
|
30
|
-
}
|
|
31
|
-
__name(isSlottable, "isSlottable");
|
|
32
|
-
const pressMap = {
|
|
29
|
+
const pressMap = isWeb ? {
|
|
33
30
|
onPress: "onClick",
|
|
34
|
-
onPressOut: "
|
|
35
|
-
onPressIn: "
|
|
36
|
-
};
|
|
31
|
+
onPressOut: "onMouseUp",
|
|
32
|
+
onPressIn: "onMouseDown"
|
|
33
|
+
} : {};
|
|
37
34
|
function mergeProps(child, slotProps) {
|
|
38
35
|
const childProps = child.props;
|
|
39
36
|
const overrideProps = { ...childProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Slot.tsx"],
|
|
4
|
-
"sourcesContent": ["// via radix\n\nimport { composeRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SlotProps = {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n )\n})\n\nSlot.displayName = 'Slot'\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode\n}\n\nconst SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.isValidElement(children)) {\n const childProps = {\n ...mergeProps(children, slotProps),\n ref: composeRefs(forwardedRef, (children as any).ref),\n }\n return React.cloneElement(children, childProps)\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null\n})\n\nSlotClone.displayName = 'SlotClone'\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Slottable = ({ children }: { children: React.ReactNode }) => {\n return <>{children}</>\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>\n\
|
|
5
|
-
"mappings": ";;AAEA;AACA;AAUO,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAM,EAAE,aAAa,cAAc;AACnC,SACE,oCAAC;AAAA,IAAW,GAAG;AAAA,IAAW,KAAK;AAAA,KAC5B,QACH;AAEJ,CAAC;AAED,KAAK,cAAc;AAUnB,MAAM,YAAY,MAAM,WAAgC,CAAC,OAAO,iBAAiB;AAC/E,QAAM,EAAE,aAAa,cAAc;AAEnC,MAAI,MAAM,eAAe,QAAQ,GAAG;AAClC,UAAM,aAAa;AAAA,MACjB,GAAG,WAAW,UAAU,SAAS;AAAA,MACjC,KAAK,YAAY,cAAe,SAAiB,GAAG;AAAA,IACtD;AACA,WAAO,MAAM,aAAa,UAAU,UAAU;AAAA,EAChD;AAEA,SAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,IAAI,MAAM,SAAS,KAAK,IAAI,IAAI;AAC1E,CAAC;AAED,UAAU,cAAc;AAMjB,MAAM,YAAY,wBAAC,EAAE,eAA8C;AACxE,SAAO,0DAAG,QAAS;AACrB,GAFyB;
|
|
4
|
+
"sourcesContent": ["// via radix\n\nimport { composeRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\nimport { isWeb } from '../constants/platform'\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SlotProps = {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n )\n})\n\nSlot.displayName = 'Slot'\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode\n}\n\nconst SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.isValidElement(children)) {\n const childProps = {\n ...mergeProps(children, slotProps),\n ref: composeRefs(forwardedRef, (children as any).ref),\n }\n return React.cloneElement(children, childProps)\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null\n})\n\nSlotClone.displayName = 'SlotClone'\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Slottable = ({ children }: { children: React.ReactNode }) => {\n return <>{children}</>\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>\n\n// function isSlottable(child: React.ReactNode): child is React.ReactElement {\n// return React.isValidElement(child)\n// }\n\nconst pressMap = isWeb\n ? {\n onPress: 'onClick',\n onPressOut: 'onMouseUp',\n onPressIn: 'onMouseDown',\n }\n : {}\n\nfunction mergeProps(child: any, slotProps: AnyProps) {\n const childProps = child.props\n\n // all child props should override\n const overrideProps = { ...childProps }\n\n const isHTMLChild = typeof child.type === 'string'\n\n if (isHTMLChild) {\n for (const key in pressMap) {\n if (key in slotProps) {\n slotProps[pressMap[key]] = slotProps[key]\n delete slotProps[key]\n }\n }\n }\n\n for (let propName in childProps) {\n const slotPropValue = slotProps[propName]\n const childPropValue = childProps[propName]\n\n if (isHTMLChild && pressMap[propName]) {\n propName = pressMap[propName]\n delete overrideProps[propName]\n }\n\n const isHandler = /^on[A-Z]/.test(propName)\n // if it's a handler, modify the override by composing the base handler\n if (isHandler) {\n overrideProps[propName] = (...args: unknown[]) => {\n childPropValue?.(...args)\n slotPropValue?.(...args)\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue }\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ')\n }\n }\n\n return { ...slotProps, ...overrideProps }\n}\n"],
|
|
5
|
+
"mappings": ";;AAEA;AACA;AAEA;AAUO,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAM,EAAE,aAAa,cAAc;AACnC,SACE,oCAAC;AAAA,IAAW,GAAG;AAAA,IAAW,KAAK;AAAA,KAC5B,QACH;AAEJ,CAAC;AAED,KAAK,cAAc;AAUnB,MAAM,YAAY,MAAM,WAAgC,CAAC,OAAO,iBAAiB;AAC/E,QAAM,EAAE,aAAa,cAAc;AAEnC,MAAI,MAAM,eAAe,QAAQ,GAAG;AAClC,UAAM,aAAa;AAAA,MACjB,GAAG,WAAW,UAAU,SAAS;AAAA,MACjC,KAAK,YAAY,cAAe,SAAiB,GAAG;AAAA,IACtD;AACA,WAAO,MAAM,aAAa,UAAU,UAAU;AAAA,EAChD;AAEA,SAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,IAAI,MAAM,SAAS,KAAK,IAAI,IAAI;AAC1E,CAAC;AAED,UAAU,cAAc;AAMjB,MAAM,YAAY,wBAAC,EAAE,eAA8C;AACxE,SAAO,0DAAG,QAAS;AACrB,GAFyB;AAYzB,MAAM,WAAW,QACb;AAAA,EACE,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,WAAW;AACb,IACA,CAAC;AAEL,oBAAoB,OAAY,WAAqB;AACnD,QAAM,aAAa,MAAM;AAGzB,QAAM,gBAAgB,EAAE,GAAG,WAAW;AAEtC,QAAM,cAAc,OAAO,MAAM,SAAS;AAE1C,MAAI,aAAa;AACf,eAAW,OAAO,UAAU;AAC1B,UAAI,OAAO,WAAW;AACpB,kBAAU,SAAS,QAAQ,UAAU;AACrC,eAAO,UAAU;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAEA,WAAS,YAAY,YAAY;AAC/B,UAAM,gBAAgB,UAAU;AAChC,UAAM,iBAAiB,WAAW;AAElC,QAAI,eAAe,SAAS,WAAW;AACrC,iBAAW,SAAS;AACpB,aAAO,cAAc;AAAA,IACvB;AAEA,UAAM,YAAY,WAAW,KAAK,QAAQ;AAE1C,QAAI,WAAW;AACb,oBAAc,YAAY,IAAI,SAAoB;AAChD,yDAAiB,GAAG;AACpB,uDAAgB,GAAG;AAAA,MACrB;AAAA,IACF,WAES,aAAa,SAAS;AAC7B,oBAAc,YAAY,EAAE,GAAG,eAAe,GAAG,eAAe;AAAA,IAClE,WAAW,aAAa,aAAa;AACnC,oBAAc,YAAY,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,WAAW,GAAG,cAAc;AAC1C;AA3CS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/views/Theme.js
CHANGED
|
@@ -8,13 +8,14 @@ React["createElement"];
|
|
|
8
8
|
const Theme = memo(/* @__PURE__ */ __name(function Theme2(props) {
|
|
9
9
|
var _a, _b;
|
|
10
10
|
const { name, theme, themeManager, themes, className } = useChangeThemeEffect(props.name, props.componentName, props);
|
|
11
|
-
|
|
11
|
+
const missingTheme = !themes || !name || !theme;
|
|
12
|
+
const contents = useMemo(() => missingTheme ? null : wrapThemeManagerContext(props.children, themeManager), [props.children, themeManager]);
|
|
13
|
+
if (missingTheme) {
|
|
12
14
|
if (name && !theme && process.env.NODE_ENV === "development") {
|
|
13
15
|
console.warn(`No theme found by name ${name}`);
|
|
14
16
|
}
|
|
15
17
|
return props.children;
|
|
16
18
|
}
|
|
17
|
-
const contents = useMemo(() => wrapThemeManagerContext(props.children, themeManager), [props.children, themeManager]);
|
|
18
19
|
if (isWeb) {
|
|
19
20
|
return /* @__PURE__ */ React.createElement("span", {
|
|
20
21
|
className: [
|
|
@@ -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
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM;AAEC,MAAM,QAAQ,KAAK,uCAAe,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,qBACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,
|
|
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={[\n `tui_Theme`,\n ...(!props.disableThemeClass ? [props.className, className].filter(Boolean) : []),\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;AAEA;AACA;AACA;AAIA,MAAM;AAEC,MAAM,QAAQ,KAAK,uCAAe,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,qBACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,QAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;AAI1C,QAAM,WAAW,QACf,MAAO,eAAe,OAAO,wBAAwB,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,OAAO;AACT,WACE,oCAAC;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,GAAI,CAAC,MAAM,oBAAoB,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,MACjF,EAAE,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,GA1C0B,QA0CzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/Tamagui.js
CHANGED
|
@@ -34,6 +34,9 @@ const getValueFromIdentifier = /* @__PURE__ */ __name((identifier) => {
|
|
|
34
34
|
const setIdentifierValue = /* @__PURE__ */ __name((identifier, value) => {
|
|
35
35
|
identifierToValue.set(identifier, value);
|
|
36
36
|
}, "setIdentifierValue");
|
|
37
|
+
if (!globalThis["Tamagui"]) {
|
|
38
|
+
globalThis["Tamagui"] = Tamagui;
|
|
39
|
+
}
|
|
37
40
|
export {
|
|
38
41
|
Tamagui,
|
|
39
42
|
getValueFromIdentifier,
|
package/dist/jsx/conf.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { Tamagui } from "./Tamagui";
|
|
4
3
|
let conf;
|
|
5
4
|
const setConfig = /* @__PURE__ */ __name((next) => {
|
|
6
5
|
conf = next;
|
|
@@ -20,9 +19,6 @@ const onConfiguredOnce = /* @__PURE__ */ __name((cb) => {
|
|
|
20
19
|
} else {
|
|
21
20
|
configListeners.add(cb);
|
|
22
21
|
}
|
|
23
|
-
if (!globalThis["Tamagui"]) {
|
|
24
|
-
globalThis["Tamagui"] = Tamagui;
|
|
25
|
-
}
|
|
26
22
|
}, "onConfiguredOnce");
|
|
27
23
|
export {
|
|
28
24
|
configListeners,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { stylePropsView } from "@tamagui/helpers";
|
|
3
|
+
import { stylePropsView, validStyles } from "@tamagui/helpers";
|
|
4
4
|
import { useForceUpdate } from "@tamagui/use-force-update";
|
|
5
5
|
import React, {
|
|
6
6
|
Children,
|
|
@@ -244,164 +244,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
244
244
|
...webProps
|
|
245
245
|
} = nonTamaguiProps;
|
|
246
246
|
viewProps = webProps;
|
|
247
|
-
|
|
248
|
-
if (accessibilityRole === "none") {
|
|
249
|
-
viewProps.role = "presentation";
|
|
250
|
-
} else {
|
|
251
|
-
const webRole = accessibilityRoleToWebRole[accessibilityRole];
|
|
252
|
-
if (webRole != null) {
|
|
253
|
-
viewProps.role = webRole || accessibilityRole;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
const role = viewProps.role;
|
|
258
|
-
if (accessibilityActiveDescendant != null) {
|
|
259
|
-
viewProps["aria-activedescendant"] = accessibilityActiveDescendant;
|
|
260
|
-
}
|
|
261
|
-
if (accessibilityAtomic != null) {
|
|
262
|
-
viewProps["aria-atomic"] = accessibilityAtomic;
|
|
263
|
-
}
|
|
264
|
-
if (accessibilityAutoComplete != null) {
|
|
265
|
-
viewProps["aria-autocomplete"] = accessibilityAutoComplete;
|
|
266
|
-
}
|
|
267
|
-
if (accessibilityBusy != null) {
|
|
268
|
-
viewProps["aria-busy"] = accessibilityBusy;
|
|
269
|
-
}
|
|
270
|
-
if (accessibilityChecked != null) {
|
|
271
|
-
viewProps["aria-checked"] = accessibilityChecked;
|
|
272
|
-
}
|
|
273
|
-
if (accessibilityColumnCount != null) {
|
|
274
|
-
viewProps["aria-colcount"] = accessibilityColumnCount;
|
|
275
|
-
}
|
|
276
|
-
if (accessibilityColumnIndex != null) {
|
|
277
|
-
viewProps["aria-colindex"] = accessibilityColumnIndex;
|
|
278
|
-
}
|
|
279
|
-
if (accessibilityColumnSpan != null) {
|
|
280
|
-
viewProps["aria-colspan"] = accessibilityColumnSpan;
|
|
281
|
-
}
|
|
282
|
-
if (accessibilityControls != null) {
|
|
283
|
-
viewProps["aria-controls"] = processIDRefList(accessibilityControls);
|
|
284
|
-
}
|
|
285
|
-
if (accessibilityCurrent != null) {
|
|
286
|
-
viewProps["aria-current"] = accessibilityCurrent;
|
|
287
|
-
}
|
|
288
|
-
if (accessibilityDescribedBy != null) {
|
|
289
|
-
viewProps["aria-describedby"] = processIDRefList(accessibilityDescribedBy);
|
|
290
|
-
}
|
|
291
|
-
if (accessibilityDetails != null) {
|
|
292
|
-
viewProps["aria-details"] = accessibilityDetails;
|
|
293
|
-
}
|
|
294
|
-
if (disabled === true) {
|
|
295
|
-
viewProps["aria-disabled"] = true;
|
|
296
|
-
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
297
|
-
viewProps.disabled = true;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if (accessibilityErrorMessage != null) {
|
|
301
|
-
viewProps["aria-errormessage"] = accessibilityErrorMessage;
|
|
302
|
-
}
|
|
303
|
-
if (accessibilityExpanded != null) {
|
|
304
|
-
viewProps["aria-expanded"] = accessibilityExpanded;
|
|
305
|
-
}
|
|
306
|
-
if (accessibilityFlowTo != null) {
|
|
307
|
-
viewProps["aria-flowto"] = processIDRefList(accessibilityFlowTo);
|
|
308
|
-
}
|
|
309
|
-
if (accessibilityHasPopup != null) {
|
|
310
|
-
viewProps["aria-haspopup"] = accessibilityHasPopup;
|
|
311
|
-
}
|
|
312
|
-
if (accessibilityHidden === true) {
|
|
313
|
-
viewProps["aria-hidden"] = accessibilityHidden;
|
|
314
|
-
}
|
|
315
|
-
if (accessibilityInvalid != null) {
|
|
316
|
-
viewProps["aria-invalid"] = accessibilityInvalid;
|
|
317
|
-
}
|
|
318
|
-
if (accessibilityKeyShortcuts != null && Array.isArray(accessibilityKeyShortcuts)) {
|
|
319
|
-
viewProps["aria-keyshortcuts"] = accessibilityKeyShortcuts.join(" ");
|
|
320
|
-
}
|
|
321
|
-
if (accessibilityLabel != null) {
|
|
322
|
-
viewProps["aria-label"] = accessibilityLabel;
|
|
323
|
-
}
|
|
324
|
-
if (accessibilityLabelledBy != null) {
|
|
325
|
-
viewProps["aria-labelledby"] = processIDRefList(accessibilityLabelledBy);
|
|
326
|
-
}
|
|
327
|
-
if (accessibilityLevel != null) {
|
|
328
|
-
viewProps["aria-level"] = accessibilityLevel;
|
|
329
|
-
}
|
|
330
|
-
if (accessibilityLiveRegion != null) {
|
|
331
|
-
viewProps["aria-live"] = accessibilityLiveRegion === "none" ? "off" : accessibilityLiveRegion;
|
|
332
|
-
}
|
|
333
|
-
if (accessibilityModal != null) {
|
|
334
|
-
viewProps["aria-modal"] = accessibilityModal;
|
|
335
|
-
}
|
|
336
|
-
if (accessibilityMultiline != null) {
|
|
337
|
-
viewProps["aria-multiline"] = accessibilityMultiline;
|
|
338
|
-
}
|
|
339
|
-
if (accessibilityMultiSelectable != null) {
|
|
340
|
-
viewProps["aria-multiselectable"] = accessibilityMultiSelectable;
|
|
341
|
-
}
|
|
342
|
-
if (accessibilityOrientation != null) {
|
|
343
|
-
viewProps["aria-orientation"] = accessibilityOrientation;
|
|
344
|
-
}
|
|
345
|
-
if (accessibilityOwns != null) {
|
|
346
|
-
viewProps["aria-owns"] = processIDRefList(accessibilityOwns);
|
|
347
|
-
}
|
|
348
|
-
if (accessibilityPlaceholder != null) {
|
|
349
|
-
viewProps["aria-placeholder"] = accessibilityPlaceholder;
|
|
350
|
-
}
|
|
351
|
-
if (accessibilityPosInSet != null) {
|
|
352
|
-
viewProps["aria-posinset"] = accessibilityPosInSet;
|
|
353
|
-
}
|
|
354
|
-
if (accessibilityPressed != null) {
|
|
355
|
-
viewProps["aria-pressed"] = accessibilityPressed;
|
|
356
|
-
}
|
|
357
|
-
if (accessibilityReadOnly != null) {
|
|
358
|
-
viewProps["aria-readonly"] = accessibilityReadOnly;
|
|
359
|
-
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
360
|
-
viewProps.readOnly = true;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
if (accessibilityRequired != null) {
|
|
364
|
-
viewProps["aria-required"] = accessibilityRequired;
|
|
365
|
-
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
366
|
-
viewProps.required = true;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
if (accessibilityRoleDescription != null) {
|
|
370
|
-
viewProps["aria-roledescription"] = accessibilityRoleDescription;
|
|
371
|
-
}
|
|
372
|
-
if (accessibilityRowCount != null) {
|
|
373
|
-
viewProps["aria-rowcount"] = accessibilityRowCount;
|
|
374
|
-
}
|
|
375
|
-
if (accessibilityRowIndex != null) {
|
|
376
|
-
viewProps["aria-rowindex"] = accessibilityRowIndex;
|
|
377
|
-
}
|
|
378
|
-
if (accessibilityRowSpan != null) {
|
|
379
|
-
viewProps["aria-rowspan"] = accessibilityRowSpan;
|
|
380
|
-
}
|
|
381
|
-
if (accessibilitySelected != null) {
|
|
382
|
-
viewProps["aria-selected"] = accessibilitySelected;
|
|
383
|
-
}
|
|
384
|
-
if (accessibilitySetSize != null) {
|
|
385
|
-
viewProps["aria-setsize"] = accessibilitySetSize;
|
|
386
|
-
}
|
|
387
|
-
if (accessibilitySort != null) {
|
|
388
|
-
viewProps["aria-sort"] = accessibilitySort;
|
|
389
|
-
}
|
|
390
|
-
if (accessibilityValueMax != null) {
|
|
391
|
-
viewProps["aria-valuemax"] = accessibilityValueMax;
|
|
392
|
-
}
|
|
393
|
-
if (accessibilityValueMin != null) {
|
|
394
|
-
viewProps["aria-valuemin"] = accessibilityValueMin;
|
|
395
|
-
}
|
|
396
|
-
if (accessibilityValueNow != null) {
|
|
397
|
-
viewProps["aria-valuenow"] = accessibilityValueNow;
|
|
398
|
-
}
|
|
399
|
-
if (accessibilityValueText != null) {
|
|
400
|
-
viewProps["aria-valuetext"] = accessibilityValueText;
|
|
401
|
-
}
|
|
402
|
-
if (nativeID) {
|
|
403
|
-
viewProps.id = nativeID;
|
|
404
|
-
}
|
|
247
|
+
assignNativePropsToWeb(elementType, viewProps, nonTamaguiProps);
|
|
405
248
|
if (!asChild) {
|
|
406
249
|
rnw.useElementLayout(hostRef, onLayout);
|
|
407
250
|
rnw.useResponderEvents(hostRef, {
|
|
@@ -444,6 +287,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
444
287
|
viewProps.target = target.charAt(0) !== "_" ? "_" + target : target;
|
|
445
288
|
}
|
|
446
289
|
}
|
|
290
|
+
const role = viewProps.role;
|
|
447
291
|
const _focusable = focusable != null ? focusable : accessible;
|
|
448
292
|
if (_focusable === false) {
|
|
449
293
|
viewProps.tabIndex = "-1";
|
|
@@ -717,10 +561,10 @@ function createComponent(configIn, ParentComponent) {
|
|
|
717
561
|
...initialSplitStyles.viewProps
|
|
718
562
|
};
|
|
719
563
|
defaultNativeStyle = {};
|
|
720
|
-
const
|
|
564
|
+
const validStyles2 = staticConfig.validStyles || stylePropsView;
|
|
721
565
|
for (const key in staticConfig.defaultProps) {
|
|
722
566
|
const val = staticConfig.defaultProps[key];
|
|
723
|
-
if (typeof val === "string" && val[0] === "$" || !
|
|
567
|
+
if (typeof val === "string" && val[0] === "$" || !validStyles2[key]) {
|
|
724
568
|
defaults[key] = val;
|
|
725
569
|
} else {
|
|
726
570
|
defaultNativeStyle[key] = val;
|
|
@@ -748,18 +592,16 @@ function createComponent(configIn, ParentComponent) {
|
|
|
748
592
|
if (configIn.memo) {
|
|
749
593
|
res = memo(res);
|
|
750
594
|
}
|
|
751
|
-
res
|
|
595
|
+
res.staticConfig = {
|
|
752
596
|
validStyles: staticConfig.validStyles || stylePropsView,
|
|
753
597
|
...staticConfig
|
|
754
598
|
};
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
758
|
-
res["extractable"] = (Component, conf) => {
|
|
759
|
-
Component["staticConfig"] = extendStaticConfig({
|
|
599
|
+
res.extractable = (Component, conf) => {
|
|
600
|
+
Component.staticConfig = extendStaticConfig({
|
|
760
601
|
Component,
|
|
761
602
|
...conf,
|
|
762
603
|
neverFlatten: true,
|
|
604
|
+
isExtractable: true,
|
|
763
605
|
defaultProps: {
|
|
764
606
|
...Component.defaultProps,
|
|
765
607
|
...conf == null ? void 0 : conf.defaultProps
|
|
@@ -777,6 +619,7 @@ Unspaced["isUnspaced"] = true;
|
|
|
777
619
|
const Spacer = createComponent({
|
|
778
620
|
memo: true,
|
|
779
621
|
componentName: "Spacer",
|
|
622
|
+
validStyles,
|
|
780
623
|
defaultProps: {
|
|
781
624
|
...stackDefaultStyles,
|
|
782
625
|
size: true
|
|
@@ -797,7 +640,7 @@ const Spacer = createComponent({
|
|
|
797
640
|
},
|
|
798
641
|
flex: {
|
|
799
642
|
true: {
|
|
800
|
-
|
|
643
|
+
flexGrow: 1
|
|
801
644
|
}
|
|
802
645
|
},
|
|
803
646
|
direction: {
|
|
@@ -912,10 +755,171 @@ const accessibilityRoleToWebRole = {
|
|
|
912
755
|
summary: "region",
|
|
913
756
|
text: null
|
|
914
757
|
};
|
|
758
|
+
function assignNativePropsToWeb(elementType, viewProps, nativeProps) {
|
|
759
|
+
if (!viewProps.role && nativeProps.accessibilityRole) {
|
|
760
|
+
if (nativeProps.accessibilityRole === "none") {
|
|
761
|
+
viewProps.role = "presentation";
|
|
762
|
+
} else {
|
|
763
|
+
const webRole = accessibilityRoleToWebRole[nativeProps.accessibilityRole];
|
|
764
|
+
if (webRole != null) {
|
|
765
|
+
viewProps.role = webRole || nativeProps.accessibilityRole;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
if (nativeProps.accessibilityActiveDescendant != null) {
|
|
770
|
+
viewProps["aria-activedescendant"] = nativeProps.accessibilityActiveDescendant;
|
|
771
|
+
}
|
|
772
|
+
if (nativeProps.accessibilityAtomic != null) {
|
|
773
|
+
viewProps["aria-atomic"] = nativeProps.accessibilityAtomic;
|
|
774
|
+
}
|
|
775
|
+
if (nativeProps.accessibilityAutoComplete != null) {
|
|
776
|
+
viewProps["aria-autocomplete"] = nativeProps.accessibilityAutoComplete;
|
|
777
|
+
}
|
|
778
|
+
if (nativeProps.accessibilityBusy != null) {
|
|
779
|
+
viewProps["aria-busy"] = nativeProps.accessibilityBusy;
|
|
780
|
+
}
|
|
781
|
+
if (nativeProps.accessibilityChecked != null) {
|
|
782
|
+
viewProps["aria-checked"] = nativeProps.accessibilityChecked;
|
|
783
|
+
}
|
|
784
|
+
if (nativeProps.accessibilityColumnCount != null) {
|
|
785
|
+
viewProps["aria-colcount"] = nativeProps.accessibilityColumnCount;
|
|
786
|
+
}
|
|
787
|
+
if (nativeProps.accessibilityColumnIndex != null) {
|
|
788
|
+
viewProps["aria-colindex"] = nativeProps.accessibilityColumnIndex;
|
|
789
|
+
}
|
|
790
|
+
if (nativeProps.accessibilityColumnSpan != null) {
|
|
791
|
+
viewProps["aria-colspan"] = nativeProps.accessibilityColumnSpan;
|
|
792
|
+
}
|
|
793
|
+
if (nativeProps.accessibilityControls != null) {
|
|
794
|
+
viewProps["aria-controls"] = processIDRefList(nativeProps.accessibilityControls);
|
|
795
|
+
}
|
|
796
|
+
if (nativeProps.accessibilityCurrent != null) {
|
|
797
|
+
viewProps["aria-current"] = nativeProps.accessibilityCurrent;
|
|
798
|
+
}
|
|
799
|
+
if (nativeProps.accessibilityDescribedBy != null) {
|
|
800
|
+
viewProps["aria-describedby"] = processIDRefList(nativeProps.accessibilityDescribedBy);
|
|
801
|
+
}
|
|
802
|
+
if (nativeProps.accessibilityDetails != null) {
|
|
803
|
+
viewProps["aria-details"] = nativeProps.accessibilityDetails;
|
|
804
|
+
}
|
|
805
|
+
if (nativeProps.disabled === true) {
|
|
806
|
+
viewProps["aria-disabled"] = true;
|
|
807
|
+
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
808
|
+
viewProps.disabled = true;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
if (nativeProps.accessibilityErrorMessage != null) {
|
|
812
|
+
viewProps["aria-errormessage"] = nativeProps.accessibilityErrorMessage;
|
|
813
|
+
}
|
|
814
|
+
if (nativeProps.accessibilityExpanded != null) {
|
|
815
|
+
viewProps["aria-expanded"] = nativeProps.accessibilityExpanded;
|
|
816
|
+
}
|
|
817
|
+
if (nativeProps.accessibilityFlowTo != null) {
|
|
818
|
+
viewProps["aria-flowto"] = processIDRefList(nativeProps.accessibilityFlowTo);
|
|
819
|
+
}
|
|
820
|
+
if (nativeProps.accessibilityHasPopup != null) {
|
|
821
|
+
viewProps["aria-haspopup"] = nativeProps.accessibilityHasPopup;
|
|
822
|
+
}
|
|
823
|
+
if (nativeProps.accessibilityHidden === true) {
|
|
824
|
+
viewProps["aria-hidden"] = nativeProps.accessibilityHidden;
|
|
825
|
+
}
|
|
826
|
+
if (nativeProps.accessibilityInvalid != null) {
|
|
827
|
+
viewProps["aria-invalid"] = nativeProps.accessibilityInvalid;
|
|
828
|
+
}
|
|
829
|
+
if (nativeProps.accessibilityKeyShortcuts != null && Array.isArray(nativeProps.accessibilityKeyShortcuts)) {
|
|
830
|
+
viewProps["aria-keyshortcuts"] = nativeProps.accessibilityKeyShortcuts.join(" ");
|
|
831
|
+
}
|
|
832
|
+
if (nativeProps.accessibilityLabel != null) {
|
|
833
|
+
viewProps["aria-label"] = nativeProps.accessibilityLabel;
|
|
834
|
+
}
|
|
835
|
+
if (nativeProps.accessibilityLabelledBy != null) {
|
|
836
|
+
viewProps["aria-labelledby"] = processIDRefList(nativeProps.accessibilityLabelledBy);
|
|
837
|
+
}
|
|
838
|
+
if (nativeProps.accessibilityLevel != null) {
|
|
839
|
+
viewProps["aria-level"] = nativeProps.accessibilityLevel;
|
|
840
|
+
}
|
|
841
|
+
if (nativeProps.accessibilityLiveRegion != null) {
|
|
842
|
+
viewProps["aria-live"] = nativeProps.accessibilityLiveRegion === "none" ? "off" : nativeProps.accessibilityLiveRegion;
|
|
843
|
+
}
|
|
844
|
+
if (nativeProps.accessibilityModal != null) {
|
|
845
|
+
viewProps["aria-modal"] = nativeProps.accessibilityModal;
|
|
846
|
+
}
|
|
847
|
+
if (nativeProps.accessibilityMultiline != null) {
|
|
848
|
+
viewProps["aria-multiline"] = nativeProps.accessibilityMultiline;
|
|
849
|
+
}
|
|
850
|
+
if (nativeProps.accessibilityMultiSelectable != null) {
|
|
851
|
+
viewProps["aria-multiselectable"] = nativeProps.accessibilityMultiSelectable;
|
|
852
|
+
}
|
|
853
|
+
if (nativeProps.accessibilityOrientation != null) {
|
|
854
|
+
viewProps["aria-orientation"] = nativeProps.accessibilityOrientation;
|
|
855
|
+
}
|
|
856
|
+
if (nativeProps.accessibilityOwns != null) {
|
|
857
|
+
viewProps["aria-owns"] = processIDRefList(nativeProps.accessibilityOwns);
|
|
858
|
+
}
|
|
859
|
+
if (nativeProps.accessibilityPlaceholder != null) {
|
|
860
|
+
viewProps["aria-placeholder"] = nativeProps.accessibilityPlaceholder;
|
|
861
|
+
}
|
|
862
|
+
if (nativeProps.accessibilityPosInSet != null) {
|
|
863
|
+
viewProps["aria-posinset"] = nativeProps.accessibilityPosInSet;
|
|
864
|
+
}
|
|
865
|
+
if (nativeProps.accessibilityPressed != null) {
|
|
866
|
+
viewProps["aria-pressed"] = nativeProps.accessibilityPressed;
|
|
867
|
+
}
|
|
868
|
+
if (nativeProps.accessibilityReadOnly != null) {
|
|
869
|
+
viewProps["aria-readonly"] = nativeProps.accessibilityReadOnly;
|
|
870
|
+
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
871
|
+
viewProps.readOnly = true;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
if (nativeProps.accessibilityRequired != null) {
|
|
875
|
+
viewProps["aria-required"] = nativeProps.accessibilityRequired;
|
|
876
|
+
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
877
|
+
viewProps.required = true;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
if (nativeProps.accessibilityRoleDescription != null) {
|
|
881
|
+
viewProps["aria-roledescription"] = nativeProps.accessibilityRoleDescription;
|
|
882
|
+
}
|
|
883
|
+
if (nativeProps.accessibilityRowCount != null) {
|
|
884
|
+
viewProps["aria-rowcount"] = nativeProps.accessibilityRowCount;
|
|
885
|
+
}
|
|
886
|
+
if (nativeProps.accessibilityRowIndex != null) {
|
|
887
|
+
viewProps["aria-rowindex"] = nativeProps.accessibilityRowIndex;
|
|
888
|
+
}
|
|
889
|
+
if (nativeProps.accessibilityRowSpan != null) {
|
|
890
|
+
viewProps["aria-rowspan"] = nativeProps.accessibilityRowSpan;
|
|
891
|
+
}
|
|
892
|
+
if (nativeProps.accessibilitySelected != null) {
|
|
893
|
+
viewProps["aria-selected"] = nativeProps.accessibilitySelected;
|
|
894
|
+
}
|
|
895
|
+
if (nativeProps.accessibilitySetSize != null) {
|
|
896
|
+
viewProps["aria-setsize"] = nativeProps.accessibilitySetSize;
|
|
897
|
+
}
|
|
898
|
+
if (nativeProps.accessibilitySort != null) {
|
|
899
|
+
viewProps["aria-sort"] = nativeProps.accessibilitySort;
|
|
900
|
+
}
|
|
901
|
+
if (nativeProps.accessibilityValueMax != null) {
|
|
902
|
+
viewProps["aria-valuemax"] = nativeProps.accessibilityValueMax;
|
|
903
|
+
}
|
|
904
|
+
if (nativeProps.accessibilityValueMin != null) {
|
|
905
|
+
viewProps["aria-valuemin"] = nativeProps.accessibilityValueMin;
|
|
906
|
+
}
|
|
907
|
+
if (nativeProps.accessibilityValueNow != null) {
|
|
908
|
+
viewProps["aria-valuenow"] = nativeProps.accessibilityValueNow;
|
|
909
|
+
}
|
|
910
|
+
if (nativeProps.accessibilityValueText != null) {
|
|
911
|
+
viewProps["aria-valuetext"] = nativeProps.accessibilityValueText;
|
|
912
|
+
}
|
|
913
|
+
if (nativeProps.nativeID) {
|
|
914
|
+
viewProps.id = nativeProps.nativeID;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
__name(assignNativePropsToWeb, "assignNativePropsToWeb");
|
|
915
918
|
export {
|
|
916
919
|
AbsoluteFill,
|
|
917
920
|
Spacer,
|
|
918
921
|
Unspaced,
|
|
922
|
+
assignNativePropsToWeb,
|
|
919
923
|
createComponent,
|
|
920
924
|
mouseUps,
|
|
921
925
|
spacedChildren
|