@tamagui/tamagui-dev-config 3.0.0-beta.924.1 → 3.0.1

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.
@@ -23,66 +23,45 @@ __export(fonts_exports, {
23
23
  bodyFont: () => bodyFont,
24
24
  cherryBombFont: () => cherryBombFont,
25
25
  headingFont: () => headingFont,
26
- monoFont: () => monoFont,
27
- silkscreenFont: () => silkscreenFont
26
+ monoFont: () => monoFont
28
27
  });
29
28
  module.exports = __toCommonJS(fonts_exports);
30
29
  var import_font_cherry_bomb = require("@tamagui/font-cherry-bomb");
31
- var import_font_inter = require("@tamagui/font-inter");
32
- var import_font_silkscreen = require("@tamagui/font-silkscreen");
30
+ var import_core = require("@tamagui/core");
33
31
  var import_createGenericFont = require("./createGenericFont.cjs");
32
+ const contrastFamily = "\"Contrast\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
33
+ const monoFamily = "\"JetBrains Mono\", ui-monospace, \"SFMono-Regular\", \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace";
34
34
  const cherryBombFont = (0, import_font_cherry_bomb.createCherryBombFont)({
35
- family: "\"Cherry Bomb\", \"Inter\", \"Arial Black\", \"Helvetica Neue\", Helvetica, Arial, sans-serif",
35
+ family: `"Cherry Bomb", "Arial Black", "Helvetica Neue", Helvetica, Arial, sans-serif`,
36
36
  weight: { 4: "800" },
37
37
  size: { true: 22.4 }
38
38
  });
