@multiplatform.one/theme 6.0.4 → 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 -46
- 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
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { ColorTokens, TransitionProp } from "tamagui";
|
|
2
|
+
import type { Knobs } from "./knobs";
|
|
3
|
+
export interface ControlStateProps {
|
|
4
|
+
borderRadius?: string;
|
|
5
|
+
borderWidth?: number;
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
padding?: string;
|
|
8
|
+
/** Focus-visible ring (DG-A11Y-01); always ≥2 via `ensureFocusVisibleRing`. */
|
|
9
|
+
outlineWidth?: number;
|
|
10
|
+
outlineStyle?: "solid" | "none";
|
|
11
|
+
outlineColor?: string;
|
|
12
|
+
outlineOffset?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface TextStateProps {
|
|
15
|
+
color?: string;
|
|
16
|
+
fontFamily?: string;
|
|
17
|
+
fontWeight?: string;
|
|
18
|
+
fontSize?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ElevationStateProps {
|
|
21
|
+
/** Size token on web ("$1"); numeric tokens.size value on native (RN-safe). */
|
|
22
|
+
elevation?: string | number;
|
|
23
|
+
}
|
|
24
|
+
/** Text-bearing control chrome (Button, Chip, Input.Box): muted fill/border, no opacity. */
|
|
25
|
+
export interface DisabledSurfaceProps {
|
|
26
|
+
backgroundColor?: string;
|
|
27
|
+
borderColor?: string;
|
|
28
|
+
cursor?: "not-allowed";
|
|
29
|
+
}
|
|
30
|
+
/** Text-free control chrome (switch track, checkbox box, radio ring, stars): opacity dim. */
|
|
31
|
+
export interface DisabledChromeProps {
|
|
32
|
+
opacity?: number;
|
|
33
|
+
cursor?: "not-allowed";
|
|
34
|
+
}
|
|
35
|
+
/** Label/value text and glyphs riding inside disabled surface chrome (stays ≥ AA). */
|
|
36
|
+
export interface DisabledTextProps {
|
|
37
|
+
color?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Whole field assembly (FieldLayout wrapper / standalone control frame). */
|
|
40
|
+
export interface DisabledAssemblyProps {
|
|
41
|
+
opacity?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resolved disabled treatment (LC-40 DISABLED-VISIBLE / DG-ST-05). A control
|
|
45
|
+
* rendered disabled MUST be visually distinguishable from its enabled twin
|
|
46
|
+
* under BOTH `disabledStyle` values. Fragments by anatomy — spread whole,
|
|
47
|
+
* never cherry-pick, and only when `disabled` (read-only is a different
|
|
48
|
+
* state and never dims):
|
|
49
|
+
*
|
|
50
|
+
* - `surfaceKnobProps` — chrome that CONTAINS text (Button, Chip, Input.Box):
|
|
51
|
+
* fill/border wash to the muted tier without opacity so the inner
|
|
52
|
+
* label/value text (via `textKnobProps`, `$color11`) keeps ≥ 4.5:1.
|
|
53
|
+
* - `selectedSurfaceKnobProps` — a SELECTED segment inside disabled
|
|
54
|
+
* text-bearing chrome (ToggleGroup / segmented controls): one wash step
|
|
55
|
+
* stronger than `surfaceKnobProps` so which option is chosen stays
|
|
56
|
+
* visible while disabled (Axiom 6) — components drop their live active
|
|
57
|
+
* fill when disabled (the `active` variant beats the wash), so the
|
|
58
|
+
* recipe owns the selected tier under BOTH disabledStyle values.
|
|
59
|
+
* - `chromeKnobProps` — chrome with no text of its own (switch track,
|
|
60
|
+
* checkbox box, radio ring, slider, rating stars): opacity dim.
|
|
61
|
+
* - `assemblyKnobProps` — the whole assembly; populated only under
|
|
62
|
+
* `dimWhole` (FieldLayout wrapper; standalone controls spread it after
|
|
63
|
+
* their surface fragment since they are their own assembly).
|
|
64
|
+
*/
|
|
65
|
+
export interface DisabledRecipe {
|
|
66
|
+
surfaceKnobProps: DisabledSurfaceProps;
|
|
67
|
+
selectedSurfaceKnobProps: DisabledSurfaceProps;
|
|
68
|
+
chromeKnobProps: DisabledChromeProps;
|
|
69
|
+
textKnobProps: DisabledTextProps;
|
|
70
|
+
assemblyKnobProps: DisabledAssemblyProps;
|
|
71
|
+
/** Effective `disabledStyle` knob value ("keepLabel" | "dimWhole"). */
|
|
72
|
+
style: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A recipe groups state-specific knob props by concern (control, text, elevation).
|
|
76
|
+
* Each value is the actual props object to assign to hoverStyle, pressStyle, etc.
|
|
77
|
+
*/
|
|
78
|
+
export interface KnobRecipe<T> {
|
|
79
|
+
hoverKnobProps: T | undefined;
|
|
80
|
+
pressKnobProps: T | undefined;
|
|
81
|
+
focusKnobProps: T | undefined;
|
|
82
|
+
focusVisibleKnobProps: T | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Corner smoothing carrier (Axiom 15 OPTICS): radius-bearing fragments gain
|
|
86
|
+
* `className: "mp-corner-smooth"` when `cornerSmoothing: "smooth"` (web
|
|
87
|
+
* only) — the mounted stylesheet in `cornerSmoothing.ts` resolves it to
|
|
88
|
+
* `corner-shape: squircle`, a Chromium 139+ progressive enhancement other
|
|
89
|
+
* engines ignore. Absent at `round` and on native.
|
|
90
|
+
*/
|
|
91
|
+
export interface CornerSmoothingCarrier {
|
|
92
|
+
className?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface KnobProps {
|
|
95
|
+
borderRadius: {
|
|
96
|
+
borderRadius: string;
|
|
97
|
+
borderColor: string;
|
|
98
|
+
borderWidth: number;
|
|
99
|
+
} & CornerSmoothingCarrier;
|
|
100
|
+
borderRadiusOuter: {
|
|
101
|
+
borderRadius: string;
|
|
102
|
+
} & CornerSmoothingCarrier;
|
|
103
|
+
/**
|
|
104
|
+
* Axiom 1 child-clip cap for padded containers (Card/Panel/DialogContent):
|
|
105
|
+
* the radius token while it fits, or the padding px once it would exceed
|
|
106
|
+
* the container's own inset. Spread after the radius-bearing fragment.
|
|
107
|
+
*/
|
|
108
|
+
containerRadius: {
|
|
109
|
+
borderRadius: string | number;
|
|
110
|
+
} & CornerSmoothingCarrier;
|
|
111
|
+
/** Size token on web ("$1"); numeric tokens.size value on native (RN-safe). */
|
|
112
|
+
elevation: string | number | undefined;
|
|
113
|
+
surface: {
|
|
114
|
+
backgroundColor: string;
|
|
115
|
+
borderColor: string;
|
|
116
|
+
borderWidth: number;
|
|
117
|
+
};
|
|
118
|
+
/** Content tier (Bento content card): padded frame, no border, no shadow. Radius carries the container cap. */
|
|
119
|
+
cardSurface: {
|
|
120
|
+
backgroundColor: string;
|
|
121
|
+
borderRadius: string | number;
|
|
122
|
+
padding: string;
|
|
123
|
+
} & CornerSmoothingCarrier;
|
|
124
|
+
/** Elevated/overlay tier (popovers, dropdowns): border + elevation. */
|
|
125
|
+
elevatedSurface: {
|
|
126
|
+
backgroundColor: string;
|
|
127
|
+
borderColor: string;
|
|
128
|
+
borderWidth: number;
|
|
129
|
+
borderRadius: string;
|
|
130
|
+
elevation: string | number | undefined;
|
|
131
|
+
} & CornerSmoothingCarrier;
|
|
132
|
+
/** Feature/marketing tier (auth, hero cards): big radius + ultra-soft wide shadow. */
|
|
133
|
+
featureSurface: {
|
|
134
|
+
backgroundColor: string;
|
|
135
|
+
borderRadius: string;
|
|
136
|
+
padding: string;
|
|
137
|
+
shadowColor: string;
|
|
138
|
+
shadowOffset: {
|
|
139
|
+
width: number;
|
|
140
|
+
height: number;
|
|
141
|
+
};
|
|
142
|
+
shadowOpacity: number;
|
|
143
|
+
shadowRadius: number;
|
|
144
|
+
} & CornerSmoothingCarrier;
|
|
145
|
+
inputSurface: {
|
|
146
|
+
borderWidth: number;
|
|
147
|
+
};
|
|
148
|
+
panelPadding: {
|
|
149
|
+
padding: string;
|
|
150
|
+
};
|
|
151
|
+
gap: {
|
|
152
|
+
gap: string;
|
|
153
|
+
};
|
|
154
|
+
gapLg: {
|
|
155
|
+
gap: string;
|
|
156
|
+
};
|
|
157
|
+
sizeToken: string;
|
|
158
|
+
heading: {
|
|
159
|
+
fontFamily: string;
|
|
160
|
+
fontWeight: string;
|
|
161
|
+
};
|
|
162
|
+
/** color is set only for solid semantic-intent Buttons (error/warning/success). */
|
|
163
|
+
body: {
|
|
164
|
+
fontFamily: string;
|
|
165
|
+
fontWeight: string;
|
|
166
|
+
color?: ColorTokens;
|
|
167
|
+
};
|
|
168
|
+
textWeight: {
|
|
169
|
+
fontWeight: string;
|
|
170
|
+
};
|
|
171
|
+
transition: TransitionProp | undefined;
|
|
172
|
+
outlined: boolean;
|
|
173
|
+
pointy: boolean;
|
|
174
|
+
textAccent: string;
|
|
175
|
+
textAccentColor: string;
|
|
176
|
+
inputBackground: string;
|
|
177
|
+
space: string;
|
|
178
|
+
size: string;
|
|
179
|
+
/** Effective density mode after compact override resolution. */
|
|
180
|
+
density: string;
|
|
181
|
+
/** House decision knobs — pass-through for consumers (forms/tables). */
|
|
182
|
+
fieldLabelPlacement: string;
|
|
183
|
+
requiredMarking: string;
|
|
184
|
+
tableZebra: string;
|
|
185
|
+
bulkBarPlacement: string;
|
|
186
|
+
selectAllScope: string;
|
|
187
|
+
timestampStyle: string;
|
|
188
|
+
disabledStyle: string;
|
|
189
|
+
formAutofocus: string;
|
|
190
|
+
}
|
|
191
|
+
export interface ResolvedKnobs {
|
|
192
|
+
knobProps: KnobProps;
|
|
193
|
+
control: KnobRecipe<ControlStateProps>;
|
|
194
|
+
text: KnobRecipe<TextStateProps>;
|
|
195
|
+
elevation: KnobRecipe<ElevationStateProps>;
|
|
196
|
+
/** LC-40: resolved disabled treatment (named to avoid `disabled` prop clashes). */
|
|
197
|
+
disabledState: DisabledRecipe;
|
|
198
|
+
}
|
|
199
|
+
export type KnobPropsOverride = (knobProps: KnobProps, knobs: Knobs) => Partial<KnobProps>;
|
|
200
|
+
//# sourceMappingURL=recipes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipes.d.ts","sourceRoot":"","sources":["../../src/theme/recipes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIrC,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAID,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;I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EAAE,KAAK,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Knobs } from "./knobs";
|
|
2
|
+
import type { KnobPropsOverride, ResolvedKnobs } from "./recipes";
|
|
3
|
+
/** Step size down one level for compact density. */
|
|
4
|
+
export declare const compactSizeMap: Record<Knobs["size"], Knobs["size"]>;
|
|
5
|
+
/** Step space down one level for compact density. */
|
|
6
|
+
export declare const compactSpaceMap: Record<Knobs["space"], Knobs["space"]>;
|
|
7
|
+
/**
|
|
8
|
+
* Apply density mode to knobs before token resolution.
|
|
9
|
+
*
|
|
10
|
+
* - `density: "compact"` steps size + space down one level.
|
|
11
|
+
* - `compactOverride` wins over the density knob when provided:
|
|
12
|
+
* `true` forces compact stepping; `false` forces comfortable (no step).
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyDensity(knobs: Knobs, compactOverride?: boolean): Knobs;
|
|
15
|
+
/**
|
|
16
|
+
* Cap a container's radius at its own padding (Axiom 1 CLIP: "my children's
|
|
17
|
+
* pixel clips first → cap at padding"). Returns the radius token untouched
|
|
18
|
+
* while it fits, or the padding px number once the token would exceed it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function capContainerRadius(borderRadius: Knobs["borderRadius"], space: Knobs["space"]): string | number;
|
|
21
|
+
export declare function resolveKnobs(knobs: Knobs, override?: KnobPropsOverride): ResolvedKnobs;
|
|
22
|
+
//# sourceMappingURL=resolveKnobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveKnobs.d.ts","sourceRoot":"","sources":["../../src/theme/resolveKnobs.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAmB,KAAK,EAAc,MAAM,SAAS,CAAC;AAClE,OAAO,KAAK,EAKV,iBAAiB,EAEjB,aAAa,EAEd,MAAM,WAAW,CAAC;AAInB,oDAAoD;AACpD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAI/D,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAIlE,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,KAAK,CAW3E;AAsED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,EACnC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,GACpB,MAAM,GAAG,MAAM,CAIjB;AAgLD,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,aAAa,CA0JtF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type CreateTamaguiProps, createTamagui } from "tamagui";
|
|
2
|
+
import type { Knobs } from "./knobs";
|
|
3
|
+
import type { Preset } from "./preset.types";
|
|
4
|
+
export declare function registerPreset(name: string, preset: Preset): void;
|
|
5
|
+
/**
|
|
6
|
+
* Look up a registered preset by name.
|
|
7
|
+
*
|
|
8
|
+
* A requested-but-unregistered name is a silent bug otherwise: callers just
|
|
9
|
+
* fall back to the default preset, so e.g. `preset:material` renders
|
|
10
|
+
* byte-identical to `default` with no signal. Warn ONCE per unknown name
|
|
11
|
+
* (empty string and the implicit "default" are legitimate no-ops and stay
|
|
12
|
+
* quiet) so a typo'd or unregistered preset is loud instead of invisible.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getPreset(name: string): Preset | undefined;
|
|
15
|
+
export declare function getPresetNames(): string[];
|
|
16
|
+
export declare function clearPresets(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a `Preset` from a registered preset name, merging knob overrides
|
|
19
|
+
* on top of the base preset's knobs.
|
|
20
|
+
*
|
|
21
|
+
* If the preset name is not found, falls back to a default preset shape
|
|
22
|
+
* using `defaultKnobs`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveThemeFromPreset(presetName: string, overrides: Partial<Knobs>): Preset;
|
|
25
|
+
export type ThemeConfig<T extends CreateTamaguiProps = CreateTamaguiProps> = {
|
|
26
|
+
tamagui: ReturnType<typeof createTamagui<T>>;
|
|
27
|
+
presets?: Record<string, Preset>;
|
|
28
|
+
defaultPreset?: string;
|
|
29
|
+
/**
|
|
30
|
+
* User-facing color theme names extracted from the raw themes object
|
|
31
|
+
* (e.g. `["blue", "green", "purple", ...]`). Computed at config creation
|
|
32
|
+
* time so consumers don't need to introspect the Tamagui config.
|
|
33
|
+
*/
|
|
34
|
+
themeColors: string[];
|
|
35
|
+
};
|
|
36
|
+
export declare function createThemeConfig<T extends CreateTamaguiProps>(tamagui: T, options?: {
|
|
37
|
+
presets?: Record<string, Preset>;
|
|
38
|
+
defaultPreset?: string;
|
|
39
|
+
}): ThemeConfig<T>;
|
|
40
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/theme/shared.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAS7C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAEjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAa1D;AAED,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAGnC;AAID;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAY5F;AAID,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IAAI;IAC3E,OAAO,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAoCF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,kBAAkB,EAC5D,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACA,WAAW,CAAC,CAAC,CAAC,CA2BhB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CreateTamaguiProps, type TamaguiProviderProps } from "tamagui";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Animate a DOM mutation (typically a theme/scheme switch) using the View
|
|
5
|
+
* Transitions API where available, falling back to a temporary class-gated
|
|
6
|
+
* CSS transition on `<html>`.
|
|
7
|
+
*
|
|
8
|
+
* Both paths derive their duration from the `--mp-transition` CSS variable,
|
|
9
|
+
* which KnobBridge keeps in sync with the animation knob.
|
|
10
|
+
*/
|
|
11
|
+
export declare function startThemeTransition(apply: () => void): void;
|
|
12
|
+
export interface ThemeProviderProps<T extends CreateTamaguiProps = CreateTamaguiProps> extends PropsWithChildren<Omit<TamaguiProviderProps, "config" | "defaultTheme">> {
|
|
13
|
+
config?: {
|
|
14
|
+
tamagui: ReturnType<typeof import("tamagui").createTamagui<T>>;
|
|
15
|
+
};
|
|
16
|
+
systemTheme?: "light" | "dark";
|
|
17
|
+
}
|
|
18
|
+
export declare function ThemeProvider<T extends CreateTamaguiProps>({ children, config, systemTheme, ...tamaguiProps }: ThemeProviderProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,kBAAkB,EAAmB,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC9F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAO/C;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAkB5D;AAMD,MAAM,WAAW,kBAAkB,CACjC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,CACjD,SAAQ,iBAAiB,CAAC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,cAAc,CAAC,CAAC;IAChF,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,UAAU,CAAC,cAAc,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;KAChE,CAAC;IACF,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAMD,wBAAgB,aAAa,CAAC,CAAC,SAAS,kBAAkB,EAAE,EAC1D,QAAQ,EACR,MAAM,EACN,WAAqB,EACrB,GAAG,YAAY,EAChB,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAiFvB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CreateTamaguiProps, type TamaguiProviderProps } from "tamagui";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
export interface ThemeProviderProps<T extends CreateTamaguiProps = CreateTamaguiProps> extends PropsWithChildren<Omit<TamaguiProviderProps, "config" | "defaultTheme">> {
|
|
4
|
+
config?: {
|
|
5
|
+
tamagui: ReturnType<typeof import("tamagui").createTamagui<T>>;
|
|
6
|
+
};
|
|
7
|
+
systemTheme?: "light" | "dark";
|
|
8
|
+
}
|
|
9
|
+
export declare function ThemeProvider<T extends CreateTamaguiProps>({ children, config, systemTheme, ...tamaguiProps }: ThemeProviderProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=theme.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.native.d.ts","sourceRoot":"","sources":["../../src/theme/theme.native.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,kBAAkB,EAAmB,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC9F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAS/C,MAAM,WAAW,kBAAkB,CACjC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,CACjD,SAAQ,iBAAiB,CAAC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,cAAc,CAAC,CAAC;IAChF,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,UAAU,CAAC,cAAc,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;KAChE,CAAC;IACF,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAMD,wBAAgB,aAAa,CAAC,CAAC,SAAS,kBAAkB,EAAE,EAC1D,QAAQ,EACR,MAAM,EACN,WAAqB,EACrB,GAAG,YAAY,EAChB,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAevB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the current theme's 12 color values read from CSS custom
|
|
3
|
+
* properties (--color1 … --color12). Returns null on the server or
|
|
4
|
+
* when the variables aren't available.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useColorScale(): string[] | null;
|
|
7
|
+
//# sourceMappingURL=useColorScale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useColorScale.d.ts","sourceRoot":"","sources":["../../src/theme/useColorScale.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,GAAG,IAAI,CAQ/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useColorScale.native.d.ts","sourceRoot":"","sources":["../../src/theme/useColorScale.native.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,GAAG,IAAI,CAE/C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SizeTokens } from "tamagui";
|
|
2
|
+
import type { KnobPropsOverride, ResolvedKnobs } from "./recipes";
|
|
3
|
+
export declare const IntentContext: import("react").Context<string | null>;
|
|
4
|
+
export declare function useIntentContext(): string | null;
|
|
5
|
+
export interface UseResolvedKnobsOptions {
|
|
6
|
+
intent?: string;
|
|
7
|
+
component?: string;
|
|
8
|
+
override?: KnobPropsOverride;
|
|
9
|
+
/** Override the size from knobs */
|
|
10
|
+
size?: SizeTokens;
|
|
11
|
+
/**
|
|
12
|
+
* Compact sizing override. When set, wins over `knobs.density`:
|
|
13
|
+
* `true` forces compact stepping; `false` forces comfortable.
|
|
14
|
+
* When omitted, the density knob controls compact vs comfortable.
|
|
15
|
+
*/
|
|
16
|
+
compact?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const solidButtonIntents: Set<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve knobs → { knobProps }.
|
|
21
|
+
*
|
|
22
|
+
* Resolution order:
|
|
23
|
+
* 1. Base knobs from nearest <Preset> context
|
|
24
|
+
* 2. Merge intent-level overrides (if intent provided or from context)
|
|
25
|
+
* 3. Merge intent+component overrides (if both provided)
|
|
26
|
+
* 4. Apply size override if provided
|
|
27
|
+
* 5. Apply density (knobs.density, or compact option which wins)
|
|
28
|
+
* 6. OS reduced-motion forces animation="none"
|
|
29
|
+
* 7. Call resolveKnobs(mergedKnobs, override) — override merges last
|
|
30
|
+
*/
|
|
31
|
+
export declare function useResolvedKnobs(options?: UseResolvedKnobsOptions): ResolvedKnobs;
|
|
32
|
+
//# sourceMappingURL=useResolvedKnobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolvedKnobs.d.ts","sourceRoot":"","sources":["../../src/theme/useResolvedKnobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAKlE,eAAO,MAAM,aAAa,wCAAqC,CAAC;AAEhE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AA0BD,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,mCAAmC;IACnC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAmBD,eAAO,MAAM,kBAAkB,aAA2C,CAAC;AAE3E;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,aAAa,CA6EjF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Knobs } from "./knobs";
|
|
2
|
+
export type ThemeScheme = "system" | "dark" | "light";
|
|
3
|
+
/**
|
|
4
|
+
* Hook that returns the current knob values (merged from preset base + cookie
|
|
5
|
+
* overrides), a setter to persist partial knob changes, a boolean indicating
|
|
6
|
+
* whether the initial state came from a persisted cookie, a setter to switch
|
|
7
|
+
* the active preset, and the active preset name.
|
|
8
|
+
*
|
|
9
|
+
* Return type:
|
|
10
|
+
* ```
|
|
11
|
+
* [
|
|
12
|
+
* Knobs, // resolved knobs
|
|
13
|
+
* (knobs?: Partial<Knobs>) => void, // merge partial knob updates
|
|
14
|
+
* boolean, // true if initialized from cookie
|
|
15
|
+
* (presetName: string) => void, // switch preset (resets overrides)
|
|
16
|
+
* string | undefined, // active preset name
|
|
17
|
+
* ]
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* On SSR the preset name is read from `mp.preset` cookie, looked up in the
|
|
21
|
+
* preset registry, and its base knobs are merged with `mp.ov.*` overrides.
|
|
22
|
+
* This produces the same resolved knobs on the server as on the client.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useTheme(): [
|
|
25
|
+
Knobs,
|
|
26
|
+
(knobs?: Partial<Knobs>) => void,
|
|
27
|
+
boolean,
|
|
28
|
+
(presetName: string) => void,
|
|
29
|
+
string | undefined
|
|
30
|
+
];
|
|
31
|
+
//# sourceMappingURL=useTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,SAAS,CAAC;AAOnD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAMtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,IAAI;IAC1B,KAAK;IACL,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI;IAChC,OAAO;IACP,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI;IAC5B,MAAM,GAAG,SAAS;CACnB,CAiKA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Knobs } from "./knobs";
|
|
2
|
+
export type ThemeScheme = "system" | "dark" | "light";
|
|
3
|
+
export declare function useTheme(): [
|
|
4
|
+
Knobs,
|
|
5
|
+
(knobs?: Partial<Knobs>) => void,
|
|
6
|
+
boolean,
|
|
7
|
+
(presetName: string) => void,
|
|
8
|
+
string | undefined
|
|
9
|
+
];
|
|
10
|
+
//# sourceMappingURL=useTheme.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTheme.native.d.ts","sourceRoot":"","sources":["../../src/theme/useTheme.native.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,SAAS,CAAC;AAOnD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAMtD,wBAAgB,QAAQ,IAAI;IAC1B,KAAK;IACL,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI;IAChC,OAAO;IACP,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI;IAC5B,MAAM,GAAG,SAAS;CACnB,CA4BA"}
|
package/CHANGELOG.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# @multiplatform.one/theme
|
|
2
|
-
|
|
3
|
-
## 6.0.4
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- @multiplatform.one/platform@6.0.4
|
|
8
|
-
- @multiplatform.one/store@6.0.4
|
|
9
|
-
|
|
10
|
-
## 6.0.3
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- @multiplatform.one/platform@6.0.3
|
|
15
|
-
- @multiplatform.one/store@6.0.3
|
|
16
|
-
|
|
17
|
-
## 6.0.2
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- @multiplatform.one/platform@6.0.2
|
|
22
|
-
- @multiplatform.one/store@6.0.2
|
|
23
|
-
|
|
24
|
-
## 6.0.1
|
|
25
|
-
|
|
26
|
-
### Patch Changes
|
|
27
|
-
|
|
28
|
-
- @multiplatform.one/platform@6.0.1
|
|
29
|
-
- @multiplatform.one/store@6.0.1
|
|
30
|
-
|
|
31
|
-
## 6.0.0
|
|
32
|
-
|
|
33
|
-
### Major Changes
|
|
34
|
-
|
|
35
|
-
- Unified 6.0.0 release: realign all public `@multiplatform.one/*` packages onto a single, matching version line (changesets `fixed` group). Highlights:
|
|
36
|
-
- **web3 split** into standalone `@multiplatform.one/connectkit` and `@multiplatform.one/gpg` packages; `web3` now depends on them instead of bundling ConnectKit.
|
|
37
|
-
- **Sign-In With GPG** screen added to the ConnectKit modal.
|
|
38
|
-
- **Native workspace web-resolution fix** + platform-split wrappers (rich-text / `TextEditor`, forms `Barcode`) so web-only libraries stay out of the native Hermes bundle.
|
|
39
|
-
|
|
40
|
-
From this release on, these packages are versioned together.
|
|
41
|
-
|
|
42
|
-
### Patch Changes
|
|
43
|
-
|
|
44
|
-
- Updated dependencies
|
|
45
|
-
- @multiplatform.one/platform@6.0.0
|
|
46
|
-
- @multiplatform.one/store@6.0.0
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`resolveKnobs > matches snapshot for defaultKnobs 1`] = `
|
|
4
|
-
{
|
|
5
|
-
"control": {
|
|
6
|
-
"focusKnobProps": undefined,
|
|
7
|
-
"focusVisibleKnobProps": undefined,
|
|
8
|
-
"hoverKnobProps": undefined,
|
|
9
|
-
"pressKnobProps": undefined,
|
|
10
|
-
},
|
|
11
|
-
"elevation": {
|
|
12
|
-
"focusKnobProps": undefined,
|
|
13
|
-
"focusVisibleKnobProps": undefined,
|
|
14
|
-
"hoverKnobProps": undefined,
|
|
15
|
-
"pressKnobProps": undefined,
|
|
16
|
-
},
|
|
17
|
-
"knobProps": {
|
|
18
|
-
"body": {
|
|
19
|
-
"fontFamily": "$body",
|
|
20
|
-
"fontWeight": "400",
|
|
21
|
-
},
|
|
22
|
-
"borderRadius": {
|
|
23
|
-
"borderRadius": "$4",
|
|
24
|
-
"borderWidth": 0.5,
|
|
25
|
-
},
|
|
26
|
-
"borderRadiusOuter": {
|
|
27
|
-
"borderRadius": "$3",
|
|
28
|
-
},
|
|
29
|
-
"elevation": undefined,
|
|
30
|
-
"gap": {
|
|
31
|
-
"gap": "$3",
|
|
32
|
-
},
|
|
33
|
-
"gapLg": {
|
|
34
|
-
"gap": "$4",
|
|
35
|
-
},
|
|
36
|
-
"heading": {
|
|
37
|
-
"fontFamily": "$heading",
|
|
38
|
-
"fontWeight": "400",
|
|
39
|
-
},
|
|
40
|
-
"inputBackground": "$color6",
|
|
41
|
-
"inputSurface": {
|
|
42
|
-
"borderWidth": 0.5,
|
|
43
|
-
},
|
|
44
|
-
"outlined": false,
|
|
45
|
-
"panelPadding": {
|
|
46
|
-
"padding": "$3",
|
|
47
|
-
},
|
|
48
|
-
"pointy": false,
|
|
49
|
-
"size": "medium",
|
|
50
|
-
"sizeToken": "$4",
|
|
51
|
-
"space": "medium",
|
|
52
|
-
"surface": {
|
|
53
|
-
"borderWidth": 0.5,
|
|
54
|
-
},
|
|
55
|
-
"textAccent": "high",
|
|
56
|
-
"textAccentColor": "$color",
|
|
57
|
-
"textWeight": {
|
|
58
|
-
"fontWeight": "400",
|
|
59
|
-
},
|
|
60
|
-
"transition": "quick",
|
|
61
|
-
},
|
|
62
|
-
"text": {
|
|
63
|
-
"focusKnobProps": undefined,
|
|
64
|
-
"focusVisibleKnobProps": undefined,
|
|
65
|
-
"hoverKnobProps": undefined,
|
|
66
|
-
"pressKnobProps": undefined,
|
|
67
|
-
},
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
@@ -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
|
-
});
|