@tamagui/core 1.0.0-alpha.0 → 1.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/dist/constants/platform.js +1 -1
  3. package/dist/constants/platform.js.map +2 -2
  4. package/dist/createComponent.js +1 -1
  5. package/dist/createComponent.js.map +2 -2
  6. package/dist/hooks/useMedia.js +1 -1
  7. package/dist/hooks/useMedia.js.map +2 -2
  8. package/dist/hooks/useTheme.js +1 -1
  9. package/dist/hooks/useTheme.js.map +2 -2
  10. package/dist/index.cjs +57 -79
  11. package/dist/index.cjs.map +3 -3
  12. package/dist/index.js +0 -1
  13. package/dist/index.js.map +2 -2
  14. package/package.json +12 -4
  15. package/src/constants/platform.ts +1 -1
  16. package/src/createComponent.tsx +2 -1
  17. package/src/hooks/useMedia.tsx +1 -1
  18. package/src/hooks/useTheme.tsx +1 -1
  19. package/src/index.ts +0 -1
  20. package/types.d.ts +0 -1
  21. package/.ultra.cache.json +0 -1
  22. package/_/constants/constants.js +0 -14
  23. package/_/constants/constants.js.map +0 -7
  24. package/_/constants/platform.js +0 -20
  25. package/_/constants/platform.js.map +0 -7
  26. package/_/constants/pseudos.js +0 -18
  27. package/_/constants/pseudos.js.map +0 -7
  28. package/_/constants/rnw.js +0 -22
  29. package/_/constants/rnw.js.map +0 -7
  30. package/_/createComponent.js +0 -427
  31. package/_/createComponent.js.map +0 -7
  32. package/_/createShorthands.js +0 -10
  33. package/_/createShorthands.js.map +0 -7
  34. package/_/createTamagui.js +0 -122
  35. package/_/createTamagui.js.map +0 -7
  36. package/_/createTheme.js +0 -20
  37. package/_/createTheme.js.map +0 -7
  38. package/_/createTokens.js +0 -29
  39. package/_/createTokens.js.map +0 -7
  40. package/_/createVariable.js +0 -22
  41. package/_/createVariable.js.map +0 -7
  42. package/_/helpers/addStylesUsingClassname.js +0 -32
  43. package/_/helpers/addStylesUsingClassname.js.map +0 -7
  44. package/_/helpers/createMediaStyle.js +0 -34
  45. package/_/helpers/createMediaStyle.js.map +0 -7
  46. package/_/helpers/createTamaguiProvider.js +0 -42
  47. package/_/helpers/createTamaguiProvider.js.map +0 -7
  48. package/_/helpers/extendStaticConfig.js +0 -176
  49. package/_/helpers/extendStaticConfig.js.map +0 -7
  50. package/_/helpers/fixNativeShadow.js +0 -8
  51. package/_/helpers/fixNativeShadow.js.map +0 -7
  52. package/_/helpers/fixNativeShadow.native.js +0 -30
  53. package/_/helpers/fixNativeShadow.native.js.map +0 -7
  54. package/_/helpers/getSplitStyles.js +0 -160
  55. package/_/helpers/getSplitStyles.js.map +0 -7
  56. package/_/helpers/getStylesAtomic.js +0 -84
  57. package/_/helpers/getStylesAtomic.js.map +0 -7
  58. package/_/helpers/getStylesAtomic.native.js +0 -10
  59. package/_/helpers/getStylesAtomic.native.js.map +0 -7
  60. package/_/helpers/insertStyleRule.js +0 -24
  61. package/_/helpers/insertStyleRule.js.map +0 -7
  62. package/_/helpers/matchMedia.js +0 -15
  63. package/_/helpers/matchMedia.js.map +0 -7
  64. package/_/helpers/matchMedia.native.js +0 -8
  65. package/_/helpers/matchMedia.native.js.map +0 -7
  66. package/_/helpers/themeable.js +0 -26
  67. package/_/helpers/themeable.js.map +0 -7
  68. package/_/hooks/useConstant.js +0 -15
  69. package/_/hooks/useConstant.js.map +0 -7
  70. package/_/hooks/useFeatures.js +0 -75
  71. package/_/hooks/useFeatures.js.map +0 -7
  72. package/_/hooks/useForceUpdate.js +0 -28
  73. package/_/hooks/useForceUpdate.js.map +0 -7
  74. package/_/hooks/useMedia.js +0 -173
  75. package/_/hooks/useMedia.js.map +0 -7
  76. package/_/hooks/usePressable.js +0 -14
  77. package/_/hooks/usePressable.js.map +0 -7
  78. package/_/hooks/useTheme.js +0 -94
  79. package/_/hooks/useTheme.js.map +0 -7
  80. package/_/index.js +0 -30
  81. package/_/index.js.map +0 -7
  82. package/_/static/postProcessStyles.js +0 -18
  83. package/_/static/postProcessStyles.js.map +0 -7
  84. package/_/static.js +0 -12
  85. package/_/static.js.map +0 -7
  86. package/_/styled.js +0 -21
  87. package/_/styled.js.map +0 -7
  88. package/_/types.js +0 -1
  89. package/_/types.js.map +0 -7
  90. package/_/views/Animated.js +0 -79
  91. package/_/views/Animated.js.map +0 -7
  92. package/_/views/Stack.js +0 -12
  93. package/_/views/Stack.js.map +0 -7
  94. package/_/views/Text.js +0 -60
  95. package/_/views/Text.js.map +0 -7
  96. package/_/views/TextAncestorContext.js +0 -19
  97. package/_/views/TextAncestorContext.js.map +0 -7
  98. package/_/views/Theme.js +0 -57
  99. package/_/views/Theme.js.map +0 -7
  100. package/_/views/ThemeContext.js +0 -6
  101. package/_/views/ThemeContext.js.map +0 -7
  102. package/_/views/ThemeInverse.js +0 -27
  103. package/_/views/ThemeInverse.js.map +0 -7
  104. package/_/views/ThemeManagerContext.js +0 -56
  105. package/_/views/ThemeManagerContext.js.map +0 -7
  106. package/_/views/ThemeProvider.js +0 -45
  107. package/_/views/ThemeProvider.js.map +0 -7
  108. package/src/hooks/useForceUpdate.tsx +0 -26
  109. package/tsconfig.json +0 -8
