@multiplatform.one/theme 6.1.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/package.json +22 -9
- package/src/dates.spec.ts +75 -0
- package/src/dates.ts +130 -0
- package/src/devWarn.spec.ts +144 -0
- package/src/devWarn.ts +235 -0
- package/src/figma/figmaTokens.spec.ts +244 -0
- package/src/figma/figmaTokens.ts +503 -0
- package/src/font.ts +6 -8
- package/src/fonts/createFontLoader.web.ts +15 -4
- package/src/index.ts +7 -0
- package/src/keyboardFocusRing.ts +45 -0
- package/src/menuRow.spec.ts +32 -0
- package/src/menuRow.ts +31 -0
- package/src/theme/FontKnobStyles.native.tsx +24 -0
- package/src/theme/FontKnobStyles.tsx +256 -0
- package/src/theme/animations/reactNative.ts +6 -1
- package/src/theme/chartPalette.spec.ts +159 -0
- package/src/theme/chartPalette.ts +170 -0
- package/src/theme/colorRules.ts +33 -1
- package/src/theme/cookies.spec.ts +32 -0
- package/src/theme/cookiesPersistence.spec.ts +86 -0
- package/src/theme/cornerSmoothing.native.ts +16 -0
- package/src/theme/cornerSmoothing.spec.ts +27 -0
- package/src/theme/cornerSmoothing.ts +46 -0
- package/src/theme/createDefaultThemeConfig.ts +32 -8
- package/src/theme/createThemeConfig.spec.ts +137 -0
- package/src/theme/createThemes.ts +77 -2
- package/src/theme/defaults/accent.ts +39 -0
- package/src/theme/defaults/base.ts +63 -0
- package/src/theme/defaults/builderOptions.ts +174 -0
- package/src/theme/defaults/fonts.spec.ts +87 -0
- package/src/theme/defaults/fonts.ts +89 -0
- package/src/theme/defaults/index.ts +4 -0
- package/src/theme/devtools/ThemeDevtoolsPanel.tsx +196 -2
- package/src/theme/devtools/buildSnapshot.ts +11 -0
- package/src/theme/devtools/knobIcons.tsx +141 -0
- package/src/theme/devtools/vizConstants.ts +1 -1
- package/src/theme/focusState.spec.ts +174 -0
- package/src/theme/focusState.ts +112 -0
- package/src/theme/fontKnobStyles.spec.ts +98 -0
- package/src/theme/hairline.native.ts +43 -0
- package/src/theme/hairline.spec.ts +63 -0
- package/src/theme/hairline.ts +101 -0
- package/src/theme/index.ts +8 -0
- package/src/theme/intent.spec.tsx +2 -2
- package/src/theme/intents.ts +6 -2
- package/src/theme/knobs.ts +134 -2
- package/src/theme/layoutTokens.spec.ts +75 -0
- package/src/theme/layoutTokens.ts +213 -0
- package/src/theme/layoutTokensHooks.spec.tsx +157 -0
- package/src/theme/presets.spec.ts +17 -0
- package/src/theme/presets.ts +22 -2
- package/src/theme/readableColor.ts +101 -0
- package/src/theme/recipes.ts +130 -7
- package/src/theme/resolveKnobs.spec.ts +560 -21
- package/src/theme/resolveKnobs.ts +267 -23
- package/src/theme/shared.tsx +26 -2
- package/src/theme/useResolvedKnobs.ts +67 -26
- package/src/theme/useResolvedKnobsBehavior.spec.tsx +166 -0
- package/types/audit/constraintAudit.d.ts +83 -0
- package/types/audit/constraintAudit.d.ts.map +1 -0
- package/types/audit/diffReport.d.ts +45 -0
- package/types/audit/diffReport.d.ts.map +1 -0
- package/types/audit/index.d.ts +5 -0
- package/types/audit/index.d.ts.map +1 -0
- package/types/dates.d.ts +52 -0
- package/types/dates.d.ts.map +1 -0
- package/types/devWarn.d.ts +104 -0
- package/types/devWarn.d.ts.map +1 -0
- package/types/figma/figmaTokens.d.ts +168 -0
- package/types/figma/figmaTokens.d.ts.map +1 -0
- package/types/font.d.ts +5 -0
- package/types/font.d.ts.map +1 -0
- package/types/fonts/createFontLoader.d.ts +3 -0
- package/types/fonts/createFontLoader.d.ts.map +1 -0
- package/types/fonts/createFontLoader.web.d.ts +3 -0
- package/types/fonts/createFontLoader.web.d.ts.map +1 -0
- package/types/fonts/index.d.ts +3 -0
- package/types/fonts/index.d.ts.map +1 -0
- package/types/fonts/types.d.ts +12 -0
- package/types/fonts/types.d.ts.map +1 -0
- package/types/index.d.ts +9 -0
- package/types/index.d.ts.map +1 -0
- package/types/keyboardFocusRing.d.ts +32 -0
- package/types/keyboardFocusRing.d.ts.map +1 -0
- package/types/menuRow.d.ts +32 -0
- package/types/menuRow.d.ts.map +1 -0
- package/types/theme/FontKnobStyles.d.ts +49 -0
- package/types/theme/FontKnobStyles.d.ts.map +1 -0
- package/types/theme/FontKnobStyles.native.d.ts +12 -0
- package/types/theme/FontKnobStyles.native.d.ts.map +1 -0
- package/types/theme/Intent.d.ts +20 -0
- package/types/theme/Intent.d.ts.map +1 -0
- package/types/theme/Preset.d.ts +15 -0
- package/types/theme/Preset.d.ts.map +1 -0
- package/types/theme/PresetContext.d.ts +18 -0
- package/types/theme/PresetContext.d.ts.map +1 -0
- package/types/theme/Tint.d.ts +19 -0
- package/types/theme/Tint.d.ts.map +1 -0
- package/types/theme/animations/css.d.ts +24 -0
- package/types/theme/animations/css.d.ts.map +1 -0
- package/types/theme/animations/index.d.ts +2 -0
- package/types/theme/animations/index.d.ts.map +1 -0
- package/types/theme/animations/index.web.d.ts +2 -0
- package/types/theme/animations/index.web.d.ts.map +1 -0
- package/types/theme/animations/reactNative.d.ts +104 -0
- package/types/theme/animations/reactNative.d.ts.map +1 -0
- package/types/theme/chartPalette.d.ts +62 -0
- package/types/theme/chartPalette.d.ts.map +1 -0
- package/types/theme/colorRules.d.ts +69 -0
- package/types/theme/colorRules.d.ts.map +1 -0
- package/types/theme/cookies.d.ts +76 -0
- package/types/theme/cookies.d.ts.map +1 -0
- package/types/theme/cornerSmoothing.d.ts +31 -0
- package/types/theme/cornerSmoothing.d.ts.map +1 -0
- package/types/theme/cornerSmoothing.native.d.ts +14 -0
- package/types/theme/cornerSmoothing.native.d.ts.map +1 -0
- package/types/theme/createDefaultThemeConfig.d.ts +37 -0
- package/types/theme/createDefaultThemeConfig.d.ts.map +1 -0
- package/types/theme/createThemes.d.ts +38 -0
- package/types/theme/createThemes.d.ts.map +1 -0
- package/types/theme/defaults/accent.d.ts +3 -0
- package/types/theme/defaults/accent.d.ts.map +1 -0
- package/types/theme/defaults/base.d.ts +3 -0
- package/types/theme/defaults/base.d.ts.map +1 -0
- package/types/theme/defaults/builderOptions.d.ts +3 -0
- package/types/theme/defaults/builderOptions.d.ts.map +1 -0
- package/types/theme/defaults/fonts.d.ts +7 -0
- package/types/theme/defaults/fonts.d.ts.map +1 -0
- package/types/theme/defaults/index.d.ts +5 -0
- package/types/theme/defaults/index.d.ts.map +1 -0
- package/types/theme/devtools/ColorLineVisualizer.d.ts +17 -0
- package/types/theme/devtools/ColorLineVisualizer.d.ts.map +1 -0
- package/types/theme/devtools/ThemeDevtoolsPanel.d.ts +87 -0
- package/types/theme/devtools/ThemeDevtoolsPanel.d.ts.map +1 -0
- package/types/theme/devtools/buildSnapshot.d.ts +12 -0
- package/types/theme/devtools/buildSnapshot.d.ts.map +1 -0
- package/types/theme/devtools/knobIcons.d.ts +33 -0
- package/types/theme/devtools/knobIcons.d.ts.map +1 -0
- package/types/theme/devtools/vizConstants.d.ts +5 -0
- package/types/theme/devtools/vizConstants.d.ts.map +1 -0
- package/types/theme/focusState.d.ts +42 -0
- package/types/theme/focusState.d.ts.map +1 -0
- package/types/theme/hairline.d.ts +88 -0
- package/types/theme/hairline.d.ts.map +1 -0
- package/types/theme/hairline.native.d.ts +42 -0
- package/types/theme/hairline.native.d.ts.map +1 -0
- package/types/theme/index.d.ts +29 -0
- package/types/theme/index.d.ts.map +1 -0
- package/types/theme/intents.d.ts +3 -0
- package/types/theme/intents.d.ts.map +1 -0
- package/types/theme/knobs.d.ts +236 -0
- package/types/theme/knobs.d.ts.map +1 -0
- package/types/theme/layoutTokens.d.ts +104 -0
- package/types/theme/layoutTokens.d.ts.map +1 -0
- package/types/theme/preset.types.d.ts +21 -0
- package/types/theme/preset.types.d.ts.map +1 -0
- package/types/theme/presets.d.ts +4 -0
- package/types/theme/presets.d.ts.map +1 -0
- package/types/theme/readableColor.d.ts +17 -0
- package/types/theme/readableColor.d.ts.map +1 -0
- package/types/theme/recipes.d.ts +200 -0
- package/types/theme/recipes.d.ts.map +1 -0
- package/types/theme/resolveKnobs.d.ts +22 -0
- package/types/theme/resolveKnobs.d.ts.map +1 -0
- package/types/theme/shared.d.ts +40 -0
- package/types/theme/shared.d.ts.map +1 -0
- package/types/theme/theme.d.ts +19 -0
- package/types/theme/theme.d.ts.map +1 -0
- package/types/theme/theme.native.d.ts +10 -0
- package/types/theme/theme.native.d.ts.map +1 -0
- package/types/theme/useColorScale.d.ts +7 -0
- package/types/theme/useColorScale.d.ts.map +1 -0
- package/types/theme/useColorScale.native.d.ts +6 -0
- package/types/theme/useColorScale.native.d.ts.map +1 -0
- package/types/theme/useResolvedKnobs.d.ts +32 -0
- package/types/theme/useResolvedKnobs.d.ts.map +1 -0
- package/types/theme/useTheme.d.ts +31 -0
- package/types/theme/useTheme.d.ts.map +1 -0
- package/types/theme/useTheme.native.d.ts +10 -0
- package/types/theme/useTheme.native.d.ts.map +1 -0
- package/CHANGELOG.md +0 -53
- package/src/theme/__snapshots__/resolveKnobs.spec.ts.snap +0 -69
- package/src/theme/pokemonScreen.spec.ts +0 -109
- package/tsconfig.json +0 -11
- package/vitest.config.mjs +0 -9
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Group 5.1 — Pokemon screen source-code analysis tests.
|
|
3
|
-
*
|
|
4
|
-
* These tests verify that the refactored Pokemon files follow the
|
|
5
|
-
* Tamagui-native Card pattern and contain zero hardcoded styling values.
|
|
6
|
-
*/
|
|
7
|
-
import fs from "node:fs";
|
|
8
|
-
import path from "node:path";
|
|
9
|
-
import { describe, expect, it } from "vitest";
|
|
10
|
-
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
// Helpers
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
|
|
15
|
-
const root = path.resolve(__dirname, "../../../..");
|
|
16
|
-
|
|
17
|
-
function readSource(relativePath: string): string {
|
|
18
|
-
return fs.readFileSync(path.resolve(root, relativePath), "utf-8");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Returns all non-comment, non-import lines from a source file.
|
|
23
|
-
* Strips single-line comments and block comments for cleaner matching.
|
|
24
|
-
*/
|
|
25
|
-
function codeLines(source: string): string[] {
|
|
26
|
-
return source
|
|
27
|
-
.replace(/\/\*[\s\S]*?\*\//g, "") // strip block comments
|
|
28
|
-
.split("\n")
|
|
29
|
-
.map((l) => l.replace(/\/\/.*$/, "").trim()) // strip line comments
|
|
30
|
-
.filter((l) => l.length > 0 && !l.startsWith("import ") && !l.startsWith("export type"));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
// Pokemon source files under test
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
|
|
37
|
-
const pokemonFiles = [
|
|
38
|
-
"features/pokemon/screen.tsx",
|
|
39
|
-
"features/pokemon/detail.tsx",
|
|
40
|
-
"features/pokemon/components/PokemonCard.tsx",
|
|
41
|
-
"features/pokemon/components/MoveList.tsx",
|
|
42
|
-
"features/pokemon/components/AbilityList.tsx",
|
|
43
|
-
"features/pokemon/components/TypeList.tsx",
|
|
44
|
-
"features/pokemon/components/PokemonStats.tsx",
|
|
45
|
-
"public/frappe-ui/src/FrappeImageView.tsx",
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
49
|
-
// Tests
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
|
|
52
|
-
describe("Pokemon screen — Card rendering with native Tamagui props", () => {
|
|
53
|
-
it("screen.tsx uses Card with elevation, borderWidth, and Card.Background/Card.Footer", () => {
|
|
54
|
-
const src = readSource("features/pokemon/screen.tsx");
|
|
55
|
-
expect(src).toContain("<Card");
|
|
56
|
-
expect(src).toMatch(/elevation/);
|
|
57
|
-
expect(src).toMatch(/borderWidth/);
|
|
58
|
-
expect(src).toContain("Card.Background");
|
|
59
|
-
expect(src).toContain("Card.Footer");
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("screen.tsx uses ToggleGroup for view switcher instead of manual Button toggles", () => {
|
|
63
|
-
const src = readSource("features/pokemon/screen.tsx");
|
|
64
|
-
expect(src).toContain("ToggleGroup");
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("FrappeImageView.tsx uses Card with elevation, borderWidth, and sizeToken", () => {
|
|
68
|
-
const src = readSource("public/frappe-ui/src/FrappeImageView.tsx");
|
|
69
|
-
expect(src).toContain("<Card");
|
|
70
|
-
expect(src).toMatch(/elevation/);
|
|
71
|
-
expect(src).toMatch(/borderWidth/);
|
|
72
|
-
expect(src).toContain("sizeToken");
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
describe("Pokemon screen — no hardcoded styling values", () => {
|
|
77
|
-
for (const filePath of pokemonFiles) {
|
|
78
|
-
it(`${filePath} has no hardcoded borderRadius, padding, gap, or elevation overrides`, () => {
|
|
79
|
-
const src = readSource(filePath);
|
|
80
|
-
const lines = codeLines(src);
|
|
81
|
-
|
|
82
|
-
for (const line of lines) {
|
|
83
|
-
// Skip lines that are prop definitions on Card/etc (elevate, bordered are fine)
|
|
84
|
-
// Skip lines that are Tamagui token references like "$3", "$4"
|
|
85
|
-
// We're looking for raw numeric values assigned to styling props
|
|
86
|
-
|
|
87
|
-
// No hardcoded borderRadius with raw numbers (e.g. borderRadius={12})
|
|
88
|
-
expect(line).not.toMatch(/borderRadius[=:{]\s*\d+(?!\s*\})/);
|
|
89
|
-
|
|
90
|
-
// No manual elevation={number} (should use `elevate` boolean instead)
|
|
91
|
-
// Allow elevation on Progress.Indicator or as Tamagui token strings
|
|
92
|
-
if (!line.includes("Progress")) {
|
|
93
|
-
expect(line).not.toMatch(/elevation[=:{]\s*\d+/);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// No spreading of borderRadiusProps (Card handles via size)
|
|
97
|
-
expect(line).not.toMatch(/\.\.\.themeProps\.borderRadiusProps/);
|
|
98
|
-
|
|
99
|
-
// No spreading of elevationProps (Card handles via elevate)
|
|
100
|
-
expect(line).not.toMatch(/\.\.\.themeProps\.elevationProps/);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
it("screen.tsx uses sizeToken on Card components", () => {
|
|
106
|
-
const src = readSource("features/pokemon/screen.tsx");
|
|
107
|
-
expect(src).toContain("sizeToken");
|
|
108
|
-
});
|
|
109
|
-
});
|
package/tsconfig.json
DELETED
package/vitest.config.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createVitestConfig } from "@multiplatform.one/config/vitest";
|
|
2
|
-
|
|
3
|
-
export default createVitestConfig({
|
|
4
|
-
tamaguiConfig: false,
|
|
5
|
-
environment: "happy-dom",
|
|
6
|
-
replaceReactNative: false,
|
|
7
|
-
include: ["src/**/*.spec.{ts,tsx}", "src/**/*.test.{ts,tsx}"],
|
|
8
|
-
exclude: ["node_modules", "dist"],
|
|
9
|
-
});
|