39
- const silkscreenFont = (0, import_font_silkscreen.createSilkscreenFont)();
40
- const headingFont = (0, import_font_inter.createInterFont)({
41
- size: {
42
- true: 14,
43
- 5: 13,
44
- 6: 15,
45
- 9: 30,
46
- 10: 44
47
- },
48
- transform: {
49
- 6: "uppercase",
50
- 7: "none"
51
- },
52
- weight: {
53
- 6: "400",
54
- 7: "700"
55
- },
56
- color: {
57
- 6: "color-focus",
58
- 7: "color"
59
- },
60
- letterSpacing: {
61
- 5: 2,
62
- 6: 1,
63
- 7: 0,
64
- 8: 0,
65
- 9: -.1,
66
- 10: -.25,
67
- 11: -.5,
68
- 12: -.75,
69
- 14: -1,
70
- 15: -2
71
- },
72
- face: {
73
- 700: { normal: "InterBold" },
74
- 800: { normal: "InterBold" },
75
- 900: { normal: "InterBold" }
39
+ const sizes = () => {
40
+ const out = { true: 14 };
41
+ let px = 11;
42
+ for (let i = 1; i <= 16; i++) {
43
+ out[i] = Math.round(px);
44
+ px *= Math.min(1.19, 1.05 + i * .019);
76
45
  }
77
- }, { sizeLineHeight: (size) => Math.round(size * 1.1 + (size < 30 ? 10 : 5)) });
78
- const bodyFont = (0, import_font_inter.createInterFont)({
79
- size: { true: 14 },
80
- weight: { 1: "400" }
81
- }, {
82
- sizeSize: (size) => Math.round(size),
83
- sizeLineHeight: (size) => Math.round(size * 1.2 + (size >= 20 ? 12 : 8))
46
+ return out;
47
+ };
48
+ const size = sizes();
49
+ const lineHeights = (ratio, extra) => Object.fromEntries(Object.entries(size).map(([k, v]) => [k, Math.round(v * ratio + extra)]));
50
+ const headingFont = (0, import_core.createFont)({
51
+ family: contrastFamily,
52
+ size,
53
+ lineHeight: lineHeights(1.25, 2),
54
+ weight: { 1: "600" },
55
+ letterSpacing: { 1: 0 }
56
+ });
57
+ const bodyFont = (0, import_core.createFont)({
58
+ family: contrastFamily,
59
+ size,
60
+ lineHeight: lineHeights(1.35, 3),
61
+ weight: { 1: "400" },
62
+ letterSpacing: { 1: 0 }
84
63
  });
85
- const monoFont = (0, import_createGenericFont.createGenericFont)(`"Berkeley Mono", "ui-monospace", "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`, {
64
+ const monoFont = (0, import_createGenericFont.createGenericFont)(monoFamily, {
86
65
  weight: { 1: "400" },
87
66
  size: {
88
67
  1: 11,
@@ -16,4 +16,3 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var index_exports = {};
17
17
  module.exports = __toCommonJS(index_exports);
18
18
  __reExport(index_exports, require("./tamagui.dev.config.cjs"), module.exports);
19
- __reExport(index_exports, require("./media.cjs"), module.exports);
@@ -26,34 +26,31 @@ __export(tamagui_dev_config_exports, {
26
26
  module.exports = __toCommonJS(tamagui_dev_config_exports);
27
27
  var import_animations_css = require("@tamagui/config/animations-css");
28
28
  var import_animations_motion = require("@tamagui/config/animations-motion");
29
- var import_v5_subtle = require("@tamagui/config/v5-subtle");
29
+ var import_v6_base = require("@tamagui/config/v6-base");
30
30
  var import_core = require("@tamagui/core");
31
31
  var import_fonts = require("./fonts.cjs");
32
- var import_media = require("./media.cjs");
33
32
  var import_themeMetadata = require("./themeMetadata.cjs");
34
33
  var import_themes = require("./themes.cjs");
35
34
  (0, import_core.setupDev)({ visualizer: true });
36
- const fonts = {
37
- heading: import_fonts.headingFont,
38
- body: import_fonts.bodyFont,
39
- mono: import_fonts.monoFont,
40
- silkscreen: import_fonts.silkscreenFont,
41
- cherryBomb: import_fonts.cherryBombFont
42
- };
43
35
  const animations = {
44
36
  default: import_animations_motion.animationsMotion,
45
37
  css: import_animations_css.animationsCSS
46
38
  };
47
39
  const configuredThemes = process.env.VITE_ENVIRONMENT === "client" ? import_themeMetadata.clientThemes : import_themes.themes;
40
+ const v6 = (0, import_v6_base.createV6Config)({ themes: configuredThemes });
48
41
  const config = {
49
- ...import_v5_subtle.defaultConfig,
50
- themes: configuredThemes,
51
- fonts,
42
+ ...v6,
43
+ fonts: {
44
+ heading: (0, import_v6_base.withTailwindTypeScale)(import_fonts.headingFont),
45
+ body: (0, import_v6_base.withTailwindTypeScale)(import_fonts.bodyFont),
46
+ mono: import_fonts.monoFont,
47
+ cherryBomb: import_fonts.cherryBombFont
48
+ },
52
49
  animations,
53
- media: import_media.media,
50
+ media: { ...v6.media },
54
51
  settings: {
55
- ...import_v5_subtle.defaultConfig.settings,
56
- mediaQueryDefaultActive: import_media.mediaQueryDefaultActive,
52
+ ...v6.settings,
53
+ mediaQueryDefaultActive: import_v6_base.mediaQueryDefaultActive,
57
54
  allowedStyleValues: "somewhat-strict-web",
58
55
  onlyAllowShorthands: false
59
56
  }
@@ -28,8 +28,6 @@ __export(themeMetadata_exports, {
28
28
  module.exports = __toCommonJS(themeMetadata_exports);
29
29
  const schemes = ["light", "dark"];
30
30
  const colors = [
31
- "black",
32
- "white",
33
31
  "gray",
34
32
  "blue",
35
33
  "red",
@@ -61,10 +59,11 @@ const componentThemes = [
61
59
  "Tooltip",
62
60
  "SwitchThumb"
63
61
  ];
64
- const numbered = (prefix, count) => Array.from({ length: count }, (_, index) => `${prefix}${index + 1}`);
62
+ const numbered = (prefix, count) => Array.from({ length: count }, (_, index) => `${prefix}-${index + 1}`);
65
63
  const baseThemeNames = schemes.flatMap((scheme) => [
66
64
  scheme,
67
65
  `${scheme}_accent`,
66
+ `${scheme}_brand`,
68
67
  `${scheme}_surface1`,
69
68
  `${scheme}_surface2`,
70
69
  ...colors.flatMap((color) => [
@@ -74,7 +73,7 @@ const baseThemeNames = schemes.flatMap((scheme) => [
74
73
  `${scheme}_${color}_surface2`
75
74
  ])
76
75
  ]);
77
- const levelThemeNames = baseThemeNames.flatMap((themeName) => themeName.endsWith("_surface1") ? [themeName.replace(/_surface1$/, "_level2")] : themeName.endsWith("_surface2") ? [themeName.replace(/_surface2$/, "_level3")] : themeName.endsWith("_accent") ? [`${themeName}_level2`, `${themeName}_level3`] : []);
76
+ const levelThemeNames = baseThemeNames.flatMap((themeName) => themeName.endsWith("_surface1") ? [themeName.replace(/_surface1$/, "_level2")] : themeName.endsWith("_surface2") ? [themeName.replace(/_surface2$/, "_level3")] : themeName.endsWith("_accent") || themeName.endsWith("_brand") ? [`${themeName}_level2`, `${themeName}_level3`] : []);
78
77
  const componentThemeNames = [...baseThemeNames, ...levelThemeNames].flatMap((parent) => componentThemes.map((component) => `${parent}_${component}`));
79
78
  const themeNames = [
80
79
  ...baseThemeNames,
@@ -102,7 +101,7 @@ const themeVariableNames = [
102
101
  "background-focus",
103
102
  "background-hover",
104
103
  "background-press",
105
- ...alphaSteps.map((step) => `background${step}`),
104
+ ...alphaSteps.map((step) => `background-${step}`),
106
105
  "border-color",
107
106
  "border-color-focus",
108
107
  "border-color-hover",
@@ -112,18 +111,18 @@ const themeVariableNames = [
112
111
  "color-hover",
113
112
  "color-press",
114
113
  "color-transparent",
115
- ...alphaSteps.map((step) => `color${step}`),
114
+ ...alphaSteps.map((step) => `color-${step}`),
116
115
  ...numbered("color", 12),
117
116
  "outline-color",
118
117
  "placeholder-color",
119
118
  "shadow-color",
120
119
  ...["black", "white"].flatMap((color) => [
121
120
  color,
122
- `${color}0`,
123
- `${color}02`,
124
- `${color}04`,
125
- `${color}06`,
126
- `${color}08`,
121
+ `${color}-0`,
122
+ `${color}-02`,
123
+ `${color}-04`,
124
+ `${color}-06`,
125
+ `${color}-08`,
127
126
  ...numbered(color, 12)
128
127
  ]),
129
128
  ...paletteColors.flatMap((color) => numbered(color, 12)),
@@ -36,6 +36,12 @@ for (const [themeName, theme] of Object.entries(selectedThemes)) {
36
36
  selectedThemes[`${themeName}_level3`] = theme;
37
37
  }
38
38
  }
39
+ for (const scheme of ["light", "dark"]) {
40
+ const inverse = selectedThemes[scheme === "light" ? "dark" : "light"];
41
+ selectedThemes[`${scheme}_brand`] = inverse;
42
+ selectedThemes[`${scheme}_brand_level2`] = inverse;
43
+ selectedThemes[`${scheme}_brand_level3`] = inverse;
44
+ }
39
45
  for (const themeName of import_themeMetadata.themeNames) {
40
46
  const component = import_themeMetadata.componentThemes.find((name) => themeName.endsWith(`_${name}`));
41
47
  if (!component || selectedThemes[themeName]) continue;
@@ -44,4 +50,30 @@ for (const themeName of import_themeMetadata.themeNames) {
44
50
  selectedThemes[themeName] = selectedThemes[parentName];
45
51
  }
46
52
  }
47
- const themes = (0, import_v6_base.toV6Themes)(selectedThemes);
53
+ const MAX_LIGHT_BORDER_GAP = 8;
54
+ const hsla = /^hsla\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*,\s*([\d.]+)\s*\)$/;
55
+ const softenLightBorder = (theme) => {
56
+ const background = hsla.exec(theme.background);
57
+ const border = hsla.exec(theme["border-color"]);
58
+ if (!background || !border) return theme;
59
+ const backgroundLightness = Number(background[3]);
60
+ const borderLightness = Number(border[3]);
61
+ if (backgroundLightness <= 50) return theme;
62
+ const gap = backgroundLightness - borderLightness;
63
+ if (gap <= MAX_LIGHT_BORDER_GAP) return theme;
64
+ const lightness = backgroundLightness - MAX_LIGHT_BORDER_GAP;
65
+ return {
66
+ ...theme,
67
+ "border-color": `hsla(${border[1]}, ${border[2]}%, ${lightness}%, ${border[4]})`
68
+ };
69
+ };
70
+ const v6Themes = (0, import_v6_base.toV6Themes)(selectedThemes);
71
+ const edited = /* @__PURE__ */ new Map();
72
+ const themes = Object.fromEntries(Object.entries(v6Themes).map(([themeName, theme]) => {
73
+ let next = edited.get(theme);
74
+ if (!next) {
75
+ next = softenLightBorder(theme);
76
+ edited.set(theme, next);
77
+ }
78
+ return [themeName, next];
79
+ }));
@@ -1,60 +1,40 @@
1
1
  import { createCherryBombFont } from "@tamagui/font-cherry-bomb";
2
- import { createInterFont } from "@tamagui/font-inter";
3
- import { createSilkscreenFont } from "@tamagui/font-silkscreen";
2
+ import { createFont } from "@tamagui/core";
4
3
  import { createGenericFont } from "./createGenericFont.mjs";
5
4
 
5
+ const contrastFamily = "\"Contrast\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
6
+ const monoFamily = "\"JetBrains Mono\", ui-monospace, \"SFMono-Regular\", \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace";
6
7
  const cherryBombFont = createCherryBombFont({
7
- family: "\"Cherry Bomb\", \"Inter\", \"Arial Black\", \"Helvetica Neue\", Helvetica, Arial, sans-serif",
8
+ family: `"Cherry Bomb", "Arial Black", "Helvetica Neue", Helvetica, Arial, sans-serif`,
8
9
  weight: { 4: "800" },
9
10
  size: { true: 22.4 }
10
11
  });
11
- const silkscreenFont = createSilkscreenFont();
12
- const headingFont = createInterFont({
13
- size: {
14
- true: 14,
15
- 5: 13,
16
- 6: 15,
17
- 9: 30,
18
- 10: 44
19
- },
20
- transform: {
21
- 6: "uppercase",
22
- 7: "none"
23
- },
24
- weight: {
25
- 6: "400",
26
- 7: "700"
27
- },
28
- color: {
29
- 6: "color-focus",
30
- 7: "color"
31
- },
32
- letterSpacing: {
33
- 5: 2,
34
- 6: 1,
35
- 7: 0,
36
- 8: 0,
37
- 9: -.1,
38
- 10: -.25,
39
- 11: -.5,
40
- 12: -.75,
41
- 14: -1,
42
- 15: -2
43
- },
44
- face: {
45
- 700: { normal: "InterBold" },
46
- 800: { normal: "InterBold" },
47
- 900: { normal: "InterBold" }
12
+ const sizes = () => {
13
+ const out = { true: 14 };
14
+ let px = 11;
15
+ for (let i = 1; i <= 16; i++) {
16
+ out[i] = Math.round(px);
17
+ px *= Math.min(1.19, 1.05 + i * .019);
48
18
  }
49
- }, { sizeLineHeight: (size) => Math.round(size * 1.1 + (size < 30 ? 10 : 5)) });
50
- const bodyFont = createInterFont({
51
- size: { true: 14 },
52
- weight: { 1: "400" }
53
- }, {
54
- sizeSize: (size) => Math.round(size),
55
- sizeLineHeight: (size) => Math.round(size * 1.2 + (size >= 20 ? 12 : 8))
19
+ return out;
20
+ };
21
+ const size = sizes();
22
+ const lineHeights = (ratio, extra) => Object.fromEntries(Object.entries(size).map(([k, v]) => [k, Math.round(v * ratio + extra)]));
23
+ const headingFont = createFont({
24
+ family: contrastFamily,
25
+ size,
26
+ lineHeight: lineHeights(1.25, 2),
27
+ weight: { 1: "600" },
28
+ letterSpacing: { 1: 0 }
29
+ });
30
+ const bodyFont = createFont({
31
+ family: contrastFamily,
32
+ size,
33
+ lineHeight: lineHeights(1.35, 3),
34
+ weight: { 1: "400" },
35
+ letterSpacing: { 1: 0 }
56
36
  });
57
- const monoFont = createGenericFont(`"Berkeley Mono", "ui-monospace", "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`, {
37
+ const monoFont = createGenericFont(monoFamily, {
58
38
  weight: { 1: "400" },
59
39
  size: {
60
40
  1: 11,
@@ -76,5 +56,5 @@ const monoFont = createGenericFont(`"Berkeley Mono", "ui-monospace", "SFMono-Reg
76
56
  }
77
57
  }, { sizeLineHeight: (x) => x * 1.5 + 2 });
78
58
 
79
- export { bodyFont, cherryBombFont, headingFont, monoFont, silkscreenFont };
59
+ export { bodyFont, cherryBombFont, headingFont, monoFont };
80
60
  //# sourceMappingURL=fonts.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fonts.js","names":[],"sources":["esm/fonts.js"],"sourcesContent":["import { createCherryBombFont } from \"@tamagui/font-cherry-bomb\";\nimport { createInterFont } from \"@tamagui/font-inter\";\nimport { createSilkscreenFont } from \"@tamagui/font-silkscreen\";\nimport { createGenericFont } from \"./createGenericFont\";\nconst cherryBombFont = createCherryBombFont({\n // Cherry Bomb is a heavy rounded display face; fall back to on-brand Inter,\n // then heavy web-safe faces, so the brief pre-load flash looks close to the\n // real thing instead of thin default Arial.\n family: '\"Cherry Bomb\", \"Inter\", \"Arial Black\", \"Helvetica Neue\", Helvetica, Arial, sans-serif',\n // Cherry Bomb only ships weight 400 (so this doesn't change its look), but a\n // heavy weight makes the Inter fallback render at ExtraBold (already preloaded)\n // instead of thin, much closer to Cherry Bomb during the load flash.\n weight: {\n 4: \"800\"\n },\n size: {\n true: 22.4\n }\n});\nconst silkscreenFont = createSilkscreenFont();\nconst headingFont = createInterFont(\n {\n size: {\n true: 14,\n 5: 13,\n 6: 15,\n 9: 30,\n 10: 44\n },\n transform: {\n 6: \"uppercase\",\n 7: \"none\"\n },\n weight: {\n 6: \"400\",\n 7: \"700\"\n },\n color: {\n 6: \"color-focus\",\n 7: \"color\"\n },\n letterSpacing: {\n 5: 2,\n 6: 1,\n 7: 0,\n 8: 0,\n 9: -0.1,\n 10: -0.25,\n 11: -0.5,\n 12: -0.75,\n 14: -1,\n 15: -2\n },\n // for native\n face: {\n 700: { normal: \"InterBold\" },\n 800: { normal: \"InterBold\" },\n 900: { normal: \"InterBold\" }\n }\n },\n { sizeLineHeight: (size) => Math.round(size * 1.1 + (size < 30 ? 10 : 5)) }\n);\nconst bodyFont = createInterFont(\n {\n size: {\n true: 14\n },\n weight: {\n 1: \"400\"\n }\n },\n {\n sizeSize: (size) => Math.round(size),\n sizeLineHeight: (size) => Math.round(size * 1.2 + (size >= 20 ? 12 : 8))\n }\n);\nconst monoFont = createGenericFont(\n `\"Berkeley Mono\", \"ui-monospace\", \"SFMono-Regular\", \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace`,\n {\n weight: {\n 1: \"400\"\n },\n size: {\n 1: 11,\n 2: 12,\n 3: 13,\n 4: 14,\n 5: 16,\n 6: 18,\n 7: 20,\n 8: 22,\n 9: 24,\n 10: 32,\n 11: 46,\n 12: 62,\n 13: 72,\n 14: 92,\n 15: 114,\n 16: 124\n }\n },\n {\n sizeLineHeight: (x) => x * 1.5 + 2\n }\n);\nexport {\n bodyFont,\n cherryBombFont,\n headingFont,\n monoFont,\n silkscreenFont\n};\n//# sourceMappingURL=fonts.js.map\n"],"mappings":";;;;;;AAIA,MAAM,iBAAiB,qBAAqB;CAI1C,QAAQ;CAIR,QAAQ,EACN,GAAG,MACL;CACA,MAAM,EACJ,MAAM,KACR;AACF,CAAC;AACD,MAAM,iBAAiB,qBAAqB;AAC5C,MAAM,cAAc,gBAClB;CACE,MAAM;EACJ,MAAM;EACN,GAAG;EACH,GAAG;EACH,GAAG;EACH,IAAI;CACN;CACA,WAAW;EACT,GAAG;EACH,GAAG;CACL;CACA,QAAQ;EACN,GAAG;EACH,GAAG;CACL;CACA,OAAO;EACL,GAAG;EACH,GAAG;CACL;CACA,eAAe;EACb,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG,CAAC;EACJ,IAAI,CAAC;EACL,IAAI,CAAC;EACL,IAAI,CAAC;EACL,IAAI,CAAC;EACL,IAAI,CAAC;CACP;CAEA,MAAM;EACJ,KAAK,EAAE,QAAQ,YAAY;EAC3B,KAAK,EAAE,QAAQ,YAAY;EAC3B,KAAK,EAAE,QAAQ,YAAY;CAC7B;AACF,GACA,EAAE,iBAAiB,SAAS,KAAK,MAAM,OAAO,OAAO,OAAO,KAAK,KAAK,EAAE,EAAE,CAC5E;AACA,MAAM,WAAW,gBACf;CACE,MAAM,EACJ,MAAM,GACR;CACA,QAAQ,EACN,GAAG,MACL;AACF,GACA;CACE,WAAW,SAAS,KAAK,MAAM,IAAI;CACnC,iBAAiB,SAAS,KAAK,MAAM,OAAO,OAAO,QAAQ,KAAK,KAAK,EAAE;AACzE,CACF;AACA,MAAM,WAAW,kBACf,+GACA;CACE,QAAQ,EACN,GAAG,MACL;CACA,MAAM;EACJ,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACN;AACF,GACA,EACE,iBAAiB,MAAM,IAAI,MAAM,EACnC,CACF"}
1
+ {"version":3,"file":"fonts.js","names":[],"sources":["esm/fonts.js"],"sourcesContent":["import { createCherryBombFont } from \"@tamagui/font-cherry-bomb\";\nimport { createFont } from \"@tamagui/core\";\nimport { createGenericFont } from \"./createGenericFont\";\n\nconst contrastFamily = \"\\\"Contrast\\\", -apple-system, BlinkMacSystemFont, \\\"Segoe UI\\\", Roboto, \\\"Helvetica Neue\\\", Arial, sans-serif\";\nconst monoFamily = \"\\\"JetBrains Mono\\\", ui-monospace, \\\"SFMono-Regular\\\", \\\"SF Mono\\\", Menlo, Consolas, \\\"Liberation Mono\\\", monospace\";\nconst cherryBombFont = createCherryBombFont({\n\tfamily: `\"Cherry Bomb\", \"Arial Black\", \"Helvetica Neue\", Helvetica, Arial, sans-serif`,\n\tweight: { 4: \"800\" },\n\tsize: { true: 22.4 }\n});\nconst sizes = () => {\n\tconst out = { true: 14 };\n\tlet px = 11;\n\tfor (let i = 1; i <= 16; i++) {\n\t\tout[i] = Math.round(px);\n\t\tpx *= Math.min(1.19, 1.05 + i * .019);\n\t}\n\treturn out;\n};\nconst size = sizes();\nconst lineHeights = (ratio, extra) => Object.fromEntries(Object.entries(size).map(([k, v]) => [k, Math.round(v * ratio + extra)]));\nconst headingFont = createFont({\n\tfamily: contrastFamily,\n\tsize,\n\tlineHeight: lineHeights(1.25, 2),\n\tweight: { 1: \"600\" },\n\tletterSpacing: { 1: 0 }\n});\nconst bodyFont = createFont({\n\tfamily: contrastFamily,\n\tsize,\n\tlineHeight: lineHeights(1.35, 3),\n\tweight: { 1: \"400\" },\n\tletterSpacing: { 1: 0 }\n});\nconst monoFont = createGenericFont(monoFamily, {\n\tweight: { 1: \"400\" },\n\tsize: {\n\t\t1: 11,\n\t\t2: 12,\n\t\t3: 13,\n\t\t4: 14,\n\t\t5: 16,\n\t\t6: 18,\n\t\t7: 20,\n\t\t8: 22,\n\t\t9: 24,\n\t\t10: 32,\n\t\t11: 46,\n\t\t12: 62,\n\t\t13: 72,\n\t\t14: 92,\n\t\t15: 114,\n\t\t16: 124\n\t}\n}, { sizeLineHeight: (x) => x * 1.5 + 2 });\n\nexport { bodyFont, cherryBombFont, headingFont, monoFont };"],"mappings":";;;;;AAIA,MAAM,iBAAiB;AACvB,MAAM,aAAa;AACnB,MAAM,iBAAiB,qBAAqB;CAC3C,QAAQ;CACR,QAAQ,EAAE,GAAG,MAAM;CACnB,MAAM,EAAE,MAAM,KAAK;AACpB,CAAC;AACD,MAAM,cAAc;CACnB,MAAM,MAAM,EAAE,MAAM,GAAG;CACvB,IAAI,KAAK;CACT,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,KAAK;EAC7B,IAAI,KAAK,KAAK,MAAM,EAAE;EACtB,MAAM,KAAK,IAAI,MAAM,OAAO,IAAI,IAAI;CACrC;CACA,OAAO;AACR;AACA,MAAM,OAAO,MAAM;AACnB,MAAM,eAAe,OAAO,UAAU,OAAO,YAAY,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,KAAK,MAAM,IAAI,QAAQ,KAAK,CAAC,CAAC,CAAC;AACjI,MAAM,cAAc,WAAW;CAC9B,QAAQ;CACR;CACA,YAAY,YAAY,MAAM,CAAC;CAC/B,QAAQ,EAAE,GAAG,MAAM;CACnB,eAAe,EAAE,GAAG,EAAE;AACvB,CAAC;AACD,MAAM,WAAW,WAAW;CAC3B,QAAQ;CACR;CACA,YAAY,YAAY,MAAM,CAAC;CAC/B,QAAQ,EAAE,GAAG,MAAM;CACnB,eAAe,EAAE,GAAG,EAAE;AACvB,CAAC;AACD,MAAM,WAAW,kBAAkB,YAAY;CAC9C,QAAQ,EAAE,GAAG,MAAM;CACnB,MAAM;EACL,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACL;AACD,GAAG,EAAE,iBAAiB,MAAM,IAAI,MAAM,EAAE,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,3 +1 @@
1
1
  export * from "./tamagui.dev.config.mjs"
2
-
3
- export * from "./media.mjs"
@@ -1,3 +1 @@
1
1
  export * from "./tamagui.dev.config.mjs"
2
-
3
- export * from "./media.mjs"
@@ -1,33 +1,30 @@
1
1
  import { animationsCSS } from "@tamagui/config/animations-css";
2
2
  import { animationsMotion } from "@tamagui/config/animations-motion";
3
- import { defaultConfig } from "@tamagui/config/v5-subtle";
3
+ import { createV6Config, mediaQueryDefaultActive, withTailwindTypeScale } from "@tamagui/config/v6-base";
4
4
  import { setupDev } from "@tamagui/core";
5
- import { bodyFont, cherryBombFont, headingFont, monoFont, silkscreenFont } from "./fonts.mjs";
6
- import { media, mediaQueryDefaultActive } from "./media.mjs";
5
+ import { bodyFont, cherryBombFont, headingFont, monoFont } from "./fonts.mjs";
7
6
  import { clientThemes } from "./themeMetadata.mjs";
8
7
  import { themes } from "./themes.mjs";
9
8
 
10
9
  setupDev({ visualizer: true });
11
- const fonts = {
12
- heading: headingFont,
13
- body: bodyFont,
14
- mono: monoFont,
15
- silkscreen: silkscreenFont,
16
- cherryBomb: cherryBombFont
17
- };
18
10
  const animations = {
19
11
  default: animationsMotion,
20
12
  css: animationsCSS
21
13
  };
22
14
  const configuredThemes = process.env.VITE_ENVIRONMENT === "client" ? clientThemes : themes;
15
+ const v6 = createV6Config({ themes: configuredThemes });
23
16
  const config = {
24
- ...defaultConfig,
25
- themes: configuredThemes,
26
- fonts,
17
+ ...v6,
18
+ fonts: {
19
+ heading: withTailwindTypeScale(headingFont),
20
+ body: withTailwindTypeScale(bodyFont),
21
+ mono: monoFont,
22
+ cherryBomb: cherryBombFont
23
+ },
27
24
  animations,
28
- media,
25
+ media: { ...v6.media },
29
26
  settings: {
30
- ...defaultConfig.settings,
27
+ ...v6.settings,
31
28
  mediaQueryDefaultActive,
32
29
  allowedStyleValues: "somewhat-strict-web",
33
30
  onlyAllowShorthands: false
@@ -1 +1 @@
1
- {"version":3,"file":"tamagui.dev.config.js","names":[],"sources":["esm/tamagui.dev.config.js"],"sourcesContent":["import { animationsCSS } from \"@tamagui/config/animations-css\";\nimport { animationsMotion } from \"@tamagui/config/animations-motion\";\nimport { defaultConfig } from \"@tamagui/config/v5-subtle\";\nimport { setupDev } from \"@tamagui/core\";\nimport { bodyFont, cherryBombFont, headingFont, monoFont, silkscreenFont } from \"./fonts\";\nimport { media, mediaQueryDefaultActive } from \"./media\";\nimport { clientThemes } from \"./themeMetadata\";\nimport { themes } from \"./themes\";\nsetupDev({\n visualizer: true\n});\nconst fonts = {\n heading: headingFont,\n body: bodyFont,\n mono: monoFont,\n silkscreen: silkscreenFont,\n cherryBomb: cherryBombFont\n};\nconst animations = {\n default: animationsMotion,\n css: animationsCSS\n};\nconst configuredThemes = process.env.VITE_ENVIRONMENT === \"client\" ? clientThemes : themes;\nconst config = {\n ...defaultConfig,\n themes: configuredThemes,\n fonts,\n animations,\n media,\n settings: {\n ...defaultConfig.settings,\n mediaQueryDefaultActive,\n allowedStyleValues: \"somewhat-strict-web\",\n // allow both shorthands and longhand names for flexibility\n onlyAllowShorthands: false\n }\n};\nObject.assign(config.media, {\n tiny: { maxWidth: 500 },\n gtTiny: { minWidth: 500 + 1 },\n small: { maxWidth: 620 },\n gtSmall: { minWidth: 620 + 1 },\n medium: { maxWidth: 780 },\n gtMedium: { minWidth: 780 + 1 },\n large: { maxWidth: 900 },\n gtLarge: { minWidth: 900 + 1 }\n});\nexport {\n animations,\n config\n};\n//# sourceMappingURL=tamagui.dev.config.js.map\n"],"mappings":";;;;;;;;;;AAQA,SAAS,EACP,YAAY,KACd,CAAC;AACD,MAAM,QAAQ;CACZ,SAAS;CACT,MAAM;CACN,MAAM;CACN,YAAY;CACZ,YAAY;AACd;AACA,MAAM,aAAa;CACjB,SAAS;CACT,KAAK;AACP;AACA,MAAM,mBAAmB,QAAQ,IAAI,qBAAqB,WAAW,eAAe;AACpF,MAAM,SAAS;CACb,GAAG;CACH,QAAQ;CACR;CACA;CACA;CACA,UAAU;EACR,GAAG,cAAc;EACjB;EACA,oBAAoB;EAEpB,qBAAqB;CACvB;AACF;AACA,OAAO,OAAO,OAAO,OAAO;CAC1B,MAAM,EAAE,UAAU,IAAI;CACtB,QAAQ,EAAE,UAAU,MAAM,EAAE;CAC5B,OAAO,EAAE,UAAU,IAAI;CACvB,SAAS,EAAE,UAAU,MAAM,EAAE;CAC7B,QAAQ,EAAE,UAAU,IAAI;CACxB,UAAU,EAAE,UAAU,MAAM,EAAE;CAC9B,OAAO,EAAE,UAAU,IAAI;CACvB,SAAS,EAAE,UAAU,MAAM,EAAE;AAC/B,CAAC"}
1
+ {"version":3,"file":"tamagui.dev.config.js","names":[],"sources":["esm/tamagui.dev.config.js"],"sourcesContent":["import { animationsCSS } from \"@tamagui/config/animations-css\";\nimport { animationsMotion } from \"@tamagui/config/animations-motion\";\nimport {\n createV6Config,\n mediaQueryDefaultActive,\n withTailwindTypeScale\n} from \"@tamagui/config/v6-base\";\nimport { setupDev } from \"@tamagui/core\";\nimport { bodyFont, cherryBombFont, headingFont, monoFont } from \"./fonts\";\nimport { clientThemes } from \"./themeMetadata\";\nimport { themes } from \"./themes\";\nsetupDev({\n visualizer: true\n});\nconst animations = {\n default: animationsMotion,\n css: animationsCSS\n};\nconst configuredThemes = process.env.VITE_ENVIRONMENT === \"client\" ? clientThemes : themes;\nconst v6 = createV6Config({ themes: configuredThemes });\nconst config = {\n ...v6,\n fonts: {\n heading: withTailwindTypeScale(headingFont),\n body: withTailwindTypeScale(bodyFont),\n mono: monoFont,\n cherryBomb: cherryBombFont\n },\n animations,\n // a copy, since the demo media below is assigned onto it\n media: { ...v6.media },\n settings: {\n ...v6.settings,\n mediaQueryDefaultActive,\n allowedStyleValues: \"somewhat-strict-web\",\n // allow both shorthands and longhand names for flexibility\n onlyAllowShorthands: false\n }\n};\nObject.assign(config.media, {\n tiny: { maxWidth: 500 },\n gtTiny: { minWidth: 500 + 1 },\n small: { maxWidth: 620 },\n gtSmall: { minWidth: 620 + 1 },\n medium: { maxWidth: 780 },\n gtMedium: { minWidth: 780 + 1 },\n large: { maxWidth: 900 },\n gtLarge: { minWidth: 900 + 1 }\n});\nexport {\n animations,\n config\n};\n//# sourceMappingURL=tamagui.dev.config.js.map\n"],"mappings":";;;;;;;;;AAWA,SAAS,EACP,YAAY,KACd,CAAC;AACD,MAAM,aAAa;CACjB,SAAS;CACT,KAAK;AACP;AACA,MAAM,mBAAmB,QAAQ,IAAI,qBAAqB,WAAW,eAAe;AACpF,MAAM,KAAK,eAAe,EAAE,QAAQ,iBAAiB,CAAC;AACtD,MAAM,SAAS;CACb,GAAG;CACH,OAAO;EACL,SAAS,sBAAsB,WAAW;EAC1C,MAAM,sBAAsB,QAAQ;EACpC,MAAM;EACN,YAAY;CACd;CACA;CAEA,OAAO,EAAE,GAAG,GAAG,MAAM;CACrB,UAAU;EACR,GAAG,GAAG;EACN;EACA,oBAAoB;EAEpB,qBAAqB;CACvB;AACF;AACA,OAAO,OAAO,OAAO,OAAO;CAC1B,MAAM,EAAE,UAAU,IAAI;CACtB,QAAQ,EAAE,UAAU,MAAM,EAAE;CAC5B,OAAO,EAAE,UAAU,IAAI;CACvB,SAAS,EAAE,UAAU,MAAM,EAAE;CAC7B,QAAQ,EAAE,UAAU,IAAI;CACxB,UAAU,EAAE,UAAU,MAAM,EAAE;CAC9B,OAAO,EAAE,UAAU,IAAI;CACvB,SAAS,EAAE,UAAU,MAAM,EAAE;AAC/B,CAAC"}
@@ -1,7 +1,5 @@
1
1
  const schemes = ["light", "dark"];
2
2
  const colors = [
3
- "black",
4
- "white",
5
3
  "gray",
6
4
  "blue",
7
5
  "red",
@@ -33,10 +31,11 @@ const componentThemes = [
33
31
  "Tooltip",
34
32
  "SwitchThumb"
35
33
  ];
36
- const numbered = (prefix, count) => Array.from({ length: count }, (_, index) => `${prefix}${index + 1}`);
34
+ const numbered = (prefix, count) => Array.from({ length: count }, (_, index) => `${prefix}-${index + 1}`);
37
35
  const baseThemeNames = schemes.flatMap((scheme) => [
38
36
  scheme,
39
37
  `${scheme}_accent`,
38
+ `${scheme}_brand`,
40
39
  `${scheme}_surface1`,
41
40
  `${scheme}_surface2`,
42
41
  ...colors.flatMap((color) => [
@@ -46,7 +45,7 @@ const baseThemeNames = schemes.flatMap((scheme) => [
46
45
  `${scheme}_${color}_surface2`
47
46
  ])
48
47
  ]);
49
- const levelThemeNames = baseThemeNames.flatMap((themeName) => themeName.endsWith("_surface1") ? [themeName.replace(/_surface1$/, "_level2")] : themeName.endsWith("_surface2") ? [themeName.replace(/_surface2$/, "_level3")] : themeName.endsWith("_accent") ? [`${themeName}_level2`, `${themeName}_level3`] : []);
48
+ const levelThemeNames = baseThemeNames.flatMap((themeName) => themeName.endsWith("_surface1") ? [themeName.replace(/_surface1$/, "_level2")] : themeName.endsWith("_surface2") ? [themeName.replace(/_surface2$/, "_level3")] : themeName.endsWith("_accent") || themeName.endsWith("_brand") ? [`${themeName}_level2`, `${themeName}_level3`] : []);
50
49
  const componentThemeNames = [...baseThemeNames, ...levelThemeNames].flatMap((parent) => componentThemes.map((component) => `${parent}_${component}`));
51
50
  const themeNames = [
52
51
  ...baseThemeNames,
@@ -74,7 +73,7 @@ const themeVariableNames = [
74
73
  "background-focus",
75
74
  "background-hover",
76
75
  "background-press",
77
- ...alphaSteps.map((step) => `background${step}`),
76
+ ...alphaSteps.map((step) => `background-${step}`),
78
77
  "border-color",
79
78
  "border-color-focus",
80
79
  "border-color-hover",
@@ -84,18 +83,18 @@ const themeVariableNames = [
84
83
  "color-hover",
85
84
  "color-press",
86
85
  "color-transparent",
87
- ...alphaSteps.map((step) => `color${step}`),
86
+ ...alphaSteps.map((step) => `color-${step}`),
88
87
  ...numbered("color", 12),
89
88
  "outline-color",
90
89
  "placeholder-color",
91
90
  "shadow-color",
92
91
  ...["black", "white"].flatMap((color) => [
93
92
  color,
94
- `${color}0`,
95
- `${color}02`,
96
- `${color}04`,
97
- `${color}06`,
98
- `${color}08`,
93
+ `${color}-0`,
94
+ `${color}-02`,
95
+ `${color}-04`,
96
+ `${color}-06`,
97
+ `${color}-08`,
99
98
  ...numbered(color, 12)
100
99
  ]),
101
100
  ...paletteColors.flatMap((color) => numbered(color, 12)),
@@ -1 +1 @@
1
- {"version":3,"file":"themeMetadata.js","names":[],"sources":["esm/themeMetadata.js"],"sourcesContent":["const schemes = [\"light\", \"dark\"];\nconst colors = [\"black\", \"white\", \"gray\", \"blue\", \"red\", \"yellow\", \"green\"];\nconst paletteColors = [\n \"blue\",\n \"gray\",\n \"green\",\n \"neutral\",\n \"orange\",\n \"pink\",\n \"purple\",\n \"red\",\n \"teal\",\n \"yellow\"\n];\nconst componentThemes = [\n \"Button\",\n \"Input\",\n \"Progress\",\n \"ProgressIndicator\",\n \"Slider\",\n \"SliderActive\",\n \"SliderThumb\",\n \"Switch\",\n \"TextArea\",\n \"Tooltip\",\n \"SwitchThumb\"\n];\nconst numbered = (prefix, count) => Array.from({ length: count }, (_, index) => `${prefix}${index + 1}`);\nconst baseThemeNames = schemes.flatMap((scheme) => [\n scheme,\n `${scheme}_accent`,\n `${scheme}_surface1`,\n `${scheme}_surface2`,\n ...colors.flatMap((color) => [\n `${scheme}_${color}`,\n `${scheme}_${color}_accent`,\n `${scheme}_${color}_surface1`,\n `${scheme}_${color}_surface2`\n ])\n]);\nconst levelThemeNames = baseThemeNames.flatMap(\n (themeName) => themeName.endsWith(\"_surface1\") ? [themeName.replace(/_surface1$/, \"_level2\")] : themeName.endsWith(\"_surface2\") ? [themeName.replace(/_surface2$/, \"_level3\")] : themeName.endsWith(\"_accent\") ? [`${themeName}_level2`, `${themeName}_level3`] : []\n);\nconst componentThemeNames = [...baseThemeNames, ...levelThemeNames].flatMap(\n (parent) => componentThemes.map((component) => `${parent}_${component}`)\n);\nconst themeNames = [...baseThemeNames, ...levelThemeNames, ...componentThemeNames];\nconst alphaSteps = [\n \"0\",\n \"01\",\n \"02\",\n \"04\",\n \"06\",\n \"08\",\n \"001\",\n \"002\",\n \"0025\",\n \"005\",\n \"0075\"\n];\nconst themeVariableNames = [\n \"accent-background\",\n \"accent-color\",\n ...numbered(\"accent\", 12),\n \"background\",\n \"background-focus\",\n \"background-hover\",\n \"background-press\",\n ...alphaSteps.map((step) => `background${step}`),\n \"border-color\",\n \"border-color-focus\",\n \"border-color-hover\",\n \"border-color-press\",\n \"color\",\n \"color-focus\",\n \"color-hover\",\n \"color-press\",\n \"color-transparent\",\n ...alphaSteps.map((step) => `color${step}`),\n ...numbered(\"color\", 12),\n \"outline-color\",\n \"placeholder-color\",\n \"shadow-color\",\n ...[\"black\", \"white\"].flatMap((color) => [\n color,\n `${color}0`,\n `${color}02`,\n `${color}04`,\n `${color}06`,\n `${color}08`,\n ...numbered(color, 12)\n ]),\n ...paletteColors.flatMap((color) => numbered(color, 12)),\n ...numbered(\"highlight\", 8),\n ...numbered(\"shadow\", 8)\n];\nconst variableShape = Object.fromEntries(\n themeVariableNames.map((name) => [name, `var(--${name})`])\n);\nconst clientThemes = Object.fromEntries(\n themeNames.map((name) => [name, variableShape])\n);\nexport {\n clientThemes,\n componentThemes,\n themeNames,\n themeVariableNames\n};\n//# sourceMappingURL=themeMetadata.js.map\n"],"mappings":";AAAA,MAAM,UAAU,CAAC,SAAS,MAAM;AAChC,MAAM,SAAS;CAAC;CAAS;CAAS;CAAQ;CAAQ;CAAO;CAAU;AAAO;AAC1E,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,YAAY,QAAQ,UAAU,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UAAU,GAAG,SAAS,QAAQ,GAAG;AACvG,MAAM,iBAAiB,QAAQ,SAAS,WAAW;CACjD;CACA,GAAG,OAAO;CACV,GAAG,OAAO;CACV,GAAG,OAAO;CACV,GAAG,OAAO,SAAS,UAAU;EAC3B,GAAG,OAAO,GAAG;EACb,GAAG,OAAO,GAAG,MAAM;EACnB,GAAG,OAAO,GAAG,MAAM;EACnB,GAAG,OAAO,GAAG,MAAM;CACrB,CAAC;AACH,CAAC;AACD,MAAM,kBAAkB,eAAe,SACpC,cAAc,UAAU,SAAS,WAAW,IAAI,CAAC,UAAU,QAAQ,cAAc,SAAS,CAAC,IAAI,UAAU,SAAS,WAAW,IAAI,CAAC,UAAU,QAAQ,cAAc,SAAS,CAAC,IAAI,UAAU,SAAS,SAAS,IAAI,CAAC,GAAG,UAAU,UAAU,GAAG,UAAU,QAAQ,IAAI,CAAC,CACrQ;AACA,MAAM,sBAAsB,CAAC,GAAG,gBAAgB,GAAG,eAAe,CAAC,CAAC,SACjE,WAAW,gBAAgB,KAAK,cAAc,GAAG,OAAO,GAAG,WAAW,CACzE;AACA,MAAM,aAAa;CAAC,GAAG;CAAgB,GAAG;CAAiB,GAAG;AAAmB;AACjF,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,qBAAqB;CACzB;CACA;CACA,GAAG,SAAS,UAAU,EAAE;CACxB;CACA;CACA;CACA;CACA,GAAG,WAAW,KAAK,SAAS,aAAa,MAAM;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG,WAAW,KAAK,SAAS,QAAQ,MAAM;CAC1C,GAAG,SAAS,SAAS,EAAE;CACvB;CACA;CACA;CACA,GAAG,CAAC,SAAS,OAAO,CAAC,CAAC,SAAS,UAAU;EACvC;EACA,GAAG,MAAM;EACT,GAAG,MAAM;EACT,GAAG,MAAM;EACT,GAAG,MAAM;EACT,GAAG,MAAM;EACT,GAAG,SAAS,OAAO,EAAE;CACvB,CAAC;CACD,GAAG,cAAc,SAAS,UAAU,SAAS,OAAO,EAAE,CAAC;CACvD,GAAG,SAAS,aAAa,CAAC;CAC1B,GAAG,SAAS,UAAU,CAAC;AACzB;AACA,MAAM,gBAAgB,OAAO,YAC3B,mBAAmB,KAAK,SAAS,CAAC,MAAM,SAAS,KAAK,EAAE,CAAC,CAC3D;AACA,MAAM,eAAe,OAAO,YAC1B,WAAW,KAAK,SAAS,CAAC,MAAM,aAAa,CAAC,CAChD"}
1
+ {"version":3,"file":"themeMetadata.js","names":[],"sources":["esm/themeMetadata.js"],"sourcesContent":["const schemes = [\"light\", \"dark\"];\nconst colors = [\"gray\", \"blue\", \"red\", \"yellow\", \"green\"];\nconst paletteColors = [\n \"blue\",\n \"gray\",\n \"green\",\n \"neutral\",\n \"orange\",\n \"pink\",\n \"purple\",\n \"red\",\n \"teal\",\n \"yellow\"\n];\nconst componentThemes = [\n \"Button\",\n \"Input\",\n \"Progress\",\n \"ProgressIndicator\",\n \"Slider\",\n \"SliderActive\",\n \"SliderThumb\",\n \"Switch\",\n \"TextArea\",\n \"Tooltip\",\n \"SwitchThumb\"\n];\nconst numbered = (prefix, count) => Array.from({ length: count }, (_, index) => `${prefix}-${index + 1}`);\nconst baseThemeNames = schemes.flatMap((scheme) => [\n scheme,\n `${scheme}_accent`,\n // brand is neutral, so one per scheme covers every tint: theme resolution\n // walks the parent name down, and `light_blue_brand` lands on `light_brand`\n `${scheme}_brand`,\n `${scheme}_surface1`,\n `${scheme}_surface2`,\n ...colors.flatMap((color) => [\n `${scheme}_${color}`,\n `${scheme}_${color}_accent`,\n `${scheme}_${color}_surface1`,\n `${scheme}_${color}_surface2`\n ])\n]);\nconst levelThemeNames = baseThemeNames.flatMap(\n (themeName) => themeName.endsWith(\"_surface1\") ? [themeName.replace(/_surface1$/, \"_level2\")] : themeName.endsWith(\"_surface2\") ? [themeName.replace(/_surface2$/, \"_level3\")] : themeName.endsWith(\"_accent\") || themeName.endsWith(\"_brand\") ? [`${themeName}_level2`, `${themeName}_level3`] : []\n);\nconst componentThemeNames = [...baseThemeNames, ...levelThemeNames].flatMap(\n (parent) => componentThemes.map((component) => `${parent}_${component}`)\n);\nconst themeNames = [...baseThemeNames, ...levelThemeNames, ...componentThemeNames];\nconst alphaSteps = [\n \"0\",\n \"01\",\n \"02\",\n \"04\",\n \"06\",\n \"08\",\n \"001\",\n \"002\",\n \"0025\",\n \"005\",\n \"0075\"\n];\nconst themeVariableNames = [\n \"accent-background\",\n \"accent-color\",\n ...numbered(\"accent\", 12),\n \"background\",\n \"background-focus\",\n \"background-hover\",\n \"background-press\",\n ...alphaSteps.map((step) => `background-${step}`),\n \"border-color\",\n \"border-color-focus\",\n \"border-color-hover\",\n \"border-color-press\",\n \"color\",\n \"color-focus\",\n \"color-hover\",\n \"color-press\",\n \"color-transparent\",\n ...alphaSteps.map((step) => `color-${step}`),\n ...numbered(\"color\", 12),\n \"outline-color\",\n \"placeholder-color\",\n \"shadow-color\",\n ...[\"black\", \"white\"].flatMap((color) => [\n color,\n `${color}-0`,\n `${color}-02`,\n `${color}-04`,\n `${color}-06`,\n `${color}-08`,\n ...numbered(color, 12)\n ]),\n ...paletteColors.flatMap((color) => numbered(color, 12)),\n ...numbered(\"highlight\", 8),\n ...numbered(\"shadow\", 8)\n];\nconst variableShape = Object.fromEntries(\n themeVariableNames.map((name) => [name, `var(--${name})`])\n);\nconst clientThemes = Object.fromEntries(\n themeNames.map((name) => [name, variableShape])\n);\nexport {\n clientThemes,\n componentThemes,\n themeNames,\n themeVariableNames\n};\n//# sourceMappingURL=themeMetadata.js.map\n"],"mappings":";AAAA,MAAM,UAAU,CAAC,SAAS,MAAM;AAChC,MAAM,SAAS;CAAC;CAAQ;CAAQ;CAAO;CAAU;AAAO;AACxD,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,YAAY,QAAQ,UAAU,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG;AACxG,MAAM,iBAAiB,QAAQ,SAAS,WAAW;CACjD;CACA,GAAG,OAAO;CAGV,GAAG,OAAO;CACV,GAAG,OAAO;CACV,GAAG,OAAO;CACV,GAAG,OAAO,SAAS,UAAU;EAC3B,GAAG,OAAO,GAAG;EACb,GAAG,OAAO,GAAG,MAAM;EACnB,GAAG,OAAO,GAAG,MAAM;EACnB,GAAG,OAAO,GAAG,MAAM;CACrB,CAAC;AACH,CAAC;AACD,MAAM,kBAAkB,eAAe,SACpC,cAAc,UAAU,SAAS,WAAW,IAAI,CAAC,UAAU,QAAQ,cAAc,SAAS,CAAC,IAAI,UAAU,SAAS,WAAW,IAAI,CAAC,UAAU,QAAQ,cAAc,SAAS,CAAC,IAAI,UAAU,SAAS,SAAS,KAAK,UAAU,SAAS,QAAQ,IAAI,CAAC,GAAG,UAAU,UAAU,GAAG,UAAU,QAAQ,IAAI,CAAC,CACrS;AACA,MAAM,sBAAsB,CAAC,GAAG,gBAAgB,GAAG,eAAe,CAAC,CAAC,SACjE,WAAW,gBAAgB,KAAK,cAAc,GAAG,OAAO,GAAG,WAAW,CACzE;AACA,MAAM,aAAa;CAAC,GAAG;CAAgB,GAAG;CAAiB,GAAG;AAAmB;AACjF,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,qBAAqB;CACzB;CACA;CACA,GAAG,SAAS,UAAU,EAAE;CACxB;CACA;CACA;CACA;CACA,GAAG,WAAW,KAAK,SAAS,cAAc,MAAM;CAChD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG,WAAW,KAAK,SAAS,SAAS,MAAM;CAC3C,GAAG,SAAS,SAAS,EAAE;CACvB;CACA;CACA;CACA,GAAG,CAAC,SAAS,OAAO,CAAC,CAAC,SAAS,UAAU;EACvC;EACA,GAAG,MAAM;EACT,GAAG,MAAM;EACT,GAAG,MAAM;EACT,GAAG,MAAM;EACT,GAAG,MAAM;EACT,GAAG,SAAS,OAAO,EAAE;CACvB,CAAC;CACD,GAAG,cAAc,SAAS,UAAU,SAAS,OAAO,EAAE,CAAC;CACvD,GAAG,SAAS,aAAa,CAAC;CAC1B,GAAG,SAAS,UAAU,CAAC;AACzB;AACA,MAAM,gBAAgB,OAAO,YAC3B,mBAAmB,KAAK,SAAS,CAAC,MAAM,SAAS,KAAK,EAAE,CAAC,CAC3D;AACA,MAAM,eAAe,OAAO,YAC1B,WAAW,KAAK,SAAS,CAAC,MAAM,aAAa,CAAC,CAChD"}
@@ -14,6 +14,12 @@ for (const [themeName, theme] of Object.entries(selectedThemes)) {
14
14
  selectedThemes[`${themeName}_level3`] = theme;
15
15
  }
16
16
  }
17
+ for (const scheme of ["light", "dark"]) {
18
+ const inverse = selectedThemes[scheme === "light" ? "dark" : "light"];
19
+ selectedThemes[`${scheme}_brand`] = inverse;
20
+ selectedThemes[`${scheme}_brand_level2`] = inverse;
21
+ selectedThemes[`${scheme}_brand_level3`] = inverse;
22
+ }
17
23
  for (const themeName of themeNames) {
18
24
  const component = componentThemes.find((name) => themeName.endsWith(`_${name}`));
19
25
  if (!component || selectedThemes[themeName]) continue;
@@ -22,7 +28,33 @@ for (const themeName of themeNames) {
22
28
  selectedThemes[themeName] = selectedThemes[parentName];
23
29
  }
24
30
  }
25
- const themes = toV6Themes(selectedThemes);
31
+ const MAX_LIGHT_BORDER_GAP = 8;
32
+ const hsla = /^hsla\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*,\s*([\d.]+)\s*\)$/;
33
+ const softenLightBorder = (theme) => {
34
+ const background = hsla.exec(theme.background);
35
+ const border = hsla.exec(theme["border-color"]);
36
+ if (!background || !border) return theme;
37
+ const backgroundLightness = Number(background[3]);
38
+ const borderLightness = Number(border[3]);
39
+ if (backgroundLightness <= 50) return theme;
40
+ const gap = backgroundLightness - borderLightness;
41
+ if (gap <= MAX_LIGHT_BORDER_GAP) return theme;
42
+ const lightness = backgroundLightness - MAX_LIGHT_BORDER_GAP;
43
+ return {
44
+ ...theme,
45
+ "border-color": `hsla(${border[1]}, ${border[2]}%, ${lightness}%, ${border[4]})`
46
+ };
47
+ };
48
+ const v6Themes = toV6Themes(selectedThemes);
49
+ const edited = /* @__PURE__ */ new Map();
50
+ const themes = Object.fromEntries(Object.entries(v6Themes).map(([themeName, theme]) => {
51
+ let next = edited.get(theme);
52
+ if (!next) {
53
+ next = softenLightBorder(theme);
54
+ edited.set(theme, next);
55
+ }
56
+ return [themeName, next];
57
+ }));
26
58
 
27
59
  export { themes };
28
60
  //# sourceMappingURL=themes.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"themes.js","names":["v5Themes"],"sources":["esm/themes.js"],"sourcesContent":["import { toV6Themes } from \"@tamagui/config/v6-base\";\nimport { themes as v5Themes } from \"@tamagui/themes/v5-subtle\";\nimport { componentThemes, themeNames } from \"./themeMetadata\";\nconst themeNameSet = new Set(themeNames);\nconst selectedThemes = Object.fromEntries(\n Object.entries(v5Themes).filter(([themeName]) => themeNameSet.has(themeName))\n);\nfor (const [themeName, theme] of Object.entries(selectedThemes)) {\n if (themeName.endsWith(\"_surface1\")) {\n selectedThemes[themeName.replace(/_surface1$/, \"_level2\")] = theme;\n } else if (themeName.endsWith(\"_surface2\")) {\n selectedThemes[themeName.replace(/_surface2$/, \"_level3\")] = theme;\n } else if (themeName.endsWith(\"_accent\")) {\n selectedThemes[`${themeName}_level2`] = theme;\n selectedThemes[`${themeName}_level3`] = theme;\n }\n}\nfor (const themeName of themeNames) {\n const component = componentThemes.find((name) => themeName.endsWith(`_${name}`));\n if (!component || selectedThemes[themeName]) continue;\n const parentName = themeName.slice(0, -(component.length + 1));\n if (selectedThemes[parentName]) {\n selectedThemes[themeName] = selectedThemes[parentName];\n }\n}\nconst themes = toV6Themes(selectedThemes);\nexport {\n themes\n};\n//# sourceMappingURL=themes.js.map\n"],"mappings":";;;;;AAGA,MAAM,eAAe,IAAI,IAAI,UAAU;AACvC,MAAM,iBAAiB,OAAO,YAC5B,OAAO,QAAQA,QAAQ,CAAC,CAAC,QAAQ,CAAC,eAAe,aAAa,IAAI,SAAS,CAAC,CAC9E;AACA,KAAK,MAAM,CAAC,WAAW,UAAU,OAAO,QAAQ,cAAc,GAAG;CAC/D,IAAI,UAAU,SAAS,WAAW,GAAG;EACnC,eAAe,UAAU,QAAQ,cAAc,SAAS,KAAK;CAC/D,OAAO,IAAI,UAAU,SAAS,WAAW,GAAG;EAC1C,eAAe,UAAU,QAAQ,cAAc,SAAS,KAAK;CAC/D,OAAO,IAAI,UAAU,SAAS,SAAS,GAAG;EACxC,eAAe,GAAG,UAAU,YAAY;EACxC,eAAe,GAAG,UAAU,YAAY;CAC1C;AACF;AACA,KAAK,MAAM,aAAa,YAAY;CAClC,MAAM,YAAY,gBAAgB,MAAM,SAAS,UAAU,SAAS,IAAI,MAAM,CAAC;CAC/E,IAAI,CAAC,aAAa,eAAe,YAAY;CAC7C,MAAM,aAAa,UAAU,MAAM,GAAG,EAAE,UAAU,SAAS,EAAE;CAC7D,IAAI,eAAe,aAAa;EAC9B,eAAe,aAAa,eAAe;CAC7C;AACF;AACA,MAAM,SAAS,WAAW,cAAc"}
1
+ {"version":3,"file":"themes.js","names":["v5Themes"],"sources":["esm/themes.js"],"sourcesContent":["import { toV6Themes } from \"@tamagui/config/v6-base\";\nimport { themes as v5Themes } from \"@tamagui/themes/v5-subtle\";\nimport { componentThemes, themeNames } from \"./themeMetadata\";\nconst themeNameSet = new Set(themeNames);\nconst selectedThemes = Object.fromEntries(\n Object.entries(v5Themes).filter(([themeName]) => themeNameSet.has(themeName))\n);\nfor (const [themeName, theme] of Object.entries(selectedThemes)) {\n if (themeName.endsWith(\"_surface1\")) {\n selectedThemes[themeName.replace(/_surface1$/, \"_level2\")] = theme;\n } else if (themeName.endsWith(\"_surface2\")) {\n selectedThemes[themeName.replace(/_surface2$/, \"_level3\")] = theme;\n } else if (themeName.endsWith(\"_accent\")) {\n selectedThemes[`${themeName}_level2`] = theme;\n selectedThemes[`${themeName}_level3`] = theme;\n }\n}\nfor (const scheme of [\"light\", \"dark\"]) {\n const inverse = selectedThemes[scheme === \"light\" ? \"dark\" : \"light\"];\n selectedThemes[`${scheme}_brand`] = inverse;\n selectedThemes[`${scheme}_brand_level2`] = inverse;\n selectedThemes[`${scheme}_brand_level3`] = inverse;\n}\nfor (const themeName of themeNames) {\n const component = componentThemes.find((name) => themeName.endsWith(`_${name}`));\n if (!component || selectedThemes[themeName]) continue;\n const parentName = themeName.slice(0, -(component.length + 1));\n if (selectedThemes[parentName]) {\n selectedThemes[themeName] = selectedThemes[parentName];\n }\n}\nconst MAX_LIGHT_BORDER_GAP = 8;\nconst hsla = /^hsla\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)%\\s*,\\s*([\\d.]+)%\\s*,\\s*([\\d.]+)\\s*\\)$/;\nconst softenLightBorder = (theme) => {\n const background = hsla.exec(theme.background);\n const border = hsla.exec(theme[\"border-color\"]);\n if (!background || !border) return theme;\n const backgroundLightness = Number(background[3]);\n const borderLightness = Number(border[3]);\n if (backgroundLightness <= 50) return theme;\n const gap = backgroundLightness - borderLightness;\n if (gap <= MAX_LIGHT_BORDER_GAP) return theme;\n const lightness = backgroundLightness - MAX_LIGHT_BORDER_GAP;\n return {\n ...theme,\n \"border-color\": `hsla(${border[1]}, ${border[2]}%, ${lightness}%, ${border[4]})`\n };\n};\nconst v6Themes = toV6Themes(selectedThemes);\nconst edited = /* @__PURE__ */ new Map();\nconst themes = Object.fromEntries(\n Object.entries(v6Themes).map(([themeName, theme]) => {\n let next = edited.get(theme);\n if (!next) {\n next = softenLightBorder(theme);\n edited.set(theme, next);\n }\n return [themeName, next];\n })\n);\nexport {\n themes\n};\n//# sourceMappingURL=themes.js.map\n"],"mappings":";;;;;AAGA,MAAM,eAAe,IAAI,IAAI,UAAU;AACvC,MAAM,iBAAiB,OAAO,YAC5B,OAAO,QAAQA,QAAQ,CAAC,CAAC,QAAQ,CAAC,eAAe,aAAa,IAAI,SAAS,CAAC,CAC9E;AACA,KAAK,MAAM,CAAC,WAAW,UAAU,OAAO,QAAQ,cAAc,GAAG;CAC/D,IAAI,UAAU,SAAS,WAAW,GAAG;EACnC,eAAe,UAAU,QAAQ,cAAc,SAAS,KAAK;CAC/D,OAAO,IAAI,UAAU,SAAS,WAAW,GAAG;EAC1C,eAAe,UAAU,QAAQ,cAAc,SAAS,KAAK;CAC/D,OAAO,IAAI,UAAU,SAAS,SAAS,GAAG;EACxC,eAAe,GAAG,UAAU,YAAY;EACxC,eAAe,GAAG,UAAU,YAAY;CAC1C;AACF;AACA,KAAK,MAAM,UAAU,CAAC,SAAS,MAAM,GAAG;CACtC,MAAM,UAAU,eAAe,WAAW,UAAU,SAAS;CAC7D,eAAe,GAAG,OAAO,WAAW;CACpC,eAAe,GAAG,OAAO,kBAAkB;CAC3C,eAAe,GAAG,OAAO,kBAAkB;AAC7C;AACA,KAAK,MAAM,aAAa,YAAY;CAClC,MAAM,YAAY,gBAAgB,MAAM,SAAS,UAAU,SAAS,IAAI,MAAM,CAAC;CAC/E,IAAI,CAAC,aAAa,eAAe,YAAY;CAC7C,MAAM,aAAa,UAAU,MAAM,GAAG,EAAE,UAAU,SAAS,EAAE;CAC7D,IAAI,eAAe,aAAa;EAC9B,eAAe,aAAa,eAAe;CAC7C;AACF;AACA,MAAM,uBAAuB;AAC7B,MAAM,OAAO;AACb,MAAM,qBAAqB,UAAU;CACnC,MAAM,aAAa,KAAK,KAAK,MAAM,UAAU;CAC7C,MAAM,SAAS,KAAK,KAAK,MAAM,eAAe;CAC9C,IAAI,CAAC,cAAc,CAAC,QAAQ,OAAO;CACnC,MAAM,sBAAsB,OAAO,WAAW,EAAE;CAChD,MAAM,kBAAkB,OAAO,OAAO,EAAE;CACxC,IAAI,uBAAuB,IAAI,OAAO;CACtC,MAAM,MAAM,sBAAsB;CAClC,IAAI,OAAO,sBAAsB,OAAO;CACxC,MAAM,YAAY,sBAAsB;CACxC,OAAO;EACL,GAAG;EACH,gBAAgB,QAAQ,OAAO,GAAG,IAAI,OAAO,GAAG,KAAK,UAAU,KAAK,OAAO,GAAG;CAChF;AACF;AACA,MAAM,WAAW,WAAW,cAAc;AAC1C,MAAM,yBAAyB,IAAI,IAAI;AACvC,MAAM,SAAS,OAAO,YACpB,OAAO,QAAQ,QAAQ,CAAC,CAAC,KAAK,CAAC,WAAW,WAAW;CACnD,IAAI,OAAO,OAAO,IAAI,KAAK;CAC3B,IAAI,CAAC,MAAM;EACT,OAAO,kBAAkB,KAAK;EAC9B,OAAO,IAAI,OAAO,IAAI;CACxB;CACA,OAAO,CAAC,WAAW,IAAI;AACzB,CAAC,CACH"}
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@tamagui/tamagui-dev-config",
3
- "version": "3.0.0-beta.924.1",
3
+ "version": "3.0.1",
4
+ "sideEffects": false,
5
+ "license": "MIT",
4
6
  "source": "src/index.ts",
5
7
  "files": [
6
8
  "src",
@@ -32,20 +34,18 @@
32
34
  "clean:build": "tamagui-build clean:build"
33
35
  },
34
36
  "dependencies": {
35
- "@tamagui/animations-css": "3.0.0-beta.924.1",
36
- "@tamagui/animations-motion": "3.0.0-beta.924.1",
37
- "@tamagui/animations-reanimated": "3.0.0-beta.924.1",
38
- "@tamagui/colors": "3.0.0-beta.924.1",
39
- "@tamagui/config": "3.0.0-beta.924.1",
40
- "@tamagui/core": "3.0.0-beta.924.1",
41
- "@tamagui/font-cherry-bomb": "3.0.0-beta.924.1",
42
- "@tamagui/font-inter": "3.0.0-beta.924.1",
43
- "@tamagui/font-silkscreen": "3.0.0-beta.924.1",
44
- "@tamagui/shorthands": "3.0.0-beta.924.1",
45
- "@tamagui/themes": "3.0.0-beta.924.1"
37
+ "@tamagui/animations-css": "3.0.1",
38
+ "@tamagui/animations-motion": "3.0.1",
39
+ "@tamagui/animations-reanimated": "3.0.1",
40
+ "@tamagui/colors": "3.0.1",
41
+ "@tamagui/config": "3.0.1",
42
+ "@tamagui/core": "3.0.1",
43
+ "@tamagui/font-cherry-bomb": "3.0.1",
44
+ "@tamagui/font-inter": "3.0.1",
45
+ "@tamagui/themes": "3.0.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@tamagui/build": "3.0.0-beta.924.1",
48
+ "@tamagui/build": "3.0.1",
49
49
  "react": "19.2.3"
50
50
  },
51
51
  "peerDependencies": {
@@ -55,5 +55,6 @@
55
55
  "type": "git",
56
56
  "url": "git+https://github.com/tamagui/tamagui.git",
57
57
  "directory": "code/packages/tamagui-dev-config"
58
- }
58
+ },
59
+ "releaseSourceCommit": "c156b7cc55e5a6cc5883ebc8189720850ac32dbd"
59
60
  }
package/src/fonts.ts CHANGED
@@ -1,17 +1,28 @@
1
1
  import { createCherryBombFont } from '@tamagui/font-cherry-bomb'
2
- import { createInterFont } from '@tamagui/font-inter'
3
- import { createSilkscreenFont } from '@tamagui/font-silkscreen'
2
+ import { createFont } from '@tamagui/core'
4
3
  import { createGenericFont } from './createGenericFont'
5
4
 
5
+ const isWeb = process.env.TAMAGUI_TARGET === 'web'
6
+
7
+ // Contrast variable font (100-900) for UI and text, paired with Inter italic
8
+ const contrastFamily = isWeb
9
+ ? '"Contrast", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'
10
+ : 'System'
11
+
12
+ // JetBrains Mono, subset to latin + punctuation as a variable font (~19kb), is
13
+ // the only webfont left. it covers every weight from one file.
14
+ const monoFamily = isWeb
15
+ ? '"JetBrains Mono", ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'
16
+ : 'JetBrains Mono'
17
+
6
18
  export const cherryBombFont = createCherryBombFont({
7
- // Cherry Bomb is a heavy rounded display face; fall back to on-brand Inter,
8
- // then heavy web-safe faces, so the brief pre-load flash looks close to the
9
- // real thing instead of thin default Arial.
10
- family:
11
- '"Cherry Bomb", "Inter", "Arial Black", "Helvetica Neue", Helvetica, Arial, sans-serif',
19
+ // Cherry Bomb is a heavy rounded display face; fall back to heavy web-safe
20
+ // faces so the brief pre-load flash looks close to the real thing instead of
21
+ // thin default Arial.
22
+ family: `"Cherry Bomb", "Arial Black", "Helvetica Neue", Helvetica, Arial, sans-serif`,
12
23
  // Cherry Bomb only ships weight 400 (so this doesn't change its look), but a
13
- // heavy weight makes the Inter fallback render at ExtraBold (already preloaded)
14
- // instead of thin, much closer to Cherry Bomb during the load flash.
24
+ // heavy weight makes the system fallback render bold instead of thin, much
25
+ // closer to Cherry Bomb during the load flash.
15
26
  weight: {
16
27
  4: '800',
17
28
  },
@@ -19,67 +30,54 @@ export const cherryBombFont = createCherryBombFont({
19
30
  true: 22.4,
20
31
  },
21
32
  })
22
- export const silkscreenFont = createSilkscreenFont()
23
- export const headingFont = createInterFont(
24
- {
25
- size: {
26
- true: 14,
27
- 5: 13,
28
- 6: 15,
29
- 9: 30,
30
- 10: 44,
31
- },
32
- transform: {
33
- 6: 'uppercase',
34
- 7: 'none',
35
- },
36
- weight: {
37
- 6: '400',
38
- 7: '700',
39
- },
40
- color: {
41
- 6: 'color-focus',
42
- 7: 'color',
43
- },
44
- letterSpacing: {
45
- 5: 2,
46
- 6: 1,
47
- 7: 0,
48
- 8: 0,
49
- 9: -0.1,
50
- 10: -0.25,
51
- 11: -0.5,
52
- 12: -0.75,
53
- 14: -1,
54
- 15: -2,
55
- },
56
- // for native
57
- face: {
58
- 700: { normal: 'InterBold' },
59
- 800: { normal: 'InterBold' },
60
- 900: { normal: 'InterBold' },
61
- },
62
- },
63
- { sizeLineHeight: (size) => Math.round(size * 1.1 + (size < 30 ? 10 : 5)) }
64
- )
65
33
 
66
- export const bodyFont = createInterFont(
67
- {
68
- size: {
69
- true: 14,
70
- },
71
- weight: {
72
- 1: '400',
73
- },
74
- },
75
- {
76
- sizeSize: (size) => Math.round(size),
77
- sizeLineHeight: (size) => Math.round(size * 1.2 + (size >= 20 ? 12 : 8)),
34
+ // one equation for the whole ramp instead of a hand-written table. each step is
35
+ // a little bigger than the one before it, from 9% at the UI sizes up to 19% at
36
+ // the display sizes, because small text wants roughly a point between steps and
37
+ // big text wants a proportion. the table this replaced had a cliff at the top:
38
+ // 30 to 44 between size 9 and 10, a 47% jump next to neighbours around 15%.
39
+ const sizes = () => {
40
+ const out: Record<number | 'true', number> = {
41
+ true: 14,
78
42
  }
79
- )
43
+ let px = 11
44
+ for (let i = 1; i <= 16; i++) {
45
+ out[i] = Math.round(px)
46
+ px *= Math.min(1.19, 1.05 + i * 0.019)
47
+ }
48
+ return out
49
+ }
50
+
51
+ // 11 12 13 14 16 18 21 25 30 36 42 50 60 71 85 101
52
+ const size = sizes()
53
+
54
+ const lineHeights = (ratio: number, extra: number) =>
55
+ Object.fromEntries(
56
+ Object.entries(size).map(([k, v]) => [k, Math.round(v * ratio + extra)])
57
+ ) as typeof size
58
+
59
+ export const headingFont = createFont({
60
+ family: contrastFamily,
61
+ size,
62
+ // eases from 1.4 at label sizes down to 1.3 at display sizes
63
+ lineHeight: lineHeights(1.25, 2),
64
+ weight: { 1: '600' },
65
+ letterSpacing: { 1: 0 },
66
+ })
67
+
68
+ export const bodyFont = createFont({
69
+ family: contrastFamily,
70
+ size,
71
+ // the old curve was size * 1.2 plus a step that jumped from 8 to 12 at size
72
+ // 20, so 18px came out at ratio 1.67 while 22px came out at 1.75: bigger text
73
+ // ended up looser than smaller text. this is monotonic and lands 16px on 25px
74
+ lineHeight: lineHeights(1.35, 3),
75
+ weight: { 1: '400' },
76
+ letterSpacing: { 1: 0 },
77
+ })
80
78
 
81
79
  export const monoFont = createGenericFont(
82
- `"Berkeley Mono", "ui-monospace", "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`,
80
+ monoFamily,
83
81
  {
84
82
  weight: {
85
83
  1: '400',
package/src/index.ts CHANGED
@@ -1,2 +1 @@
1
1
  export * from './tamagui.dev.config'
2
- export * from './media'
@@ -1,10 +1,15 @@
1
1
  import { animationsCSS } from '@tamagui/config/animations-css'
2
2
  import { animationsMotion } from '@tamagui/config/animations-motion'
3
- import { defaultConfig } from '@tamagui/config/v5-subtle'
3
+ // v6-base rather than v6: `defaultConfig` carries a whole theme pack the site
4
+ // replaces with its own themes
5
+ import {
6
+ createV6Config,
7
+ mediaQueryDefaultActive,
8
+ withTailwindTypeScale,
9
+ } from '@tamagui/config/v6-base'
4
10
  import type { CreateTamaguiProps } from '@tamagui/core'
5
11
  import { setupDev } from '@tamagui/core'
6
- import { bodyFont, cherryBombFont, headingFont, monoFont, silkscreenFont } from './fonts'
7
- import { media, mediaQueryDefaultActive } from './media'
12
+ import { bodyFont, cherryBombFont, headingFont, monoFont } from './fonts'
8
13
  import { clientThemes } from './themeMetadata'
9
14
  import { themes } from './themes'
10
15
 
@@ -12,14 +17,6 @@ setupDev({
12
17
  visualizer: true,
13
18
  })
14
19
 
15
- const fonts = {
16
- heading: headingFont,
17
- body: bodyFont,
18
- mono: monoFont,
19
- silkscreen: silkscreenFont,
20
- cherryBomb: cherryBombFont,
21
- }
22
-
23
20
  export const animations = {
24
21
  default: animationsMotion,
25
22
  css: animationsCSS,
@@ -30,14 +27,21 @@ const configuredThemes =
30
27
  ? (clientThemes as unknown as typeof themes)
31
28
  : themes
32
29
 
30
+ const v6 = createV6Config({ themes: configuredThemes })
31
+
33
32
  export const config = {
34
- ...defaultConfig,
35
- themes: configuredThemes,
36
- fonts,
33
+ ...v6,
34
+ fonts: {
35
+ heading: withTailwindTypeScale(headingFont),
36
+ body: withTailwindTypeScale(bodyFont),
37
+ mono: monoFont,
38
+ cherryBomb: cherryBombFont,
39
+ },
37
40
  animations,
38
- media,
41
+ // a copy, since the demo media below is assigned onto it
42
+ media: { ...v6.media },
39
43
  settings: {
40
- ...defaultConfig.settings,
44
+ ...v6.settings,
41
45
  mediaQueryDefaultActive,
42
46
  allowedStyleValues: 'somewhat-strict-web',
43
47
  // allow both shorthands and longhand names for flexibility
@@ -1,5 +1,7 @@
1
1
  const schemes = ['light', 'dark']
2
- const colors = ['black', 'white', 'gray', 'blue', 'red', 'yellow', 'green']
2
+ // only the tint families in @tamagui/logo, since every color here costs 192 theme
3
+ // names (and their selectors) in the render-blocking stylesheet
4
+ const colors = ['gray', 'blue', 'red', 'yellow', 'green']
3
5
  const paletteColors = [
4
6
  'blue',
5
7
  'gray',
@@ -27,11 +29,14 @@ export const componentThemes = [
27
29
  ]
28
30
 
29
31
  const numbered = (prefix: string, count: number) =>
30
- Array.from({ length: count }, (_, index) => `${prefix}${index + 1}`)
32
+ Array.from({ length: count }, (_, index) => `${prefix}-${index + 1}`)
31
33
 
32
34
  const baseThemeNames = schemes.flatMap((scheme) => [
33
35
  scheme,
34
36
  `${scheme}_accent`,
37
+ // brand is neutral, so one per scheme covers every tint: theme resolution
38
+ // walks the parent name down, and `light_blue_brand` lands on `light_brand`
39
+ `${scheme}_brand`,
35
40
  `${scheme}_surface1`,
36
41
  `${scheme}_surface2`,
37
42
  ...colors.flatMap((color) => [
@@ -47,7 +52,7 @@ const levelThemeNames = baseThemeNames.flatMap((themeName) =>
47
52
  ? [themeName.replace(/_surface1$/, '_level2')]
48
53
  : themeName.endsWith('_surface2')
49
54
  ? [themeName.replace(/_surface2$/, '_level3')]
50
- : themeName.endsWith('_accent')
55
+ : themeName.endsWith('_accent') || themeName.endsWith('_brand')
51
56
  ? [`${themeName}_level2`, `${themeName}_level3`]
52
57
  : []
53
58
  )
@@ -80,7 +85,7 @@ export const themeVariableNames = [
80
85
  'background-focus',
81
86
  'background-hover',
82
87
  'background-press',
83
- ...alphaSteps.map((step) => `background${step}`),
88
+ ...alphaSteps.map((step) => `background-${step}`),
84
89
  'border-color',
85
90
  'border-color-focus',
86
91
  'border-color-hover',
@@ -90,18 +95,18 @@ export const themeVariableNames = [
90
95
  'color-hover',
91
96
  'color-press',
92
97
  'color-transparent',
93
- ...alphaSteps.map((step) => `color${step}`),
98
+ ...alphaSteps.map((step) => `color-${step}`),
94
99
  ...numbered('color', 12),
95
100
  'outline-color',
96
101
  'placeholder-color',
97
102
  'shadow-color',
98
103
  ...['black', 'white'].flatMap((color) => [
99
104
  color,
100
- `${color}0`,
101
- `${color}02`,
102
- `${color}04`,
103
- `${color}06`,
104
- `${color}08`,
105
+ `${color}-0`,
106
+ `${color}-02`,
107
+ `${color}-04`,
108
+ `${color}-06`,
109
+ `${color}-08`,
105
110
  ...numbered(color, 12),
106
111
  ]),
107
112
  ...paletteColors.flatMap((color) => numbered(color, 12)),
package/src/themes.ts CHANGED
@@ -25,6 +25,19 @@ for (const [themeName, theme] of Object.entries(selectedThemes)) {
25
25
  }
26
26
  }
27
27
 
28
+ // `brand` is the loudest surface in the v3 grammar, and the convention is that
29
+ // it inverses: a brand button, checked switch or tooltip on a light page is
30
+ // near-black with light text, the same trade shadcn makes for its primary. it
31
+ // stays neutral under a tinted parent, so the two scheme roots are enough. the
32
+ // bold scale does not nest, so its levels alias it rather than walking back
33
+ // toward the page.
34
+ for (const scheme of ['light', 'dark']) {
35
+ const inverse = selectedThemes[scheme === 'light' ? 'dark' : 'light']
36
+ selectedThemes[`${scheme}_brand`] = inverse
37
+ selectedThemes[`${scheme}_brand_level2`] = inverse
38
+ selectedThemes[`${scheme}_brand_level3`] = inverse
39
+ }
40
+
28
41
  // V5's component-theme lookup stays on the active parent theme when a more
29
42
  // specific component subtheme does not exist. Materialize those fallback
30
43
  // names so a V3 nested Theme resolves identically instead of jumping back to
@@ -38,4 +51,47 @@ for (const themeName of themeNames) {
38
51
  }
39
52
  }
40
53
 
41
- export const themes = toV6Themes(selectedThemes)
54
+ // V5's light gray ramp puts `border-color` on color4, twelve lightness points
55
+ // below a 97% background, so every card, input and code block on the site is
56
+ // outlined in #d9d9d9. Colored light themes already sit within six points of
57
+ // their background and read fine, so rather than repaint the pack, cap how far
58
+ // a light theme's border may fall below its own background. Dark themes are
59
+ // left alone: a border there has to climb away from the background to show up.
60
+ const MAX_LIGHT_BORDER_GAP = 8
61
+
62
+ const hsla = /^hsla\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*,\s*([\d.]+)\s*\)$/
63
+
64
+ const softenLightBorder = <Theme extends Record<string, any>>(theme: Theme): Theme => {
65
+ const background = hsla.exec(theme.background)
66
+ const border = hsla.exec(theme['border-color'])
67
+ if (!background || !border) return theme
68
+
69
+ const backgroundLightness = Number(background[3])
70
+ const borderLightness = Number(border[3])
71
+ if (backgroundLightness <= 50) return theme
72
+
73
+ const gap = backgroundLightness - borderLightness
74
+ if (gap <= MAX_LIGHT_BORDER_GAP) return theme
75
+
76
+ const lightness = backgroundLightness - MAX_LIGHT_BORDER_GAP
77
+ return {
78
+ ...theme,
79
+ 'border-color': `hsla(${border[1]}, ${border[2]}%, ${lightness}%, ${border[4]})`,
80
+ }
81
+ }
82
+
83
+ const v6Themes = toV6Themes(selectedThemes)
84
+
85
+ // several names alias one object above, so keep that sharing through the edit
86
+ const edited = new Map<object, object>()
87
+
88
+ export const themes = Object.fromEntries(
89
+ Object.entries(v6Themes).map(([themeName, theme]) => {
90
+ let next = edited.get(theme)
91
+ if (!next) {
92
+ next = softenLightBorder(theme)
93
+ edited.set(theme, next)
94
+ }
95
+ return [themeName, next]
96
+ })
97
+ ) as typeof v6Themes
@@ -1,80 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var media_exports = {};
22
- __export(media_exports, {
23
- demoMedia: () => demoMedia,
24
- media: () => media,
25
- mediaQueryDefaultActive: () => mediaQueryDefaultActive,
26
- widths: () => widths
27
- });
28
- module.exports = __toCommonJS(media_exports);
29
- const demoMedia = [
30
- 500,
31
- 620,
32
- 780,
33
- 900
34
- ];
35
- const widths = [
36
- 660,
37
- 800,
38
- 1020,
39
- 1280
40
- ];
41
- const breakpoints = {
42
- "2xl": 1536,
43
- xl: 1280,
44
- lg: 1024,
45
- md: 768,
46
- sm: 640,
47
- xs: 460,
48
- "2xs": 340
49
- };
50
- const media = {
51
- "max-xs": { maxWidth: breakpoints.xs },
52
- "max-2xs": { maxWidth: breakpoints["2xs"] },
53
- "max-sm": { maxWidth: breakpoints.sm },
54
- "max-md": { maxWidth: breakpoints.md },
55
- "max-lg": { maxWidth: breakpoints.lg },
56
- "max-xl": { maxWidth: breakpoints.xl },
57
- "max-2xl": { maxWidth: breakpoints["2xl"] },
58
- xl: { maxWidth: 1650 },
59
- lg_xl: { maxWidth: 1400 },
60
- lg: { maxWidth: 1280 },
61
- md: { maxWidth: 1020 },
62
- sm: { maxWidth: 800 },
63
- xs: { maxWidth: 660 },
64
- xxs: { maxWidth: 390 },
65
- gtXxs: { minWidth: 390 + 1 },
66
- gtXs: { minWidth: 660 + 1 },
67
- gtSm: { minWidth: 800 + 1 },
68
- gtMd: { minWidth: 1020 + 1 },
69
- gtLg: { minWidth: 1280 + 1 },
70
- gtXl: { minWidth: 1650 + 1 },
71
- pointerFine: { pointer: "fine" }
72
- };
73
- const mediaQueryDefaultActive = {
74
- xl: true,
75
- lg: true,
76
- md: true,
77
- sm: true,
78
- xs: true,
79
- xxs: false
80
- };
@@ -1,55 +0,0 @@
1
- const demoMedia = [
2
- 500,
3
- 620,
4
- 780,
5
- 900
6
- ];
7
- const widths = [
8
- 660,
9
- 800,
10
- 1020,
11
- 1280
12
- ];
13
- const breakpoints = {
14
- "2xl": 1536,
15
- xl: 1280,
16
- lg: 1024,
17
- md: 768,
18
- sm: 640,
19
- xs: 460,
20
- "2xs": 340
21
- };
22
- const media = {
23
- "max-xs": { maxWidth: breakpoints.xs },
24
- "max-2xs": { maxWidth: breakpoints["2xs"] },
25
- "max-sm": { maxWidth: breakpoints.sm },
26
- "max-md": { maxWidth: breakpoints.md },
27
- "max-lg": { maxWidth: breakpoints.lg },
28
- "max-xl": { maxWidth: breakpoints.xl },
29
- "max-2xl": { maxWidth: breakpoints["2xl"] },
30
- xl: { maxWidth: 1650 },
31
- lg_xl: { maxWidth: 1400 },
32
- lg: { maxWidth: 1280 },
33
- md: { maxWidth: 1020 },
34
- sm: { maxWidth: 800 },
35
- xs: { maxWidth: 660 },
36
- xxs: { maxWidth: 390 },
37
- gtXxs: { minWidth: 390 + 1 },
38
- gtXs: { minWidth: 660 + 1 },
39
- gtSm: { minWidth: 800 + 1 },
40
- gtMd: { minWidth: 1020 + 1 },
41
- gtLg: { minWidth: 1280 + 1 },
42
- gtXl: { minWidth: 1650 + 1 },
43
- pointerFine: { pointer: "fine" }
44
- };
45
- const mediaQueryDefaultActive = {
46
- xl: true,
47
- lg: true,
48
- md: true,
49
- sm: true,
50
- xs: true,
51
- xxs: false
52
- };
53
-
54
- export { demoMedia, media, mediaQueryDefaultActive, widths };
55
- //# sourceMappingURL=media.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"media.js","names":[],"sources":["esm/media.js"],"sourcesContent":["const demoMedia = [500, 620, 780, 900];\nconst widths = [660, 800, 1020, 1280];\nconst breakpoints = {\n \"2xl\": 1536,\n xl: 1280,\n lg: 1024,\n md: 768,\n sm: 640,\n xs: 460,\n \"2xs\": 340\n};\nconst media = {\n // v4 Config\n \"max-xs\": { maxWidth: breakpoints.xs },\n \"max-2xs\": { maxWidth: breakpoints[\"2xs\"] },\n \"max-sm\": { maxWidth: breakpoints.sm },\n \"max-md\": { maxWidth: breakpoints.md },\n \"max-lg\": { maxWidth: breakpoints.lg },\n \"max-xl\": { maxWidth: breakpoints.xl },\n \"max-2xl\": { maxWidth: breakpoints[\"2xl\"] },\n // for site\n xl: { maxWidth: 1650 },\n // between lg and xl - for studio usage\n lg_xl: { maxWidth: 1400 },\n lg: { maxWidth: 1280 },\n md: { maxWidth: 1020 },\n sm: { maxWidth: 800 },\n xs: { maxWidth: 660 },\n xxs: { maxWidth: 390 },\n gtXxs: { minWidth: 390 + 1 },\n gtXs: { minWidth: 660 + 1 },\n gtSm: { minWidth: 800 + 1 },\n gtMd: { minWidth: 1020 + 1 },\n gtLg: { minWidth: 1280 + 1 },\n gtXl: { minWidth: 1650 + 1 },\n pointerFine: { pointer: \"fine\" }\n};\nconst mediaQueryDefaultActive = {\n xl: true,\n lg: true,\n md: true,\n sm: true,\n xs: true,\n // false\n xxs: false\n};\nexport {\n demoMedia,\n media,\n mediaQueryDefaultActive,\n widths\n};\n//# sourceMappingURL=media.js.map\n"],"mappings":";AAAA,MAAM,YAAY;CAAC;CAAK;CAAK;CAAK;AAAG;AACrC,MAAM,SAAS;CAAC;CAAK;CAAK;CAAM;AAAI;AACpC,MAAM,cAAc;CAClB,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;AACT;AACA,MAAM,QAAQ;CAEZ,UAAU,EAAE,UAAU,YAAY,GAAG;CACrC,WAAW,EAAE,UAAU,YAAY,OAAO;CAC1C,UAAU,EAAE,UAAU,YAAY,GAAG;CACrC,UAAU,EAAE,UAAU,YAAY,GAAG;CACrC,UAAU,EAAE,UAAU,YAAY,GAAG;CACrC,UAAU,EAAE,UAAU,YAAY,GAAG;CACrC,WAAW,EAAE,UAAU,YAAY,OAAO;CAE1C,IAAI,EAAE,UAAU,KAAK;CAErB,OAAO,EAAE,UAAU,KAAK;CACxB,IAAI,EAAE,UAAU,KAAK;CACrB,IAAI,EAAE,UAAU,KAAK;CACrB,IAAI,EAAE,UAAU,IAAI;CACpB,IAAI,EAAE,UAAU,IAAI;CACpB,KAAK,EAAE,UAAU,IAAI;CACrB,OAAO,EAAE,UAAU,MAAM,EAAE;CAC3B,MAAM,EAAE,UAAU,MAAM,EAAE;CAC1B,MAAM,EAAE,UAAU,MAAM,EAAE;CAC1B,MAAM,EAAE,UAAU,OAAO,EAAE;CAC3B,MAAM,EAAE,UAAU,OAAO,EAAE;CAC3B,MAAM,EAAE,UAAU,OAAO,EAAE;CAC3B,aAAa,EAAE,SAAS,OAAO;AACjC;AACA,MAAM,0BAA0B;CAC9B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,KAAK;AACP"}
package/src/media.ts DELETED
@@ -1,55 +0,0 @@
1
- export const demoMedia = [500, 620, 780, 900]
2
- export const widths = [660, 800, 1020, 1280]
3
-
4
- // note order is important!
5
- // earlier defined = less important
6
-
7
- // v4 Config
8
- const breakpoints = {
9
- '2xl': 1536,
10
- xl: 1280,
11
- lg: 1024,
12
- md: 768,
13
- sm: 640,
14
- xs: 460,
15
- '2xs': 340,
16
- }
17
-
18
- export const media = {
19
- // v4 Config
20
- 'max-xs': { maxWidth: breakpoints.xs },
21
- 'max-2xs': { maxWidth: breakpoints['2xs'] },
22
- 'max-sm': { maxWidth: breakpoints.sm },
23
- 'max-md': { maxWidth: breakpoints.md },
24
- 'max-lg': { maxWidth: breakpoints.lg },
25
- 'max-xl': { maxWidth: breakpoints.xl },
26
- 'max-2xl': { maxWidth: breakpoints['2xl'] },
27
- // for site
28
- xl: { maxWidth: 1650 },
29
- // between lg and xl - for studio usage
30
- lg_xl: { maxWidth: 1400 },
31
- lg: { maxWidth: 1280 },
32
- md: { maxWidth: 1020 },
33
- sm: { maxWidth: 800 },
34
- xs: { maxWidth: 660 },
35
- xxs: { maxWidth: 390 },
36
- gtXxs: { minWidth: 390 + 1 },
37
- gtXs: { minWidth: 660 + 1 },
38
- gtSm: { minWidth: 800 + 1 },
39
- gtMd: { minWidth: 1020 + 1 },
40
- gtLg: { minWidth: 1280 + 1 },
41
- gtXl: { minWidth: 1650 + 1 },
42
- pointerFine: { pointer: 'fine' },
43
- } as const
44
-
45
- // note all the non "gt" ones should be true to start to match mobile-first
46
- // were aiming for "xs" to be the default to "gtXs" true too
47
- export const mediaQueryDefaultActive = {
48
- xl: true,
49
- lg: true,
50
- md: true,
51
- sm: true,
52
- xs: true,
53
- // false
54
- xxs: false,
55
- }