@tamagui/theme-builder 1.45.10 → 1.45.11

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.
@@ -0,0 +1,175 @@
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 ThemeBuilder_exports = {};
20
+ __export(ThemeBuilder_exports, {
21
+ ThemeBuilder: () => ThemeBuilder,
22
+ createThemeBuilder: () => createThemeBuilder
23
+ });
24
+ module.exports = __toCommonJS(ThemeBuilder_exports);
25
+ var import_create_theme = require("@tamagui/create-theme");
26
+ class ThemeBuilder {
27
+ constructor(state) {
28
+ this.state = state;
29
+ }
30
+ addPalettes(palettes) {
31
+ this.state.palettes = {
32
+ // as {} prevents generic string key merge messing up types
33
+ ...this.state.palettes,
34
+ ...palettes
35
+ };
36
+ return this;
37
+ }
38
+ addTemplates(templates) {
39
+ this.state.templates = {
40
+ // as {} prevents generic string key merge messing up types
41
+ ...this.state.templates,
42
+ ...templates
43
+ };
44
+ return this;
45
+ }
46
+ addMasks(masks) {
47
+ this.state.masks = {
48
+ // as {} prevents generic string key merge messing up types
49
+ ...this.state.masks,
50
+ ...(0, import_create_theme.objectFromEntries)(
51
+ (0, import_create_theme.objectEntries)(masks).map(([key, val]) => [key, (0, import_create_theme.createMask)(val)])
52
+ )
53
+ };
54
+ return this;
55
+ }
56
+ addThemes(themes) {
57
+ this.state.themes = {
58
+ // as {} prevents generic string key merge messing up types
59
+ ...this.state.themes,
60
+ ...themes
61
+ };
62
+ return this;
63
+ }
64
+ addChildThemes(childThemeDefinition, options) {
65
+ const currentThemes = this.state.themes;
66
+ if (!currentThemes) {
67
+ throw new Error(
68
+ `No themes defined yet, use addThemes first to set your base themes`
69
+ );
70
+ }
71
+ const currentThemeNames = (0, import_create_theme.objectKeys)(currentThemes);
72
+ const incomingThemeNames = (0, import_create_theme.objectKeys)(childThemeDefinition);
73
+ const namesWithDefinitions = currentThemeNames.flatMap((prefix) => {
74
+ if (options == null ? void 0 : options.avoidNestingWithin) {
75
+ if (options.avoidNestingWithin.some(
76
+ (avoidName) => prefix.startsWith(avoidName) || prefix.endsWith(avoidName)
77
+ )) {
78
+ return [];
79
+ }
80
+ }
81
+ return incomingThemeNames.map((subName) => {
82
+ const fullName = `${prefix}_${subName}`;
83
+ const definition = childThemeDefinition[subName];
84
+ return [fullName, definition];
85
+ });
86
+ });
87
+ const childThemes = (0, import_create_theme.objectFromEntries)(namesWithDefinitions);
88
+ const next = {
89
+ // as {} prevents generic string key merge messing up types
90
+ ...this.state.themes,
91
+ ...childThemes
92
+ };
93
+ this.state.themes = next;
94
+ return this;
95
+ }
96
+ build() {
97
+ var _a, _b;
98
+ if (!this.state.themes) {
99
+ return {};
100
+ }
101
+ const out = {};
102
+ const maskedThemes = [];
103
+ for (const themeName in this.state.themes) {
104
+ const nameParts = themeName.split("_");
105
+ const parentName = nameParts.slice(0, nameParts.length - 1).join("_");
106
+ const definitions = this.state.themes[themeName];
107
+ const themeDefinition = Array.isArray(definitions) ? (() => {
108
+ const found = definitions.find((d) => parentName.startsWith(d.parent));
109
+ if (!found) {
110
+ throw new Error(`No parent for ${themeName}: ${parentName}`);
111
+ }
112
+ return found;
113
+ })() : definitions;
114
+ if ("theme" in themeDefinition) {
115
+ out[themeName] = themeDefinition.theme;
116
+ } else if ("mask" in themeDefinition) {
117
+ maskedThemes.push({ parentName, themeName, mask: themeDefinition });
118
+ } else {
119
+ const {
120
+ palette: paletteName,
121
+ template: templateName,
122
+ ...options
123
+ } = themeDefinition;
124
+ if (!this.state.palettes) {
125
+ throw new Error(
126
+ `No palettes defined for theme with palette expected: ${themeName}`
127
+ );
128
+ }
129
+ let palette = this.state.palettes[paletteName];
130
+ if (!palette) {
131
+ const fullPaletteName = `${parentName}_${paletteName}`;
132
+ palette = this.state.palettes[fullPaletteName];
133
+ }
134
+ if (!palette) {
135
+ throw new Error(`No palette for theme ${themeName}: ${paletteName}`);
136
+ }
137
+ const template = (_a = this.state.templates) == null ? void 0 : _a[templateName];
138
+ if (!template) {
139
+ throw new Error(`No template for theme ${themeName}: ${templateName}`);
140
+ }
141
+ out[themeName] = (0, import_create_theme.createTheme)(palette, template, options, themeName);
142
+ }
143
+ }
144
+ for (const { mask, themeName, parentName } of maskedThemes) {
145
+ const parent = out[parentName];
146
+ if (!parent) {
147
+ throw new Error(
148
+ `No parent theme found with name ${parentName} for theme ${themeName} to use as a mask target`
149
+ );
150
+ }
151
+ const { mask: maskName, ...options } = mask;
152
+ const maskFunction = (_b = this.state.masks) == null ? void 0 : _b[maskName];
153
+ if (!maskFunction) {
154
+ throw new Error(`No mask ${maskFunction}`);
155
+ }
156
+ out[themeName] = (0, import_create_theme.applyMask)(
157
+ parent,
158
+ maskFunction,
159
+ options,
160
+ parentName,
161
+ themeName
162
+ );
163
+ }
164
+ return out;
165
+ }
166
+ }
167
+ function createThemeBuilder() {
168
+ return new ThemeBuilder({});
169
+ }
170
+ // Annotate the CommonJS export names for ESM import in node:
171
+ 0 && (module.exports = {
172
+ ThemeBuilder,
173
+ createThemeBuilder
174
+ });
175
+ //# sourceMappingURL=ThemeBuilder.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ThemeBuilder.ts"],
4
+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wDAAwD;AAAA,UAC1D;AAAA,QACF;AAEA,YAAI,UAAU,KAAK,MAAM,SAAS,WAAW;AAE7C,YAAI,CAAC,SAAS;AACZ,gBAAM,kBAAkB,GAAG,cAAc;AACzC,oBAAU,KAAK,MAAM,SAAS,eAAe;AAAA,QAE/C;AAEA,YAAI,CAAC,SAAS;AACZ,gBAAM,IAAI,MAAM,wBAAwB,cAAc,aAAa;AAAA,QACrE;AAEA,cAAM,YAAW,UAAK,MAAM,cAAX,mBAAuB;AACxC,YAAI,CAAC,UAAU;AACb,gBAAM,IAAI,MAAM,yBAAyB,cAAc,cAAc;AAAA,QACvE;AAEA,YAAI,SAAS,QAAI,iCAAY,SAAS,UAAU,SAAS,SAAS;AAAA,MACpE;AAAA,IACF;AAEA,eAAW,EAAE,MAAM,WAAW,WAAW,KAAK,cAAc;AAC1D,YAAM,SAAS,IAAI,UAAU;AAE7B,UAAI,CAAC,QAAQ;AACX,cAAM,IAAI;AAAA,UACR,mCAAmC,wBAAwB;AAAA,QAC7D;AAAA,MACF;AAEA,YAAM,EAAE,MAAM,UAAU,GAAG,QAAQ,IAAI;AACvC,YAAM,gBAAe,UAAK,MAAM,UAAX,mBAAmB;AAExC,UAAI,CAAC,cAAc;AACjB,cAAM,IAAI,MAAM,WAAW,cAAc;AAAA,MAC3C;AAEA,UAAI,SAAS,QAAI;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,SAAS,qBAAqB;AACnC,SAAO,IAAI,aAAa,CAAC,CAAC;AAC5B;",
5
+ "names": []
6
+ }
package/dist/cjs/index.js CHANGED
@@ -15,11 +15,9 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var src_exports = {};
17
17
  module.exports = __toCommonJS(src_exports);
