@tamagui/core 1.0.1-beta.136 → 1.0.1-beta.137
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/addTheme.js +74 -0
- package/dist/cjs/addTheme.js.map +7 -0
- package/dist/cjs/contexts/TextAncestorContext.js +44 -0
- package/dist/cjs/contexts/TextAncestorContext.js.map +7 -0
- package/dist/cjs/contexts/ThemeContext.js +30 -0
- package/dist/cjs/contexts/ThemeContext.js.map +7 -0
- package/dist/cjs/createComponent.js +2 -2
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +18 -118
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +2 -5
- package/dist/cjs/createTheme.js.map +2 -2
- package/dist/cjs/ensureThemeVariable.js +152 -0
- package/dist/cjs/ensureThemeVariable.js.map +7 -0
- package/dist/cjs/helpers/ThemeManager.js +212 -0
- package/dist/cjs/helpers/ThemeManager.js.map +7 -0
- package/dist/cjs/helpers/createTamaguiProvider.js +1 -1
- package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/cjs/helpers/ensureThemeVariable.js +152 -0
- package/dist/cjs/helpers/ensureThemeVariable.js.map +7 -0
- package/dist/cjs/helpers/getThemeCSSRules.js +98 -0
- package/dist/cjs/helpers/getThemeCSSRules.js.map +7 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js +31 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +7 -0
- package/dist/cjs/helpers/themes.js +79 -0
- package/dist/cjs/helpers/themes.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +20 -11
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/loadTheme.js +64 -0
- package/dist/cjs/loadTheme.js.map +7 -0
- package/dist/cjs/updateTheme.js +44 -0
- package/dist/cjs/updateTheme.js.map +7 -0
- package/dist/cjs/vendor/Pressability.js +32 -0
- package/dist/cjs/vendor/Pressability.js.map +7 -0
- package/dist/cjs/vendor/Pressability.native.js +32 -0
- package/dist/cjs/vendor/Pressability.native.js.map +7 -0
- package/dist/cjs/views/Theme.js +1 -1
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeProvider.js +1 -1
- package/dist/cjs/views/ThemeProvider.js.map +1 -1
- package/dist/cjs/views/ThemeReset.js +1 -1
- package/dist/cjs/views/ThemeReset.js.map +1 -1
- package/dist/esm/addTheme.js +50 -0
- package/dist/esm/addTheme.js.map +7 -0
- package/dist/esm/contexts/TextAncestorContext.js +15 -0
- package/dist/esm/contexts/TextAncestorContext.js.map +7 -0
- package/dist/esm/contexts/ThemeContext.js +6 -0
- package/dist/esm/contexts/ThemeContext.js.map +7 -0
- package/dist/esm/createComponent.js +2 -2
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createTamagui.js +17 -117
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTheme.js +1 -3
- package/dist/esm/createTheme.js.map +2 -2
- package/dist/esm/ensureThemeVariable.js +125 -0
- package/dist/esm/ensureThemeVariable.js.map +7 -0
- package/dist/esm/helpers/ThemeManager.js +186 -0
- package/dist/esm/helpers/ThemeManager.js.map +7 -0
- package/dist/esm/helpers/createTamaguiProvider.js +1 -1
- package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/esm/helpers/ensureThemeVariable.js +125 -0
- package/dist/esm/helpers/ensureThemeVariable.js.map +7 -0
- package/dist/esm/helpers/getThemeCSSRules.js +74 -0
- package/dist/esm/helpers/getThemeCSSRules.js.map +7 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js +7 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +7 -0
- package/dist/esm/helpers/themes.js +54 -0
- package/dist/esm/helpers/themes.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +23 -11
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/loadTheme.js +40 -0
- package/dist/esm/loadTheme.js.map +7 -0
- package/dist/esm/updateTheme.js +20 -0
- package/dist/esm/updateTheme.js.map +7 -0
- package/dist/esm/vendor/Pressability.js +7 -0
- package/dist/esm/vendor/Pressability.js.map +7 -0
- package/dist/esm/vendor/Pressability.native.js +7 -0
- package/dist/esm/vendor/Pressability.native.js.map +7 -0
- package/dist/esm/views/Theme.js +1 -1
- package/dist/esm/views/Theme.js.map +1 -1
- package/dist/esm/views/ThemeProvider.js +1 -1
- package/dist/esm/views/ThemeProvider.js.map +1 -1
- package/dist/esm/views/ThemeReset.js +1 -1
- package/dist/esm/views/ThemeReset.js.map +1 -1
- package/package.json +8 -8
- package/types/addTheme.d.ts +11 -0
- package/types/{views → contexts}/TextAncestorContext.d.ts +0 -0
- package/types/{ThemeContext.d.ts → contexts/ThemeContext.d.ts} +1 -1
- package/types/createTheme.d.ts +0 -1
- package/types/{ThemeManager.d.ts → helpers/ThemeManager.d.ts} +5 -5
- package/types/helpers/getThemeCSSRules.d.ts +8 -0
- package/types/helpers/getThemeCSSRules.native.d.ts +2 -0
- package/types/helpers/themes.d.ts +4 -0
- package/types/hooks/useTheme.d.ts +2 -1
- package/types/index.d.ts +3 -1
- package/types/updateTheme.d.ts +9 -0
- package/types/{Pressability.d.ts → vendor/Pressability.d.ts} +0 -0
- package/types/{Pressability.native.d.ts → vendor/Pressability.native.d.ts} +0 -0
- package/types/views/Theme.d.ts +1 -1
- package/types/defaultComponentState.d.ts +0 -1
|
@@ -0,0 +1,212 @@
|
|
|
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 ThemeManager_exports = {};
|
|
20
|
+
__export(ThemeManager_exports, {
|
|
21
|
+
ThemeManager: () => ThemeManager,
|
|
22
|
+
ThemeManagerContext: () => ThemeManagerContext,
|
|
23
|
+
emptyManager: () => emptyManager
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(ThemeManager_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_conf = require("../conf");
|
|
28
|
+
var import_constants = require("../constants/constants");
|
|
29
|
+
var import_getThemeUnwrapped = require("../hooks/getThemeUnwrapped");
|
|
30
|
+
class ThemeManager {
|
|
31
|
+
constructor(name = "", theme = null, parentManager = null, reset = false) {
|
|
32
|
+
this.name = name;
|
|
33
|
+
this.theme = theme;
|
|
34
|
+
this.parentManager = parentManager;
|
|
35
|
+
this.reset = reset;
|
|
36
|
+
this.keys = /* @__PURE__ */ new Map();
|
|
37
|
+
this.listeners = /* @__PURE__ */ new Map();
|
|
38
|
+
this.themeListeners = /* @__PURE__ */ new Set();
|
|
39
|
+
this.className = null;
|
|
40
|
+
let parent = parentManager;
|
|
41
|
+
let tries = 0;
|
|
42
|
+
while (true) {
|
|
43
|
+
tries++;
|
|
44
|
+
if (tries > 10) {
|
|
45
|
+
throw new Error(`Nested 10 of the same theme in a row, likely error`);
|
|
46
|
+
}
|
|
47
|
+
if (!parent)
|
|
48
|
+
break;
|
|
49
|
+
if (parent.name === name) {
|
|
50
|
+
parent = parent.parentManager;
|
|
51
|
+
} else {
|
|
52
|
+
this.parentManager = parent;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
get didChangeTheme() {
|
|
58
|
+
return this.parentManager && this.name !== this.parentManager.fullName;
|
|
59
|
+
}
|
|
60
|
+
get parentName() {
|
|
61
|
+
var _a;
|
|
62
|
+
return ((_a = this.parentManager) == null ? void 0 : _a.name) || null;
|
|
63
|
+
}
|
|
64
|
+
get fullName() {
|
|
65
|
+
return this.getNextTheme().name || this.name || "";
|
|
66
|
+
}
|
|
67
|
+
getValue(key) {
|
|
68
|
+
let theme = this.theme;
|
|
69
|
+
let manager = this;
|
|
70
|
+
while (true) {
|
|
71
|
+
if (!theme)
|
|
72
|
+
return;
|
|
73
|
+
if (key in theme) {
|
|
74
|
+
if (key === "color") {
|
|
75
|
+
console.log("get", theme[key]);
|
|
76
|
+
}
|
|
77
|
+
return theme[key];
|
|
78
|
+
}
|
|
79
|
+
manager = this.parentManager;
|
|
80
|
+
if (!manager || manager.theme === theme) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
theme = manager.theme;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
update({ name, theme, className } = {}, force = false) {
|
|
87
|
+
if (!force) {
|
|
88
|
+
const nameChanged = name !== this.name;
|
|
89
|
+
if (!nameChanged) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
this.className = className || null;
|
|
94
|
+
this.name = name || "";
|
|
95
|
+
this.theme = theme;
|
|
96
|
+
this.notifyListeners();
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
getNextTheme(props = {}, debug) {
|
|
100
|
+
var _a;
|
|
101
|
+
const { themes = (0, import_conf.getThemes)(), name, componentName } = props;
|
|
102
|
+
if (props.reset && name) {
|
|
103
|
+
return {
|
|
104
|
+
name,
|
|
105
|
+
theme: themes[name],
|
|
106
|
+
className: this.getClassName(name)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const parentIsReset = (_a = this.parentManager) == null ? void 0 : _a.reset;
|
|
110
|
+
if (!name) {
|
|
111
|
+
if (componentName) {
|
|
112
|
+
const names = [
|
|
113
|
+
`${this.name}_${componentName}`,
|
|
114
|
+
`${withoutComponentName(this.name)}_${componentName}`
|
|
115
|
+
];
|
|
116
|
+
for (const name2 of names) {
|
|
117
|
+
if (name2 in themes) {
|
|
118
|
+
const className = this.getClassName(name2);
|
|
119
|
+
return { name: name2, theme: themes[name2], className };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
name: this.name,
|
|
125
|
+
theme: this.theme
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
let nextName = name || this.name || "";
|
|
129
|
+
let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName;
|
|
130
|
+
while (true) {
|
|
131
|
+
if (nextName in themes) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
nextName = `${parentName}_${name}`;
|
|
135
|
+
if (nextName in themes) {
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
if (!parentName.includes(import_constants.THEME_NAME_SEPARATOR)) {
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
parentName = parentName.slice(0, parentName.lastIndexOf(import_constants.THEME_NAME_SEPARATOR));
|
|
142
|
+
}
|
|
143
|
+
if (componentName) {
|
|
144
|
+
const names = [
|
|
145
|
+
`${nextName}_${componentName}`,
|
|
146
|
+
`${withoutComponentName(nextName)}_${componentName}`
|
|
147
|
+
];
|
|
148
|
+
for (const name2 of names) {
|
|
149
|
+
if (name2 in themes) {
|
|
150
|
+
nextName = name2;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
let theme = themes[nextName];
|
|
155
|
+
if (!theme) {
|
|
156
|
+
theme = themes[`light_${nextName}`];
|
|
157
|
+
}
|
|
158
|
+
if (process.env.NODE_ENV === "development") {
|
|
159
|
+
if (debug) {
|
|
160
|
+
console.log("getNextTheme", this.getClassName(nextName), { props, nextName, parentName });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
name: nextName,
|
|
165
|
+
theme: (0, import_getThemeUnwrapped.getThemeUnwrapped)(theme),
|
|
166
|
+
className: this.getClassName(nextName)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
getClassName(name) {
|
|
170
|
+
return `${import_constants.THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace("light_", "").replace("dark_", "");
|
|
171
|
+
}
|
|
172
|
+
track(uuid, keys) {
|
|
173
|
+
if (!this.name)
|
|
174
|
+
return;
|
|
175
|
+
this.keys.set(uuid, keys);
|
|
176
|
+
}
|
|
177
|
+
notifyListeners() {
|
|
178
|
+
var _a;
|
|
179
|
+
if (!this.name) {
|
|
180
|
+
this.keys.clear();
|
|
181
|
+
}
|
|
182
|
+
for (const [uuid, keys] of this.keys.entries()) {
|
|
183
|
+
if (keys.size) {
|
|
184
|
+
(_a = this.listeners.get(uuid)) == null ? void 0 : _a();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
this.themeListeners.forEach((cb) => cb(this.name, this));
|
|
188
|
+
}
|
|
189
|
+
onChangeTheme(cb) {
|
|
190
|
+
this.themeListeners.add(cb);
|
|
191
|
+
return () => {
|
|
192
|
+
this.themeListeners.delete(cb);
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
onUpdate(uuid, cb) {
|
|
196
|
+
this.listeners.set(uuid, cb);
|
|
197
|
+
return () => {
|
|
198
|
+
this.listeners.delete(uuid);
|
|
199
|
+
this.keys.delete(uuid);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const ThemeManagerContext = (0, import_react.createContext)(null);
|
|
204
|
+
const emptyManager = new ThemeManager();
|
|
205
|
+
const withoutComponentName = (name) => name.replace(/(\_[A-Z][a-zA-Z]+)+$/g, "");
|
|
206
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
207
|
+
0 && (module.exports = {
|
|
208
|
+
ThemeManager,
|
|
209
|
+
ThemeManagerContext,
|
|
210
|
+
emptyManager
|
|
211
|
+
});
|
|
212
|
+
//# sourceMappingURL=ThemeManager.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/ThemeManager.tsx"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react'\n\nimport { getThemes } from '../conf'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from '../constants/constants'\nimport { getThemeUnwrapped } from '../hooks/getThemeUnwrapped'\nimport { ThemeObject, Themes } from '../types'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport type SetActiveThemeProps = {\n className?: string\n parentManager?: ThemeManager | null\n name?: string | null\n theme?: any\n}\n\nexport type GetNextThemeProps = {\n themes?: Themes\n name?: string | null\n componentName?: string | null\n reset?: boolean\n}\n\nexport class ThemeManager {\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n className: string | null = null\n\n constructor(\n public name: string = '',\n public theme: ThemeObject | null = null,\n public parentManager: ThemeManager | null = null,\n public reset: boolean = false\n ) {\n // find the nearest different parentManager\n let parent = parentManager\n let tries = 0\n while (true) {\n tries++\n if (tries > 10) {\n throw new Error(`Nested 10 of the same theme in a row, likely error`)\n }\n if (!parent) break\n if (parent.name === name) {\n // go up if same\n parent = parent.parentManager\n } else {\n this.parentManager = parent\n break\n }\n }\n }\n\n get didChangeTheme() {\n return this.parentManager && this.name !== this.parentManager.fullName\n }\n\n get parentName() {\n return this.parentManager?.name || null\n }\n\n get fullName(): string {\n return this.getNextTheme().name || this.name || ''\n // const parentName = this.parentManager?.fullName || ''\n // const name = this.name || ''\n // const parts = [...new Set([...`${parentName}_${name}`.split('_')])].filter(Boolean)\n // return parts.join('_')\n }\n\n // gets value going up to parents\n getValue(key: string) {\n let theme = this.theme\n let manager = this as ThemeManager | null\n while (true) {\n if (!theme) return\n if (key in theme) {\n if (key === 'color') {\n console.log('get', theme[key])\n }\n return theme[key]\n }\n manager = this.parentManager\n if (!manager || manager.theme === theme) {\n return\n }\n theme = manager.theme\n }\n }\n\n update({ name, theme, className }: SetActiveThemeProps = {}, force = false) {\n if (!force) {\n // className compare on web, avoids light/dark re-renders\n const nameChanged = name !== this.name\n if (!nameChanged) {\n return false\n }\n }\n this.className = className || null\n this.name = name || ''\n this.theme = theme\n this.notifyListeners()\n return true\n }\n\n getNextTheme(props: GetNextThemeProps = {}, debug?: any) {\n const { themes = getThemes(), name, componentName } = props\n\n if (props.reset && name) {\n return {\n name: name,\n theme: themes[name],\n className: this.getClassName(name),\n }\n }\n\n const parentIsReset = this.parentManager?.reset\n\n if (!name) {\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${this.name}_${componentName}`,\n `${withoutComponentName(this.name)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n const className = this.getClassName(name)\n return { name, theme: themes[name], className }\n }\n }\n }\n return {\n name: this.name,\n theme: this.theme,\n }\n }\n\n let nextName = name || this.name || ''\n let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName\n\n while (true) {\n if (nextName in themes) {\n break\n }\n nextName = `${parentName}_${name}`\n if (nextName in themes) {\n break\n }\n if (!parentName.includes(THEME_NAME_SEPARATOR)) {\n // this is fine - some themes can not have parents\n break\n }\n // go up one\n parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR))\n }\n\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${nextName}_${componentName}`,\n `${withoutComponentName(nextName)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n nextName = name\n }\n }\n }\n\n let theme = themes[nextName]\n if (!theme) {\n theme = themes[`light_${nextName}`]\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (debug) {\n console.log('getNextTheme', this.getClassName(nextName), { props, nextName, parentName })\n }\n }\n\n return {\n name: nextName,\n theme: getThemeUnwrapped(theme),\n className: this.getClassName(nextName),\n }\n }\n\n getClassName(name: string) {\n return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace('light_', '').replace('dark_', '')\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n notifyListeners() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager | null>(null)\nexport const emptyManager = new ThemeManager()\n\nconst withoutComponentName = (name: string) => name.replace(/(\\_[A-Z][a-zA-Z]+)+$/g, '')\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAE9B,kBAA0B;AAC1B,uBAA6D;AAC7D,+BAAkC;AAmB3B,MAAM,aAAa;AAAA,EAMxB,YACS,OAAe,IACf,QAA4B,MAC5B,gBAAqC,MACrC,QAAiB,OACxB;AAJO;AACA;AACA;AACA;AATT,gBAAO,oBAAI,IAAsB;AACjC,qBAAY,oBAAI,IAAmB;AACnC,0BAAiB,oBAAI,IAAmB;AACxC,qBAA2B;AASzB,QAAI,SAAS;AACb,QAAI,QAAQ;AACZ,WAAO,MAAM;AACX;AACA,UAAI,QAAQ,IAA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
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -27,7 +27,7 @@ module.exports = __toCommonJS(createTamaguiProvider_exports);
|
|
|
27
27
|
var React = __toESM(require("react"));
|
|
28
28
|
var import_platform = require("../constants/platform");
|
|
29
29
|
var import_ButtonInsideButtonContext = require("../contexts/ButtonInsideButtonContext");
|
|
30
|
-
var import_TextAncestorContext = require("../
|
|
30
|
+
var import_TextAncestorContext = require("../contexts/TextAncestorContext");
|
|
31
31
|
var import_ThemeProvider = require("../views/ThemeProvider");
|
|
32
32
|
function createTamaguiProvider(config) {
|
|
33
33
|
return function TamaguiProvider({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/createTamaguiProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\n\nimport { isClient } from '../constants/platform'\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAEvB,sBAAyB;AACzB,uCAA0C;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\n\nimport { isClient } from '../constants/platform'\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TextAncestorProvider } from '../contexts/TextAncestorContext'\nimport { TamaguiInternalConfig, TamaguiProviderProps } from '../types'\nimport { ThemeProvider } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider(config: TamaguiInternalConfig) {\n return function TamaguiProvider({\n disableInjectCSS,\n children,\n ...themePropsProvider\n }: TamaguiProviderProps) {\n // inject CSS if asked to (not SSR compliant)\n if (isClient) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n if (disableInjectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(config.getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [disableInjectCSS])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider\n themes={config.themes}\n defaultTheme={config.defaultTheme || 'light'}\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n >\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAEvB,sBAAyB;AACzB,uCAA0C;AAC1C,iCAAqC;AAErC,2BAA8B;AAEvB,+BAA+B,QAA+B;AACnE,SAAO,yBAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,OACG;AAAA,KACoB;AAEvB,QAAI,0BAAU;AAEZ,YAAM,gBAAgB,MAAM;AAC1B,YAAI;AAAkB;AACtB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,cAAM,YAAY,SAAS,eAAe,OAAO,OAAO,CAAC,CAAC;AAC1D,iBAAS,KAAK,YAAY,KAAK;AAC/B,eAAO,MAAM;AACX,mBAAS,KAAK,YAAY,KAAK;AAAA,QACjC;AAAA,MACF,GAAG,CAAC,gBAAgB,CAAC;AAAA,IACvB;AAEA,WACE,oCAAC,2DAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,uDACC,oCAAC;AAAA,MACC,QAAQ,OAAO;AAAA,MACf,cAAc,OAAO,gBAAgB;AAAA,MACrC,sBAAsB,OAAO;AAAA,MAC7B,uBAAuB,OAAO;AAAA,MAC7B,GAAG;AAAA,OAEH,QACH,CACF,CACF;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,152 @@
|
|
|
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 ensureThemeVariable_exports = {};
|
|
20
|
+
__export(ensureThemeVariable_exports, {
|
|
21
|
+
ensureThemeVariable: () => ensureThemeVariable,
|
|
22
|
+
getThemeCSSRules: () => getThemeCSSRules,
|
|
23
|
+
proxyThemeToParents: () => proxyThemeToParents,
|
|
24
|
+
themes: () => themes
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(ensureThemeVariable_exports);
|
|
27
|
+
var import_constants = require("./constants/constants");
|
|
28
|
+
var import_createVariable = require("./createVariable");
|
|
29
|
+
var import_registerCSSVariable = require("./helpers/registerCSSVariable");
|
|
30
|
+
var import_getThemeUnwrapped = require("./hooks/getThemeUnwrapped");
|
|
31
|
+
const themes = {};
|
|
32
|
+
function ensureThemeVariable(theme, key) {
|
|
33
|
+
const val = theme[key];
|
|
34
|
+
const themeKey = key;
|
|
35
|
+
if (!(0, import_createVariable.isVariable)(val)) {
|
|
36
|
+
theme[key] = (0, import_createVariable.createVariable)({
|
|
37
|
+
key: themeKey,
|
|
38
|
+
name: themeKey,
|
|
39
|
+
val
|
|
40
|
+
});
|
|
41
|
+
} else {
|
|
42
|
+
if (val.name !== themeKey) {
|
|
43
|
+
theme[key] = (0, import_createVariable.createVariable)({
|
|
44
|
+
key: val.name,
|
|
45
|
+
name: themeKey,
|
|
46
|
+
val: val.val
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function proxyThemeToParents(themeName, themes2) {
|
|
52
|
+
const cur = [];
|
|
53
|
+
const parents = themeName.split("_").slice(0, -1).map((part) => {
|
|
54
|
+
cur.push(part);
|
|
55
|
+
return cur.join("_");
|
|
56
|
+
});
|
|
57
|
+
if (!parents.length) {
|
|
58
|
+
return themes2[themeName];
|
|
59
|
+
}
|
|
60
|
+
const og = themes2[themeName];
|
|
61
|
+
return new Proxy(og, {
|
|
62
|
+
get(target, key) {
|
|
63
|
+
if (key === import_getThemeUnwrapped.GetThemeUnwrapped) {
|
|
64
|
+
return og;
|
|
65
|
+
}
|
|
66
|
+
if (Reflect.has(target, key)) {
|
|
67
|
+
return Reflect.get(target, key);
|
|
68
|
+
}
|
|
69
|
+
for (let i = parents.length - 1; i >= 0; i--) {
|
|
70
|
+
const parent = themes2[parents[i]];
|
|
71
|
+
if (!parent) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (Reflect.has(parent, key)) {
|
|
75
|
+
return Reflect.get(parent, key);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return Reflect.get(target, key);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function getThemeCSSRules({
|
|
83
|
+
config,
|
|
84
|
+
themeName,
|
|
85
|
+
theme,
|
|
86
|
+
names
|
|
87
|
+
}) {
|
|
88
|
+
const cssRuleSets = [];
|
|
89
|
+
const hasDarkLight = "light" in config.themes && "dark" in config.themes;
|
|
90
|
+
const CNP = `.${import_constants.THEME_CLASSNAME_PREFIX}`;
|
|
91
|
+
let vars = "";
|
|
92
|
+
for (const themeKey in theme) {
|
|
93
|
+
const variable = theme[themeKey];
|
|
94
|
+
let value = null;
|
|
95
|
+
if (variable.isFloating || !import_registerCSSVariable.tokensValueToVariable.has(variable.val)) {
|
|
96
|
+
value = variable.val;
|
|
97
|
+
} else {
|
|
98
|
+
value = import_registerCSSVariable.tokensValueToVariable.get(variable.val).variable;
|
|
99
|
+
}
|
|
100
|
+
vars += `--${themeKey}:${value};`;
|
|
101
|
+
}
|
|
102
|
+
const isDarkOrLightBase = themeName === "dark" || themeName === "light";
|
|
103
|
+
const selectors = names.map((name) => {
|
|
104
|
+
return `${CNP}${name}`;
|
|
105
|
+
});
|
|
106
|
+
if (hasDarkLight) {
|
|
107
|
+
for (const subName of names) {
|
|
108
|
+
const isDark = isDarkOrLightBase || subName.startsWith("dark_");
|
|
109
|
+
const childSelector = `${CNP}${subName.replace(isDark ? "dark_" : "light_", "")}`;
|
|
110
|
+
const order = isDark ? ["dark", "light"] : ["light", "dark"];
|
|
111
|
+
if (isDarkOrLightBase) {
|
|
112
|
+
order.reverse();
|
|
113
|
+
}
|
|
114
|
+
const [stronger, weaker] = order;
|
|
115
|
+
const max = config.maxDarkLightNesting ?? 3;
|
|
116
|
+
new Array(Math.round(max * 1.5)).fill(void 0).forEach((_, pi) => {
|
|
117
|
+
const isOdd = pi % 2 === 1;
|
|
118
|
+
if (isOdd && pi < 3)
|
|
119
|
+
return;
|
|
120
|
+
const parents = new Array(pi + 1).fill(void 0).map((_2, psi) => {
|
|
121
|
+
return `${CNP}${psi % 2 === 0 ? stronger : weaker}`;
|
|
122
|
+
});
|
|
123
|
+
let parentSelectors = parents.length > 1 ? parents.slice(1) : parents;
|
|
124
|
+
if (isOdd) {
|
|
125
|
+
const [_first, second, ...rest] = parentSelectors;
|
|
126
|
+
parentSelectors = [second, ...rest, second];
|
|
127
|
+
}
|
|
128
|
+
const lastParentSelector = parentSelectors[parentSelectors.length - 1];
|
|
129
|
+
selectors.push(`${parentSelectors.join(" ")} ${childSelector === lastParentSelector ? "" : childSelector}`);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const rootSep = config.themeClassNameOnRoot ? "" : " ";
|
|
134
|
+
const css = `${selectors.map((x) => `:root${rootSep}${x}`).join(", ")} {${vars}}`;
|
|
135
|
+
cssRuleSets.push(css);
|
|
136
|
+
if (config.shouldAddPrefersColorThemes && isDarkOrLightBase) {
|
|
137
|
+
const isDark = themeName.startsWith("dark");
|
|
138
|
+
cssRuleSets.push(`@media(prefers-color-scheme: ${isDark ? "dark" : "light"}) {
|
|
139
|
+
body { background:${theme.background}; color: ${theme.color} }
|
|
140
|
+
:root {${vars} }
|
|
141
|
+
}`);
|
|
142
|
+
}
|
|
143
|
+
return cssRuleSets;
|
|
144
|
+
}
|
|
145
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
146
|
+
0 && (module.exports = {
|
|
147
|
+
ensureThemeVariable,
|
|
148
|
+
getThemeCSSRules,
|
|
149
|
+
proxyThemeToParents,
|
|
150
|
+
themes
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=ensureThemeVariable.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/ensureThemeVariable.ts"],
|
|
4
|
+
"sourcesContent": ["import { THEME_CLASSNAME_PREFIX } from './constants/constants'\nimport { Variable, createVariable, isVariable } from './createVariable'\nimport { tokensValueToVariable } from './helpers/registerCSSVariable'\nimport { GetThemeUnwrapped } from './hooks/getThemeUnwrapped'\nimport { CreateTamaguiProps, ThemeObject } from './types'\n\nexport const themes = {}\n// mutates, freeze after\n// shared by createTamagui so extracted here\nexport function ensureThemeVariable(theme: any, key: string) {\n const val = theme[key]\n const themeKey = key\n if (!isVariable(val)) {\n theme[key] = createVariable({\n key: themeKey,\n name: themeKey,\n val,\n })\n } else {\n if (val.name !== themeKey) {\n // rename to theme name\n theme[key] = createVariable({\n key: val.name,\n name: themeKey,\n val: val.val,\n })\n }\n }\n}\nexport function proxyThemeToParents(themeName: string, themes: CreateTamaguiProps['themes']) {\n // we could test if this is better as just a straight object spread or fancier proxy\n const cur: string[] = []\n // if theme is dark_blue_alt1_Button\n // this will be the parent names in order: ['dark', 'dark_blue', 'dark_blue_alt1\"]\n const parents = themeName\n .split('_')\n .slice(0, -1)\n .map((part) => {\n cur.push(part)\n return cur.join('_')\n })\n\n if (!parents.length) {\n return themes[themeName]\n }\n\n // proxy fallback values to parent theme values\n const og = themes[themeName]\n return new Proxy(og, {\n get(target, key) {\n if (key === GetThemeUnwrapped) {\n return og\n }\n if (Reflect.has(target, key)) {\n return Reflect.get(target, key)\n }\n // check parents\n for (let i = parents.length - 1; i >= 0; i--) {\n const parent = themes[parents[i]]\n if (!parent) {\n continue\n }\n if (Reflect.has(parent, key)) {\n return Reflect.get(parent, key)\n }\n }\n return Reflect.get(target, key)\n },\n })\n}\nexport function getThemeCSSRules({\n config,\n themeName,\n theme,\n names,\n}: {\n config: CreateTamaguiProps\n themeName: string\n theme: ThemeObject\n names: string[]\n}) {\n const cssRuleSets: string[] = []\n\n // special case for SSR\n const hasDarkLight = 'light' in config.themes && 'dark' in config.themes\n const CNP = `.${THEME_CLASSNAME_PREFIX}`\n let vars = ''\n\n // themeToVariableToValueMap.set(theme, {})\n // const varToValMap = themeToVariableToValueMap.get(theme)\n for (const themeKey in theme) {\n const variable = theme[themeKey] as Variable\n let value: any = null\n // if (varToValMap) {\n // varToValMap[variable.variable] = variable.val\n // }\n if (variable.isFloating || !tokensValueToVariable.has(variable.val)) {\n value = variable.val\n } else {\n value = tokensValueToVariable.get(variable.val)!.variable\n }\n vars += `--${themeKey}:${value};`\n }\n\n const isDarkOrLightBase = themeName === 'dark' || themeName === 'light'\n const selectors = names.map((name) => {\n return `${CNP}${name}`\n })\n\n // since we dont specify dark/light in classnames we have to do an awkward specificity war\n // use config.maxDarkLightNesting to determine how deep you can nest until it breaks\n if (hasDarkLight) {\n for (const subName of names) {\n const isDark = isDarkOrLightBase || subName.startsWith('dark_')\n const childSelector = `${CNP}${subName.replace(isDark ? 'dark_' : 'light_', '')}`\n const order = isDark ? ['dark', 'light'] : ['light', 'dark']\n if (isDarkOrLightBase) {\n order.reverse()\n }\n const [stronger, weaker] = order\n const max = config.maxDarkLightNesting ?? 3\n\n new Array(Math.round(max * 1.5)).fill(undefined).forEach((_, pi) => {\n const isOdd = pi % 2 === 1\n if (isOdd && pi < 3) return\n const parents = new Array(pi + 1).fill(undefined).map((_, psi) => {\n return `${CNP}${psi % 2 === 0 ? stronger : weaker}`\n })\n let parentSelectors = parents.length > 1 ? parents.slice(1) : parents\n if (isOdd) {\n const [_first, second, ...rest] = parentSelectors\n parentSelectors = [second, ...rest, second]\n }\n // avoid .t_light .t_light at the end (make sure child is unique from last parent)\n const lastParentSelector = parentSelectors[parentSelectors.length - 1]\n selectors.push(\n `${parentSelectors.join(' ')} ${\n childSelector === lastParentSelector ? '' : childSelector\n }`\n )\n })\n }\n }\n\n const rootSep = config.themeClassNameOnRoot ? '' : ' '\n const css = `${selectors.map((x) => `:root${rootSep}${x}`).join(', ')} {${vars}}`\n cssRuleSets.push(css)\n\n if (config.shouldAddPrefersColorThemes && isDarkOrLightBase) {\n // add media prefers for dark/light base\n const isDark = themeName.startsWith('dark')\n cssRuleSets.push(\n `@media(prefers-color-scheme: ${isDark ? 'dark' : 'light'}) {\nbody { background:${theme.background}; color: ${theme.color} }\n:root {${vars} } \n}`\n )\n }\n\n return cssRuleSets\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAuC;AACvC,4BAAqD;AACrD,iCAAsC;AACtC,+BAAkC;AAG3B,MAAM,SAAS,CAAC;AAGhB,6BAA6B,OAAY,KAAa;AAC3D,QAAM,MAAM,MAAM;AAClB,QAAM,WAAW;AACjB,MAAI,CAAC,sCAAW,GAAG,GAAG;AACpB,UAAM,OAAO,0CAAe;AAAA,MAC1B,KAAK;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AAqB,gBAAgB,gBAAgB,SAAS;AACpE,kBAAU,KACR,GAAG,gBAAgB,KAAK,GAAG,KACzB,kBAAkB,qBAAqB,KAAK,eAEhD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,UAAU,OAAO,uBAAuB,KAAK;AACnD,QAAM,MAAM,GAAG,UAAU,IAAI,CAAC,MAAM,QAAQ,UAAU,GAAG,EAAE,KAAK,IAAI,MAAM;AAC1E,cAAY,KAAK,GAAG;AAEpB,MAAI,OAAO,+BAA+B,mBAAmB;AAE3D,UAAM,SAAS,UAAU,WAAW,MAAM;AAC1C,gBAAY,KACV,gCAAgC,SAAS,SAAS;AAAA,oBACpC,MAAM,sBAAsB,MAAM;AAAA,SAC7C;AAAA,EAEL;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
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 getThemeCSSRules_exports = {};
|
|
20
|
+
__export(getThemeCSSRules_exports, {
|
|
21
|
+
getThemeCSSRules: () => getThemeCSSRules
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getThemeCSSRules_exports);
|
|
24
|
+
var import_constants = require("../constants/constants");
|
|
25
|
+
var import_registerCSSVariable = require("./registerCSSVariable");
|
|
26
|
+
function getThemeCSSRules({
|
|
27
|
+
config,
|
|
28
|
+
themeName,
|
|
29
|
+
theme,
|
|
30
|
+
names
|
|
31
|
+
}) {
|
|
32
|
+
const cssRuleSets = [];
|
|
33
|
+
const hasDarkLight = "light" in config.themes && "dark" in config.themes;
|
|
34
|
+
const CNP = `.${import_constants.THEME_CLASSNAME_PREFIX}`;
|
|
35
|
+
let vars = "";
|
|
36
|
+
for (const themeKey in theme) {
|
|
37
|
+
const variable = theme[themeKey];
|
|
38
|
+
let value = null;
|
|
39
|
+
if (variable.isFloating || !import_registerCSSVariable.tokensValueToVariable.has(variable.val)) {
|
|
40
|
+
value = variable.val;
|
|
41
|
+
} else {
|
|
42
|
+
value = import_registerCSSVariable.tokensValueToVariable.get(variable.val).variable;
|
|
43
|
+
}
|
|
44
|
+
vars += `--${themeKey}:${value};`;
|
|
45
|
+
}
|
|
46
|
+
const isDarkOrLightBase = themeName === "dark" || themeName === "light";
|
|
47
|
+
const selectors = names.map((name) => {
|
|
48
|
+
return `${CNP}${name}`;
|
|
49
|
+
});
|
|
50
|
+
if (hasDarkLight) {
|
|
51
|
+
for (const subName of names) {
|
|
52
|
+
const isDark = isDarkOrLightBase || subName.startsWith("dark_");
|
|
53
|
+
const max = config.maxDarkLightNesting ?? 3;
|
|
54
|
+
if (!isDark && !subName.startsWith("light_")) {
|
|
55
|
+
selectors.push(`:root:root ${CNP}${subName}`);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const childSelector = `${CNP}${subName.replace(isDark ? "dark_" : "light_", "")}`;
|
|
59
|
+
const order = isDark ? ["dark", "light"] : ["light", "dark"];
|
|
60
|
+
if (isDarkOrLightBase) {
|
|
61
|
+
order.reverse();
|
|
62
|
+
}
|
|
63
|
+
const [stronger, weaker] = order;
|
|
64
|
+
const numSelectors = Math.round(max * 1.5);
|
|
65
|
+
for (let pi = 0; pi < numSelectors; pi++) {
|
|
66
|
+
const isOdd = pi % 2 === 1;
|
|
67
|
+
if (isOdd && pi < 3)
|
|
68
|
+
continue;
|
|
69
|
+
const parents = new Array(pi + 1).fill(void 0).map((_, psi) => {
|
|
70
|
+
return `${CNP}${psi % 2 === 0 ? stronger : weaker}`;
|
|
71
|
+
});
|
|
72
|
+
let parentSelectors = parents.length > 1 ? parents.slice(1) : parents;
|
|
73
|
+
if (isOdd) {
|
|
74
|
+
const [_first, second, ...rest] = parentSelectors;
|
|
75
|
+
parentSelectors = [second, ...rest, second];
|
|
76
|
+
}
|
|
77
|
+
const lastParentSelector = parentSelectors[parentSelectors.length - 1];
|
|
78
|
+
selectors.push(`${parentSelectors.join(" ")} ${childSelector === lastParentSelector ? "" : childSelector}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const rootSep = config.themeClassNameOnRoot ? "" : " ";
|
|
83
|
+
const css = `${selectors.map((x) => `:root${rootSep}${x}`).join(", ")} {${vars}}`;
|
|
84
|
+
cssRuleSets.push(css);
|
|
85
|
+
if (config.shouldAddPrefersColorThemes && isDarkOrLightBase) {
|
|
86
|
+
const isDark = themeName.startsWith("dark");
|
|
87
|
+
cssRuleSets.push(`@media(prefers-color-scheme: ${isDark ? "dark" : "light"}) {
|
|
88
|
+
body { background:${theme.background}; color: ${theme.color} }
|
|
89
|
+
:root {${vars} }
|
|
90
|
+
}`);
|
|
91
|
+
}
|
|
92
|
+
return cssRuleSets;
|
|
93
|
+
}
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
getThemeCSSRules
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=getThemeCSSRules.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/getThemeCSSRules.ts"],
|
|
4
|
+
"sourcesContent": ["import { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { Variable } from '../createVariable'\nimport { CreateTamaguiProps, ThemeObject } from '../types'\nimport { tokensValueToVariable } from './registerCSSVariable'\n\nexport function getThemeCSSRules({\n config,\n themeName,\n theme,\n names,\n}: {\n config: CreateTamaguiProps\n themeName: string\n theme: ThemeObject\n names: string[]\n}) {\n const cssRuleSets: string[] = []\n\n // special case for SSR\n const hasDarkLight = 'light' in config.themes && 'dark' in config.themes\n const CNP = `.${THEME_CLASSNAME_PREFIX}`\n let vars = ''\n\n // themeToVariableToValueMap.set(theme, {})\n // const varToValMap = themeToVariableToValueMap.get(theme)\n for (const themeKey in theme) {\n const variable = theme[themeKey] as Variable\n let value: any = null\n // if (varToValMap) {\n // varToValMap[variable.variable] = variable.val\n // }\n if (variable.isFloating || !tokensValueToVariable.has(variable.val)) {\n value = variable.val\n } else {\n value = tokensValueToVariable.get(variable.val)!.variable\n }\n vars += `--${themeKey}:${value};`\n }\n\n const isDarkOrLightBase = themeName === 'dark' || themeName === 'light'\n const selectors = names.map((name) => {\n return `${CNP}${name}`\n })\n\n // since we dont specify dark/light in classnames we have to do an awkward specificity war\n // use config.maxDarkLightNesting to determine how deep you can nest until it breaks\n if (hasDarkLight) {\n for (const subName of names) {\n const isDark = isDarkOrLightBase || subName.startsWith('dark_')\n const max = config.maxDarkLightNesting ?? 3\n\n if (!isDark && !subName.startsWith('light_')) {\n // neither light nor dark subtheme, just generate one selector with :root:root which\n // will override all :root light/dark selectors generated below\n selectors.push(`:root:root ${CNP}${subName}`)\n continue\n }\n\n const childSelector = `${CNP}${subName.replace(isDark ? 'dark_' : 'light_', '')}`\n const order = isDark ? ['dark', 'light'] : ['light', 'dark']\n if (isDarkOrLightBase) {\n order.reverse()\n }\n const [stronger, weaker] = order\n const numSelectors = Math.round(max * 1.5)\n\n for (let pi = 0; pi < numSelectors; pi++) {\n const isOdd = pi % 2 === 1\n if (isOdd && pi < 3) continue\n const parents = new Array(pi + 1).fill(undefined).map((_, psi) => {\n return `${CNP}${psi % 2 === 0 ? stronger : weaker}`\n })\n let parentSelectors = parents.length > 1 ? parents.slice(1) : parents\n if (isOdd) {\n const [_first, second, ...rest] = parentSelectors\n parentSelectors = [second, ...rest, second]\n }\n // avoid .t_light .t_light at the end (make sure child is unique from last parent)\n const lastParentSelector = parentSelectors[parentSelectors.length - 1]\n selectors.push(\n `${parentSelectors.join(' ')} ${\n childSelector === lastParentSelector ? '' : childSelector\n }`\n )\n }\n }\n }\n\n const rootSep = config.themeClassNameOnRoot ? '' : ' '\n const css = `${selectors.map((x) => `:root${rootSep}${x}`).join(', ')} {${vars}}`\n cssRuleSets.push(css)\n\n if (config.shouldAddPrefersColorThemes && isDarkOrLightBase) {\n // add media prefers for dark/light base\n const isDark = themeName.startsWith('dark')\n cssRuleSets.push(\n `@media(prefers-color-scheme: ${isDark ? 'dark' : 'light'}) {\nbody { background:${theme.background}; color: ${theme.color} }\n:root {${vars} } \n}`\n )\n }\n\n return cssRuleSets\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAuC;AAGvC,iCAAsC;AAE/B,0BAA0B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GAMC;AACD,QAAM,cAAwB,CAAC;AAG/B,QAAM,eAAe,WAAW,OAAO,UAAU,UAAU,OAAO;AAClE,QAAM,MAAM,IAAI;AAChB,MAAI,OAAO;AAIX,aAAW,YAAY,OAAO;AAC5B,UAAM,WAAW,MAAM;AACvB,QAAI,QAAa;AAIjB,QAAI,SAAS,cAAc,CAAC,iDAAsB,IAAI,SAAS,GAAG,GAAG;AACnE,cAAQ,SAAS;AAAA,IACnB,OAAO;AACL,cAAQ,iDAAsB,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ACzB,kBAAkB,qBAAqB,KAAK,eAEhD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,OAAO,uBAAuB,KAAK;AACnD,QAAM,MAAM,GAAG,UAAU,IAAI,CAAC,MAAM,QAAQ,UAAU,GAAG,EAAE,KAAK,IAAI,MAAM;AAC1E,cAAY,KAAK,GAAG;AAEpB,MAAI,OAAO,+BAA+B,mBAAmB;AAE3D,UAAM,SAAS,UAAU,WAAW,MAAM;AAC1C,gBAAY,KACV,gCAAgC,SAAS,SAAS;AAAA,oBACpC,MAAM,sBAAsB,MAAM;AAAA,SAC7C;AAAA,EAEL;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 getThemeCSSRules_native_exports = {};
|
|
20
|
+
__export(getThemeCSSRules_native_exports, {
|
|
21
|
+
getThemeCSSRules: () => getThemeCSSRules
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getThemeCSSRules_native_exports);
|
|
24
|
+
function getThemeCSSRules() {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
getThemeCSSRules
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=getThemeCSSRules.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/getThemeCSSRules.native.ts"],
|
|
4
|
+
"sourcesContent": ["export function getThemeCSSRules() {\n return []\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,4BAA4B;AACjC,SAAO,CAAC;AACV;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|