@tamagui/core 1.0.0-alpha.27 → 1.0.0-alpha.31
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 +23 -26
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +60 -45
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +1 -32
- package/dist/cjs/createTheme.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +8 -2
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/styled.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/esm/createComponent.js +23 -26
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +60 -46
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTheme.js +1 -16
- package/dist/esm/createTheme.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +8 -2
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/styled.js.map +1 -1
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/jsx/createComponent.js +23 -26
- package/dist/jsx/createTamagui.js +60 -46
- package/dist/jsx/createTheme.js +1 -16
- package/dist/jsx/hooks/useTheme.js +8 -2
- package/package.json +7 -7
- package/types/constants/constants.d.ts +8 -0
- package/types/constants/constants.d.ts.map +1 -0
- package/types/constants/platform.d.ts +9 -0
- package/types/constants/platform.d.ts.map +1 -0
- package/types/constants/pseudos.d.ts +15 -0
- package/types/constants/pseudos.d.ts.map +1 -0
- package/types/constants/rnw.d.ts +2 -0
- package/types/constants/rnw.d.ts.map +1 -0
- package/types/createComponent.d.ts +17 -0
- package/types/createComponent.d.ts.map +1 -0
- package/types/createFont.d.ts +3 -0
- package/types/createFont.d.ts.map +1 -0
- package/types/createShorthands.d.ts +2 -0
- package/types/createShorthands.d.ts.map +1 -0
- package/types/createTamagui.d.ts +54 -0
- package/types/createTamagui.d.ts.map +1 -0
- package/types/createTheme.d.ts +7 -0
- package/types/createTheme.d.ts.map +1 -0
- package/types/createTokens.d.ts +55 -0
- package/types/createTokens.d.ts.map +1 -0
- package/types/createVariable.d.ts +15 -0
- package/types/createVariable.d.ts.map +1 -0
- package/types/helpers/addStylesUsingClassname.d.ts +3 -0
- package/types/helpers/addStylesUsingClassname.d.ts.map +1 -0
- package/types/helpers/createMediaStyle.d.ts +8 -0
- package/types/helpers/createMediaStyle.d.ts.map +1 -0
- package/types/helpers/createPropMapper.d.ts +3 -0
- package/types/helpers/createPropMapper.d.ts.map +1 -0
- package/types/helpers/createTamaguiProvider.d.ts +5 -0
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -0
- package/types/helpers/extendStaticConfig.d.ts +5 -0
- package/types/helpers/extendStaticConfig.d.ts.map +1 -0
- package/types/helpers/fixNativeShadow.d.ts +2 -0
- package/types/helpers/fixNativeShadow.d.ts.map +1 -0
- package/types/helpers/fixNativeShadow.native.d.ts +2 -0
- package/types/helpers/fixNativeShadow.native.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +15 -0
- package/types/helpers/getSplitStyles.d.ts.map +1 -0
- package/types/helpers/getStylesAtomic.d.ts +3 -0
- package/types/helpers/getStylesAtomic.d.ts.map +1 -0
- package/types/helpers/getStylesAtomic.native.d.ts +2 -0
- package/types/helpers/getStylesAtomic.native.d.ts.map +1 -0
- package/types/helpers/insertStyleRule.d.ts +2 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -0
- package/types/helpers/isObj.d.ts +2 -0
- package/types/helpers/isObj.d.ts.map +1 -0
- package/types/helpers/isTamaguiElement.d.ts +3 -0
- package/types/helpers/isTamaguiElement.d.ts.map +1 -0
- package/types/helpers/matchMedia.d.ts +2 -0
- package/types/helpers/matchMedia.d.ts.map +1 -0
- package/types/helpers/matchMedia.native.d.ts +3 -0
- package/types/helpers/matchMedia.native.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts +10 -0
- package/types/helpers/themeable.d.ts.map +1 -0
- package/types/helpers/validate.d.ts +4 -0
- package/types/helpers/validate.d.ts.map +1 -0
- package/types/hooks/useConstant.d.ts +2 -0
- package/types/hooks/useConstant.d.ts.map +1 -0
- package/types/hooks/useFeatures.d.ts +5 -0
- package/types/hooks/useFeatures.d.ts.map +1 -0
- package/types/hooks/useMedia.d.ts +16 -0
- package/types/hooks/useMedia.d.ts.map +1 -0
- package/types/hooks/usePressable.d.ts +3 -0
- package/types/hooks/usePressable.d.ts.map +1 -0
- package/types/hooks/useTheme.d.ts +7 -0
- package/types/hooks/useTheme.d.ts.map +1 -0
- package/types/index.d.ts +29 -0
- package/types/index.d.ts.map +1 -0
- package/types/static/postProcessStyles.d.ts +7 -0
- package/types/static/postProcessStyles.d.ts.map +1 -0
- package/types/static.d.ts +15 -0
- package/types/static.d.ts.map +1 -0
- package/types/styled.d.ts +21 -0
- package/types/styled.d.ts.map +1 -0
- package/types/types.d.ts +314 -0
- package/types/types.d.ts.map +1 -0
- package/types/views/Animated.d.ts +15 -0
- package/types/views/Animated.d.ts.map +1 -0
- package/types/views/Stack.d.ts +3 -0
- package/types/views/Stack.d.ts.map +1 -0
- package/types/views/Text.d.ts +3 -0
- package/types/views/Text.d.ts.map +1 -0
- package/types/views/TextAncestorContext.d.ts +5 -0
- package/types/views/TextAncestorContext.d.ts.map +1 -0
- package/types/views/Theme.d.ts +8 -0
- package/types/views/Theme.d.ts.map +1 -0
- package/types/views/ThemeContext.d.ts +18 -0
- package/types/views/ThemeContext.d.ts.map +1 -0
- package/types/views/ThemeInverse.d.ts +10 -0
- package/types/views/ThemeInverse.d.ts.map +1 -0
- package/types/views/ThemeManagerContext.d.ts +22 -0
- package/types/views/ThemeManagerContext.d.ts.map +1 -0
- package/types/views/ThemeProvider.d.ts +10 -0
- package/types/views/ThemeProvider.d.ts.map +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useTheme.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react'\n\nimport {
|
|
5
|
-
"mappings": ";;AAAA;AACA;
|
|
4
|
+
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { Variable } from '../createVariable'\nimport { ThemeName, ThemeObject } from '../types'\nimport { ThemeContext } from '../views/ThemeContext'\nimport { ThemeManagerContext } from '../views/ThemeManagerContext'\nimport { GET_DEFAULT_THEME } from '../views/ThemeProvider'\n\ntype UseThemeState = {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nconst areEqualSets = (a: Set<string>, b: Set<string>) => {\n if (a.size !== b.size) return false\n for (const val in a) {\n if (!b.has(val)) {\n return false\n }\n }\n return true\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent.name)\n\n useIsomorphicLayoutEffect(() => {\n return parent.onChangeTheme((next, manager) => {\n setName(opts?.parent ? manager.parentName : next)\n })\n }, [parent])\n\n return name || 'light'\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)[GET_DEFAULT_THEME] as any as ThemeName\n}\n\nexport const useTheme = (): ThemeObject => {\n const forceUpdate = useForceUpdate()\n const manager = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const state = useRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n state.current.isRendering = true\n\n // track usage\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = manager.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n manager.track(st.uuid, st.keys)\n }\n })\n\n useEffect(() => {\n return manager.onUpdate(state.current.uuid, forceUpdate)\n }, [])\n\n const theme = (manager.name ? themes[manager.name] : themes.light) ?? themes.light\n\n return useMemo(\n () => {\n return new Proxy(theme, {\n get(_, key: string) {\n const name = manager.name\n if (!name) {\n return Reflect.get(_, key)\n }\n let activeTheme = themes[name]\n if (!activeTheme) {\n console.error('No theme by name', name, 'only:', themes, 'keeping current theme')\n activeTheme = theme\n }\n const val = activeTheme[key]\n if (process.env.NODE_ENV === 'development') {\n if (typeof val === 'undefined') {\n console.warn(`No theme value \"${String(key)}\" in`, activeTheme, themes)\n return null\n }\n if (!(val instanceof Variable)) {\n console.warn('Non variable!', val)\n }\n if (val.name !== key) {\n console.warn('Non-matching name for variable to key', key, val.name)\n }\n }\n if (state.current.isRendering) {\n state.current.keys.add(key)\n }\n return val\n },\n })\n },\n [\n /* if concurrent mode wanted put manager.name here */\n ]\n )\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAQA,MAAM,eAAe,wBAAC,GAAgB,MAAmB;AACvD,MAAI,EAAE,SAAS,EAAE;AAAM,WAAO;AAC9B,aAAW,OAAO,GAAG;AACnB,QAAI,CAAC,EAAE,IAAI,MAAM;AACf,aAAO;AAAA;AAAA;AAGX,SAAO;AAAA,GAPY;AAUd,MAAM,eAAe,wBAAC,SAA6B;AACxD,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,MAAM,WAAW,SAAS,OAAO;AAExC,4BAA0B,MAAM;AAC9B,WAAO,OAAO,cAAc,CAAC,MAAM,YAAY;AAC7C,cAAQ,MAAM,SAAS,QAAQ,aAAa;AAAA;AAAA,KAE7C,CAAC;AAEJ,SAAO,QAAQ;AAAA,GAVW;AAarB,MAAM,sBAAsB,6BAAM;AACvC,SAAO,WAAW,cAAc;AAAA,GADC;AAI5B,MAAM,WAAW,6BAAmB;AACzC,QAAM,cAAc;AACpB,QAAM,UAAU,WAAW;AAC3B,QAAM,SAAS,WAAW;AAC1B,QAAM,QAAQ;AACd,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,UAAU;AAAA,MACd,MAAM;AAAA,MACN,MAAM,IAAI;AAAA,MACV,aAAa;AAAA;AAAA;AAGjB,QAAM,QAAQ,cAAc;AAG5B,4BAA0B,MAAM;AAC9B,UAAM,KAAK,MAAM;AACjB,OAAG,cAAc;AACjB,UAAM,MAAM,QAAQ,KAAK,IAAI,GAAG;AAChC,QAAI,CAAC,OAAO,CAAC,aAAa,GAAG,MAAM,MAAM;AACvC,cAAQ,MAAM,GAAG,MAAM,GAAG;AAAA;AAAA;AAI9B,YAAU,MAAM;AACd,WAAO,QAAQ,SAAS,MAAM,QAAQ,MAAM;AAAA,KAC3C;AAEH,QAAM,QAAS,SAAQ,OAAO,OAAO,QAAQ,QAAQ,OAAO,UAAU,OAAO;AAE7E,SAAO,QACL,MAAM;AACJ,WAAO,IAAI,MAAM,OAAO;AAAA,MACtB,IAAI,GAAG,KAAa;AAClB,cAAM,OAAO,QAAQ;AACrB,YAAI,CAAC,MAAM;AACT,iBAAO,QAAQ,IAAI,GAAG;AAAA;AAExB,YAAI,cAAc,OAAO;AACzB,YAAI,CAAC,aAAa;AAChB,kBAAQ,MAAM,oBAAoB,MAAM,SAAS,QAAQ;AACzD,wBAAc;AAAA;AAEhB,cAAM,MAAM,YAAY;AACxB,YAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAI,OAAO,QAAQ,aAAa;AAC9B,oBAAQ,KAAK,mBAAmB,OAAO,YAAY,aAAa;AAChE,mBAAO;AAAA;AAET,cAAI,CAAE,gBAAe,WAAW;AAC9B,oBAAQ,KAAK,iBAAiB;AAAA;AAEhC,cAAI,IAAI,SAAS,KAAK;AACpB,oBAAQ,KAAK,yCAAyC,KAAK,IAAI;AAAA;AAAA;AAGnE,YAAI,MAAM,QAAQ,aAAa;AAC7B,gBAAM,QAAQ,KAAK,IAAI;AAAA;AAEzB,eAAO;AAAA;AAAA;AAAA,KAIb;AAAA,GA/DoB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styled.ts"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport { MediaProps, StaticComponent, StaticConfig, TamaguiConfig, Themes, Tokens } from './types'\n\nexport function styled<\n ParentComponent extends StaticComponent | React.Component<any>,\n Variants extends GetVariants<ParentComponent>\n>(\n Component: ParentComponent,\n options?: GetProps<ParentComponent> & {\n variants?: Variants\n },\n staticExtractionOptions?: StaticConfig\n) {\n const staticConfigProps: StaticConfig = (() => {\n if (options) {\n const { variants, ...defaultProps } = options\n return { ...staticExtractionOptions, variants, defaultProps }\n }\n return {}\n })()\n const config = extendStaticConfig(Component, staticConfigProps)\n const component = createComponent(config!) // error is good here its on init\n type VariantProps = GetVariantProps<Variants>\n return component as StaticComponent<\n Omit<GetProps<ParentComponent>, keyof VariantProps> & VariantProps & MediaProps<VariantProps>\n // leave this out it was causing infinite recursion type issues\n // VariantProps\n >\n}\n\n// type ParentVariants = A extends StaticComponent<any, infer Variants> ? Variants : {}\n\nexport type GetProps<A> = A extends StaticComponent<infer Props>\n ? Props\n : A extends React.Component<infer Props>\n ? Props\n : {}\n\nexport type GetVariants<ParentComponent extends StaticComponent | React.Component<any>> = void | {\n [key: string]: {\n [key: string]:\n | Partial<GetProps<ParentComponent>>\n | ((\n val: any,\n config: {\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n props: GetProps<ParentComponent>\n }\n ) => Partial<GetProps<ParentComponent>>)\n }\n}\n\nexport type GetVariantProps<Variants> = Variants extends void\n ? {}\n : {\n // ensure variants actually defined\n [Key in keyof Variants]?: keyof Variants[Key] extends `...${infer VariantSpread}`\n ? VariantSpread extends keyof Tokens\n ? keyof Tokens[VariantSpread] extends string | number\n ? `$${keyof Tokens[VariantSpread]}
|
|
4
|
+
"sourcesContent": ["import React from 'react'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport { MediaProps, StaticComponent, StaticConfig, TamaguiConfig, Themes, Tokens } from './types'\n\nexport function styled<\n ParentComponent extends StaticComponent | React.Component<any>,\n Variants extends GetVariants<ParentComponent>\n>(\n Component: ParentComponent,\n options?: GetProps<ParentComponent> & {\n variants?: Variants\n },\n staticExtractionOptions?: StaticConfig\n) {\n const staticConfigProps: StaticConfig = (() => {\n if (options) {\n const { variants, ...defaultProps } = options\n return { ...staticExtractionOptions, variants, defaultProps }\n }\n return {}\n })()\n const config = extendStaticConfig(Component, staticConfigProps)\n const component = createComponent(config!) // error is good here its on init\n type VariantProps = GetVariantProps<Variants>\n return component as StaticComponent<\n Omit<GetProps<ParentComponent>, keyof VariantProps> & VariantProps & MediaProps<VariantProps>\n // leave this out it was causing infinite recursion type issues\n // VariantProps\n >\n}\n\n// type ParentVariants = A extends StaticComponent<any, infer Variants> ? Variants : {}\n\nexport type GetProps<A> = A extends StaticComponent<infer Props>\n ? Props\n : A extends React.Component<infer Props>\n ? Props\n : {}\n\nexport type GetVariants<ParentComponent extends StaticComponent | React.Component<any>> = void | {\n [key: string]: {\n [key: string]:\n | Partial<GetProps<ParentComponent>>\n | ((\n val: any,\n config: {\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n props: GetProps<ParentComponent>\n }\n ) => Partial<GetProps<ParentComponent>>)\n }\n}\n\nexport type GetVariantProps<Variants> = Variants extends void\n ? {}\n : {\n // ensure variants actually defined\n [Key in keyof Variants]?: keyof Variants[Key] extends `...${infer VariantSpread}`\n ? VariantSpread extends keyof Tokens\n ? keyof Tokens[VariantSpread] extends string | number\n ? `$${keyof Tokens[VariantSpread]}` | null\n : unknown\n : unknown\n : keyof Variants[Key] extends 'true'\n ? boolean | null\n : keyof Exclude<Variants[Key], undefined>\n }\n\n// type X = { ok: 1 }\n// type Y = { okk: 2; ok: 3 }\n// type Z = X & Y\n// type Z2 = Z\n\n// TODO get name\n// const displayName = `styled(Component)`\n// Object.defineProperty(component, 'name', {\n// value: displayName,\n// writable: false,\n// })\n"],
|
|
5
5
|
"mappings": ";;AAEA;AACA;AAGO,gBAIL,WACA,SAGA,yBACA;AACA,QAAM,oBAAmC,OAAM;AAC7C,QAAI,SAAS;AACX,YAAM,EAAE,aAAa,iBAAiB;AACtC,aAAO,KAAK,yBAAyB,UAAU;AAAA;AAEjD,WAAO;AAAA;AAET,QAAM,SAAS,mBAAmB,WAAW;AAC7C,QAAM,YAAY,gBAAgB;AAElC,SAAO;AAAA;AApBO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Text.tsx"],
|
|
4
|
-
"sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps>({\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'inline-flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n '[number]': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n
|
|
5
|
-
"mappings": "AAAA;AAEA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA;AAGP,MAAM,OAAO,gBAA2B;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA;AAAA,EAEZ,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,YAAY,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,MAAM;AAAA;AAAA,IAG/D,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA;AAAA,MAEd,OAAO;AAAA,QACL,YAAY;AAAA;AAAA;AAAA,IAIhB,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA;AAAA;AAAA,IAIZ,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\n\nimport { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { TextProps } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps>({\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'inline-flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n '[number]': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA;AAGP,MAAM,OAAO,gBAA2B;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA;AAAA,EAEZ,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,YAAY,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,MAAM;AAAA;AAAA,IAG/D,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA;AAAA,MAEd,OAAO;AAAA,QACL,YAAY;AAAA;AAAA;AAAA,IAIhB,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA;AAAA;AAAA,IAIZ,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA;AAAA;AAAA;AAAA,EAIzB,YAAY,IAAI,IAAI,QAAQ,KAAK,CAAC;AAAA,EAClC,aAAa;AAAA,OACR;AAAA,OACA;AAAA,OACC,SAAS;AAAA,MACX,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -23,8 +23,8 @@ import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticCon
|
|
|
23
23
|
import { getSplitStyles } from "./helpers/getSplitStyles";
|
|
24
24
|
import { useFeatures } from "./hooks/useFeatures";
|
|
25
25
|
import { usePressable } from "./hooks/usePressable";
|
|
26
|
+
import { useTheme } from "./hooks/useTheme";
|
|
26
27
|
import { TextAncestorContext } from "./views/TextAncestorContext";
|
|
27
|
-
import { ThemeManagerContext } from "./views/ThemeManagerContext";
|
|
28
28
|
const mouseUps = new Set();
|
|
29
29
|
if (typeof document !== "undefined") {
|
|
30
30
|
document.addEventListener("mouseup", () => {
|
|
@@ -32,6 +32,24 @@ if (typeof document !== "undefined") {
|
|
|
32
32
|
mouseUps.clear();
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
const defaultComponentState = {
|
|
36
|
+
hover: false,
|
|
37
|
+
press: false,
|
|
38
|
+
pressIn: false
|
|
39
|
+
};
|
|
40
|
+
function createShallowUpdate(setter) {
|
|
41
|
+
return (next) => {
|
|
42
|
+
setter((prev) => {
|
|
43
|
+
for (const key in next) {
|
|
44
|
+
if (prev[key] !== next[key]) {
|
|
45
|
+
return { ...prev, ...next };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return prev;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
__name(createShallowUpdate, "createShallowUpdate");
|
|
35
53
|
function createComponent(configIn) {
|
|
36
54
|
let staticConfig;
|
|
37
55
|
if ("parsed" in configIn) {
|
|
@@ -49,21 +67,9 @@ function createComponent(configIn) {
|
|
|
49
67
|
const component = forwardRef((props, forwardedRef) => {
|
|
50
68
|
const forceUpdate = useForceUpdate();
|
|
51
69
|
const features = useFeatures(props, { forceUpdate });
|
|
52
|
-
const
|
|
53
|
-
const [state, set_] = useState(
|
|
54
|
-
|
|
55
|
-
press: false,
|
|
56
|
-
pressIn: false,
|
|
57
|
-
theme: manager.name
|
|
58
|
-
}));
|
|
59
|
-
const set = /* @__PURE__ */ __name((next) => set_((prev) => {
|
|
60
|
-
for (const key in next) {
|
|
61
|
-
if (prev[key] !== next[key]) {
|
|
62
|
-
return { ...prev, ...next };
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return prev;
|
|
66
|
-
}), "set");
|
|
70
|
+
const theme = useTheme();
|
|
71
|
+
const [state, set_] = useState(defaultComponentState);
|
|
72
|
+
const set = createShallowUpdate(set_);
|
|
67
73
|
if (process.env.NODE_ENV === "development" && !isText && isWeb) {
|
|
68
74
|
Children.toArray(props.children).forEach((item) => {
|
|
69
75
|
if (typeof item === "string") {
|
|
@@ -73,7 +79,6 @@ function createComponent(configIn) {
|
|
|
73
79
|
}
|
|
74
80
|
const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false;
|
|
75
81
|
const hostRef = useRef(null);
|
|
76
|
-
const theme = manager.theme || initialTheme;
|
|
77
82
|
const {
|
|
78
83
|
viewProps: viewPropsIn,
|
|
79
84
|
pseudos,
|
|
@@ -144,7 +149,6 @@ function createComponent(configIn) {
|
|
|
144
149
|
onStartShouldSetResponderCapture
|
|
145
150
|
});
|
|
146
151
|
}
|
|
147
|
-
const isTracking = useRef(false);
|
|
148
152
|
const internal = useRef();
|
|
149
153
|
if (!internal.current) {
|
|
150
154
|
internal.current = {
|
|
@@ -153,18 +157,11 @@ function createComponent(configIn) {
|
|
|
153
157
|
}
|
|
154
158
|
useEffect(() => {
|
|
155
159
|
internal.current.isMounted = true;
|
|
156
|
-
const dispose = manager?.onChangeTheme((name) => {
|
|
157
|
-
if (isTracking.current) {
|
|
158
|
-
set({ theme: name });
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
160
|
return () => {
|
|
162
|
-
dispose();
|
|
163
161
|
mouseUps.delete(unPress);
|
|
164
|
-
isTracking.current = false;
|
|
165
162
|
internal.current.isMounted = false;
|
|
166
163
|
};
|
|
167
|
-
}, [
|
|
164
|
+
}, []);
|
|
168
165
|
const element = isWeb ? !Component || typeof Component === "string" ? tag || Component : Component : Component;
|
|
169
166
|
const ReactView = !isWeb ? View : element || (hasTextAncestor ? "span" : "div");
|
|
170
167
|
const ReactText = !isWeb ? Text : element || "span";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { getStyleRules } from "@tamagui/helpers";
|
|
4
|
-
import {
|
|
4
|
+
import { isWeb } from "./constants/platform";
|
|
5
|
+
import { Variable, createVariable } from "./createVariable";
|
|
5
6
|
import { createTamaguiProvider } from "./helpers/createTamaguiProvider";
|
|
6
|
-
import { validateConfig } from "./helpers/validate";
|
|
7
7
|
import { configureMedia } from "./hooks/useMedia";
|
|
8
8
|
let conf;
|
|
9
9
|
const getHasConfigured = /* @__PURE__ */ __name(() => !!conf, "getHasConfigured");
|
|
@@ -20,10 +20,8 @@ const onConfiguredOnce = /* @__PURE__ */ __name((cb) => {
|
|
|
20
20
|
}, "onConfiguredOnce");
|
|
21
21
|
const PREFIX = `theme--`;
|
|
22
22
|
function createTamagui(config) {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
validateConfig(config);
|
|
26
|
-
}
|
|
23
|
+
if (config["parsed"]) {
|
|
24
|
+
return config;
|
|
27
25
|
}
|
|
28
26
|
if (conf) {
|
|
29
27
|
console.warn("Called createTamagui twice! Should never do so");
|
|
@@ -34,61 +32,60 @@ function createTamagui(config) {
|
|
|
34
32
|
});
|
|
35
33
|
const themeConfig = (() => {
|
|
36
34
|
let cssRules = [];
|
|
37
|
-
let tokenRule = `:root {`;
|
|
38
35
|
const varsByValue = new Map();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
if (isWeb) {
|
|
37
|
+
let tokenRule = `:root {`;
|
|
38
|
+
const addVar = /* @__PURE__ */ __name((v) => {
|
|
39
|
+
varsByValue[v.val] = v;
|
|
40
|
+
const rule = `--${v.name}:${typeof v.val === "number" ? `${v.val}px` : v.val};`;
|
|
41
|
+
tokenRule += rule;
|
|
42
|
+
}, "addVar");
|
|
43
|
+
for (const key in config.tokens) {
|
|
44
|
+
for (const skey in config.tokens[key]) {
|
|
45
|
+
const val = config.tokens[key][skey];
|
|
46
|
+
if (key === "font") {
|
|
47
|
+
for (const fkey in val) {
|
|
48
|
+
if (fkey === "family") {
|
|
49
|
+
addVar(val[fkey]);
|
|
50
|
+
} else {
|
|
51
|
+
for (const fskey in val[fkey]) {
|
|
52
|
+
addVar(val[fkey][fskey]);
|
|
53
|
+
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
} else {
|
|
57
|
+
addVar(val);
|
|
56
58
|
}
|
|
57
|
-
} else {
|
|
58
|
-
addVar(val);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
cssRules.push(`${tokenRule}
|
|
61
|
+
cssRules.push(`${tokenRule}
|
|
63
62
|
}`);
|
|
63
|
+
}
|
|
64
64
|
for (const themeName in config.themes) {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const theme = { ...config.themes[themeName] };
|
|
66
|
+
config.themes[themeName] = theme;
|
|
67
67
|
let vars = "";
|
|
68
68
|
for (const themeKey in theme) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
}, "getVariableCSS");
|
|
74
|
-
vars += getVariableCSS(val);
|
|
75
|
-
if (!isVariable(val)) {
|
|
76
|
-
theme[themeKey] = createVariable({
|
|
77
|
-
name: themeKey,
|
|
78
|
-
val
|
|
79
|
-
});
|
|
69
|
+
if (isWeb) {
|
|
70
|
+
const val = theme[themeKey];
|
|
71
|
+
const varName = val instanceof Variable ? val.name : varsByValue[val]?.name;
|
|
72
|
+
vars += `--${themeKey}:${varName ? `var(--${varName});` : `${val}`};`;
|
|
80
73
|
}
|
|
74
|
+
ensureThemeVariable(theme, themeKey);
|
|
81
75
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
if (isWeb) {
|
|
77
|
+
const [themeClassName, parentName] = themeName.includes("-") ? themeName.split("-") : [themeName, ""];
|
|
78
|
+
const oppositeName = parentName === "dark" ? "light" : "dark";
|
|
79
|
+
const cssParentSel = parentName ? `.${PREFIX}${parentName}` : "";
|
|
80
|
+
const cssChildSel = `.${PREFIX}${themeClassName}`;
|
|
81
|
+
const cssSel = `${cssParentSel} ${cssChildSel}`;
|
|
82
|
+
const cssRule = `${cssSel}, .${PREFIX}${oppositeName} ${cssSel} {
|
|
88
83
|
${vars}
|
|
89
84
|
}`;
|
|
90
|
-
|
|
85
|
+
cssRules.push(cssRule);
|
|
86
|
+
}
|
|
91
87
|
}
|
|
88
|
+
varsByValue.clear();
|
|
92
89
|
Object.freeze(cssRules);
|
|
93
90
|
return {
|
|
94
91
|
cssRules,
|
|
@@ -158,6 +155,23 @@ const parseTokens = /* @__PURE__ */ __name((tokens) => {
|
|
|
158
155
|
}
|
|
159
156
|
return res;
|
|
160
157
|
}, "parseTokens");
|
|
158
|
+
function ensureThemeVariable(theme, key) {
|
|
159
|
+
const val = theme[key];
|
|
160
|
+
if (!(val instanceof Variable)) {
|
|
161
|
+
theme[key] = createVariable({
|
|
162
|
+
name: key,
|
|
163
|
+
val
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
if (val.name !== key) {
|
|
167
|
+
theme[key] = createVariable({
|
|
168
|
+
name: key,
|
|
169
|
+
val: val.val
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
__name(ensureThemeVariable, "ensureThemeVariable");
|
|
161
175
|
export {
|
|
162
176
|
createTamagui,
|
|
163
177
|
getHasConfigured,
|
package/dist/jsx/createTheme.js
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
const createTheme = /* @__PURE__ */ __name((theme) => {
|
|
5
|
-
const res = {};
|
|
6
|
-
for (const key in theme) {
|
|
7
|
-
const val = theme[key];
|
|
8
|
-
if (!(val instanceof Variable)) {
|
|
9
|
-
res[key] = createVariable({
|
|
10
|
-
name: key,
|
|
11
|
-
val
|
|
12
|
-
});
|
|
13
|
-
} else {
|
|
14
|
-
res[key] = val;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return res;
|
|
18
|
-
}, "createTheme");
|
|
3
|
+
const createTheme = /* @__PURE__ */ __name((theme) => theme, "createTheme");
|
|
19
4
|
export {
|
|
20
5
|
createTheme
|
|
21
6
|
};
|
|
@@ -70,14 +70,20 @@ const useTheme = /* @__PURE__ */ __name(() => {
|
|
|
70
70
|
const val = activeTheme[key];
|
|
71
71
|
if (process.env.NODE_ENV === "development") {
|
|
72
72
|
if (typeof val === "undefined") {
|
|
73
|
-
console.warn(`No theme value "${String(key)}" in
|
|
73
|
+
console.warn(`No theme value "${String(key)}" in`, activeTheme, themes);
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
+
if (!(val instanceof Variable)) {
|
|
77
|
+
console.warn("Non variable!", val);
|
|
78
|
+
}
|
|
79
|
+
if (val.name !== key) {
|
|
80
|
+
console.warn("Non-matching name for variable to key", key, val.name);
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
if (state.current.isRendering) {
|
|
78
84
|
state.current.keys.add(key);
|
|
79
85
|
}
|
|
80
|
-
return
|
|
86
|
+
return val;
|
|
81
87
|
}
|
|
82
88
|
});
|
|
83
89
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.31",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
|
-
"module": "dist",
|
|
6
|
+
"module": "dist/esm",
|
|
7
7
|
"typings": "types",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tamagui-build",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@tamagui/helpers": "^1.0.0-alpha.
|
|
17
|
+
"@tamagui/helpers": "^1.0.0-alpha.31",
|
|
18
18
|
"@tamagui/ow": "^0.28.1",
|
|
19
|
-
"@tamagui/use-debounce": "^1.0.0-alpha.
|
|
20
|
-
"@tamagui/use-force-update": "^1.0.0-alpha.
|
|
19
|
+
"@tamagui/use-debounce": "^1.0.0-alpha.31",
|
|
20
|
+
"@tamagui/use-force-update": "^1.0.0-alpha.31",
|
|
21
21
|
"react": "*",
|
|
22
22
|
"react-dom": "*"
|
|
23
23
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"react-native-web": "*"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tamagui/build": "^1.0.0-alpha.
|
|
28
|
+
"@tamagui/build": "^1.0.0-alpha.31",
|
|
29
29
|
"@types/react": "^17.0.35",
|
|
30
30
|
"esbuild": "^0.13.12",
|
|
31
31
|
"react-native-web": "^0.17.5",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=16"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "3593d13742ae284776db7fbe0486d622312c7c15"
|
|
41
41
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;;;CAS9B,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export declare const isWeb: boolean;
|
|
3
|
+
export declare const isSSR: boolean;
|
|
4
|
+
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
5
|
+
export declare const isChrome: boolean;
|
|
6
|
+
export declare const supportsTouchWeb: boolean;
|
|
7
|
+
export declare const isTouchDevice: boolean;
|
|
8
|
+
export declare const isWebIOS: boolean;
|
|
9
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/constants/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAA;AAGlD,eAAO,MAAM,KAAK,SAAuE,CAAA;AACzF,eAAO,MAAM,KAAK,SAAyC,CAAA;AAC3D,eAAO,MAAM,yBAAyB,kBAAsC,CAAA;AAC5E,eAAO,MAAM,QAAQ,SAA+E,CAAA;AACpG,eAAO,MAAM,gBAAgB,SAA4D,CAAA;AACzF,eAAO,MAAM,aAAa,SAA6B,CAAA;AACvD,eAAO,MAAM,QAAQ,SAKA,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const pseudos: {
|
|
2
|
+
focusStyle: {
|
|
3
|
+
name: string;
|
|
4
|
+
priority: number;
|
|
5
|
+
};
|
|
6
|
+
pressStyle: {
|
|
7
|
+
name: string;
|
|
8
|
+
priority: number;
|
|
9
|
+
};
|
|
10
|
+
hoverStyle: {
|
|
11
|
+
name: string;
|
|
12
|
+
priority: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=pseudos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pseudos.d.ts","sourceRoot":"","sources":["../../src/constants/pseudos.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;;;;;;;;CAanB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnw.d.ts","sourceRoot":"","sources":["../../src/constants/rnw.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ViewStyle } from 'react-native';
|
|
2
|
+
import { StaticComponent, StaticConfig, StaticConfigParsed } from './types';
|
|
3
|
+
export declare const mouseUps: Set<Function>;
|
|
4
|
+
declare type DefaultProps = {};
|
|
5
|
+
export declare function createComponent<A extends Object = DefaultProps>(configIn: Partial<StaticConfig> | StaticConfigParsed): StaticComponent<A, void, StaticConfigParsed, any>;
|
|
6
|
+
export declare const Spacer: StaticComponent<{
|
|
7
|
+
size?: number | `$${string}` | `$${number}` | undefined;
|
|
8
|
+
flex?: number | boolean | undefined;
|
|
9
|
+
}, void, StaticConfigParsed, any>;
|
|
10
|
+
export declare function spacedChildren({ isZStack, children, space, flexDirection, }: {
|
|
11
|
+
isZStack?: boolean;
|
|
12
|
+
children: any;
|
|
13
|
+
space?: any;
|
|
14
|
+
flexDirection?: ViewStyle['flexDirection'];
|
|
15
|
+
}): any;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=createComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAA;AAYhE,OAAO,EAEL,eAAe,EACf,YAAY,EACZ,kBAAkB,EAEnB,MAAM,SAAS,CAAA;AAGhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AAS3C,aAAK,YAAY,GAAG,EAAE,CAAA;AAuBtB,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,YAAY,EAC7D,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,qDA+brD;AAOD,eAAO,MAAM,MAAM;;;iCAyBjB,CAAA;AAEF,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,aAAa,GACd,EAAE;IACD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,GAAG,CAAA;IACb,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,aAAa,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,CAAA;CAC3C,OAwCA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFont.d.ts","sourceRoot":"","sources":["../src/createFont.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,eAAO,MAAM,UAAU,uCA2BtB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createShorthands.d.ts","sourceRoot":"","sources":["../src/createShorthands.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAEnF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Variable } from './createVariable';
|
|
2
|
+
import { CreateTamaguiConfig, GenericTamaguiConfig, MediaQueryKey, TamaguiInternalConfig, TamaguiProviderProps } from './types';
|
|
3
|
+
export declare type CreateTamaguiProps = TamaguiProviderProps & Omit<GenericTamaguiConfig, 'themes'> & {
|
|
4
|
+
themes: {
|
|
5
|
+
[key: string]: {
|
|
6
|
+
[key: string]: string | number | Variable;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
mediaQueryDefaultActive?: MediaQueryKey[];
|
|
10
|
+
};
|
|
11
|
+
export declare const getHasConfigured: () => boolean;
|
|
12
|
+
export declare const getTamagui: () => TamaguiInternalConfig<import("./types").CreateTokens<string | number | Variable>, {
|
|
13
|
+
[key: string]: {
|
|
14
|
+
bg: string | Variable;
|
|
15
|
+
bg2: string | Variable;
|
|
16
|
+
bg3: string | Variable;
|
|
17
|
+
bg4: string | Variable;
|
|
18
|
+
color: string | Variable;
|
|
19
|
+
color2: string | Variable;
|
|
20
|
+
color3: string | Variable;
|
|
21
|
+
color4: string | Variable;
|
|
22
|
+
borderColor: string | Variable;
|
|
23
|
+
borderColor2: string | Variable;
|
|
24
|
+
shadowColor: string | Variable;
|
|
25
|
+
shadowColor2: string | Variable;
|
|
26
|
+
};
|
|
27
|
+
}, {}, {
|
|
28
|
+
[x: string]: {
|
|
29
|
+
[key: string]: string | number;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
export declare const getTokens: () => import("./types").CreateTokens<Variable>;
|
|
33
|
+
export declare const getThemes: () => {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
bg: string | Variable;
|
|
36
|
+
bg2: string | Variable;
|
|
37
|
+
bg3: string | Variable;
|
|
38
|
+
bg4: string | Variable;
|
|
39
|
+
color: string | Variable;
|
|
40
|
+
color2: string | Variable;
|
|
41
|
+
color3: string | Variable;
|
|
42
|
+
color4: string | Variable;
|
|
43
|
+
borderColor: string | Variable;
|
|
44
|
+
borderColor2: string | Variable;
|
|
45
|
+
shadowColor: string | Variable;
|
|
46
|
+
shadowColor2: string | Variable;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
declare type ConfigListener = (conf: TamaguiInternalConfig) => void;
|
|
50
|
+
export declare const onConfiguredOnce: (cb: ConfigListener) => void;
|
|
51
|
+
export declare function createTamagui<Conf extends CreateTamaguiProps>(config: Conf): Conf extends CreateTamaguiConfig<infer A, infer B, infer C, infer D> ? TamaguiInternalConfig<A, B, C, D> : unknown;
|
|
52
|
+
export declare function getThemeParentClassName(themeName?: string | null): string;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=createTamagui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTamagui.d.ts","sourceRoot":"","sources":["../src/createTamagui.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAkB,MAAM,kBAAkB,CAAA;AAG3D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,oBAAY,kBAAkB,GAAG,oBAAoB,GAGnD,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,GAAG;IACrC,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;SAC1C,CAAA;KACF,CAAA;IAED,uBAAuB,CAAC,EAAE,aAAa,EAAE,CAAA;CAC1C,CAAA;AAIH,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAE5C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;EAAc,CAAA;AACrC,eAAO,MAAM,SAAS,gDAA2B,CAAA;AACjD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;CAAqB,CAAA;AAE3C,aAAK,cAAc,GAAG,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAA;AAE3D,eAAO,MAAM,gBAAgB,OAAQ,cAAc,SAMlD,CAAA;AAID,wBAAgB,aAAa,CAAC,IAAI,SAAS,kBAAkB,EAC3D,MAAM,EAAE,IAAI,GACX,IAAI,SAAS,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GACnE,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACjC,OAAO,CAuIV;AAED,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,UAEhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTheme.d.ts","sourceRoot":"","sources":["../src/createTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,aAAK,YAAY,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAA;AAExD,eAAO,MAAM,WAAW,qDAA6D,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Variable } from './createVariable';
|
|
2
|
+
import { CreateTokens } from './types';
|
|
3
|
+
export declare function createTokens<T extends CreateTokens>(tokens: T): MakeTokens<T>;
|
|
4
|
+
export declare const mapTokensToVariables: (tokens: CreateTokens, parentPath?: string) => CreateTokens<Variable>;
|
|
5
|
+
declare type MakeTokens<T> = T extends {
|
|
6
|
+
font: {
|
|
7
|
+
[key in infer A]: {
|
|
8
|
+
size: infer B;
|
|
9
|
+
lineHeight: infer C;
|
|
10
|
+
letterSpacing: infer D;
|
|
11
|
+
weight: infer Z;
|
|
12
|
+
family: infer Y;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
color: infer E;
|
|
16
|
+
space: infer F;
|
|
17
|
+
size: infer G;
|
|
18
|
+
radius: infer H;
|
|
19
|
+
zIndex: infer J;
|
|
20
|
+
} ? {
|
|
21
|
+
font: {
|
|
22
|
+
[key in A]: {
|
|
23
|
+
size: {
|
|
24
|
+
[key in keyof B]: Variable;
|
|
25
|
+
};
|
|
26
|
+
lineHeight: {
|
|
27
|
+
[key in keyof C]: Variable;
|
|
28
|
+
};
|
|
29
|
+
letterSpacing: {
|
|
30
|
+
[key in keyof D]: Variable;
|
|
31
|
+
};
|
|
32
|
+
weight: {
|
|
33
|
+
[key in keyof Z]: Variable;
|
|
34
|
+
};
|
|
35
|
+
family: Y;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
color: {
|
|
39
|
+
[key in keyof E]: Variable;
|
|
40
|
+
};
|
|
41
|
+
space: {
|
|
42
|
+
[key in keyof F]: Variable;
|
|
43
|
+
};
|
|
44
|
+
size: {
|
|
45
|
+
[key in keyof G]: Variable;
|
|
46
|
+
};
|
|
47
|
+
radius: {
|
|
48
|
+
[key in keyof H]: Variable;
|
|
49
|
+
};
|
|
50
|
+
zIndex: {
|
|
51
|
+
[key in keyof J]: Variable;
|
|
52
|
+
};
|
|
53
|
+
} : never;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=createTokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTokens.d.ts","sourceRoot":"","sources":["../src/createTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,kBAAkB,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAItC,wBAAgB,YAAY,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAM7E;AAMD,eAAO,MAAM,oBAAoB,WACvB,YAAY,0BAEnB,aAAa,QAAQ,CAavB,CAAA;AAGD,aAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS;IAC7B,IAAI,EAAE;SACH,GAAG,IAAI,MAAM,CAAC,GAAG;YAChB,IAAI,EAAE,MAAM,CAAC,CAAA;YACb,UAAU,EAAE,MAAM,CAAC,CAAA;YACnB,aAAa,EAAE,MAAM,CAAC,CAAA;YACtB,MAAM,EAAE,MAAM,CAAC,CAAA;YACf,MAAM,EAAE,MAAM,CAAC,CAAA;SAChB;KACF,CAAA;IACD,KAAK,EAAE,MAAM,CAAC,CAAA;IACd,KAAK,EAAE,MAAM,CAAC,CAAA;IACd,IAAI,EAAE,MAAM,CAAC,CAAA;IACb,MAAM,EAAE,MAAM,CAAC,CAAA;IACf,MAAM,EAAE,MAAM,CAAC,CAAA;CAChB,GACG;IACE,IAAI,EAAE;SACH,GAAG,IAAI,CAAC,GAAG;YACV,IAAI,EAAE;iBACH,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;aAC3B,CAAA;YACD,UAAU,EAAE;iBACT,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;aAC3B,CAAA;YACD,aAAa,EAAE;iBACZ,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;aAC3B,CAAA;YACD,MAAM,EAAE;iBACL,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;aAC3B,CAAA;YACD,MAAM,EAAE,CAAC,CAAA;SACV;KACF,CAAA;IACD,KAAK,EAAE;SACJ,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;KAC3B,CAAA;IACD,KAAK,EAAE;SACJ,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;KAC3B,CAAA;IACD,IAAI,EAAE;SACH,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;KAC3B,CAAA;IACD,MAAM,EAAE;SACL,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;KAC3B,CAAA;IACD,MAAM,EAAE;SACL,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ;KAC3B,CAAA;CACF,GACD,KAAK,CAAA"}
|