18
- __reExport(src_exports, require("@tamagui/create-theme"), module.exports);
19
- __reExport(src_exports, require("@tamagui/create-theme/theme-builder"), module.exports);
18
+ __reExport(src_exports, require("./ThemeBuilder"), module.exports);
20
19
  // Annotate the CommonJS export names for ESM import in node:
21
20
  0 && (module.exports = {
22
- ...require("@tamagui/create-theme"),
23
- ...require("@tamagui/create-theme/theme-builder")
21
+ ...require("./ThemeBuilder")
24
22
  });
25
23
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,kCAAd;AACA,wBAAc,gDADd;",
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,2BAAd;",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,157 @@
1
+ import {
2
+ applyMask,
3
+ createMask,
4
+ createTheme,
5
+ objectEntries,
6
+ objectFromEntries,
7
+ objectKeys
8
+ } from "@tamagui/create-theme";
9
+ class ThemeBuilder {
10
+ constructor(state) {
11
+ this.state = state;
12
+ }
13
+ addPalettes(palettes) {
14
+ this.state.palettes = {
15
+ // as {} prevents generic string key merge messing up types
16
+ ...this.state.palettes,
17
+ ...palettes
18
+ };
19
+ return this;
20
+ }
21
+ addTemplates(templates) {
22
+ this.state.templates = {
23
+ // as {} prevents generic string key merge messing up types
24
+ ...this.state.templates,
25
+ ...templates
26
+ };
27
+ return this;
28
+ }
29
+ addMasks(masks) {
30
+ this.state.masks = {
31
+ // as {} prevents generic string key merge messing up types
32
+ ...this.state.masks,
33
+ ...objectFromEntries(
34
+ objectEntries(masks).map(([key, val]) => [key, createMask(val)])
35
+ )
36
+ };
37
+ return this;
38
+ }
39
+ addThemes(themes) {
40
+ this.state.themes = {
41
+ // as {} prevents generic string key merge messing up types
42
+ ...this.state.themes,
43
+ ...themes
44
+ };
45
+ return this;
46
+ }
47
+ addChildThemes(childThemeDefinition, options) {
48
+ const currentThemes = this.state.themes;
49
+ if (!currentThemes) {
50
+ throw new Error(
51
+ `No themes defined yet, use addThemes first to set your base themes`
52
+ );
53
+ }
54
+ const currentThemeNames = objectKeys(currentThemes);
55
+ const incomingThemeNames = objectKeys(childThemeDefinition);
56
+ const namesWithDefinitions = currentThemeNames.flatMap((prefix) => {
57
+ if (options == null ? void 0 : options.avoidNestingWithin) {
58
+ if (options.avoidNestingWithin.some(
59
+ (avoidName) => prefix.startsWith(avoidName) || prefix.endsWith(avoidName)
60
+ )) {
61
+ return [];
62
+ }
63
+ }
64
+ return incomingThemeNames.map((subName) => {
65
+ const fullName = `${prefix}_${subName}`;
66
+ const definition = childThemeDefinition[subName];
67
+ return [fullName, definition];
68
+ });
69
+ });
70
+ const childThemes = objectFromEntries(namesWithDefinitions);
71
+ const next = {
72
+ // as {} prevents generic string key merge messing up types
73
+ ...this.state.themes,
74
+ ...childThemes
75
+ };
76
+ this.state.themes = next;
77
+ return this;
78
+ }
79
+ build() {
80
+ var _a, _b;
81
+ if (!this.state.themes) {
82
+ return {};
83
+ }
84
+ const out = {};
85
+ const maskedThemes = [];
86
+ for (const themeName in this.state.themes) {
87
+ const nameParts = themeName.split("_");
88
+ const parentName = nameParts.slice(0, nameParts.length - 1).join("_");
89
+ const definitions = this.state.themes[themeName];
90
+ const themeDefinition = Array.isArray(definitions) ? (() => {
91
+ const found = definitions.find((d) => parentName.startsWith(d.parent));
92
+ if (!found) {
93
+ throw new Error(`No parent for ${themeName}: ${parentName}`);
94
+ }
95
+ return found;
96
+ })() : definitions;
97
+ if ("theme" in themeDefinition) {
98
+ out[themeName] = themeDefinition.theme;
99
+ } else if ("mask" in themeDefinition) {
100
+ maskedThemes.push({ parentName, themeName, mask: themeDefinition });
101
+ } else {
102
+ const {
103
+ palette: paletteName,
104
+ template: templateName,
105
+ ...options
106
+ } = themeDefinition;
107
+ if (!this.state.palettes) {
108
+ throw new Error(
109
+ `No palettes defined for theme with palette expected: ${themeName}`
110
+ );
111
+ }
112
+ let palette = this.state.palettes[paletteName];
113
+ if (!palette) {
114
+ const fullPaletteName = `${parentName}_${paletteName}`;
115
+ palette = this.state.palettes[fullPaletteName];
116
+ }
117
+ if (!palette) {
118
+ throw new Error(`No palette for theme ${themeName}: ${paletteName}`);
119
+ }
120
+ const template = (_a = this.state.templates) == null ? void 0 : _a[templateName];
121
+ if (!template) {
122
+ throw new Error(`No template for theme ${themeName}: ${templateName}`);
123
+ }
124
+ out[themeName] = createTheme(palette, template, options, themeName);
125
+ }
126
+ }
127
+ for (const { mask, themeName, parentName } of maskedThemes) {
128
+ const parent = out[parentName];
129
+ if (!parent) {
130
+ throw new Error(
131
+ `No parent theme found with name ${parentName} for theme ${themeName} to use as a mask target`
132
+ );
133
+ }
134
+ const { mask: maskName, ...options } = mask;
135
+ const maskFunction = (_b = this.state.masks) == null ? void 0 : _b[maskName];
136
+ if (!maskFunction) {
137
+ throw new Error(`No mask ${maskFunction}`);
138
+ }
139
+ out[themeName] = applyMask(
140
+ parent,
141
+ maskFunction,
142
+ options,
143
+ parentName,
144
+ themeName
145
+ );
146
+ }
147
+ return out;
148
+ }
149
+ }
150
+ function createThemeBuilder() {
151
+ return new ThemeBuilder({});
152
+ }
153
+ export {
154
+ ThemeBuilder,
155
+ createThemeBuilder
156
+ };
157
+ //# sourceMappingURL=ThemeBuilder.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ThemeBuilder.ts"],
4
+ "mappings": "AAAA;AAAA,EAME;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA0DA,MAAM,aAA8C;AAAA,EACzD,YAAmB,OAAc;AAAd;AAAA,EAAe;AAAA,EAElC,YAAgD,UAAa;AAC3D,SAAK,MAAM,WAAW;AAAA;AAAA,MAEpB,GAAI,KAAK,MAAM;AAAA,MACf,GAAG;AAAA,IACL;AACA,WAAO;AAAA,EAKT;AAAA,EAEA,aAAkD,WAAc;AAC9D,SAAK,M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,UAAU;AACb,gBAAM,IAAI,MAAM,yBAAyB,cAAc,cAAc;AAAA,QACvE;AAEA,YAAI,SAAS,IAAI,YAAY,SAAS,UAAU,SAAS,SAAS;AAAA,MACpE;AAAA,IACF;AAEA,eAAW,EAAE,MAAM,WAAW,WAAW,KAAK,cAAc;AAC1D,YAAM,SAAS,IAAI,UAAU;AAE7B,UAAI,CAAC,QAAQ;AACX,cAAM,IAAI;AAAA,UACR,mCAAmC,wBAAwB;AAAA,QAC7D;AAAA,MACF;AAEA,YAAM,EAAE,MAAM,UAAU,GAAG,QAAQ,IAAI;AACvC,YAAM,gBAAe,UAAK,MAAM,UAAX,mBAAmB;AAExC,UAAI,CAAC,cAAc;AACjB,cAAM,IAAI,MAAM,WAAW,cAAc;AAAA,MAC3C;AAEA,UAAI,SAAS,IAAI;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,SAAS,qBAAqB;AACnC,SAAO,IAAI,aAAa,CAAC,CAAC;AAC5B;",
5
+ "names": []
6
+ }
package/dist/esm/index.js CHANGED
@@ -1,3 +1,2 @@
1
- export * from "@tamagui/create-theme";
2
- export * from "@tamagui/create-theme/theme-builder";
1
+ export * from "./ThemeBuilder";
3
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,cAAc;AACd,cAAc;",
4
+ "mappings": "AAAA,cAAc;",
5
5
  "names": []
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/theme-builder",
3
- "version": "1.45.10",
3
+ "version": "1.45.11",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -27,10 +27,10 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@tamagui/create-theme": "1.45.10"
30
+ "@tamagui/create-theme": "1.45.11"
31
31
  },