@@ -1,94 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { useContext, useEffect, useMemo, useRef, useState } from "react";
4
- import { useIsomorphicLayoutEffect } from "../constants/platform";
5
- import { Variable } from "../createVariable";
6
- import { ThemeContext } from "../views/ThemeContext";
7
- import { ThemeManagerContext } from "../views/ThemeManagerContext";
8
- import { GET_DEFAULT_THEME } from "../views/ThemeProvider";
9
- import { useForceUpdate } from "./useForceUpdate";
10
- const areEqualSets = /* @__PURE__ */ __name((a, b) => {
11
- if (a.size !== b.size)
12
- return false;
13
- for (const val in a) {
14
- if (!b.has(val)) {
15
- return false;
16
- }
17
- }
18
- return true;
19
- }, "areEqualSets");
20
- const useThemeName = /* @__PURE__ */ __name(() => {
21
- const parent = useContext(ThemeManagerContext);
22
- const [name, setName] = useState(parent.name);
23
- useEffect(() => {
24
- return parent.onChangeTheme((next) => {
25
- setName((prev) => {
26
- if (prev === next)
27
- return prev;
28
- return next;
29
- });
30
- });
31
- }, [parent]);
32
- return name || "light";
33
- }, "useThemeName");
34
- const useDefaultThemeName = /* @__PURE__ */ __name(() => {
35
- return useContext(ThemeContext)[GET_DEFAULT_THEME];
36
- }, "useDefaultThemeName");
37
- const useTheme = /* @__PURE__ */ __name(() => {
38
- var _a;
39
- const forceUpdate = useForceUpdate();
40
- const manager = useContext(ThemeManagerContext);
41
- const themes = useContext(ThemeContext);
42
- const state = useRef();
43
- if (!state.current) {
44
- state.current = {
45
- uuid: {},
46
- keys: new Set(),
47
- isRendering: true
48
- };
49
- }
50
- state.current.isRendering = true;
51
- useIsomorphicLayoutEffect(() => {
52
- const st = state.current;
53
- st.isRendering = false;
54
- const cur = manager.keys.get(st.uuid);
55
- if (!cur || !areEqualSets(st.keys, cur)) {
56
- manager.track(st.uuid, st.keys);
57
- }
58
- });
59
- useEffect(() => {
60
- return manager.onUpdate(state.current.uuid, forceUpdate);
61
- }, []);
62
- const theme = (_a = manager.name ? themes[manager.name] : themes.light) != null ? _a : themes.light;
63
- return useMemo(() => {
64
- return new Proxy(theme, {
65
- get(_, key) {
66
- const name = manager.name;
67
- if (!name) {
68
- return Reflect.get(_, key);
69
- }
70
- let activeTheme = themes[name];
71
- if (!activeTheme) {
72
- console.error("No theme by name", name, "only:", themes, "keeping current theme");
73
- activeTheme = theme;
74
- }
75
- const val = activeTheme[key];
76
- if (process.env.NODE_ENV === "development") {
77
- if (typeof val === "undefined") {
78
- throw new Error(`No theme value "${String(key)}" in: ${Object.keys(activeTheme)}`);
79
- }
80
- }
81
- if (state.current.isRendering) {
82
- state.current.keys.add(key);
83
- }
84
- return new Variable({ val: val.val, name: key });
85
- }
86
- });
87
- }, []);
88
- }, "useTheme");
89
- export {
90
- useDefaultThemeName,
91
- useTheme,
92
- useThemeName
93
- };
94
- //# sourceMappingURL=useTheme.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/useTheme.tsx"],
4
- "sourcesContent": ["import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { Variable } from '../createVariable'\nimport { ThemeName } from '../types'\nimport { ThemeContext } from '../views/ThemeContext'\nimport { ThemeManagerContext } from '../views/ThemeManagerContext'\nimport { GET_DEFAULT_THEME } from '../views/ThemeProvider'\nimport { useForceUpdate } from './useForceUpdate'\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 = () => {\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent.name)\n useEffect(() => {\n return parent.onChangeTheme((next) => {\n setName((prev) => {\n if (prev === next) return prev\n return next\n })\n })\n }, [parent])\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 = () => {\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 throw new Error(`No theme value \"${String(key)}\" in: ${Object.keys(activeTheme)}`)\n }\n }\n if (state.current.isRendering) {\n state.current.keys.add(key)\n }\n // TODO costly, can make faster (we need name mapping to og name, but val pointing to new val)\n // console.log('returning new variable', val, key)\n return new Variable({ val: val.val, name: key })\n },\n })\n },\n [\n /* if concurrent mode wanted put manager.name here */\n ]\n )\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AAEA;AACA;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,6BAAM;AAChC,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,MAAM,WAAW,SAAS,OAAO;AACxC,YAAU,MAAM;AACd,WAAO,OAAO,cAAc,CAAC,SAAS;AACpC,cAAQ,CAAC,SAAS;AAChB,YAAI,SAAS;AAAM,iBAAO;AAC1B,eAAO;AAAA;AAAA;AAAA,KAGV,CAAC;AACJ,SAAO,QAAQ;AAAA,GAXW;AAcrB,MAAM,sBAAsB,6BAAM;AACvC,SAAO,WAAW,cAAc;AAAA,GADC;AAI5B,MAAM,WAAW,6BAAM;AA5C9B;AA6CE,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,cAAQ,OAAO,OAAO,QAAQ,QAAQ,OAAO,UAA7C,YAAuD,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,kBAAM,IAAI,MAAM,mBAAmB,OAAO,aAAa,OAAO,KAAK;AAAA;AAAA;AAGvE,YAAI,MAAM,QAAQ,aAAa;AAC7B,gBAAM,QAAQ,KAAK,IAAI;AAAA;AAIzB,eAAO,IAAI,SAAS,EAAE,KAAK,IAAI,KAAK,MAAM;AAAA;AAAA;AAAA,KAIhD;AAAA,GA1DoB;",
6
- "names": []
7
- }
package/_/index.js DELETED
@@ -1,30 +0,0 @@
1
- export * from "./createComponent";
2
- export * from "./createShorthands";
3
- export * from "./createTheme";
4
- export * from "./createTamagui";
5
- import { createTokens } from "./createTokens";
6
- export * from "./createVariable";
7
- export * from "./styled";
8
- export * from "./types";
9
- export * from "./constants/pseudos";
10
- export * from "./constants/constants";
11
- export * from "./constants/platform";
12
- export * from "./constants/rnw";
13
- export * from "./helpers/getStylesAtomic";
14
- export * from "./helpers/matchMedia";
15
- export * from "./helpers/themeable";
16
- export * from "./hooks/useConstant";
17
- export * from "./hooks/useForceUpdate";
18
- export * from "./hooks/useMedia";
19
- export * from "./hooks/useTheme";
20
- export * from "./views/Animated";
21
- export * from "./views/Stack";
22
- export * from "./views/Text";
23
- export * from "./views/Theme";
24
- export * from "./views/ThemeInverse";
25
- export * from "./views/ThemeProvider";
26
- export * from "./views/TextAncestorContext";
27
- export {
28
- createTokens
29
- };
30
- //# sourceMappingURL=index.js.map
package/_/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport { createTokens } from './createTokens'\nexport * from './createVariable'\nexport * from './styled'\nexport * from './types'\n\nexport * from './constants/pseudos'\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport * from './constants/rnw'\n\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/matchMedia'\nexport * from './helpers/themeable'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useForceUpdate'\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './views/Animated'\nexport * from './views/Stack'\nexport * from './views/Text'\nexport * from './views/Theme'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/TextAncestorContext'\n"],
5
- "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;",
6
- "names": []
7
- }
@@ -1,18 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { getSplitStyles } from "../helpers/getSplitStyles";
4
- const postProcessStyles = /* @__PURE__ */ __name((inStyles, staticConfig, theme) => {
5
- const { style, viewProps, pseudos, classNames } = getSplitStyles(inStyles, staticConfig, theme);
6
- const next = {};
7
- for (const s of style) {
8
- if (!s)
9
- continue;
10
- Object.assign(next, s);
11
- }
12
- Object.assign(next, pseudos);
13
- return { style: next, viewProps, classNames };
14
- }, "postProcessStyles");
15
- export {
16
- postProcessStyles
17
- };
18
- //# sourceMappingURL=postProcessStyles.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/static/postProcessStyles.tsx"],
4
- "sourcesContent": ["import { getSplitStyles } from '../helpers/getSplitStyles'\nimport { StaticConfigParsed, TamaguiInternalConfig, ThemeObject } from '../types'\n\n// used only by static extractor\n\nexport const postProcessStyles = (\n inStyles: any,\n staticConfig: StaticConfigParsed,\n theme: ThemeObject\n) => {\n const { style, viewProps, pseudos, classNames } = getSplitStyles(inStyles, staticConfig, theme)\n // flattening\n const next = {}\n for (const s of style) {\n if (!s) continue\n Object.assign(next, s)\n }\n Object.assign(next, pseudos)\n return { style: next, viewProps, classNames }\n}\n"],
5
- "mappings": ";;AAAA;AAKO,MAAM,oBAAoB,wBAC/B,UACA,cACA,UACG;AACH,QAAM,EAAE,OAAO,WAAW,SAAS,eAAe,eAAe,UAAU,cAAc;AAEzF,QAAM,OAAO;AACb,aAAW,KAAK,OAAO;AACrB,QAAI,CAAC;AAAG;AACR,WAAO,OAAO,MAAM;AAAA;AAEtB,SAAO,OAAO,MAAM;AACpB,SAAO,EAAE,OAAO,MAAM,WAAW;AAAA,GAbF;",
6
- "names": []
7
- }
package/_/static.js DELETED
@@ -1,12 +0,0 @@
1
- export * from "./styled";
2
- export * from "./createComponent";
3
- export * from "./createTamagui";
4
- export * from "./constants/constants";
5
- export * from "./hooks/useMedia";
6
- export * from "./hooks/useTheme";
7
- export * from "./helpers/getStylesAtomic";
8
- export * from "./helpers/getSplitStyles";
9
- export * from "@tamagui/helpers";
10
- export * from "./constants/pseudos";
11
- export * from "./static/postProcessStyles";
12
- //# sourceMappingURL=static.js.map
package/_/static.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/static.ts"],
4
- "sourcesContent": ["// only stuff that gets extracted or needed by tamagui-static\n\nexport * from './styled'\nexport * from './createComponent'\nexport * from './createTamagui'\nexport * from './constants/constants'\n\nexport * from './hooks/useMedia'\nexport * from './hooks/useTheme'\n\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/getSplitStyles'\nexport * from '@tamagui/helpers'\n\nexport * from './constants/pseudos'\n\n// -- below exports are only bundled compile-time --\n\nexport * from './static/postProcessStyles'\n"],
5
- "mappings": "AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AAIA;",
6
- "names": []
7
- }
package/_/styled.js DELETED
@@ -1,21 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { createComponent } from "./createComponent";
4
- import { extendStaticConfig } from "./helpers/extendStaticConfig";
5
- function styled(Component, options) {
6
- const staticConfigProps = (() => {
7
- if (options) {
8
- const { variants, ...defaultProps } = options;
9
- return { variants, defaultProps };
10
- }
11
- return {};
12
- })();
13
- const config = extendStaticConfig(Component, staticConfigProps);
14
- const component = createComponent(config);
15
- return component;
16
- }
17
- __name(styled, "styled");
18
- export {
19
- styled
20
- };
21
- //# sourceMappingURL=styled.js.map
package/_/styled.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/styled.ts"],
4
- "sourcesContent": ["import React from 'react'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport { StaticComponent, TamaguiConfig, Themes, Tokens } from './types'\n\nexport type GetProps<A> = A extends StaticComponent<infer Props>\n ? Props\n : A extends React.Component<infer Props>\n ? Props\n : {}\n\nexport function styled<\n A extends StaticComponent | React.Component<any>,\n StyledVariants extends void | {\n [key: string]: {\n [key: string]:\n | Partial<GetProps<A>>\n | ((\n val: any,\n config: {\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n }\n ) => Partial<GetProps<A>>)\n }\n }\n>(\n Component: A,\n options?: GetProps<A> & {\n variants?: StyledVariants\n }\n) {\n const staticConfigProps = (() => {\n if (options) {\n const { variants, ...defaultProps } = options\n return { 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\n // type ParentVariants = A extends StaticComponent<any, infer Variants> ? Variants : {}\n\n type VariantProps = StyledVariants extends void\n ? {}\n : {\n // ensure variants actually defined\n [Key in keyof StyledVariants]?: keyof StyledVariants[Key] extends `...${infer VariantSpread}`\n ? VariantSpread extends keyof Tokens\n ? keyof Tokens[VariantSpread] extends string | number\n ? `$${keyof Tokens[VariantSpread]}`\n : unknown\n : unknown\n : keyof StyledVariants[Key] extends 'true'\n ? boolean\n : keyof StyledVariants[Key]\n }\n\n return component as StaticComponent<\n GetProps<A> & VariantProps\n // adding this one causes infinite type recursion after a couple styled() exntesions\n // VariantProps\n // typeof config,\n // ParentVariants\n >\n}\n\n// TODO get name\n// const displayName = `styled(Component)`\n// Object.defineProperty(component, 'name', {\n// value: displayName,\n// writable: false,\n// })\n"],
5
- "mappings": ";;AAEA;AACA;AASO,gBAgBL,WACA,SAGA;AACA,QAAM,oBAAqB,OAAM;AAC/B,QAAI,SAAS;AACX,YAAM,EAAE,aAAa,iBAAiB;AACtC,aAAO,EAAE,UAAU;AAAA;AAErB,WAAO;AAAA;AAET,QAAM,SAAS,mBAAmB,WAAW;AAC7C,QAAM,YAAY,gBAAgB;AAmBlC,SAAO;AAAA;AAhDO;",
6
- "names": []
7
- }
package/_/types.js DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
package/_/types.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,79 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import React, { useMemo } from "react";
4
- import {
5
- Animated
6
- } from "react-native";
7
- import { useIsomorphicLayoutEffect } from "../constants/platform";
8
- import { useConstant } from "../hooks/useConstant";
9
- import { Stack } from "./Stack";
10
- const defaultAnimation = {
11
- from: {
12
- opacity: 0,
13
- translateY: 12
14
- },
15
- to: {
16
- opacity: 1,
17
- translateY: 0
18
- }
19
- };
20
- const styleKeys = {
21
- opacity: true,
22
- backgroundColor: true,
23
- borderColor: true
24
- };
25
- const AnimatedStack = /* @__PURE__ */ __name(({
26
- animateState = "in",
27
- animation = defaultAnimation,
28
- velocity = 6,
29
- children,
30
- animated,
31
- ...props
32
- }) => {
33
- const driver = useConstant(() => {
34
- return new Animated.Value(0);
35
- });
36
- const animatedProps = useMemo(() => {
37
- if (!animated) {
38
- return null;
39
- }
40
- const styleProps = {};
41
- const transform = [];
42
- for (const key in animation.from) {
43
- const fromVal = animation.from[key];
44
- const toVal = animation.to[key];
45
- const interpolatedVal = driver.interpolate({
46
- inputRange: [0, 1],
47
- outputRange: [fromVal, toVal]
48
- });
49
- if (styleKeys[key]) {
50
- styleProps[key] = interpolatedVal;
51
- } else {
52
- transform.push({
53
- [key]: interpolatedVal
54
- });
55
- }
56
- }
57
- return { transform, ...styleProps };
58
- }, [animated, animateState]);
59
- useIsomorphicLayoutEffect(() => {
60
- if (!animated) {
61
- return;
62
- }
63
- Animated.spring(driver, {
64
- useNativeDriver: true,
65
- velocity,
66
- toValue: animateState === "in" ? 1 : 0
67
- }).start();
68
- }, [animated, animateState]);
69
- const childrenMemo = useMemo(() => children, [children]);
70
- return /* @__PURE__ */ React.createElement(Stack, {
71
- animated,
72
- ...props,
73
- ...animatedProps
74
- }, childrenMemo);
75
- }, "AnimatedStack");
76
- export {
77
- AnimatedStack
78
- };
79
- //# sourceMappingURL=Animated.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/Animated.tsx"],
4
- "sourcesContent": ["import React, { useMemo } from 'react'\nimport {\n Animated,\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n SkewXTransform,\n SkewYTransform,\n TranslateXTransform,\n TranslateYTransform,\n} from 'react-native'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useConstant } from '../hooks/useConstant'\nimport { StackProps } from '../types'\nimport { Stack } from './Stack'\n\nconst defaultAnimation = {\n from: {\n opacity: 0,\n translateY: 12,\n },\n to: {\n opacity: 1,\n translateY: 0,\n },\n}\n\ntype AnimatableProps = Partial<\n Pick<StackProps, 'backgroundColor' | 'borderColor' | 'opacity'> &\n PerpectiveTransform &\n RotateTransform &\n RotateXTransform &\n RotateYTransform &\n RotateZTransform &\n ScaleTransform &\n ScaleXTransform &\n ScaleYTransform &\n TranslateXTransform &\n TranslateYTransform &\n SkewXTransform &\n SkewYTransform\n>\n\nconst styleKeys = {\n opacity: true,\n backgroundColor: true,\n borderColor: true,\n}\n\nexport type AnimatedStackProps = StackProps & {\n animateState?: 'in' | 'out'\n velocity?: number\n animation?: {\n from: AnimatableProps\n to: AnimatableProps\n }\n}\n\nexport const AnimatedStack = ({\n animateState = 'in',\n animation = defaultAnimation,\n velocity = 6,\n children,\n animated,\n ...props\n}: AnimatedStackProps) => {\n const driver = useConstant(() => {\n return new Animated.Value(0)\n })\n\n const animatedProps = useMemo(() => {\n if (!animated) {\n return null\n }\n\n const styleProps = {}\n const transform: any = []\n\n for (const key in animation.from) {\n const fromVal = animation.from[key]\n const toVal = animation.to[key]\n const interpolatedVal = driver.interpolate({\n inputRange: [0, 1],\n outputRange: [fromVal, toVal],\n })\n if (styleKeys[key]) {\n styleProps[key] = interpolatedVal\n } else {\n transform.push({\n [key]: interpolatedVal,\n })\n }\n }\n return { transform, ...styleProps }\n }, [animated, animateState])\n\n useIsomorphicLayoutEffect(() => {\n if (!animated) {\n return\n }\n Animated.spring(driver, {\n useNativeDriver: true,\n velocity,\n toValue: animateState === 'in' ? 1 : 0,\n }).start()\n }, [animated, animateState])\n\n const childrenMemo = useMemo(() => children, [children])\n\n return (\n <Stack animated={animated} {...props} {...animatedProps}>\n {childrenMemo}\n </Stack>\n )\n}\n"],
5
- "mappings": ";;AAAA;AACA;AAAA;AAAA;AAgBA;AACA;AAEA;AAEA,MAAM,mBAAmB;AAAA,EACvB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,EAEd,IAAI;AAAA,IACF,SAAS;AAAA,IACT,YAAY;AAAA;AAAA;AAoBhB,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,aAAa;AAAA;AAYR,MAAM,gBAAgB,wBAAC;AAAA,EAC5B,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA;AAAA,KACG;AAAA,MACqB;AACxB,QAAM,SAAS,YAAY,MAAM;AAC/B,WAAO,IAAI,SAAS,MAAM;AAAA;AAG5B,QAAM,gBAAgB,QAAQ,MAAM;AAClC,QAAI,CAAC,UAAU;AACb,aAAO;AAAA;AAGT,UAAM,aAAa;AACnB,UAAM,YAAiB;AAEvB,eAAW,OAAO,UAAU,MAAM;AAChC,YAAM,UAAU,UAAU,KAAK;AAC/B,YAAM,QAAQ,UAAU,GAAG;AAC3B,YAAM,kBAAkB,OAAO,YAAY;AAAA,QACzC,YAAY,CAAC,GAAG;AAAA,QAChB,aAAa,CAAC,SAAS;AAAA;AAEzB,UAAI,UAAU,MAAM;AAClB,mBAAW,OAAO;AAAA,aACb;AACL,kBAAU,KAAK;AAAA,WACZ,MAAM;AAAA;AAAA;AAAA;AAIb,WAAO,EAAE,cAAc;AAAA,KACtB,CAAC,UAAU;AAEd,4BAA0B,MAAM;AAC9B,QAAI,CAAC,UAAU;AACb;AAAA;AAEF,aAAS,OAAO,QAAQ;AAAA,MACtB,iBAAiB;AAAA,MACjB;AAAA,MACA,SAAS,iBAAiB,OAAO,IAAI;AAAA,OACpC;AAAA,KACF,CAAC,UAAU;AAEd,QAAM,eAAe,QAAQ,MAAM,UAAU,CAAC;AAE9C,SACE,oCAAC,OAAD;AAAA,IAAO;AAAA,OAAwB;AAAA,OAAW;AAAA,KACvC;AAAA,GArDsB;",
6
- "names": []
7
- }
package/_/views/Stack.js DELETED
@@ -1,12 +0,0 @@
1
- import { stackDefaultStyles } from "../constants/constants";
2
- import { createComponent } from "../createComponent";
3
- const Stack = createComponent({
4
- defaultProps: {
5
- ...stackDefaultStyles,
6
- flexDirection: "column"
7
- }
8
- });
9
- export {
10
- Stack
11
- };
12
- //# sourceMappingURL=Stack.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/Stack.tsx"],
4
- "sourcesContent": ["import { stackDefaultStyles } from '../constants/constants'\nimport { createComponent } from '../createComponent'\nimport { StackProps } from '../types'\n\nexport const Stack = createComponent<StackProps>({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n },\n})\n\n// test types\n// export const YStack = styled(Stack, {\n// flexDirection: 'column',\n// })\n// // test types\n// const x00 = <Stack missing={0} /> // should err\n// const x0 = <YStack missing={0} /> // should err\n// const x1 = (props: StackProps) => <YStack {...props} />\n// type ys = typeof YStack\n// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown\n"],
5
- "mappings": "AAAA;AACA;AAGO,MAAM,QAAQ,gBAA4B;AAAA,EAC/C,cAAc;AAAA,OACT;AAAA,IACH,eAAe;AAAA;AAAA;",
6
- "names": []
7
- }
package/_/views/Text.js DELETED
@@ -1,60 +0,0 @@
1
- import { isWeb } from "../constants/platform";
2
- import { createComponent } from "../createComponent";
3
- import { stylePropsTextOnly, validStyles } from "../static";
4
- const ellipseStyle = {
5
- maxWidth: "100%",
6
- overflow: "hidden",
7
- textOverflow: "ellipsis",
8
- whiteSpace: "nowrap"
9
- };
10
- const Text = createComponent({
11
- isText: true,
12
- defaultProps: {
13
- display: isWeb ? "inline" : "inline-flex",
14
- boxSizing: "border-box",
15
- fontFamily: "System",
16
- wordWrap: "break-word"
17
- },
18
- variants: {
19
- numberOfLines: {
20
- 1: ellipseStyle,
21
- "[number]": (lines) => lines > 1 ? { WebkitLineClamp: 1 } : null
22
- },
23
- selectable: {
24
- true: {
25
- userSelect: "text"
26
- },
27
- false: {
28
- userSelect: "none"
29
- }
30
- },
31
- pressable: {
32
- true: {
33
- cursor: "pointer"
34
- }
35
- },
36
- ellipse: {
37
- true: isWeb ? ellipseStyle : {
38
- numberOfLines: 1,
39
- lineBreakMode: "clip"
40
- }
41
- }
42
- },
43
- deoptProps: new Set(isWeb ? [] : ["ellipse"]),
44
- validStyles: {
45
- ...validStyles,
46
- ...stylePropsTextOnly,
47
- ...isWeb && {
48
- userSelect: true,
49
- textOverflow: true,
50
- whiteSpace: true,
51
- wordWrap: true,
52
- selectable: true,
53
- cursor: true
54
- }
55
- }
56
- });
57
- export {
58
- Text
59
- };
60
- //# sourceMappingURL=Text.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/Text.tsx"],
4
- "sourcesContent": ["import { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { stylePropsTextOnly, validStyles } from '../static'\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 // TODO document\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;AACA;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,EAKzB,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
- "names": []
7
- }
@@ -1,19 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- var _a;
4
- import React from "react";
5
- import { rnw } from "../constants/rnw";
6
- const TextAncestorContext = (_a = rnw) == null ? void 0 : _a.TextAncestorContext;
7
- const TextAncestorProvider = /* @__PURE__ */ __name((props) => {
8
- if (TextAncestorContext) {
9
- return /* @__PURE__ */ React.createElement(TextAncestorContext.Provider, {
10
- value: false
11
- }, props.children);
12
- }
13
- return props.children;
14
- }, "TextAncestorProvider");
15
- export {
16
- TextAncestorContext,
17
- TextAncestorProvider
18
- };
19
- //# sourceMappingURL=TextAncestorContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/TextAncestorContext.tsx"],
4
- "sourcesContent": ["import React from 'react'\n\nimport { rnw } from '../constants/rnw'\n\nexport const TextAncestorContext = rnw?.TextAncestorContext\n\nexport const TextAncestorProvider = (props) => {\n if (TextAncestorContext) {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n }\n return props.children\n}\n"],
5
- "mappings": ";;AAAA;AAAA;AAEA;AAEO,MAAM,sBAAsB,iCAAK;AAEjC,MAAM,uBAAuB,wBAAC,UAAU;AAC7C,MAAI,qBAAqB;AACvB,WAAO,oCAAC,oBAAoB,UAArB;AAAA,MAA8B,OAAO;AAAA,OAAQ,MAAM;AAAA;AAE5D,SAAO,MAAM;AAAA,GAJqB;",
6
- "names": []
7
- }
package/_/views/Theme.js DELETED
@@ -1,57 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import React, { useContext, useState } from "react";
4
- import { isWeb, useIsomorphicLayoutEffect } from "../constants/platform";
5
- import { getThemeParentClassName } from "../createTamagui";
6
- import { useConstant } from "../hooks/useConstant";
7
- import { ThemeContext } from "./ThemeContext";
8
- import { ThemeManager, ThemeManagerContext } from "./ThemeManagerContext";
9
- const Theme = /* @__PURE__ */ __name((props) => {
10
- var _a, _b;
11
- const parent = useContext(ThemeManagerContext);
12
- const themes = useContext(ThemeContext);
13
- const [parentName, setParentName] = useState(parent.name || "light");
14
- if (!themes) {
15
- console.warn("no themes???", props);
16
- return props.children;
17
- }
18
- const name = props.name;
19
- const theme = themes[name] || themes[`${name}-${parentName}`];
20
- const themeManager = useConstant(() => {
21
- const manager = new ThemeManager();
22
- if (name) {
23
- manager.setActiveTheme(name, themes[name]);
24
- }
25
- return manager;
26
- });
27
- useIsomorphicLayoutEffect(() => {
28
- themeManager.setActiveTheme(name, theme);
29
- return parent.onChangeTheme((next) => {
30
- if (next) {
31
- themeManager.setActiveTheme(next, themes[next]);
32
- setParentName(next);
33
- }
34
- });
35
- }, [themes, name]);
36
- if (!name) {
37
- return props.children;
38
- }
39
- const contents = themeManager ? /* @__PURE__ */ React.createElement(ThemeManagerContext.Provider, {
40
- value: themeManager
41
- }, props.children) : props.children;
42
- if (isWeb) {
43
- if (props.disableThemeClass) {
44
- return contents;
45
- }
46
- const color = (_b = (_a = themes[name]) == null ? void 0 : _a["color"]) == null ? void 0 : _b["variable"];
47
- return /* @__PURE__ */ React.createElement("div", {
48
- className: getThemeParentClassName(name),
49
- style: { display: "contents", color }
50
- }, contents);
51
- }
52
- return contents;
53
- }, "Theme");
54
- export {
55
- Theme
56
- };
57
- //# sourceMappingURL=Theme.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import React, { useContext, useState } from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getThemeParentClassName } from '../createTamagui'\nimport { useConstant } from '../hooks/useConstant'\nimport { ThemeName, Themes } from '../types'\nimport { ThemeContext } from './ThemeContext'\nimport { ThemeManager, ThemeManagerContext } from './ThemeManagerContext'\n\nexport type ThemeProps = {\n disableThemeClass?: boolean\n name: ThemeName | null\n children?: any\n}\n\nexport const Theme = (props: ThemeProps) => {\n const parent = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const [parentName, setParentName] = useState(parent.name || 'light')\n if (!themes) {\n console.warn('no themes???', props)\n return props.children\n }\n const name = props.name as string\n const theme = themes[name] || themes[`${name}-${parentName}`]\n const themeManager = useConstant<ThemeManager>(() => {\n const manager = new ThemeManager()\n if (name) {\n manager.setActiveTheme(name, themes[name])\n }\n return manager\n })\n\n useIsomorphicLayoutEffect(() => {\n themeManager.setActiveTheme(name, theme)\n return parent.onChangeTheme((next) => {\n if (next) {\n themeManager.setActiveTheme(next, themes[next])\n setParentName(next)\n }\n })\n }, [themes, name])\n\n if (!name) {\n return props.children\n }\n\n const contents = themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>\n {props.children}\n </ThemeManagerContext.Provider>\n ) : (\n props.children\n )\n\n if (isWeb) {\n if (props.disableThemeClass) {\n return contents\n }\n const color = themes[name]?.['color']?.['variable']\n return (\n <div\n className={getThemeParentClassName(name)}\n // in order to provide currentColor, set color by default\n style={{ display: 'contents', color }}\n >\n {contents}\n </div>\n )\n }\n\n return contents\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AAEA;AACA;AAQO,MAAM,QAAQ,wBAAC,UAAsB;AAf5C;AAgBE,QAAM,SAAS,WAAW;AAC1B,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,YAAY,iBAAiB,SAAS,OAAO,QAAQ;AAC5D,MAAI,CAAC,QAAQ;AACX,YAAQ,KAAK,gBAAgB;AAC7B,WAAO,MAAM;AAAA;AAEf,QAAM,OAAO,MAAM;AACnB,QAAM,QAAQ,OAAO,SAAS,OAAO,GAAG,QAAQ;AAChD,QAAM,eAAe,YAA0B,MAAM;AACnD,UAAM,UAAU,IAAI;AACpB,QAAI,MAAM;AACR,cAAQ,eAAe,MAAM,OAAO;AAAA;AAEtC,WAAO;AAAA;AAGT,4BAA0B,MAAM;AAC9B,iBAAa,eAAe,MAAM;AAClC,WAAO,OAAO,cAAc,CAAC,SAAS;AACpC,UAAI,MAAM;AACR,qBAAa,eAAe,MAAM,OAAO;AACzC,sBAAc;AAAA;AAAA;AAAA,KAGjB,CAAC,QAAQ;AAEZ,MAAI,CAAC,MAAM;AACT,WAAO,MAAM;AAAA;AAGf,QAAM,WAAW,eACf,oCAAC,oBAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KAClC,MAAM,YAGT,MAAM;AAGR,MAAI,OAAO;AACT,QAAI,MAAM,mBAAmB;AAC3B,aAAO;AAAA;AAET,UAAM,QAAQ,mBAAO,UAAP,mBAAe,aAAf,mBAA0B;AACxC,WACE,oCAAC,OAAD;AAAA,MACE,WAAW,wBAAwB;AAAA,MAEnC,OAAO,EAAE,SAAS,YAAY;AAAA,OAE7B;AAAA;AAKP,SAAO;AAAA,GAxDY;",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- import { createContext } from "react";
2
- const ThemeContext = createContext(null);
3
- export {
4
- ThemeContext
5
- };
6
- //# sourceMappingURL=ThemeContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/ThemeContext.tsx"],
4
- "sourcesContent": ["import { createContext } from 'react'\n\nimport { Themes } from '../types'\n\nexport const ThemeContext = createContext<Themes>(null as any)\n"],
5
- "mappings": "AAAA;AAIO,MAAM,eAAe,cAAsB;",
6
- "names": []
7
- }
@@ -1,27 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import React from "react";
4
- import { useDefaultThemeName, useThemeName } from "../hooks/useTheme";
5
- import { Theme } from "./Theme";
6
- let inversions = {
7
- light: "dark",
8
- dark: "light"
9
- };
10
- function setThemeInversions(next) {
11
- inversions = next;
12
- }
13
- __name(setThemeInversions, "setThemeInversions");
14
- const ThemeInverse = /* @__PURE__ */ __name((props) => {
15
- const themeName = useThemeName();
16
- const defaultTheme = useDefaultThemeName();
17
- const name = inversions[themeName] || inversions[defaultTheme] || null;
18
- console.log("todo fixme invert", { themeName, defaultTheme, next: name });
19
- return /* @__PURE__ */ React.createElement(Theme, {
20
- name
21
- }, props.children);
22
- }, "ThemeInverse");
23
- export {
24
- ThemeInverse,
25
- setThemeInversions
26
- };
27
- //# sourceMappingURL=ThemeInverse.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/ThemeInverse.tsx"],
4
- "sourcesContent": ["import React from 'react'\n\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const name = inversions[themeName] || inversions[defaultTheme] || null\n console.log('todo fixme invert', { themeName, defaultTheme, next: name })\n return <Theme name={name}>{props.children}</Theme>\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AAIA,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA;AAGD,4BAA4B,MAAoB;AACrD,eAAa;AAAA;AADC;AAIT,MAAM,eAAe,wBAAC,UAA6B;AACxD,QAAM,YAAY;AAClB,QAAM,eAAe;AACrB,QAAM,OAAO,WAAW,cAAc,WAAW,iBAAiB;AAClE,UAAQ,IAAI,qBAAqB,EAAE,WAAW,cAAc,MAAM;AAClE,SAAO,oCAAC,OAAD;AAAA,IAAO;AAAA,KAAa,MAAM;AAAA,GALP;",
6
- "names": []
7
- }