@planningcenter/chat-react-native 1.4.0 → 1.4.1-rc.0
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/build/contexts/chat_context.d.ts +8 -1
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +21 -2
- package/build/contexts/chat_context.js.map +1 -1
- package/build/hooks/index.d.ts +0 -1
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/index.d.ts +1 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -2
- package/build/index.js.map +1 -1
- package/package.json +2 -2
- package/src/contexts/chat_context.tsx +34 -3
- package/src/hooks/index.ts +0 -1
- package/src/index.tsx +0 -2
- package/build/hooks/use_create_chat_theme.d.ts +0 -10
- package/build/hooks/use_create_chat_theme.d.ts.map +0 -1
- package/build/hooks/use_create_chat_theme.js +0 -20
- package/build/hooks/use_create_chat_theme.js.map +0 -1
- package/src/hooks/use_create_chat_theme.tsx +0 -31
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ColorSchemeName } from 'react-native';
|
|
3
|
+
import { DeepPartial, OAuthToken } from '../types';
|
|
4
|
+
import { DefaultTheme } from '../utils/theme';
|
|
3
5
|
type ContextValue = {
|
|
4
6
|
token?: OAuthToken;
|
|
5
7
|
onTokenExpired: () => void;
|
|
@@ -11,5 +13,10 @@ export declare function ChatProvider({ children, value }: {
|
|
|
11
13
|
children: any;
|
|
12
14
|
value: ContextValue;
|
|
13
15
|
}): React.JSX.Element | null;
|
|
16
|
+
interface CreateChatThemeProps {
|
|
17
|
+
theme?: DeepPartial<DefaultTheme>;
|
|
18
|
+
colorScheme?: ColorSchemeName;
|
|
19
|
+
}
|
|
20
|
+
export declare const useCreateChatTheme: ({ theme: customTheme, colorScheme: appColorScheme, }: CreateChatThemeProps) => any;
|
|
14
21
|
export {};
|
|
15
22
|
//# sourceMappingURL=chat_context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_context.d.ts","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat_context.d.ts","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiC,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,eAAe,EAAkB,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAgB,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAI3D,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,KAAK,EAAE,GAAG,CAAA;IACV,GAAG,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;CAC/C,CAAA;AAED,eAAO,MAAM,WAAW,6BAKtB,CAAA;AAEF,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,4BAYvF;AAED,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACjC,WAAW,CAAC,EAAE,eAAe,CAAA;CAC9B;AAED,eAAO,MAAM,kBAAkB,yDAG5B,oBAAoB,QAetB,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { merge } from 'lodash';
|
|
2
|
+
import React, { createContext, useMemo } from 'react';
|
|
3
|
+
import { useColorScheme } from 'react-native';
|
|
4
|
+
import { defaultTheme } from '../utils/theme';
|
|
5
|
+
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map';
|
|
2
6
|
import { ApiProvider } from './api_provider';
|
|
3
7
|
export const ChatContext = createContext({
|
|
4
8
|
theme: undefined,
|
|
@@ -7,12 +11,27 @@ export const ChatContext = createContext({
|
|
|
7
11
|
onTokenExpired: () => { },
|
|
8
12
|
});
|
|
9
13
|
export function ChatProvider({ children, value }) {
|
|
14
|
+
const theme = useCreateChatTheme(value.theme);
|
|
10
15
|
if (!Object.keys(value.token || {}).length)
|
|
11
16
|
return null;
|
|
12
|
-
return (<ChatContext.Provider value={value}>
|
|
17
|
+
return (<ChatContext.Provider value={{ ...value, theme }}>
|
|
13
18
|
<ApiProvider env={value.env} token={value.token} onTokenExpired={value.onTokenExpired}>
|
|
14
19
|
{children}
|
|
15
20
|
</ApiProvider>
|
|
16
21
|
</ChatContext.Provider>);
|
|
17
22
|
}
|
|
23
|
+
export const useCreateChatTheme = ({ theme: customTheme = {}, colorScheme: appColorScheme, }) => {
|
|
24
|
+
const internalColorScheme = useColorScheme() || 'light';
|
|
25
|
+
const colorScheme = appColorScheme || internalColorScheme;
|
|
26
|
+
const memoizedTheme = useMemo(() => {
|
|
27
|
+
return {
|
|
28
|
+
...merge({}, defaultTheme(colorScheme), customTheme),
|
|
29
|
+
colors: {
|
|
30
|
+
...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),
|
|
31
|
+
...tapestryAliasTokensColorMap[colorScheme],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}, [colorScheme, customTheme]);
|
|
35
|
+
return memoizedTheme;
|
|
36
|
+
};
|
|
18
37
|
//# sourceMappingURL=chat_context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_context.js","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"chat_context.js","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAmB,cAAc,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAA;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAS5C,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAe;IACrD,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;IACd,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;CACzB,CAAC,CAAA;AAEF,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAA0C;IACtF,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAE7C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAEvD,OAAO,CACL,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,CAC/C;MAAA,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CACpF;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,WAAW,CACf;IAAA,EAAE,WAAW,CAAC,QAAQ,CAAC,CACxB,CAAA;AACH,CAAC;AAOD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,KAAK,EAAE,WAAW,GAAG,EAAE,EACvB,WAAW,EAAE,cAAc,GACN,EAAE,EAAE;IACzB,MAAM,mBAAmB,GAAG,cAAc,EAAE,IAAI,OAAO,CAAA;IACvD,MAAM,WAAW,GAAG,cAAc,IAAI,mBAAmB,CAAA;IAEzD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO;YACL,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;YACpD,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;gBACnE,GAAG,2BAA2B,CAAC,WAAW,CAAC;aAC5C;SACF,CAAA;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAA;IAE9B,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA","sourcesContent":["import { merge } from 'lodash'\nimport React, { createContext, useMemo } from 'react'\nimport { ColorSchemeName, useColorScheme } from 'react-native'\nimport { DeepPartial, OAuthToken } from '../types'\nimport { defaultTheme, DefaultTheme } from '../utils/theme'\nimport { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map'\nimport { ApiProvider } from './api_provider'\n\ntype ContextValue = {\n token?: OAuthToken\n onTokenExpired: () => void\n theme: any\n env?: 'production' | 'staging' | 'development'\n}\n\nexport const ChatContext = createContext<ContextValue>({\n theme: undefined,\n token: undefined,\n env: undefined,\n onTokenExpired: () => {},\n})\n\nexport function ChatProvider({ children, value }: { children: any; value: ContextValue }) {\n const theme = useCreateChatTheme(value.theme)\n\n if (!Object.keys(value.token || {}).length) return null\n\n return (\n <ChatContext.Provider value={{ ...value, theme }}>\n <ApiProvider env={value.env} token={value.token} onTokenExpired={value.onTokenExpired}>\n {children}\n </ApiProvider>\n </ChatContext.Provider>\n )\n}\n\ninterface CreateChatThemeProps {\n theme?: DeepPartial<DefaultTheme>\n colorScheme?: ColorSchemeName\n}\n\nexport const useCreateChatTheme = ({\n theme: customTheme = {},\n colorScheme: appColorScheme,\n}: CreateChatThemeProps) => {\n const internalColorScheme = useColorScheme() || 'light'\n const colorScheme = appColorScheme || internalColorScheme\n\n const memoizedTheme = useMemo(() => {\n return {\n ...merge({}, defaultTheme(colorScheme), customTheme),\n colors: {\n ...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),\n ...tapestryAliasTokensColorMap[colorScheme],\n },\n }\n }, [colorScheme, customTheme])\n\n return memoizedTheme\n}\n"]}
|
package/build/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA"}
|
package/build/hooks/index.js
CHANGED
package/build/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA","sourcesContent":["export { useTheme } from './use_theme'\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Conversations } from './components/conversations';
|
|
2
2
|
import { ChatContext, ChatProvider } from './contexts/chat_context';
|
|
3
|
-
import { useCreateChatTheme } from './hooks';
|
|
4
3
|
import { OAuthToken } from './types';
|
|
5
4
|
import { baseUrlMap, uploadUrlMap } from './utils/session';
|
|
6
5
|
import { TemporaryDefaultColorsType } from './utils/theme';
|
|
7
|
-
export { baseUrlMap, ChatContext, ChatProvider, Conversations, OAuthToken, TemporaryDefaultColorsType, uploadUrlMap,
|
|
6
|
+
export { baseUrlMap, ChatContext, ChatProvider, Conversations, OAuthToken, TemporaryDefaultColorsType, uploadUrlMap, };
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAE1D,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,0BAA0B,EAC1B,YAAY,GACb,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Conversations } from './components/conversations';
|
|
2
2
|
import { ChatContext, ChatProvider } from './contexts/chat_context';
|
|
3
|
-
import { useCreateChatTheme } from './hooks';
|
|
4
3
|
import { baseUrlMap, uploadUrlMap } from './utils/session';
|
|
5
|
-
export { baseUrlMap, ChatContext, ChatProvider, Conversations, uploadUrlMap,
|
|
4
|
+
export { baseUrlMap, ChatContext, ChatProvider, Conversations, uploadUrlMap, };
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEnE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG1D,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EAGb,YAAY,GACb,CAAA","sourcesContent":["import { Conversations } from './components/conversations'\nimport { ChatContext, ChatProvider } from './contexts/chat_context'\nimport { OAuthToken } from './types'\nimport { baseUrlMap, uploadUrlMap } from './utils/session'\nimport { TemporaryDefaultColorsType } from './utils/theme'\n\nexport {\n baseUrlMap,\n ChatContext,\n ChatProvider,\n Conversations,\n OAuthToken,\n TemporaryDefaultColorsType,\n uploadUrlMap,\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "1.4.0",
|
|
3
|
+
"version": "1.4.1-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"prettier": "^3.4.2",
|
|
39
39
|
"react-native": "0.74.5"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "ec03747d0b2fdf8c637b72c015da37358b0b2d86"
|
|
42
42
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { merge } from 'lodash'
|
|
2
|
+
import React, { createContext, useMemo } from 'react'
|
|
3
|
+
import { ColorSchemeName, useColorScheme } from 'react-native'
|
|
4
|
+
import { DeepPartial, OAuthToken } from '../types'
|
|
5
|
+
import { defaultTheme, DefaultTheme } from '../utils/theme'
|
|
6
|
+
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map'
|
|
3
7
|
import { ApiProvider } from './api_provider'
|
|
4
8
|
|
|
5
9
|
type ContextValue = {
|
|
@@ -17,13 +21,40 @@ export const ChatContext = createContext<ContextValue>({
|
|
|
17
21
|
})
|
|
18
22
|
|
|
19
23
|
export function ChatProvider({ children, value }: { children: any; value: ContextValue }) {
|
|
24
|
+
const theme = useCreateChatTheme(value.theme)
|
|
25
|
+
|
|
20
26
|
if (!Object.keys(value.token || {}).length) return null
|
|
21
27
|
|
|
22
28
|
return (
|
|
23
|
-
<ChatContext.Provider value={value}>
|
|
29
|
+
<ChatContext.Provider value={{ ...value, theme }}>
|
|
24
30
|
<ApiProvider env={value.env} token={value.token} onTokenExpired={value.onTokenExpired}>
|
|
25
31
|
{children}
|
|
26
32
|
</ApiProvider>
|
|
27
33
|
</ChatContext.Provider>
|
|
28
34
|
)
|
|
29
35
|
}
|
|
36
|
+
|
|
37
|
+
interface CreateChatThemeProps {
|
|
38
|
+
theme?: DeepPartial<DefaultTheme>
|
|
39
|
+
colorScheme?: ColorSchemeName
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const useCreateChatTheme = ({
|
|
43
|
+
theme: customTheme = {},
|
|
44
|
+
colorScheme: appColorScheme,
|
|
45
|
+
}: CreateChatThemeProps) => {
|
|
46
|
+
const internalColorScheme = useColorScheme() || 'light'
|
|
47
|
+
const colorScheme = appColorScheme || internalColorScheme
|
|
48
|
+
|
|
49
|
+
const memoizedTheme = useMemo(() => {
|
|
50
|
+
return {
|
|
51
|
+
...merge({}, defaultTheme(colorScheme), customTheme),
|
|
52
|
+
colors: {
|
|
53
|
+
...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),
|
|
54
|
+
...tapestryAliasTokensColorMap[colorScheme],
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
}, [colorScheme, customTheme])
|
|
58
|
+
|
|
59
|
+
return memoizedTheme
|
|
60
|
+
}
|
package/src/hooks/index.ts
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Conversations } from './components/conversations'
|
|
2
2
|
import { ChatContext, ChatProvider } from './contexts/chat_context'
|
|
3
|
-
import { useCreateChatTheme } from './hooks'
|
|
4
3
|
import { OAuthToken } from './types'
|
|
5
4
|
import { baseUrlMap, uploadUrlMap } from './utils/session'
|
|
6
5
|
import { TemporaryDefaultColorsType } from './utils/theme'
|
|
@@ -13,5 +12,4 @@ export {
|
|
|
13
12
|
OAuthToken,
|
|
14
13
|
TemporaryDefaultColorsType,
|
|
15
14
|
uploadUrlMap,
|
|
16
|
-
useCreateChatTheme,
|
|
17
15
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ColorSchemeName } from 'react-native';
|
|
2
|
-
import { DefaultTheme } from '../utils/theme';
|
|
3
|
-
import { DeepPartial } from '../types';
|
|
4
|
-
interface CreateChatThemeProps {
|
|
5
|
-
theme?: DeepPartial<DefaultTheme>;
|
|
6
|
-
colorScheme?: ColorSchemeName;
|
|
7
|
-
}
|
|
8
|
-
export declare const useCreateChatTheme: ({ theme: customTheme, colorScheme: appColorScheme, }: CreateChatThemeProps) => any;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=use_create_chat_theme.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use_create_chat_theme.d.ts","sourceRoot":"","sources":["../../src/hooks/use_create_chat_theme.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAgB,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAItC,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACjC,WAAW,CAAC,EAAE,eAAe,CAAA;CAC9B;AAED,eAAO,MAAM,kBAAkB,yDAG5B,oBAAoB,QAetB,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { useColorScheme } from 'react-native';
|
|
3
|
-
import { defaultTheme } from '../utils/theme';
|
|
4
|
-
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map';
|
|
5
|
-
import { merge } from 'lodash';
|
|
6
|
-
export const useCreateChatTheme = ({ theme: customTheme = {}, colorScheme: appColorScheme, }) => {
|
|
7
|
-
const internalColorScheme = useColorScheme() || 'light';
|
|
8
|
-
const colorScheme = appColorScheme || internalColorScheme;
|
|
9
|
-
const memoizedTheme = useMemo(() => {
|
|
10
|
-
return {
|
|
11
|
-
...merge({}, defaultTheme(colorScheme), customTheme),
|
|
12
|
-
colors: {
|
|
13
|
-
...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),
|
|
14
|
-
...tapestryAliasTokensColorMap[colorScheme],
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
}, [colorScheme, customTheme]);
|
|
18
|
-
return memoizedTheme;
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=use_create_chat_theme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use_create_chat_theme.js","sourceRoot":"","sources":["../../src/hooks/use_create_chat_theme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAA;AAE3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAA;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAO9B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,KAAK,EAAE,WAAW,GAAG,EAAE,EACvB,WAAW,EAAE,cAAc,GACN,EAAE,EAAE;IACzB,MAAM,mBAAmB,GAAG,cAAc,EAAE,IAAI,OAAO,CAAA;IACvD,MAAM,WAAW,GAAG,cAAc,IAAI,mBAAmB,CAAA;IAEzD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO;YACL,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;YACpD,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;gBACnE,GAAG,2BAA2B,CAAC,WAAW,CAAC;aAC5C;SACF,CAAA;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAA;IAE9B,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { useColorScheme, ColorSchemeName } from 'react-native'\nimport { defaultTheme, DefaultTheme } from '../utils/theme'\nimport { DeepPartial } from '../types'\nimport { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map'\nimport { merge } from 'lodash'\n\ninterface CreateChatThemeProps {\n theme?: DeepPartial<DefaultTheme>\n colorScheme?: ColorSchemeName\n}\n\nexport const useCreateChatTheme = ({\n theme: customTheme = {},\n colorScheme: appColorScheme,\n}: CreateChatThemeProps) => {\n const internalColorScheme = useColorScheme() || 'light'\n const colorScheme = appColorScheme || internalColorScheme\n\n const memoizedTheme = useMemo(() => {\n return {\n ...merge({}, defaultTheme(colorScheme), customTheme),\n colors: {\n ...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),\n ...tapestryAliasTokensColorMap[colorScheme],\n },\n }\n }, [colorScheme, customTheme])\n\n return memoizedTheme\n}\n"]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
import { useColorScheme, ColorSchemeName } from 'react-native'
|
|
3
|
-
import { defaultTheme, DefaultTheme } from '../utils/theme'
|
|
4
|
-
import { DeepPartial } from '../types'
|
|
5
|
-
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map'
|
|
6
|
-
import { merge } from 'lodash'
|
|
7
|
-
|
|
8
|
-
interface CreateChatThemeProps {
|
|
9
|
-
theme?: DeepPartial<DefaultTheme>
|
|
10
|
-
colorScheme?: ColorSchemeName
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const useCreateChatTheme = ({
|
|
14
|
-
theme: customTheme = {},
|
|
15
|
-
colorScheme: appColorScheme,
|
|
16
|
-
}: CreateChatThemeProps) => {
|
|
17
|
-
const internalColorScheme = useColorScheme() || 'light'
|
|
18
|
-
const colorScheme = appColorScheme || internalColorScheme
|
|
19
|
-
|
|
20
|
-
const memoizedTheme = useMemo(() => {
|
|
21
|
-
return {
|
|
22
|
-
...merge({}, defaultTheme(colorScheme), customTheme),
|
|
23
|
-
colors: {
|
|
24
|
-
...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),
|
|
25
|
-
...tapestryAliasTokensColorMap[colorScheme],
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
}, [colorScheme, customTheme])
|
|
29
|
-
|
|
30
|
-
return memoizedTheme
|
|
31
|
-
}
|