32
32
  "devDependencies": {
33
- "@tamagui/build": "1.45.10"
33
+ "@tamagui/build": "1.45.11"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -0,0 +1,328 @@
1
+ import {
2
+ MaskDefinitions,
3
+ PaletteDefinitions,
4
+ TemplateDefinitions,
5
+ ThemeDefinitions,
6
+ ThemeUsingMask,
7
+ applyMask,
8
+ createMask,
9
+ createTheme,
10
+ objectEntries,
11
+ objectFromEntries,
12
+ objectKeys,
13
+ } from '@tamagui/create-theme'
14
+ import type { Narrow } from '@tamagui/web'
15
+
16
+ type ThemeBuilderState = {
17
+ palettes?: PaletteDefinitions
18
+ templates?: TemplateDefinitions
19
+ themes?: ThemeDefinitions
20
+ masks?: MaskDefinitions
21
+ }
22
+
23
+ type ObjectStringKeys<A extends Object | undefined> = A extends Object
24
+ ? Exclude<keyof A, symbol | number>
25
+ : never
26
+
27
+ type GetGeneratedThemeFromTemplate<Template> = {
28
+ [key in keyof Template]: string
29
+ }
30
+
31
+ type GetParentTheme<P, Themes extends ThemeDefinitions | undefined> = P extends string
32
+ ? P extends keyof Themes
33
+ ? Themes[P]
34
+ : GetParentName<P> extends keyof Themes
35
+ ? Themes[GetParentName<P>]
36
+ : GetParentName<GetParentName<P>> extends keyof Themes
37
+ ? Themes[GetParentName<GetParentName<P>>]
38
+ : GetParentName<GetParentName<GetParentName<P>>> extends keyof Themes
39
+ ? Themes[GetParentName<GetParentName<GetParentName<P>>>]
40
+ : never
41
+ : never
42
+
43
+ type GetGeneratedTheme<TD extends any, S extends ThemeBuilderState> = TD extends {
44
+ theme: infer T
45
+ }
46
+ ? T
47
+ : TD extends { parent: infer P }
48
+ ? // ? GetGeneratedThemeFromTemplate<GetParentTheme<P, S['templates']>>
49
+ GetGeneratedTheme<GetParentTheme<P, S['themes']>, S>
50
+ : TD extends { template: infer T }
51
+ ? T extends keyof S['templates']
52
+ ? GetGeneratedThemeFromTemplate<S['templates'][T]>
53
+ : TD
54
+ : TD
55
+
56
+ type ThemeBuilderBuildResult<S extends ThemeBuilderState> = {
57
+ [Key in keyof S['themes']]: GetGeneratedTheme<S['themes'][Key], S>
58
+ }
59
+
60
+ type GetParentName<N extends string> =
61
+ N extends `${infer A}_${infer B}_${infer C}_${infer D}_${string}`
62
+ ? `${A}_${B}_${C}_${D}`
63
+ : N extends `${infer A}_${infer B}_${infer C}_${string}`
64
+ ? `${A}_${B}_${C}`
65
+ : N extends `${infer A}_${infer B}_${string}`
66
+ ? `${A}_${B}`
67
+ : N extends `${infer A}_${string}`
68
+ ? `${A}`
69
+ : never
70
+
71
+ export class ThemeBuilder<State extends ThemeBuilderState> {
72
+ constructor(public state: State) {}
73
+
74
+ addPalettes<const P extends PaletteDefinitions>(palettes: P) {
75
+ this.state.palettes = {
76
+ // as {} prevents generic string key merge messing up types
77
+ ...(this.state.palettes as {}),
78
+ ...palettes,
79
+ }
80
+ return this as any as ThemeBuilder<
81
+ State & {
82
+ palettes: P
83
+ }
84
+ >
85
+ }
86
+
87
+ addTemplates<const T extends TemplateDefinitions>(templates: T) {
88
+ this.state.templates = {
89
+ // as {} prevents generic string key merge messing up types
90
+ ...(this.state.templates as {}),
91
+ ...templates,
92
+ }
93
+ return this as any as ThemeBuilder<
94
+ State & {
95
+ templates: T
96
+ }
97
+ >
98
+ }
99
+
100
+ addMasks<const M extends MaskDefinitions>(masks: M) {
101
+ this.state.masks = {
102
+ // as {} prevents generic string key merge messing up types
103
+ ...(this.state.masks as {}),
104
+ ...(objectFromEntries(
105
+ objectEntries(masks).map(([key, val]) => [key, createMask(val)])
106
+ ) as M),
107
+ }
108
+ return this as any as ThemeBuilder<
109
+ State & {
110
+ masks: M
111
+ }
112
+ >
113
+ }
114
+
115
+ addThemes<const T extends ThemeDefinitions<ObjectStringKeys<State['masks']>>>(
116
+ themes: T
117
+ ) {
118
+ this.state.themes = {
119
+ // as {} prevents generic string key merge messing up types
120
+ ...(this.state.themes as {}),
121
+ ...themes,
122
+ }
123
+ return this as any as ThemeBuilder<
124
+ State & {
125
+ themes: T
126
+ }
127
+ >
128
+ }
129
+
130
+ addChildThemes<
131
+ CTD extends Narrow<ThemeDefinitions<ObjectStringKeys<State['masks']>>>,
132
+ const AvoidNestingWithin extends string[] = []
133
+ >(
134
+ childThemeDefinition: CTD,
135
+ options?: {
136
+ avoidNestingWithin?: AvoidNestingWithin
137
+ }
138
+ ) {
139
+ const currentThemes = this.state.themes as State['themes']
140
+ if (!currentThemes) {
141
+ throw new Error(
142
+ `No themes defined yet, use addThemes first to set your base themes`
143
+ )
144
+ }
145
+
146
+ // AvoidNestingWithin[number] exclude isn't working here...
147
+ type CurrentNames = Exclude<keyof typeof currentThemes, symbol | number>
148
+ type ChildNames = Exclude<keyof CTD, symbol | number>
149
+
150
+ const currentThemeNames = objectKeys(currentThemes) as CurrentNames[]
151
+ const incomingThemeNames = objectKeys(childThemeDefinition) as ChildNames[]
152
+
153
+ const namesWithDefinitions = currentThemeNames.flatMap((prefix) => {
154
+ if (options?.avoidNestingWithin) {
155
+ if (
156
+ options.avoidNestingWithin.some(
157
+ (avoidName) => prefix.startsWith(avoidName) || prefix.endsWith(avoidName)
158
+ )
159
+ ) {
160
+ return []
161
+ }
162
+ }
163
+
164
+ return incomingThemeNames.map((subName) => {
165
+ const fullName = `${prefix}_${subName}`
166
+ const definition = childThemeDefinition[subName]
167
+ return [fullName, definition] as const
168
+ })
169
+ })
170
+
171
+ type ChildThemes = {
172
+ [key in `${CurrentNames}_${ChildNames}`]: CTD & {
173
+ parent: GetParentName<key>
174
+ }
175
+ }
176
+
177
+ const childThemes = objectFromEntries(namesWithDefinitions) as ChildThemes
178
+
179
+ const next = {
180
+ // as {} prevents generic string key merge messing up types
181
+ ...(this.state.themes as {}),
182
+ ...childThemes,
183
+ }
184
+
185
+ // @ts-ignore
186
+ this.state.themes = next
187
+
188
+ return this as any as ThemeBuilder<
189
+ State & {
190
+ themes: ChildThemes
191
+ }
192
+ >
193
+ }
194
+
195
+ build(): ThemeBuilderBuildResult<State> {
196
+ if (!this.state.themes) {
197
+ return {} as any
198
+ }
199
+
200
+ const out = {}
201
+ const maskedThemes: {
202
+ parentName: string
203
+ themeName: string
204
+ mask: ThemeUsingMask
205
+ }[] = []
206
+
207
+ for (const themeName in this.state.themes) {
208
+ const nameParts = themeName.split('_')
209
+ const parentName = nameParts.slice(0, nameParts.length - 1).join('_')
210
+
211
+ const definitions = this.state.themes[themeName]
212
+ const themeDefinition = Array.isArray(definitions)
213
+ ? (() => {
214
+ const found = definitions.find((d) => parentName.startsWith(d.parent!))
215
+ if (!found) {
216
+ throw new Error(`No parent for ${themeName}: ${parentName}`)
217
+ }
218
+ return found
219
+ })()
220
+ : definitions
221
+
222
+ if ('theme' in themeDefinition) {
223
+ out[themeName] = themeDefinition.theme
224
+ } else if ('mask' in themeDefinition) {
225
+ maskedThemes.push({ parentName, themeName, mask: themeDefinition })
226
+ } else {
227
+ const {
228
+ palette: paletteName,
229
+ template: templateName,
230
+ ...options
231
+ } = themeDefinition
232
+
233
+ if (!this.state.palettes) {
234
+ throw new Error(
235
+ `No palettes defined for theme with palette expected: ${themeName}`
236
+ )
237
+ }
238
+
239
+ let palette = this.state.palettes[paletteName]
240
+
241
+ if (!palette) {
242
+ const fullPaletteName = `${parentName}_${paletteName}`
243
+ palette = this.state.palettes[fullPaletteName]
244
+ // try using the prefix
245
+ }
246
+
247
+ if (!palette) {
248
+ throw new Error(`No palette for theme ${themeName}: ${paletteName}`)
249
+ }
250
+
251
+ const template = this.state.templates?.[templateName]
252
+ if (!template) {
253
+ throw new Error(`No template for theme ${themeName}: ${templateName}`)
254
+ }
255
+
256
+ out[themeName] = createTheme(palette, template, options, themeName)
257
+ }
258
+ }
259
+
260
+ for (const { mask, themeName, parentName } of maskedThemes) {
261
+ const parent = out[parentName]
262
+
263
+ if (!parent) {
264
+ throw new Error(
265
+ `No parent theme found with name ${parentName} for theme ${themeName} to use as a mask target`
266
+ )
267
+ }
268
+
269
+ const { mask: maskName, ...options } = mask
270
+ const maskFunction = this.state.masks?.[maskName]
271
+
272
+ if (!maskFunction) {
273
+ throw new Error(`No mask ${maskFunction}`)
274
+ }
275
+
276
+ out[themeName] = applyMask(
277
+ parent,
278
+ maskFunction as any,
279
+ options,
280
+ parentName,
281
+ themeName
282
+ )
283
+ }
284
+
285
+ return out as any
286
+ }
287
+ }
288
+
289
+ export function createThemeBuilder() {
290
+ return new ThemeBuilder({})
291
+ }
292
+
293
+ // // test types
294
+ // let x = createThemeBuilder()
295
+ // .addMasks({
296
+ // test: {
297
+ // name: 'mask',
298
+ // mask: (() => {}) as any,
299
+ // },
300
+ // })
301
+ // .addThemes({
302
+ // light: {
303
+ // template: '',
304
+ // palette: '',
305
+ // },
306
+ // dark: {
307
+ // mask: 'test',
308
+ // },
309
+ // })
310
+ // .addChildThemes({
311
+ // List: [
312
+ // {
313
+ // parent: '',
314
+ // mask: 'test',
315
+ // },
316
+ // ],
317
+ // })
318
+
319
+ // x
320
+
321
+ // x.state.themes
322
+ // x.state.masks
323
+
324
+ // let y = x.addChildThemes({
325
+ // blue: {
326
+ // mask: 'ok',
327
+ // },
328
+ // })
package/src/index.ts CHANGED
@@ -1,2 +1 @@
1
- export * from '@tamagui/create-theme'
2
- export * from '@tamagui/create-theme/theme-builder'
1
+ export * from './ThemeBuilder'
@@ -0,0 +1,51 @@
1
+ import { MaskDefinitions, PaletteDefinitions, TemplateDefinitions, ThemeDefinitions } from '@tamagui/create-theme';
2
+ import type { Narrow } from '@tamagui/web';
3
+ type ThemeBuilderState = {
4
+ palettes?: PaletteDefinitions;
5
+ templates?: TemplateDefinitions;
6
+ themes?: ThemeDefinitions;
7
+ masks?: MaskDefinitions;
8
+ };
9
+ type ObjectStringKeys<A extends Object | undefined> = A extends Object ? Exclude<keyof A, symbol | number> : never;
10
+ type GetGeneratedThemeFromTemplate<Template> = {
11
+ [key in keyof Template]: string;
12
+ };
13
+ type GetParentTheme<P, Themes extends ThemeDefinitions | undefined> = P extends string ? P extends keyof Themes ? Themes[P] : GetParentName<P> extends keyof Themes ? Themes[GetParentName<P>] : GetParentName<GetParentName<P>> extends keyof Themes ? Themes[GetParentName<GetParentName<P>>] : GetParentName<GetParentName<GetParentName<P>>> extends keyof Themes ? Themes[GetParentName<GetParentName<GetParentName<P>>>] : never : never;
14
+ type GetGeneratedTheme<TD extends any, S extends ThemeBuilderState> = TD extends {
15
+ theme: infer T;
16
+ } ? T : TD extends {
17
+ parent: infer P;
18
+ } ? GetGeneratedTheme<GetParentTheme<P, S['themes']>, S> : TD extends {
19
+ template: infer T;
20
+ } ? T extends keyof S['templates'] ? GetGeneratedThemeFromTemplate<S['templates'][T]> : TD : TD;
21
+ type ThemeBuilderBuildResult<S extends ThemeBuilderState> = {
22
+ [Key in keyof S['themes']]: GetGeneratedTheme<S['themes'][Key], S>;
23
+ };
24
+ type GetParentName<N extends string> = N extends `${infer A}_${infer B}_${infer C}_${infer D}_${string}` ? `${A}_${B}_${C}_${D}` : N extends `${infer A}_${infer B}_${infer C}_${string}` ? `${A}_${B}_${C}` : N extends `${infer A}_${infer B}_${string}` ? `${A}_${B}` : N extends `${infer A}_${string}` ? `${A}` : never;
25
+ export declare class ThemeBuilder<State extends ThemeBuilderState> {
26
+ state: State;
27
+ constructor(state: State);
28
+ addPalettes<const P extends PaletteDefinitions>(palettes: P): ThemeBuilder<State & {
29
+ palettes: P;
30
+ }>;
31
+ addTemplates<const T extends TemplateDefinitions>(templates: T): ThemeBuilder<State & {
32
+ templates: T;
33
+ }>;
34
+ addMasks<const M extends MaskDefinitions>(masks: M): ThemeBuilder<State & {
35
+ masks: M;
36
+ }>;
37
+ addThemes<const T extends ThemeDefinitions<ObjectStringKeys<State['masks']>>>(themes: T): ThemeBuilder<State & {
38
+ themes: T;
39
+ }>;
40
+ addChildThemes<CTD extends Narrow<ThemeDefinitions<ObjectStringKeys<State['masks']>>>, const AvoidNestingWithin extends string[] = []>(childThemeDefinition: CTD, options?: {
41
+ avoidNestingWithin?: AvoidNestingWithin;
42
+ }): ThemeBuilder<State & {
43
+ themes: { [key in `${Exclude<keyof NonNullable<State["themes"]>, number | symbol>}_${Exclude<keyof CTD, number | symbol>}`]: CTD & {
44
+ parent: GetParentName<key>;
45
+ }; };
46
+ }>;
47
+ build(): ThemeBuilderBuildResult<State>;
48
+ }
49
+ export declare function createThemeBuilder(): ThemeBuilder<{}>;
50
+ export {};
51
+ //# sourceMappingURL=ThemeBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeBuilder.d.ts","sourceRoot":"","sources":["../src/ThemeBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAQjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,KAAK,iBAAiB,GAAG;IACvB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,KAAK,CAAC,EAAE,eAAe,CAAA;CACxB,CAAA;AAED,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,IAAI,CAAC,SAAS,MAAM,GAClE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,GACjC,KAAK,CAAA;AAET,KAAK,6BAA6B,CAAC,QAAQ,IAAI;KAC5C,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM;CAChC,CAAA;AAED,KAAK,cAAc,CAAC,CAAC,EAAE,MAAM,SAAS,gBAAgB,GAAG,SAAS,IAAI,CAAC,SAAS,MAAM,GAClF,CAAC,SAAS,MAAM,MAAM,GACpB,MAAM,CAAC,CAAC,CAAC,GACT,aAAa,CAAC,CAAC,CAAC,SAAS,MAAM,MAAM,GACrC,MAAM,CAAC,aAAa,CAAC,CAAC,CA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"}
package/types/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from '@tamagui/create-theme';
2
- export * from '@tamagui/create-theme/theme-builder';
1
+ export * from './ThemeBuilder';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,qCAAqC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}