@tamagui/core 1.0.1-beta.41 → 1.0.1-beta.44
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/createComponent.js +71 -29
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +2 -0
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTokens.js +1 -1
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createVariable.js +2 -1
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +0 -1
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/getSize.js.map +2 -2
- package/dist/cjs/helpers/getStackSize.js +1 -1
- package/dist/cjs/helpers/getStackSize.js.map +2 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Slot.js +3 -9
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/esm/createComponent.js +71 -30
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +2 -0
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js +1 -1
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createVariable.js +2 -1
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +0 -4
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/getSize.js.map +2 -2
- package/dist/esm/helpers/getStackSize.js +1 -1
- package/dist/esm/helpers/getStackSize.js.map +2 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/Slot.js +3 -10
- package/dist/esm/views/Slot.js.map +2 -2
- package/dist/jsx/createComponent.js +67 -26
- package/dist/jsx/createTamagui.js +2 -0
- package/dist/jsx/createTokens.js +1 -1
- package/dist/jsx/createVariable.js +2 -1
- package/dist/jsx/helpers/extendStaticConfig.js +0 -4
- package/dist/jsx/helpers/getStackSize.js +1 -1
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/views/Slot.js +3 -7
- package/package.json +6 -6
- package/types/createComponent.d.ts +23 -13
- package/types/createComponent.d.ts.map +1 -1
- package/types/createVariable.d.ts +3 -1
- package/types/createVariable.d.ts.map +1 -1
- package/types/helpers/extendStaticConfig.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/getStackSize.d.ts +3 -3
- package/types/helpers/getStackSize.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/styled.d.ts +2 -2
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +10 -8
- package/types/types.d.ts.map +1 -1
- package/types/views/Slot.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'\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> |
|
|
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'\nimport { Stack } from './views/Stack'\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 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;AAqBO,gBAIL,WAEA,SAMA,yBACA;AACA,QAAM,oBAAqB,OAAM;AAtCnC;AAuCI,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,WAC/B;AAAA,WACC,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;AA7FgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/views/Slot.js
CHANGED
|
@@ -4,14 +4,6 @@ import { composeRefs } from "@tamagui/compose-refs";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
const Slot = React.forwardRef((props, forwardedRef) => {
|
|
6
6
|
const { children, ...slotProps } = props;
|
|
7
|
-
if (React.Children.toArray(children).some(isSlottable)) {
|
|
8
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, React.Children.map(children, (child) => {
|
|
9
|
-
return isSlottable(child) ? /* @__PURE__ */ React.createElement(SlotClone, {
|
|
10
|
-
...slotProps,
|
|
11
|
-
ref: forwardedRef
|
|
12
|
-
}, child.props.children) : child;
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
7
|
return /* @__PURE__ */ React.createElement(SlotClone, {
|
|
16
8
|
...slotProps,
|
|
17
9
|
ref: forwardedRef
|
|
@@ -21,10 +13,11 @@ Slot.displayName = "Slot";
|
|
|
21
13
|
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
22
14
|
const { children, ...slotProps } = props;
|
|
23
15
|
if (React.isValidElement(children)) {
|
|
24
|
-
|
|
16
|
+
const childProps = {
|
|
25
17
|
...mergeProps(children, slotProps),
|
|
26
18
|
ref: composeRefs(forwardedRef, children.ref)
|
|
27
|
-
}
|
|
19
|
+
};
|
|
20
|
+
return React.cloneElement(children, childProps);
|
|
28
21
|
}
|
|
29
22
|
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
30
23
|
});
|
|
@@ -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
|
|
5
|
-
"mappings": ";;AAEA;AACA;AAUO,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAM,EAAE,aAAa,cAAc;
|
|
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\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n return React.isValidElement(child)\n}\n\nconst pressMap = {\n onPress: 'onClick',\n onPressOut: 'onMouseOut',\n onPressIn: 'onMouseIn',\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;AAUO,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAM,EAAE,aAAa,cAAc;AACnC,SACE,oCAAC;AAAA,OAAc;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,SACd,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;AAQzB,qBAAqB,OAAqD;AACxE,SAAO,MAAM,eAAe,KAAK;AACnC;AAFS;AAIT,MAAM,WAAW;AAAA,EACf,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,WAAW;AACb;AAEA,oBAAoB,OAAY,WAAqB;AACnD,QAAM,aAAa,MAAM;AAGzB,QAAM,gBAAgB,KAAK,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,KAAK,kBAAkB,eAAe;AAAA,IAClE,WAAW,aAAa,aAAa;AACnC,oBAAc,YAAY,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AAEA,SAAO,KAAK,cAAc,cAAc;AAC1C;AA3CS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -97,7 +97,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
97
97
|
props = tamaguiDefaultProps && !props.asChild ? { ...tamaguiDefaultProps, ...props } : props;
|
|
98
98
|
const { Component, isText, isZStack } = staticConfig;
|
|
99
99
|
const componentName = props.componentName || staticConfig.componentName;
|
|
100
|
-
const componentClassName = props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
|
|
100
|
+
const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
|
|
101
101
|
if (process.env.NODE_ENV === "development") {
|
|
102
102
|
if (props["debug"]) {
|
|
103
103
|
console.log("\u26A0\uFE0F", componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "debug on");
|
|
@@ -149,6 +149,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
149
149
|
onMouseEnter,
|
|
150
150
|
onMouseLeave,
|
|
151
151
|
hrefAttrs,
|
|
152
|
+
separator,
|
|
152
153
|
onClick,
|
|
153
154
|
theme: _themeProp,
|
|
154
155
|
defaultVariants,
|
|
@@ -526,7 +527,14 @@ function createComponent(configIn, ParentComponent) {
|
|
|
526
527
|
if (process.env.NODE_ENV === "development" && props["debug"]) {
|
|
527
528
|
console.log(" \xBB className", { splitStyles, style: style2, isStringElement, pseudos, state, classNames, propsClassName: props.className, classList, className: className.trim().split(" "), themeClassName: theme.className, values: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) });
|
|
528
529
|
}
|
|
529
|
-
|
|
530
|
+
if (staticConfig.isReactNativeWeb) {
|
|
531
|
+
viewProps.dataSet = {
|
|
532
|
+
...viewProps.dataSet,
|
|
533
|
+
className
|
|
534
|
+
};
|
|
535
|
+
} else {
|
|
536
|
+
viewProps.className = className;
|
|
537
|
+
}
|
|
530
538
|
viewProps.style = style2;
|
|
531
539
|
} else {
|
|
532
540
|
viewProps.style = styles;
|
|
@@ -603,25 +611,22 @@ function createComponent(configIn, ParentComponent) {
|
|
|
603
611
|
onPress == null ? void 0 : onPress(e);
|
|
604
612
|
} : null
|
|
605
613
|
} : null;
|
|
606
|
-
|
|
614
|
+
let childEls = !children || asChild ? children : wrapThemeManagerContext(spacedChildren({
|
|
615
|
+
separator,
|
|
607
616
|
children,
|
|
608
617
|
space,
|
|
609
618
|
direction: props.spaceDirection || "both",
|
|
610
619
|
isZStack
|
|
611
620
|
}), getThemeManagerIfChanged(theme));
|
|
612
621
|
let content;
|
|
613
|
-
if (isWeb) {
|
|
614
|
-
if (staticConfig.isReactNativeWeb) {
|
|
615
|
-
viewProps.dataSet = {
|
|
616
|
-
...viewProps.dataSet,
|
|
617
|
-
className: viewProps.className
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
622
|
if (asChild) {
|
|
622
623
|
elementType = Slot;
|
|
623
|
-
|
|
624
|
-
|
|
624
|
+
viewProps = {
|
|
625
|
+
...viewProps,
|
|
626
|
+
onPress,
|
|
627
|
+
onPressIn,
|
|
628
|
+
onPressOut
|
|
629
|
+
};
|
|
625
630
|
}
|
|
626
631
|
if (isWeb) {
|
|
627
632
|
const [pressableProps] = usePressable(events ? {
|
|
@@ -750,6 +755,10 @@ function createComponent(configIn, ParentComponent) {
|
|
|
750
755
|
return res;
|
|
751
756
|
}
|
|
752
757
|
__name(createComponent, "createComponent");
|
|
758
|
+
const Unspaced = /* @__PURE__ */ __name((props) => {
|
|
759
|
+
return props.children;
|
|
760
|
+
}, "Unspaced");
|
|
761
|
+
Unspaced["isUnspaced"] = true;
|
|
753
762
|
const Spacer = createComponent({
|
|
754
763
|
memo: true,
|
|
755
764
|
componentName: "Spacer",
|
|
@@ -796,14 +805,16 @@ function spacedChildren({
|
|
|
796
805
|
children,
|
|
797
806
|
space,
|
|
798
807
|
direction,
|
|
799
|
-
spaceFlex
|
|
808
|
+
spaceFlex,
|
|
809
|
+
separator
|
|
800
810
|
}) {
|
|
801
|
-
|
|
811
|
+
const hasSpace = !!(space || spaceFlex);
|
|
812
|
+
const hasSeparator = !(separator === void 0 || separator === null);
|
|
813
|
+
if (!hasSpace && !hasSeparator) {
|
|
802
814
|
return children;
|
|
803
815
|
}
|
|
804
|
-
const childrenList =
|
|
805
|
-
|
|
806
|
-
if (len <= 1) {
|
|
816
|
+
const childrenList = Children.toArray(children);
|
|
817
|
+
if (childrenList.length <= 1) {
|
|
807
818
|
return childrenList;
|
|
808
819
|
}
|
|
809
820
|
const final = [];
|
|
@@ -815,20 +826,49 @@ function spacedChildren({
|
|
|
815
826
|
final.push(<Fragment key={index}>{isZStack ? <AbsoluteFill>{child}</AbsoluteFill> : child}</Fragment>);
|
|
816
827
|
}
|
|
817
828
|
const next = childrenList[index + 1];
|
|
818
|
-
if (next && !
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
829
|
+
if (next && !isUnspaced(next)) {
|
|
830
|
+
if (separator) {
|
|
831
|
+
if (hasSpace) {
|
|
832
|
+
final.push(createSpacer({
|
|
833
|
+
key: `_${index}_before_sep_spacer`,
|
|
834
|
+
direction,
|
|
835
|
+
space,
|
|
836
|
+
spaceFlex
|
|
837
|
+
}));
|
|
838
|
+
}
|
|
839
|
+
final.push(React.isValidElement(separator) ? React.cloneElement(separator, { key: `sep_${index}` }) : separator);
|
|
840
|
+
if (hasSpace) {
|
|
841
|
+
final.push(createSpacer({
|
|
842
|
+
key: `_${index}_after_sep_spacer`,
|
|
843
|
+
direction,
|
|
844
|
+
space,
|
|
845
|
+
spaceFlex
|
|
846
|
+
}));
|
|
847
|
+
}
|
|
848
|
+
} else {
|
|
849
|
+
final.push(createSpacer({
|
|
850
|
+
key: `_${index}_spacer`,
|
|
851
|
+
direction,
|
|
852
|
+
space,
|
|
853
|
+
spaceFlex
|
|
854
|
+
}));
|
|
855
|
+
}
|
|
822
856
|
}
|
|
823
857
|
}
|
|
824
858
|
return final;
|
|
825
859
|
}
|
|
826
860
|
__name(spacedChildren, "spacedChildren");
|
|
827
|
-
function
|
|
828
|
-
|
|
829
|
-
|
|
861
|
+
function createSpacer({ key, direction, space, spaceFlex }) {
|
|
862
|
+
return <Spacer key={key} direction={direction === "both" ? void 0 : direction === "row" || direction === "row-reverse" ? "horizontal" : "vertical"} size={space} {...spaceFlex && {
|
|
863
|
+
flex: spaceFlex
|
|
864
|
+
}} />;
|
|
865
|
+
}
|
|
866
|
+
__name(createSpacer, "createSpacer");
|
|
867
|
+
function isUnspaced(child) {
|
|
868
|
+
var _a, _b;
|
|
869
|
+
return ((_a = child == null ? void 0 : child["type"]) == null ? void 0 : _a["isVisuallyHidden"]) || ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isUnspaced"]);
|
|
830
870
|
}
|
|
831
|
-
__name(
|
|
871
|
+
__name(isUnspaced, "isUnspaced");
|
|
832
872
|
function AbsoluteFill(props) {
|
|
833
873
|
return isWeb ? <div style={{
|
|
834
874
|
position: "absolute",
|
|
@@ -860,6 +900,7 @@ const accessibilityRoleToWebRole = {
|
|
|
860
900
|
export {
|
|
861
901
|
AbsoluteFill,
|
|
862
902
|
Spacer,
|
|
903
|
+
Unspaced,
|
|
863
904
|
createComponent,
|
|
864
905
|
mouseUps,
|
|
865
906
|
spacedChildren
|
|
@@ -189,12 +189,14 @@ function ensureThemeVariable(theme, key) {
|
|
|
189
189
|
const val = theme[key];
|
|
190
190
|
if (!isVariable(val)) {
|
|
191
191
|
theme[key] = createVariable({
|
|
192
|
+
key,
|
|
192
193
|
name: key,
|
|
193
194
|
val
|
|
194
195
|
});
|
|
195
196
|
} else {
|
|
196
197
|
if (val.name !== key) {
|
|
197
198
|
theme[key] = createVariable({
|
|
199
|
+
key,
|
|
198
200
|
name: key,
|
|
199
201
|
val: val.val
|
|
200
202
|
});
|
package/dist/jsx/createTokens.js
CHANGED
|
@@ -17,7 +17,7 @@ const mapTokensToVariables = /* @__PURE__ */ __name((tokens, parentPath = "") =>
|
|
|
17
17
|
if (val && typeof val === "object") {
|
|
18
18
|
res[key] = mapTokensToVariables(tokens[key], name);
|
|
19
19
|
} else {
|
|
20
|
-
res[key] = createVariable({ val, name });
|
|
20
|
+
res[key] = createVariable({ val, name, key });
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
return res;
|
|
@@ -4,10 +4,11 @@ var _a;
|
|
|
4
4
|
import { isWeb } from "./constants/platform";
|
|
5
5
|
const IS_VARIABLE_SYMBOL = "__isVariable__";
|
|
6
6
|
class Variable {
|
|
7
|
-
constructor({ val, name }) {
|
|
7
|
+
constructor({ val, name, key }) {
|
|
8
8
|
this[_a] = true;
|
|
9
9
|
this.val = isVariable(val) ? val.val : val;
|
|
10
10
|
this.name = name;
|
|
11
|
+
this.key = key;
|
|
11
12
|
this.variable = isWeb ? createCSSVariable(name) : this.val;
|
|
12
13
|
}
|
|
13
14
|
toString() {
|
|
@@ -35,10 +35,6 @@ function extendStaticConfig(config, parent) {
|
|
|
35
35
|
...parent.staticConfig.validStyles,
|
|
36
36
|
...config.validStyles
|
|
37
37
|
} : parent.staticConfig.validStyles || stylePropsView,
|
|
38
|
-
defaultVariants: {
|
|
39
|
-
...parent.staticConfig.defaultVariants,
|
|
40
|
-
...config.defaultVariants
|
|
41
|
-
},
|
|
42
38
|
defaultProps: {
|
|
43
39
|
...parent.staticConfig.defaultProps,
|
|
44
40
|
...parent.staticConfig.defaultVariants,
|
|
@@ -33,7 +33,7 @@ const createGetStackSize = /* @__PURE__ */ __name((scale) => (val, extras) => {
|
|
|
33
33
|
paddingVertical: props.circular ? 0 : py
|
|
34
34
|
};
|
|
35
35
|
}, "createGetStackSize");
|
|
36
|
-
const buttonScaling = { sizeX: 0.
|
|
36
|
+
const buttonScaling = { sizeX: 0.75, sizeY: 0.333 };
|
|
37
37
|
const getButtonSize = createGetStackSize(buttonScaling);
|
|
38
38
|
export {
|
|
39
39
|
buttonScaling,
|
package/dist/jsx/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export * from "./hooks/useMedia";
|
|
|
35
35
|
export * from "./hooks/usePressable";
|
|
36
36
|
export * from "./hooks/useTheme";
|
|
37
37
|
export * from "./hooks/useUnmountEffect";
|
|
38
|
+
export * from "./views/Slot";
|
|
38
39
|
export * from "./views/Stack";
|
|
39
40
|
export * from "./views/Text";
|
|
40
41
|
export * from "./views/TextAncestorContext";
|
package/dist/jsx/views/Slot.js
CHANGED
|
@@ -4,21 +4,17 @@ import { composeRefs } from "@tamagui/compose-refs";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
const Slot = React.forwardRef((props, forwardedRef) => {
|
|
6
6
|
const { children, ...slotProps } = props;
|
|
7
|
-
if (React.Children.toArray(children).some(isSlottable)) {
|
|
8
|
-
return <>{React.Children.map(children, (child) => {
|
|
9
|
-
return isSlottable(child) ? <SlotClone {...slotProps} ref={forwardedRef}>{child.props.children}</SlotClone> : child;
|
|
10
|
-
})}</>;
|
|
11
|
-
}
|
|
12
7
|
return <SlotClone {...slotProps} ref={forwardedRef}>{children}</SlotClone>;
|
|
13
8
|
});
|
|
14
9
|
Slot.displayName = "Slot";
|
|
15
10
|
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
16
11
|
const { children, ...slotProps } = props;
|
|
17
12
|
if (React.isValidElement(children)) {
|
|
18
|
-
|
|
13
|
+
const childProps = {
|
|
19
14
|
...mergeProps(children, slotProps),
|
|
20
15
|
ref: composeRefs(forwardedRef, children.ref)
|
|
21
|
-
}
|
|
16
|
+
};
|
|
17
|
+
return React.cloneElement(children, childProps);
|
|
22
18
|
}
|
|
23
19
|
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
24
20
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.44",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@expo/match-media": "^0.3.0",
|
|
24
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
24
|
+
"@tamagui/helpers": "^1.0.1-beta.44",
|
|
25
25
|
"@tamagui/ow": "^0.28.1",
|
|
26
|
-
"@tamagui/use-debounce": "^1.0.1-beta.
|
|
27
|
-
"@tamagui/use-force-update": "^1.0.1-beta.
|
|
26
|
+
"@tamagui/use-debounce": "^1.0.1-beta.44",
|
|
27
|
+
"@tamagui/use-force-update": "^1.0.1-beta.44",
|
|
28
28
|
"expo-screen-orientation": "^4.2.0",
|
|
29
29
|
"hyphenate-style-name": "^1.0.4",
|
|
30
30
|
"inline-style-prefixer": "^6.0.0",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"react-native-web": "*"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
39
|
+
"@tamagui/build": "^1.0.1-beta.44",
|
|
40
40
|
"@types/react": "^17.0.35",
|
|
41
41
|
"csstype": "^3.0.10",
|
|
42
42
|
"esbuild": "^0.14.36",
|
|
43
43
|
"react-native-web": "^0.17.5",
|
|
44
|
-
"typescript": "^4.
|
|
44
|
+
"typescript": "^4.7.2"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { SpaceDirection, SpaceTokens, StackProps, StaticConfig, StaticConfigParsed, StylableComponent, TamaguiComponent } from './types';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SpaceFlexDirection, SpaceTokens, StackProps, StaticConfig, StaticConfigParsed, StylableComponent, TamaguiComponent, TamaguiElement } from './types';
|
|
4
3
|
export declare const mouseUps: Set<Function>;
|
|
5
|
-
export declare function createComponent<ComponentPropTypes extends Object = {}, Ref =
|
|
6
|
-
export declare const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
export declare function createComponent<ComponentPropTypes extends Object = {}, Ref = TamaguiElement, BaseProps = never>(configIn: Partial<StaticConfig> | StaticConfigParsed, ParentComponent?: StylableComponent): TamaguiComponent<ComponentPropTypes, Ref, BaseProps, {}>;
|
|
5
|
+
export declare const Unspaced: {
|
|
6
|
+
(props: {
|
|
7
|
+
children?: any;
|
|
8
|
+
}): any;
|
|
9
|
+
isUnspaced: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare type SpaceDirection = 'vertical' | 'horizontal';
|
|
12
|
+
export declare type SpacerProps = Omit<StackProps, 'flex' | 'direction'> & {
|
|
13
|
+
size?: number | SpaceTokens;
|
|
14
|
+
flex?: boolean | number;
|
|
15
|
+
direction?: SpaceDirection;
|
|
16
|
+
};
|
|
17
|
+
export declare const Spacer: TamaguiComponent<SpacerProps, TamaguiElement, never, {}>;
|
|
18
|
+
export declare type SpacedChildrenProps = {
|
|
12
19
|
isZStack?: boolean;
|
|
13
|
-
children
|
|
20
|
+
children?: any;
|
|
14
21
|
space?: any;
|
|
15
22
|
spaceFlex?: boolean | number;
|
|
16
|
-
direction?:
|
|
17
|
-
|
|
23
|
+
direction?: SpaceFlexDirection;
|
|
24
|
+
separator?: React.ReactNode;
|
|
25
|
+
};
|
|
26
|
+
export declare function spacedChildren({ isZStack, children, space, direction, spaceFlex, separator, }: SpacedChildrenProps): any;
|
|
18
27
|
export declare function AbsoluteFill(props: any): JSX.Element;
|
|
28
|
+
export {};
|
|
19
29
|
//# sourceMappingURL=createComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAUN,MAAM,OAAO,CAAA;AAkBd,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAGhB,cAAc,EAGf,MAAM,SAAS,CAAA;AAgBhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA0B3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,GAAG,EAAE,EACtC,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EACjB,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,EAAE,eAAe,CAAC,EAAE,iBAAiB,4DAq+B1F;AAGD,eAAO,MAAM,QAAQ;YAAW;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE;;CAEjD,CAAA;AAMD,aAAK,cAAc,GAAG,UAAU,GAAG,YAAY,CAAA;AAE/C,oBAAY,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG;IACjE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IAC3B,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,cAAc,CAAA;CAC3B,CAAA;AACD,eAAO,MAAM,MAAM,0DA0CjB,CAAA;AAEF,oBAAY,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,kBAAkB,CAAA;IAC9B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B,CAAA;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,SAAS,EACT,SAAS,EACT,SAAS,GACV,EAAE,mBAAmB,OAsErB;AA2BD,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,eAkBtC"}
|
|
@@ -4,12 +4,14 @@ export declare class Variable {
|
|
|
4
4
|
name: string;
|
|
5
5
|
val: string | number;
|
|
6
6
|
variable: string | number;
|
|
7
|
-
|
|
7
|
+
key: string;
|
|
8
|
+
constructor({ val, name, key }: VariableIn);
|
|
8
9
|
toString(): string;
|
|
9
10
|
}
|
|
10
11
|
declare type VariableIn = {
|
|
11
12
|
val: string | number | Variable;
|
|
12
13
|
name: string;
|
|
14
|
+
key: string;
|
|
13
15
|
};
|
|
14
16
|
export declare const createVariable: (props: VariableIn) => Variable;
|
|
15
17
|
export declare function isVariable(v: Variable | any): v is Variable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createVariable.d.ts","sourceRoot":"","sources":["../src/createVariable.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAElD,qBAAa,QAAQ;IAInB,CAAC,kBAAkB,CAAC,UAAO;IAE3B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"createVariable.d.ts","sourceRoot":"","sources":["../src/createVariable.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAElD,qBAAa,QAAQ;IAInB,CAAC,kBAAkB,CAAC,UAAO;IAE3B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,GAAG,EAAE,MAAM,CAAA;gBAEC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,UAAU;IAQ1C,QAAQ;CAGT;AAED,aAAK,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhF,eAAO,MAAM,cAAc,UAAW,UAAU,aAAwB,CAAA;AAExE,wBAAgB,UAAU,CAAC,CAAC,EAAE,QAAQ,GAAG,GAAG,GAAG,CAAC,IAAI,QAAQ,CAE3D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,GAAG,GAAG,OAGjD;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ,GAAG,GAAG,OAGhD;AAGD,eAAO,MAAM,iBAAiB,QAAS,MAAM,iCAG5C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extendStaticConfig.d.ts","sourceRoot":"","sources":["../../src/helpers/extendStaticConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAG9E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"extendStaticConfig.d.ts","sourceRoot":"","sources":["../../src/helpers/extendStaticConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAG9E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,EAAE,iBAAiB,sBA6C3F;AAED,eAAO,MAAM,iBAAiB,WAAY,QAAQ,YAAY,CAAC,KAAG,kBAMjE,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SizeTokens } from '../types';
|
|
2
|
-
export declare const getSize: (size?: SizeTokens | undefined, sizeUpOrDownBy?: number) =>
|
|
2
|
+
export declare const getSize: (size?: SizeTokens | undefined, sizeUpOrDownBy?: number) => import("..").Variable;
|
|
3
3
|
//# sourceMappingURL=getSize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSize.d.ts","sourceRoot":"","sources":["../../src/helpers/getSize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,eAAO,MAAM,OAAO,UAAW,UAAU,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"getSize.d.ts","sourceRoot":"","sources":["../../src/helpers/getSize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,eAAO,MAAM,OAAO,UAAW,UAAU,GAAG,SAAS,mDAKpD,CAAA"}
|
|
@@ -8,9 +8,9 @@ export declare type ScaleVariantExtras = Pick<VariantSpreadExtras<any>, 'tokens'
|
|
|
8
8
|
export declare const getSizeScaledToFont: (val: string | number, { sizeX, sizeY }: ScaleProps, { tokens, props, fonts }: ScaleVariantExtras) => {
|
|
9
9
|
px: number;
|
|
10
10
|
py: number;
|
|
11
|
-
radius:
|
|
12
|
-
size:
|
|
13
|
-
lineHeight:
|
|
11
|
+
radius: any;
|
|
12
|
+
size: any;
|
|
13
|
+
lineHeight: any;
|
|
14
14
|
minHeight: number;
|
|
15
15
|
};
|
|
16
16
|
export declare const createGetStackSize: (scale: ScaleProps) => (val: SizeTokens | number, extras: VariantSpreadExtras<any>) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStackSize.d.ts","sourceRoot":"","sources":["../../src/helpers/getStackSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAgC,MAAM,eAAe,CAAA;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAIrC,aAAK,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAElD,oBAAY,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,CAAA;AAE7F,eAAO,MAAM,mBAAmB,QACzB,MAAM,GAAG,MAAM,oBACM,UAAU,4BACV,kBAAkB;;;;;;;CAqB7C,CAAA;AAED,eAAO,MAAM,kBAAkB,UACrB,UAAU,WAAW,UAAU,GAAG,MAAM
|
|
1
|
+
{"version":3,"file":"getStackSize.d.ts","sourceRoot":"","sources":["../../src/helpers/getStackSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAgC,MAAM,eAAe,CAAA;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAIrC,aAAK,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAElD,oBAAY,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,CAAA;AAE7F,eAAO,MAAM,mBAAmB,QACzB,MAAM,GAAG,MAAM,oBACM,UAAU,4BACV,kBAAkB;;;;;;;CAqB7C,CAAA;AAED,eAAO,MAAM,kBAAkB,UACrB,UAAU,WAAW,UAAU,GAAG,MAAM;;;;;CAS/C,CAAA;AAEH,eAAO,MAAM,aAAa;;;CAAgC,CAAA;AAC1D,eAAO,MAAM,aAAa,QAZK,UAAU,GAAG,MAAM;;;;;CAYY,CAAA"}
|
package/types/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export * from './hooks/useMedia';
|
|
|
35
35
|
export * from './hooks/usePressable';
|
|
36
36
|
export * from './hooks/useTheme';
|
|
37
37
|
export * from './hooks/useUnmountEffect';
|
|
38
|
+
export * from './views/Slot';
|
|
38
39
|
export * from './views/Stack';
|
|
39
40
|
export * from './views/Text';
|
|
40
41
|
export * from './views/TextAncestorContext';
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAE5F,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAE/B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAE9C,cAAc,sCAAsC,CAAA;AAEpD,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AAExC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAElC,cAAc,2BAA2B,CAAA;AACzC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAE5F,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAE/B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAE9C,cAAc,sCAAsC,CAAA;AAEpD,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AAExC,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAElC,cAAc,2BAA2B,CAAA;AACzC,cAAc,kBAAkB,CAAA"}
|
package/types/styled.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ export declare type StyledOptions<ParentComponent extends StylableComponent> = G
|
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export declare function styled<ParentComponent extends StylableComponent, Variants extends VariantDefinitions<ParentComponent> |
|
|
9
|
+
export declare function styled<ParentComponent extends StylableComponent, Variants extends VariantDefinitions<ParentComponent> | void = VariantDefinitions<ParentComponent> | void>(Component: ParentComponent, options?: GetProps<ParentComponent> & {
|
|
10
10
|
name?: string;
|
|
11
11
|
variants?: Variants | undefined;
|
|
12
12
|
defaultVariants?: {
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
};
|
|
15
|
-
}, staticExtractionOptions?: Partial<StaticConfig>): TamaguiComponent<Variants extends
|
|
15
|
+
}, staticExtractionOptions?: Partial<StaticConfig>): TamaguiComponent<Variants extends void ? GetProps<ParentComponent> : (ParentComponent extends TamaguiComponent<any, any, infer P, {}> ? P : GetProps<ParentComponent>) & Omit<ParentComponent extends TamaguiComponent<any, any, any, infer V> ? V : {}, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; }) & MediaProps<Partial<(ParentComponent extends TamaguiComponent<any, any, infer P, {}> ? P : GetProps<ParentComponent>) & Omit<ParentComponent extends TamaguiComponent<any, any, any, infer V> ? V : {}, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>> & PseudoProps<Partial<(ParentComponent extends TamaguiComponent<any, any, infer P, {}> ? P : GetProps<ParentComponent>) & Omit<ParentComponent extends TamaguiComponent<any, any, any, infer V> ? V : {}, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>>, any, ParentComponent extends TamaguiComponent<any, any, infer P, {}> ? P : GetProps<ParentComponent>, (ParentComponent extends TamaguiComponent<any, any, any, infer V> ? V : {}) & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>;
|
|
16
16
|
//# sourceMappingURL=styled.d.ts.map
|
package/types/styled.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAIhB,oBAAY,aAAa,CAAC,eAAe,SAAS,iBAAiB,IAAI,QAAQ,CAAC,eAAe,CAAC,GAAG;IACjG,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,SAAS,CAAA;IAC1D,eAAe,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;CACzC,CAAA;AAED,wBAAgB,MAAM,CACpB,eAAe,SAAS,iBAAiB,EACzC,QAAQ,SAAS,kBAAkB,CAAC,eAAe,CAAC,GAAG,IAAI,GAAG,kBAAkB,CAAC,eAAe,CAAC,GAAG,IAAI,EAExG,SAAS,EAAE,eAAe,EAE1B,OAAO,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAE/B,eAAe,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;CACzC,EACD,uBAAuB,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,8lEAiFhD"}
|
package/types/types.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Properties } from 'csstype';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { GestureResponderEvent, Image, TextProps as ReactTextProps, Text, TextInput, TextStyle, View, ViewProps, ViewStyle } from 'react-native';
|
|
4
4
|
import { Variable } from './createVariable';
|
|
5
5
|
import { ResolveVariableTypes } from './helpers/createPropMapper';
|
|
6
6
|
import { RNWTextProps, RNWViewProps } from './types-rnw';
|
|
7
7
|
import { ThemeProviderProps } from './views/ThemeProvider';
|
|
8
|
+
export declare type SpaceFlexDirection = ViewStyle['flexDirection'] | 'both';
|
|
9
|
+
export declare type TamaguiElement = HTMLElement | View;
|
|
8
10
|
export declare type TamaguiComponentPropsBase = {
|
|
9
11
|
asChild?: boolean;
|
|
10
12
|
space?: SpaceTokens;
|
|
11
|
-
spaceDirection?:
|
|
13
|
+
spaceDirection?: SpaceFlexDirection;
|
|
14
|
+
separator?: React.ReactNode;
|
|
12
15
|
dangerouslySetInnerHTML?: {
|
|
13
16
|
__html: string;
|
|
14
17
|
};
|
|
@@ -199,7 +202,6 @@ export declare type AnimationProp = AnimationKeys | {
|
|
|
199
202
|
};
|
|
200
203
|
}
|
|
201
204
|
];
|
|
202
|
-
export declare type SpaceDirection = ViewStyle['flexDirection'] | 'both';
|
|
203
205
|
declare type GetTokenFontKeysFor<A extends 'size' | 'weight' | 'letterSpacing' | 'family' | 'lineHeight' | 'transform' | 'style' | 'color'> = keyof TamaguiConfig['fonts']['body'][A];
|
|
204
206
|
declare type GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`;
|
|
205
207
|
export declare type SizeTokens = GetTokenString<keyof Tokens['size']> | number;
|
|
@@ -267,11 +269,11 @@ export declare type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVi
|
|
|
267
269
|
ellipse?: boolean;
|
|
268
270
|
selectable?: boolean;
|
|
269
271
|
textDecorationDistance?: number;
|
|
270
|
-
userSelect?:
|
|
271
|
-
textOverflow?:
|
|
272
|
-
whiteSpace?:
|
|
273
|
-
wordWrap?:
|
|
274
|
-
cursor?:
|
|
272
|
+
userSelect?: Properties['userSelect'];
|
|
273
|
+
textOverflow?: Properties['textOverflow'];
|
|
274
|
+
whiteSpace?: Properties['whiteSpace'];
|
|
275
|
+
wordWrap?: Properties['wordWrap'];
|
|
276
|
+
cursor?: Properties['cursor'];
|
|
275
277
|
};
|
|
276
278
|
export declare type TextPropsBaseShared = Omit<ReactTextProps, 'children'> & RNWTextProps & TamaguiComponentPropsBase;
|
|
277
279
|
export declare type TextPropsBase = TextPropsBaseShared & WithThemeAndShorthands<TextStylePropsBase>;
|