@tamagui/core 1.0.1-beta.141 → 1.0.1-beta.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Tamagui.js +2 -2
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/addTheme.js +28 -22
- package/dist/cjs/addTheme.js.map +2 -2
- package/dist/cjs/config.js +75 -0
- package/dist/cjs/config.js.map +7 -0
- package/dist/cjs/constants/platform.js +7 -1
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/platform.native.js +62 -0
- package/dist/cjs/constants/platform.native.js.map +7 -0
- package/dist/cjs/createComponent.js +71 -58
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createComponent.server.js +431 -0
- package/dist/cjs/createComponent.server.js.map +7 -0
- package/dist/cjs/createTamagui.js +10 -8
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createVariable.js +6 -12
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js +5 -2
- package/dist/cjs/createVariables.js.map +2 -2
- package/dist/cjs/helpers/RNComponents.js +11 -11
- package/dist/cjs/helpers/RNComponents.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +7 -9
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/assignNativePropsToWeb.js +0 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +3 -3
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/expandStyles.js +4 -4
- package/dist/cjs/helpers/expandStyles.js.map +2 -2
- package/dist/cjs/helpers/getAnimationDriver.js +32 -0
- package/dist/cjs/helpers/getAnimationDriver.js.map +7 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +3 -3
- package/dist/cjs/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/cjs/helpers/getFont.js +1 -1
- package/dist/cjs/helpers/getFont.js.map +2 -2
- package/dist/cjs/helpers/getSize.js +2 -2
- package/dist/cjs/helpers/getSize.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +12 -13
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +6 -4
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getVariantExtras.js +2 -2
- package/dist/cjs/helpers/getVariantExtras.js.map +2 -2
- package/dist/cjs/helpers/normalizeColor.js +2 -2
- package/dist/cjs/helpers/normalizeColor.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/cjs/helpers/useAnimationDriver.js +2 -0
- package/dist/cjs/helpers/useAnimationDriver.js.map +7 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js +2 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/cjs/hooks/useAnimationDriver.js +2 -0
- package/dist/cjs/hooks/useAnimationDriver.js.map +7 -0
- package/dist/cjs/hooks/useFeatures.js +2 -2
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/hooks/useServerContext.js +21 -0
- package/dist/cjs/hooks/useServerContext.js.map +7 -0
- package/dist/cjs/hooks/useServerHooks.js +36 -0
- package/dist/cjs/hooks/useServerHooks.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +71 -41
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +7 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/injectStyles.js +40 -0
- package/dist/cjs/injectStyles.js.map +7 -0
- package/dist/cjs/insertFont.js +2 -2
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/cjs/styled.js +11 -1
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +6 -1
- package/dist/cjs/views/TamaguiProvider.js.map +2 -2
- package/dist/cjs/views/ThemeProvider.js +9 -5
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/esm/Tamagui.js +1 -1
- package/dist/esm/Tamagui.js.map +1 -1
- package/dist/esm/addTheme.js +27 -21
- package/dist/esm/addTheme.js.map +2 -2
- package/dist/esm/config.js +43 -0
- package/dist/esm/config.js.map +7 -0
- package/dist/esm/constants/platform.js +5 -1
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/constants/platform.native.js +28 -0
- package/dist/esm/constants/platform.native.js.map +7 -0
- package/dist/esm/createComponent.js +71 -60
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.server.js +408 -0
- package/dist/esm/createComponent.server.js.map +7 -0
- package/dist/esm/createTamagui.js +7 -5
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createVariable.js +6 -12
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js +5 -2
- package/dist/esm/createVariables.js.map +2 -2
- package/dist/esm/helpers/RNComponents.js +11 -8
- package/dist/esm/helpers/RNComponents.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +6 -8
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/assignNativePropsToWeb.js +0 -1
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +2 -2
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/expandStyles.js +3 -3
- package/dist/esm/helpers/expandStyles.js.map +2 -2
- package/dist/esm/helpers/getAnimationDriver.js +8 -0
- package/dist/esm/helpers/getAnimationDriver.js.map +7 -0
- package/dist/esm/helpers/getExpandedShorthands.js +2 -2
- package/dist/esm/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/esm/helpers/getFont.js +1 -1
- package/dist/esm/helpers/getFont.js.map +2 -2
- package/dist/esm/helpers/getSize.js +1 -1
- package/dist/esm/helpers/getSize.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +12 -13
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +5 -3
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getVariantExtras.js +1 -1
- package/dist/esm/helpers/getVariantExtras.js.map +1 -1
- package/dist/esm/helpers/normalizeColor.js +1 -1
- package/dist/esm/helpers/normalizeColor.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/esm/helpers/useAnimationDriver.js +1 -0
- package/dist/esm/helpers/useAnimationDriver.js.map +7 -0
- package/dist/esm/hooks/getThemeUnwrapped.js +2 -0
- package/dist/esm/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/esm/hooks/useAnimationDriver.js +1 -0
- package/dist/esm/hooks/useAnimationDriver.js.map +7 -0
- package/dist/esm/hooks/useFeatures.js +1 -1
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/hooks/useServerContext.js +4 -0
- package/dist/esm/hooks/useServerContext.js.map +7 -0
- package/dist/esm/hooks/useServerHooks.js +11 -0
- package/dist/esm/hooks/useServerHooks.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +72 -42
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/injectStyles.js +16 -0
- package/dist/esm/injectStyles.js.map +7 -0
- package/dist/esm/insertFont.js +1 -1
- package/dist/esm/insertFont.js.map +1 -1
- package/dist/esm/styled.js +11 -1
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.js +7 -2
- package/dist/esm/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +9 -5
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/package.json +35 -14
- package/src/Tamagui.ts +1 -1
- package/src/addTheme.ts +33 -21
- package/src/{conf.ts → config.ts} +4 -0
- package/src/constants/platform.native.ts +14 -0
- package/src/constants/platform.ts +12 -1
- package/src/createComponent.tsx +164 -148
- package/src/createTamagui.ts +11 -5
- package/src/createVariable.ts +8 -25
- package/src/createVariables.ts +5 -2
- package/src/helpers/RNComponents.tsx +13 -13
- package/src/helpers/ThemeManager.tsx +15 -12
- package/src/helpers/assignNativePropsToWeb.tsx +0 -1
- package/src/helpers/createPropMapper.ts +2 -2
- package/src/helpers/expandStyles.ts +4 -3
- package/src/helpers/getAnimationDriver.tsx +5 -0
- package/src/helpers/getExpandedShorthands.ts +2 -2
- package/src/helpers/getFont.tsx +1 -1
- package/src/helpers/getSize.ts +1 -1
- package/src/helpers/getSplitStyles.tsx +12 -13
- package/src/helpers/getStylesAtomic.ts +6 -3
- package/src/helpers/getVariantExtras.tsx +2 -2
- package/src/helpers/normalizeColor.ts +1 -1
- package/src/helpers/normalizeValueWithProperty.ts +2 -0
- package/src/hooks/getThemeUnwrapped.tsx +1 -0
- package/src/hooks/useFeatures.tsx +2 -1
- package/src/hooks/useServerHooks.tsx +13 -0
- package/src/hooks/useTheme.tsx +94 -48
- package/src/index.ts +2 -1
- package/src/injectStyles.ts +20 -0
- package/src/insertFont.ts +1 -1
- package/src/styled.tsx +15 -1
- package/src/types.tsx +33 -0
- package/src/views/TamaguiProvider.tsx +11 -4
- package/src/views/ThemeProvider.tsx +9 -6
- package/types/config.d.ts +27 -0
- package/types/constants/platform.d.ts +1 -0
- package/types/constants/platform.native.d.ts +13 -0
- package/types/createComponent.server.d.ts +36 -0
- package/types/createVariable.d.ts +1 -2
- package/types/helpers/RNComponents.d.ts +1 -1
- package/types/helpers/ThemeManager.d.ts +2 -8
- package/types/helpers/getAnimationDriver.d.ts +6 -0
- package/types/helpers/useAnimationDriver.d.ts +1 -0
- package/types/hooks/useAnimationDriver.d.ts +1 -0
- package/types/hooks/useServerContext.d.ts +2 -0
- package/types/hooks/useServerHooks.d.ts +4 -0
- package/types/hooks/useTheme.d.ts +5 -21
- package/types/index.d.ts +2 -1
- package/types/injectStyles.d.ts +7 -0
- package/types/types.d.ts +23 -0
- package/types/views/TamaguiProvider.d.ts +1 -1
- package/types/views/ThemeProvider.d.ts +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
17
|
+
var React = __toESM(require("react"));
|
|
18
|
+
const import_meta = {};
|
|
19
|
+
console.log("ok", React["createServerContext"]);
|
|
20
|
+
const isRSC = import_meta.env.SSR;
|
|
21
|
+
//# sourceMappingURL=useServerContext.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useServerContext.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\n\nconsole.log('ok', React['createServerContext'])\n\n// @ts-ignore\nconst isRSC = import.meta.env.SSR\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA,YAAuB;AAAvB;AAEA,QAAQ,IAAI,MAAM,MAAM,sBAAsB;AAG9C,MAAM,QAAQ,YAAY,IAAI;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useServerHooks_exports = {};
|
|
20
|
+
__export(useServerHooks_exports, {
|
|
21
|
+
useServerRef: () => useServerRef,
|
|
22
|
+
useServerState: () => useServerState
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useServerHooks_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_platform = require("../constants/platform");
|
|
27
|
+
const useServerState = import_platform.isRSC ? (val) => [val, idFn] : import_react.useState;
|
|
28
|
+
const useServerRef = import_platform.isRSC ? (val) => ({ current: val }) : import_react.useRef;
|
|
29
|
+
const idFn = () => {
|
|
30
|
+
};
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
useServerRef,
|
|
34
|
+
useServerState
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=useServerHooks.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useServerHooks.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useRef, useState } from 'react'\n\nimport { isRSC } from '../constants/platform'\n\nexport const useServerState = isRSC\n ? (((val: any) => [val, idFn]) as unknown as typeof useState)\n : useState\n\nexport const useServerRef = isRSC\n ? (((val: any) => ({ current: val })) as unknown as typeof useRef)\n : useRef\n\nconst idFn = () => {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AAEjC,sBAAsB;AAEf,MAAM,iBAAiB,wBACxB,CAAC,QAAa,CAAC,KAAK,IAAI,IAC1B;AAEG,MAAM,eAAe,wBACtB,CAAC,QAAc,GAAE,SAAS,IAAI,KAChC;AAEJ,MAAM,OAAO,MAAM;AAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -28,21 +28,26 @@ __export(useTheme_exports, {
|
|
|
28
28
|
module.exports = __toCommonJS(useTheme_exports);
|
|
29
29
|
var import_use_force_update = require("@tamagui/use-force-update");
|
|
30
30
|
var import_react = require("react");
|
|
31
|
-
var
|
|
31
|
+
var import_config = require("../config");
|
|
32
32
|
var import_platform = require("../constants/platform");
|
|
33
33
|
var import_ThemeContext = require("../contexts/ThemeContext");
|
|
34
34
|
var import_areEqualSets = require("../helpers/areEqualSets");
|
|
35
35
|
var import_ThemeManager = require("../helpers/ThemeManager");
|
|
36
36
|
var import_getThemeUnwrapped = require("./getThemeUnwrapped");
|
|
37
37
|
var import_useConstant = require("./useConstant");
|
|
38
|
+
var import_useServerHooks = require("./useServerHooks");
|
|
38
39
|
const useTheme = (themeName, componentName, props, forceUpdate) => {
|
|
40
|
+
if (import_platform.isRSC) {
|
|
41
|
+
const config = (0, import_config.getConfig)();
|
|
42
|
+
return getThemeProxied(config.themes[config.defaultTheme], config.defaultTheme);
|
|
43
|
+
}
|
|
39
44
|
const { name, theme, themes, themeManager, className } = useChangeThemeEffect(themeName, componentName, props, forceUpdate);
|
|
40
45
|
if (process.env.NODE_ENV === "development") {
|
|
41
46
|
if ((props == null ? void 0 : props.debug) === "verbose") {
|
|
42
47
|
console.log(" \u{1F539} useTheme", { themeName, componentName, name, className });
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
|
-
const state = (0,
|
|
50
|
+
const state = (0, import_useServerHooks.useServerRef)();
|
|
46
51
|
if (!state.current) {
|
|
47
52
|
state.current = {
|
|
48
53
|
uuid: {},
|
|
@@ -64,52 +69,54 @@ const useTheme = (themeName, componentName, props, forceUpdate) => {
|
|
|
64
69
|
if (process.env.NODE_ENV === "development") {
|
|
65
70
|
console.warn("No theme with name", themeName);
|
|
66
71
|
}
|
|
67
|
-
return themes[(0,
|
|
72
|
+
return themes[(0, import_config.getConfig)().defaultTheme || "light"];
|
|
68
73
|
}
|
|
69
74
|
return (0, import_react.useMemo)(() => {
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
75
|
+
return getThemeProxied(theme, name, className, themeManager, state, debugProp);
|
|
76
|
+
}, [theme, name, themeManager, className, debugProp]);
|
|
77
|
+
};
|
|
78
|
+
function getThemeProxied(theme, name, className, themeManager, state, debugProp) {
|
|
79
|
+
return new Proxy(theme, {
|
|
80
|
+
has(_, key) {
|
|
81
|
+
if (typeof key === "string" && key[0] === "$") {
|
|
82
|
+
key = key.slice(1);
|
|
83
|
+
}
|
|
84
|
+
return Reflect.has(theme, key);
|
|
85
|
+
},
|
|
86
|
+
get(_, key) {
|
|
87
|
+
if (key === import_getThemeUnwrapped.GetThemeUnwrapped) {
|
|
88
|
+
return theme;
|
|
89
|
+
}
|
|
90
|
+
if (key === GetThemeManager) {
|
|
91
|
+
return themeManager;
|
|
92
|
+
}
|
|
93
|
+
if (key === "name") {
|
|
94
|
+
return name;
|
|
95
|
+
}
|
|
96
|
+
if (key === "className") {
|
|
97
|
+
return className;
|
|
98
|
+
}
|
|
99
|
+
if (!name || key === "__proto__" || typeof key === "symbol" || key === "$typeof") {
|
|
100
|
+
return Reflect.get(_, key);
|
|
101
|
+
}
|
|
102
|
+
if (key[0] === "$") {
|
|
103
|
+
key = key.slice(1);
|
|
104
|
+
}
|
|
105
|
+
if (!themeManager) {
|
|
106
|
+
return theme[key];
|
|
107
|
+
}
|
|
108
|
+
if (state) {
|
|
102
109
|
if (state.current.isRendering && !state.current.keys.has(key)) {
|
|
103
110
|
state.current.keys.add(key);
|
|
104
111
|
if (process.env.NODE_ENV === "development" && debugProp === "verbose") {
|
|
105
112
|
console.log(" \u{1F538} tracking theme", key);
|
|
106
113
|
}
|
|
107
114
|
}
|
|
108
|
-
return themeManager.getValue(key);
|
|
109
115
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
};
|
|
116
|
+
return themeManager.getValue(key);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
113
120
|
const GetThemeManager = Symbol();
|
|
114
121
|
const getThemeManager = (theme) => {
|
|
115
122
|
if (!theme)
|
|
@@ -117,6 +124,10 @@ const getThemeManager = (theme) => {
|
|
|
117
124
|
return theme[GetThemeManager];
|
|
118
125
|
};
|
|
119
126
|
const useThemeName = (opts) => {
|
|
127
|
+
if (import_platform.isRSC) {
|
|
128
|
+
const config = (0, import_config.getConfig)();
|
|
129
|
+
return config.defaultTheme || "light";
|
|
130
|
+
}
|
|
120
131
|
const parent = (0, import_react.useContext)(import_ThemeManager.ThemeManagerContext);
|
|
121
132
|
const [name, setName] = (0, import_react.useState)((parent == null ? void 0 : parent.name) || "");
|
|
122
133
|
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
@@ -137,11 +148,30 @@ const useDefaultThemeName = () => {
|
|
|
137
148
|
};
|
|
138
149
|
const activeThemeManagers = /* @__PURE__ */ new Set();
|
|
139
150
|
const useChangeThemeEffect = (name, componentName, props, forceUpdateProp) => {
|
|
151
|
+
const { themes } = (0, import_config.getConfig)();
|
|
152
|
+
if (import_platform.isRSC) {
|
|
153
|
+
const parentManager2 = new import_ThemeManager.ThemeManager("light", themes.light);
|
|
154
|
+
const next2 = parentManager2.getNextTheme({
|
|
155
|
+
name,
|
|
156
|
+
componentName,
|
|
157
|
+
themes,
|
|
158
|
+
reset: props == null ? void 0 : props.reset
|
|
159
|
+
});
|
|
160
|
+
return {
|
|
161
|
+
...next2,
|
|
162
|
+
themes,
|
|
163
|
+
themeManager: null
|
|
164
|
+
};
|
|
165
|
+
}
|
|
140
166
|
const debug = props && props["debug"];
|
|
141
167
|
const parentManager = (0, import_react.useContext)(import_ThemeManager.ThemeManagerContext) || import_ThemeManager.emptyManager;
|
|
142
|
-
const { themes } = (0, import_react.useContext)(import_ThemeContext.ThemeContext);
|
|
143
168
|
const reset = (props == null ? void 0 : props.reset) || false;
|
|
144
|
-
const getThemeProps = {
|
|
169
|
+
const getThemeProps = {
|
|
170
|
+
name,
|
|
171
|
+
componentName,
|
|
172
|
+
themes,
|
|
173
|
+
reset
|
|
174
|
+
};
|
|
145
175
|
const next = parentManager.getNextTheme(getThemeProps, debug);
|
|
146
176
|
const forceUpdate = forceUpdateProp || (0, import_use_force_update.useForceUpdate)();
|
|
147
177
|
const themeManager = (0, import_useConstant.useConstant)(() => {
|
|
@@ -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, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA+B;AAC/B,mBAA8E;AAE9E,
|
|
4
|
+
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../config'\nimport { isRSC, isSSR, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport {\n GetNextThemeProps,\n ThemeManager,\n ThemeManagerContext,\n emptyManager,\n} from '../helpers/ThemeManager'\nimport { ThemeName, ThemeObject } from '../types'\nimport { GetThemeUnwrapped } from './getThemeUnwrapped'\nimport { useConstant } from './useConstant'\nimport { useServerRef } from './useServerHooks'\n\nexport interface ThemeProps {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: boolean | 'verbose'\n}\n\ninterface UseThemeState {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdate?: any\n): ThemeObject => {\n // TODO this can use useChangeThemeEffect almost ready\n if (isRSC) {\n const config = getConfig()\n // @ts-ignore\n return getThemeProxied(config.themes[config.defaultTheme], config.defaultTheme)\n }\n\n const { name, theme, themes, themeManager, className } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.debug === 'verbose') {\n // eslint-disable-next-line no-console\n console.log(' \uD83D\uDD39 useTheme', { themeName, componentName, name, className })\n }\n }\n\n const state = useServerRef() 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 = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n const debugProp = props && props['debug']\n\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('No theme with name', themeName)\n }\n return themes[getConfig().defaultTheme || 'light']\n }\n\n return useMemo(() => {\n return getThemeProxied(theme, name, className, themeManager, state, debugProp)\n }, [theme, name, themeManager, className, debugProp])\n}\n\nfunction getThemeProxied(\n theme: any,\n name: string,\n className?: string,\n themeManager?: ThemeManager | null,\n state?: React.MutableRefObject<UseThemeState>,\n debugProp?: boolean | 'verbose'\n) {\n return new Proxy(theme, {\n has(_, key) {\n if (typeof key === 'string' && key[0] === '$') {\n key = key.slice(1)\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (key === GetThemeUnwrapped) {\n return theme\n }\n if (key === GetThemeManager) {\n return themeManager\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!name || key === '__proto__' || typeof key === 'symbol' || key === '$typeof') {\n return Reflect.get(_, key)\n }\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n if (!themeManager) {\n return theme[key]\n }\n if (state) {\n if (state.current.isRendering && !state.current.keys.has(key)) {\n state.current.keys.add(key)\n if (process.env.NODE_ENV === 'development' && debugProp === 'verbose') {\n // eslint-disable-next-line no-console\n console.log(' \uD83D\uDD38 tracking theme', key)\n }\n }\n }\n return themeManager.getValue(key)\n },\n })\n}\n\nconst GetThemeManager = Symbol()\n\nexport const getThemeManager = (theme: any): ThemeManager | undefined => {\n if (!theme) return\n return theme[GetThemeManager]\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n if (isRSC) {\n const config = getConfig()\n return config.defaultTheme || 'light'\n }\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const activeThemeManagers = new Set<ThemeManager>()\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdateProp?: any\n): {\n themes: Record<string, ThemeObject>\n themeManager: ThemeManager | null\n name: string\n theme: ThemeObject | null\n className?: string\n} => {\n const { themes } = getConfig()\n if (isRSC) {\n // we need context working for this to work well\n const parentManager = new ThemeManager('light', themes.light)\n const next = parentManager.getNextTheme({\n name,\n componentName,\n themes,\n reset: props?.reset,\n })\n return {\n ...next,\n themes,\n themeManager: null,\n }\n }\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const reset = props?.reset || false\n const getThemeProps: GetNextThemeProps = {\n name,\n componentName,\n themes,\n reset,\n }\n const next = parentManager.getNextTheme(getThemeProps, debug)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const forceUpdate = forceUpdateProp || useForceUpdate()\n\n const themeManager = useConstant<ThemeManager | null>(() => {\n return new ThemeManager(next.name, next.theme, parentManager, reset)\n })\n\n // if not SSR\n if (!isSSR) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => {\n if (!themeManager) return\n\n activeThemeManagers.add(themeManager)\n\n if (next?.name) {\n themeManager.update(next)\n }\n\n const disposeParentOnChange = parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme(getThemeProps, debug)\n if (!next) return\n if (themeManager.update(next)) {\n forceUpdate()\n }\n })\n\n return () => {\n activeThemeManagers.delete(themeManager)\n disposeParentOnChange()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [themes, name, componentName, debug, next?.name])\n }\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n themes,\n themeManager,\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA+B;AAC/B,mBAA8E;AAE9E,oBAA0B;AAC1B,sBAAwD;AACxD,0BAA6B;AAC7B,0BAA6B;AAC7B,0BAKO;AAEP,+BAAkC;AAClC,yBAA4B;AAC5B,4BAA6B;AAkBtB,MAAM,WAAW,CACtB,WACA,eACA,OACA,gBACgB;AAEhB,MAAI,uBAAO;AACT,UAAM,SAAS,6BAAU;AAEzB,WAAO,gBAAgB,OAAO,OAAO,OAAO,eAAe,OAAO,YAAY;AAAA,EAChF;AAEA,QAAM,EAAE,MAAM,OAAO,QAAQ,cAAc,cAAc,qBACvD,WACA,eACA,OACA,WACF;AAEA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,gCAAO,WAAU,WAAW;AAE9B,cAAQ,IAAI,wBAAiB,EAAE,WAAW,eAAe,MAAM,UAAU,CAAC;AAAA,IAC5E;AAAA,EACF;AAEA,QAAM,QAAQ,wCAAa;AAC3B,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,UAAU;AAAA,MACd,MAAM,CAAC;AAAA,MACP,MAAM,oBAAI,IAAI;AAAA,MACd,aAAa;AAAA,IACf;AAAA,EACF;AACA,QAAM,QAAQ,cAAc;AAG5B,iDAA0B,MAAM;AAC9B,UAAM,KAAK,MAAM;AACjB,OAAG,cAAc;AACjB,UAAM,MAAM,6CAAc,KAAK,IAAI,GAAG;AACtC,QAAI,CAAC,OAAO,CAAC,sCAAa,GAAG,MAAM,GAAG,GAAG;AACvC,mDAAc,M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AAC7B,QAAM,gBAAgB,6BAAW,uCAAmB,KAAK;AACzD,QAAM,QAAQ,gCAAO,UAAS;AAC9B,QAAM,gBAAmC;AAAA,IACvC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,QAAM,OAAO,cAAc,aAAa,eAAe,KAAK;AAE5D,QAAM,cAAc,mBAAmB,4CAAe;AAEtD,QAAM,eAAe,oCAAiC,MAAM;AAC1D,WAAO,IAAI,iCAAa,KAAK,MAAM,KAAK,OAAO,eAAe,KAAK;AAAA,EACrE,CAAC;AAGD,MAAI,CAAC,uBAAO;AAEV,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AAEnB,0BAAoB,IAAI,YAAY;AAEpC,UAAI,6BAAM,MAAM;AACd,qBAAa,OAAO,IAAI;AAAA,MAC1B;AAEA,YAAM,wBAAwB,cAAc,cAAc,MAAM;AAC9D,cAAM,QAAO,cAAc,aAAa,eAAe,KAAK;AAC5D,YAAI,CAAC;AAAM;AACX,YAAI,aAAa,OAAO,KAAI,GAAG;AAC7B,sBAAY;AAAA,QACd;AAAA,MACF,CAAC;AAED,aAAO,MAAM;AACX,4BAAoB,OAAO,YAAY;AACvC,8BAAsB;AAAA,MACxB;AAAA,IAEF,GAAG,CAAC,QAAQ,MAAM,eAAe,OAAO,6BAAM,IAAI,CAAC;AAAA,EACrD;AAEA,SAAO;AAAA,IACL,GAAI,iBAAiB;AAAA,MACnB,MAAM,cAAc;AAAA,MACpB,OAAO,cAAc;AAAA,IACvB;AAAA,IACA,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -24,15 +24,15 @@ __export(src_exports, {
|
|
|
24
24
|
addMediaQueryListener: () => import_useMedia.addMediaQueryListener,
|
|
25
25
|
configureMedia: () => import_useMedia.configureMedia,
|
|
26
26
|
createDOMProps: () => import_rnw.createDOMProps,
|
|
27
|
-
getConfig: () =>
|
|
28
|
-
getHasConfigured: () =>
|
|
27
|
+
getConfig: () => import_config.getConfig,
|
|
28
|
+
getHasConfigured: () => import_config.getHasConfigured,
|
|
29
29
|
getMedia: () => import_useMedia.getMedia,
|
|
30
|
-
getThemes: () =>
|
|
31
|
-
getTokens: () =>
|
|
30
|
+
getThemes: () => import_config.getThemes,
|
|
31
|
+
getTokens: () => import_config.getTokens,
|
|
32
32
|
mediaObjectToString: () => import_useMedia.mediaObjectToString,
|
|
33
33
|
mediaQueryConfig: () => import_useMedia.mediaQueryConfig,
|
|
34
34
|
mediaState: () => import_useMedia.mediaState,
|
|
35
|
-
onConfiguredOnce: () =>
|
|
35
|
+
onConfiguredOnce: () => import_config.onConfiguredOnce,
|
|
36
36
|
removeMediaQueryListener: () => import_useMedia.removeMediaQueryListener,
|
|
37
37
|
useMedia: () => import_useMedia.useMedia
|
|
38
38
|
});
|
|
@@ -51,7 +51,7 @@ __reExport(src_exports, require("./addTheme"), module.exports);
|
|
|
51
51
|
__reExport(src_exports, require("./updateTheme"), module.exports);
|
|
52
52
|
__reExport(src_exports, require("./styled"), module.exports);
|
|
53
53
|
__reExport(src_exports, require("./types"), module.exports);
|
|
54
|
-
var
|
|
54
|
+
var import_config = require("./config");
|
|
55
55
|
__reExport(src_exports, require("./constants/constants"), module.exports);
|
|
56
56
|
__reExport(src_exports, require("./constants/platform"), module.exports);
|
|
57
57
|
var import_rnw = require("@tamagui/rnw");
|
|
@@ -59,6 +59,7 @@ __reExport(src_exports, require("./helpers/calc"), module.exports);
|
|
|
59
59
|
__reExport(src_exports, require("./helpers/createShallowUpdate"), module.exports);
|
|
60
60
|
__reExport(src_exports, require("./helpers/getStackSize"), module.exports);
|
|
61
61
|
__reExport(src_exports, require("./helpers/getVariantExtras"), module.exports);
|
|
62
|
+
__reExport(src_exports, require("./helpers/getAnimationDriver"), module.exports);
|
|
62
63
|
__reExport(src_exports, require("./helpers/getExpandedShorthands"), module.exports);
|
|
63
64
|
__reExport(src_exports, require("./helpers/getSize"), module.exports);
|
|
64
65
|
__reExport(src_exports, require("./helpers/getSplitStyles"), module.exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createVariable'\nexport * from './createVariables'\nexport * from './insertFont'\nexport * from './addTheme'\nexport * from './updateTheme'\nexport * from './styled'\nexport * from './types'\n\n// for type portability\nexport type { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,sBAAd;AACA,wBAAc,8BADd;AAEA,wBAAc,+BAFd;AAGA,wBAAc,0BAHd;AAIA,wBAAc,4BAJd;AAKA,wBAAc,yBALd;AAMA,wBAAc,2BANd;AAOA,wBAAc,6BAPd;AAQA,wBAAc,8BARd;AASA,wBAAc,yBATd;AAUA,wBAAc,uBAVd;AAWA,wBAAc,0BAXd;AAYA,wBAAc,qBAZd;AAaA,wBAAc,oBAbd;AAiBA,
|
|
4
|
+
"sourcesContent": ["export * from './Tamagui'\nexport * from './createComponent'\nexport * from './createShorthands'\nexport * from './createTheme'\nexport * from './createTamagui'\nexport * from './createFont'\nexport * from './createTokens'\nexport * from './createVariable'\nexport * from './createVariables'\nexport * from './insertFont'\nexport * from './addTheme'\nexport * from './updateTheme'\nexport * from './styled'\nexport * from './types'\n\n// for type portability\nexport type { RNWTextProps, RNWViewProps } from './types-rnw'\nexport { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './config'\n\nexport * from './constants/constants'\nexport * from './constants/platform'\nexport { createDOMProps } from '@tamagui/rnw'\n\nexport * from './helpers/calc'\nexport * from './helpers/createShallowUpdate'\nexport * from './helpers/getStackSize'\nexport * from './helpers/getVariantExtras'\nexport * from './helpers/getAnimationDriver'\nexport * from './helpers/getExpandedShorthands'\nexport * from './helpers/getSize'\nexport * from './helpers/getSplitStyles'\nexport * from './helpers/getStylesAtomic'\nexport * from './helpers/pseudoDescriptors'\nexport * from './helpers/mergeProps'\nexport * from './helpers/expandStyles'\nexport * from './helpers/getFont'\nexport * from './helpers/isObj'\nexport * from './helpers/isTamaguiElement'\nexport * from './helpers/isTamaguiComponent'\nexport * from './helpers/matchMedia'\nexport * from './helpers/startTransition'\nexport * from './helpers/themeable'\nexport * from './helpers/withStaticProperties'\n\nexport * from './contexts/ButtonInsideButtonContext'\n\nexport * from './hooks/useConstant'\nexport * from './hooks/useId'\nexport * from './hooks/useIsMounted'\nexport * from './hooks/useIsTouchDevice'\nexport {\n configureMedia,\n getMedia,\n mediaState,\n useMedia,\n mediaObjectToString,\n addMediaQueryListener,\n removeMediaQueryListener,\n mediaQueryConfig,\n} from './hooks/useMedia'\nexport * from './hooks/usePressable'\nexport * from './hooks/useTheme'\nexport * from './hooks/useIsSSR'\nexport * from './hooks/useUnmountEffect'\nexport * from './hooks/useSafeRef'\n\nexport * from './views/Slot'\nexport * from './views/Stack'\nexport * from './views/Text'\nexport { TextAncestorProvider, TextAncestorContext } from './contexts/TextAncestorContext'\nexport * from './views/Theme'\nexport * from './views/ThemeInverse'\nexport * from './views/ThemeProvider'\nexport * from './views/ThemeReset'\nexport * from './views/FontLanguage'\nexport * from './views/TamaguiProvider'\n\nexport * from '@tamagui/use-force-update'\nexport * from '@tamagui/use-event'\nexport * from '@tamagui/helpers'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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0D;AAC1D,wBAAc,0BAtEd;AAuEA,wBAAc,iCAvEd;AAwEA,wBAAc,kCAxEd;AAyEA,wBAAc,+BAzEd;AA0EA,wBAAc,iCA1Ed;AA2EA,wBAAc,oCA3Ed;AA6EA,wBAAc,sCA7Ed;AA8EA,wBAAc,+BA9Ed;AA+EA,wBAAc,6BA/Ed;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var injectStyles_exports = {};
|
|
20
|
+
__export(injectStyles_exports, {
|
|
21
|
+
injectStyles: () => injectStyles
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(injectStyles_exports);
|
|
24
|
+
const stylesheets = {};
|
|
25
|
+
const injectStyles = ({ filePath, css }) => {
|
|
26
|
+
let stylesheet = stylesheets[filePath];
|
|
27
|
+
if (!stylesheet) {
|
|
28
|
+
const styleEl = document.createElement("style");
|
|
29
|
+
styleEl.setAttribute("data-file", filePath);
|
|
30
|
+
styleEl.setAttribute("type", "text/css");
|
|
31
|
+
stylesheet = stylesheets[filePath] = styleEl;
|
|
32
|
+
document.head.appendChild(styleEl);
|
|
33
|
+
}
|
|
34
|
+
stylesheet.innerHTML = css;
|
|
35
|
+
};
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
injectStyles
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=injectStyles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/injectStyles.ts"],
|
|
4
|
+
"sourcesContent": ["// for vite dev mode\n\nconst stylesheets: Record<string, HTMLElement> = {}\n\ninterface InjectStylesOptions {\n filePath: string\n css: string\n}\n\nexport const injectStyles = ({ filePath, css }: InjectStylesOptions) => {\n let stylesheet = stylesheets[filePath]\n if (!stylesheet) {\n const styleEl = document.createElement('style')\n styleEl.setAttribute('data-file', filePath)\n styleEl.setAttribute('type', 'text/css')\n stylesheet = stylesheets[filePath] = styleEl\n document.head.appendChild(styleEl)\n }\n stylesheet.innerHTML = css\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,cAA2C,CAAC;AAO3C,MAAM,eAAe,CAAC,EAAE,UAAU,UAA+B;AACtE,MAAI,aAAa,YAAY;AAC7B,MAAI,CAAC,YAAY;AACf,UAAM,UAAU,SAAS,cAAc,OAAO;AAC9C,YAAQ,aAAa,aAAa,QAAQ;AAC1C,YAAQ,aAAa,QAAQ,UAAU;AACvC,iBAAa,YAAY,YAAY;AACrC,aAAS,KAAK,YAAY,OAAO;AAAA,EACnC;AACA,aAAW,YAAY;AACzB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/insertFont.js
CHANGED
|
@@ -23,7 +23,7 @@ __export(insertFont_exports, {
|
|
|
23
23
|
registerFontVariables: () => registerFontVariables
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(insertFont_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_config = require("./config");
|
|
27
27
|
var import_createFont = require("./createFont");
|
|
28
28
|
var import_createVariables = require("./createVariables");
|
|
29
29
|
var import_registerCSSVariable = require("./helpers/registerCSSVariable");
|
|
@@ -38,7 +38,7 @@ function insertFont(name, fontIn) {
|
|
|
38
38
|
style.setAttribute("data-tamagui-font", name);
|
|
39
39
|
document.head.appendChild(style);
|
|
40
40
|
}
|
|
41
|
-
(0,
|
|
41
|
+
(0, import_config.setConfigFont)(name, tokened, parsed);
|
|
42
42
|
return parsed;
|
|
43
43
|
}
|
|
44
44
|
function parseFont(definition) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/insertFont.ts"],
|
|
4
|
-
"sourcesContent": ["import { setConfigFont } from './
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { setConfigFont } from './config'\nimport { createFont } from './createFont'\nimport { Variable } from './createVariable'\nimport { DeepVariableObject, createVariables } from './createVariables'\nimport { registerCSSVariable, variableToCSS } from './helpers/registerCSSVariable'\nimport { GenericFont } from './types'\n\n/**\n * Runtime dynamic insert font\n */\nexport function insertFont<A extends GenericFont>(name: string, fontIn: A): DeepVariableObject<A> {\n const font = createFont(fontIn)\n const tokened = createVariables(font, name) as GenericFont\n const parsed = parseFont(tokened) as DeepVariableObject<A>\n if (process.env.TAMAGUI_TARGET === 'web' && typeof document !== 'undefined') {\n const fontVars = registerFontVariables(parsed)\n const style = document.createElement('style')\n style.innerText = `:root .font_${name} {${fontVars.join(';')}}`\n style.setAttribute('data-tamagui-font', name)\n document.head.appendChild(style)\n }\n setConfigFont(name, tokened, parsed)\n return parsed\n}\n\nexport function parseFont<A extends GenericFont>(definition: A): DeepVariableObject<A> {\n const parsed: any = {}\n for (const attrKey in definition) {\n const attr = definition[attrKey]\n if (attrKey === 'family') {\n parsed[attrKey] = attr\n continue\n }\n parsed[attrKey] = {}\n for (const key in attr) {\n let val = attr[key] as any\n // is a theme reference\n if (val.val?.[0] === '$') {\n val = val.val\n }\n parsed[attrKey][`$${key}`] = val\n }\n }\n return parsed\n}\n\nexport function registerFontVariables(parsedFont: any) {\n const response: string[] = []\n\n for (const fkey in parsedFont) {\n if (fkey === 'family') {\n const val = parsedFont[fkey] as Variable\n registerCSSVariable(val)\n response.push(variableToCSS(val))\n } else {\n for (const fskey in parsedFont[fkey]) {\n const fval = parsedFont[fkey][fskey]\n if (typeof fval === 'string') {\n // no need to add its a theme reference like \"$borderColor\"\n } else {\n const val = parsedFont[fkey][fskey] as Variable\n registerCSSVariable(val)\n response.push(variableToCSS(val))\n }\n }\n }\n }\n return response\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8B;AAC9B,wBAA2B;AAE3B,6BAAoD;AACpD,iCAAmD;AAM5C,oBAA2C,MAAc,QAAkC;AAChG,QAAM,OAAO,kCAAW,MAAM;AAC9B,QAAM,UAAU,4CAAgB,MAAM,IAAI;AAC1C,QAAM,SAAS,UAAU,OAAO;AAChC,MAAI,QAAQ,IAAI,mBAAmB,SAAS,OAAO,aAAa,aAAa;AAC3E,UAAM,WAAW,sBAAsB,MAAM;AAC7C,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,YAAY,eAAe,SAAS,SAAS,KAAK,GAAG;AAC3D,UAAM,aAAa,qBAAqB,IAAI;AAC5C,aAAS,KAAK,YAAY,KAAK;AAAA,EACjC;AACA,mCAAc,MAAM,SAAS,MAAM;AACnC,SAAO;AACT;AAEO,mBAA0C,YAAsC;AAzBvF;AA0BE,QAAM,SAAc,CAAC;AACrB,aAAW,WAAW,YAAY;AAChC,UAAM,OAAO,WAAW;AACxB,QAAI,YAAY,UAAU;AACxB,aAAO,WAAW;AAClB;AAAA,IACF;AACA,WAAO,WAAW,CAAC;AACnB,eAAW,OAAO,MAAM;AACtB,UAAI,MAAM,KAAK;AAEf,UAAI,WAAI,QAAJ,mBAAU,QAAO,KAAK;AACxB,cAAM,IAAI;AAAA,MACZ;AACA,aAAO,SAAS,IAAI,SAAS;AAAA,IAC/B;AAAA,EACF;AACA,SAAO;AACT;AAEO,+BAA+B,YAAiB;AACrD,QAAM,WAAqB,CAAC;AAE5B,aAAW,QAAQ,YAAY;AAC7B,QAAI,SAAS,UAAU;AACrB,YAAM,MAAM,WAAW;AACvB,0DAAoB,GAAG;AACvB,eAAS,KAAK,8CAAc,GAAG,CAAC;AAAA,IAClC,OAAO;AACL,iBAAW,SAAS,WAAW,OAAO;AACpC,cAAM,OAAO,WAAW,MAAM;AAC9B,YAAI,OAAO,SAAS,UAAU;AAAA,QAE9B,OAAO;AACL,gBAAM,MAAM,WAAW,MAAM;AAC7B,8DAAoB,GAAG;AACvB,mBAAS,KAAK,8CAAc,GAAG,CAAC;AAAA,QAClC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -32,7 +32,17 @@ function styled(Component, options, staticExtractionOptions) {
|
|
|
32
32
|
if (defaultVariants) {
|
|
33
33
|
Object.assign(defaultProps, defaultVariants);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
let isReactNativeWeb = (parentStaticConfig == null ? void 0 : parentStaticConfig.isReactNativeWeb) || import_RNComponents.RNComponents.has(Component);
|
|
36
|
+
if (!("staticConfig" in Component) && !isReactNativeWeb) {
|
|
37
|
+
if (import_RNComponents.RNComponents.has(Component["displayName"])) {
|
|
38
|
+
import_RNComponents.RNComponents.add(Component);
|
|
39
|
+
isReactNativeWeb = true;
|
|
40
|
+
} else {
|
|
41
|
+
if (process.env.NODE_ENV === "development") {
|
|
42
|
+
console.warn(`Invalid styled() component: Tamagui only accepts react-native Text, View, Image, TextInput, or another styled Tamagui view`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
const reactNativeWebComponent = isReactNativeWeb ? (parentStaticConfig == null ? void 0 : parentStaticConfig.reactNativeWebComponent) || Component : null;
|
|
37
47
|
const isTamagui = !isReactNativeWeb && !!parentStaticConfig;
|
|
38
48
|
const Comp = reactNativeWebComponent || Component;
|
package/dist/cjs/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Image, Text, TextInput } from 'react-native'\n\nimport { createComponent } from './createComponent'\nimport { RNComponents } from './helpers/RNComponents'\nimport {\n GetProps,\n GetVariantValues,\n MediaProps,\n PseudoProps,\n StaticConfig,\n StylableComponent,\n TamaguiComponent,\n VariantDefinitions,\n VariantSpreadFunction,\n} from './types'\n\n// TODO may be able to use this in the options?: arg below directly\nexport type StyledOptions<ParentComponent extends StylableComponent> = GetProps<ParentComponent> & {\n name?: string\n variants?: VariantDefinitions<ParentComponent> | undefined\n defaultVariants?: { [key: string]: any }\n}\n\nexport function styled<\n ParentComponent extends StylableComponent,\n Variants extends VariantDefinitions<ParentComponent> | void = VariantDefinitions<ParentComponent> | void\n>(\n Component: ParentComponent,\n // this should be Partial<GetProps<ParentComponent>> but causes excessively deep type issues\n options?: GetProps<ParentComponent> & {\n name?: string\n variants?: Variants | undefined\n // thought i had this typed, but can't get it linked\n defaultVariants?: { [key: string]: any }\n },\n staticExtractionOptions?: Partial<StaticConfig>\n) {\n const staticConfigProps = (() => {\n const parentStaticConfig =\n 'staticConfig' in Component ? (Component.staticConfig as StaticConfig) : null\n if (options) {\n const { variants, name, defaultVariants, ...defaultProps } = options\n if (defaultVariants) {\n Object.assign(defaultProps, defaultVariants)\n }\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAuC;AAEvC,6BAAgC;AAChC,0BAA6B;AAoBtB,gBAIL,WAEA,SAMA,yBACA;AACA,QAAM,oBAAqB,OAAM;AAC/B,UAAM,qBACJ,kBAAkB,YAAa,UAAU,eAAgC;AAC3E,QAAI,SAAS;AACX,YAAM,EAAE,UAAU,MAAM,oBAAoB,iBAAiB;AAC7D,UAAI,iBAAiB;AACnB,eAAO,OAAO,cAAc,eAAe;AAAA,MAC7C;AACA,
|
|
4
|
+
"sourcesContent": ["import { Image, Text, TextInput } from 'react-native'\n\nimport { createComponent } from './createComponent'\nimport { RNComponents } from './helpers/RNComponents'\nimport {\n GetProps,\n GetVariantValues,\n MediaProps,\n PseudoProps,\n StaticConfig,\n StylableComponent,\n TamaguiComponent,\n VariantDefinitions,\n VariantSpreadFunction,\n} from './types'\n\n// TODO may be able to use this in the options?: arg below directly\nexport type StyledOptions<ParentComponent extends StylableComponent> = GetProps<ParentComponent> & {\n name?: string\n variants?: VariantDefinitions<ParentComponent> | undefined\n defaultVariants?: { [key: string]: any }\n}\n\nexport function styled<\n ParentComponent extends StylableComponent,\n Variants extends VariantDefinitions<ParentComponent> | void = VariantDefinitions<ParentComponent> | void\n>(\n Component: ParentComponent,\n // this should be Partial<GetProps<ParentComponent>> but causes excessively deep type issues\n options?: GetProps<ParentComponent> & {\n name?: string\n variants?: Variants | undefined\n // thought i had this typed, but can't get it linked\n defaultVariants?: { [key: string]: any }\n },\n staticExtractionOptions?: Partial<StaticConfig>\n) {\n const staticConfigProps = (() => {\n const parentStaticConfig =\n 'staticConfig' in Component ? (Component.staticConfig as StaticConfig) : null\n if (options) {\n const { variants, name, defaultVariants, ...defaultProps } = options\n if (defaultVariants) {\n Object.assign(defaultProps, defaultVariants)\n }\n let isReactNativeWeb = parentStaticConfig?.isReactNativeWeb || RNComponents.has(Component)\n // this can happen due to smart-ness in fake-react-native, rough heuristic here to ensure we match (could be better..)\n if (!('staticConfig' in Component) && !isReactNativeWeb) {\n if (RNComponents.has(Component['displayName'])) {\n RNComponents.add(Component)\n isReactNativeWeb = true\n } else {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(\n `Invalid styled() component: Tamagui only accepts react-native Text, View, Image, TextInput, or another styled Tamagui view`\n )\n }\n }\n }\n const reactNativeWebComponent = isReactNativeWeb\n ? parentStaticConfig?.reactNativeWebComponent || Component\n : null\n const isTamagui = !isReactNativeWeb && !!parentStaticConfig\n const Comp = reactNativeWebComponent || (Component as any)\n const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false))\n const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false))\n const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false))\n\n const conf: Partial<StaticConfig> = {\n ...staticExtractionOptions,\n ...(!isTamagui && {\n Component: Comp,\n }),\n isTamagui,\n // this type gets messed up by options?: Partial<GetProps<ParentComponent>> above\n // take away the Partial<> and it's fine\n variants,\n defaultProps,\n defaultVariants,\n componentName: name,\n isReactNativeWeb,\n // for nesting multiple levels of rnw styled() need keep use the OG component\n reactNativeWebComponent,\n isInput,\n isText,\n isImage,\n }\n\n return conf\n }\n return {}\n })()\n\n const component = createComponent(staticConfigProps, Component)\n\n // get parent props without pseudos and medias so we can rebuild both with new variants\n type ParentPropsBase = ParentComponent extends TamaguiComponent<any, any, infer P>\n ? P\n : GetProps<ParentComponent>\n type ParentVariants = ParentComponent extends TamaguiComponent<any, any, any, infer V> ? V : {}\n\n type OurVariants = Variants extends void\n ? {}\n : {\n [Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>\n ? Val\n : GetVariantValues<keyof Variants[Key]>\n }\n\n type VariantProps = Omit<ParentVariants, keyof OurVariants> & OurVariants\n type OurPropsBase = ParentPropsBase & VariantProps\n\n type Props = Variants extends void\n ? GetProps<ParentComponent>\n : // start with base props\n OurPropsBase &\n // add in media (+ pseudos nested)\n MediaProps<Partial<OurPropsBase>> &\n // add in pseudos\n PseudoProps<Partial<OurPropsBase>>\n\n return component as TamaguiComponent<\n Props,\n // TODO infer ref\n any,\n ParentPropsBase,\n ParentVariants & OurVariants\n >\n}\n\n// import { Stack } from './views/Stack'\n// const X = styled(Stack, {\n// variants: {\n// size: {\n// '...size': (val) => {\n// return {}\n// }\n// },\n// disabled: {\n// true: {\n// opacity: 0.5,\n// pointerEvents: 'none',\n// },\n// },\n// }\n// })\n// type variants = GetStyledVariants<typeof X>\n// const y = <X disabled size=\"$10\" />\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAuC;AAEvC,6BAAgC;AAChC,0BAA6B;AAoBtB,gBAIL,WAEA,SAMA,yBACA;AACA,QAAM,oBAAqB,OAAM;AAC/B,UAAM,qBACJ,kBAAkB,YAAa,UAAU,eAAgC;AAC3E,QAAI,SAAS;AACX,YAAM,EAAE,UAAU,MAAM,oBAAoB,iBAAiB;AAC7D,UAAI,iBAAiB;AACnB,eAAO,OAAO,cAAc,eAAe;AAAA,MAC7C;AACA,UAAI,mBAAmB,0DAAoB,qBAAoB,iCAAa,IAAI,SAAS;AAEzF,UAAI,CAAE,mBAAkB,cAAc,CAAC,kBAAkB;AACvD,YAAI,iCAAa,IAAI,UAAU,cAAc,GAAG;AAC9C,2CAAa,IAAI,SAAS;AAC1B,6BAAmB;AAAA,QACrB,OAAO;AACL,cAAI,QAAQ,IAAI,aAAa,eAAe;AAE1C,oBAAQ,KACN,4HACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AACA,YAAM,0BAA0B,mBAC5B,0DAAoB,4BAA2B,YAC/C;AACJ,YAAM,YAAY,CAAC,oBAAoB,CAAC,CAAC;AACzC,YAAM,OAAO,2BAA4B;AACzC,YAAM,UAAU,CAAC,CAAE,cAAa,WAAY,EAAC,YAAY,SAAS,4BAA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