@multiplatform.one/theme 7.34.4 → 7.36.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/package.json +20 -5
- package/src/audit/constraintAudit.spec.ts +274 -87
- package/src/audit/constraintAudit.ts +135 -120
- package/src/audit/constraintScope.spec.ts +1 -1
- package/src/audit/designTokens.ts +42 -0
- package/src/audit/themeMatrix.spec.ts +83 -2
- package/src/audit/themeMatrix.ts +33 -1
- package/src/figma/figmaTokens.spec.ts +26 -34
- package/src/figma/figmaTokens.ts +26 -50
- package/src/fonts/createFontLoader.ts +4 -1
- package/src/menuRow.ts +4 -1
- package/src/theme/FontKnobStyles.tsx +2 -1
- package/src/theme/Preset.stories.tsx +0 -1
- package/src/theme/Preset.tsx +6 -1
- package/src/theme/PresetContext.ts +4 -0
- package/src/theme/Surface.spec.tsx +114 -67
- package/src/theme/Surface.stories.tsx +8 -25
- package/src/theme/Surface.tsx +87 -43
- package/src/theme/accentFloor.spec.ts +37 -11
- package/src/theme/activateThemeConfig.ts +22 -6
- package/src/theme/animations/animations.spec.ts +62 -0
- package/src/theme/animations/css.ts +9 -35
- package/src/theme/animations/reactNative.ts +98 -25
- package/src/theme/boundaryFloor.spec.ts +57 -0
- package/src/theme/chartPalette.spec.ts +56 -27
- package/src/theme/chartPalette.ts +33 -28
- package/src/theme/colorRules.spec.ts +32 -72
- package/src/theme/cookies.spec.ts +49 -18
- package/src/theme/cookies.ts +36 -7
- package/src/theme/cookiesPersistence.spec.ts +5 -5
- package/src/theme/createDefaultThemeConfig.spec.ts +182 -20
- package/src/theme/createDefaultThemeConfig.ts +34 -28
- package/src/theme/createThemes.ts +169 -218
- package/src/theme/defaults/accent.ts +3 -35
- package/src/theme/defaults/base.ts +14 -53
- package/src/theme/defaults/builderOptions.ts +68 -85
- package/src/theme/defaults/categoryFonts.ts +10 -0
- package/src/theme/defaults/fonts.spec.ts +84 -4
- package/src/theme/defaults/fonts.ts +166 -124
- package/src/theme/defaults/house.ts +48 -0
- package/src/theme/defaults/index.ts +1 -0
- package/src/theme/defaults/neutralRamp.spec.ts +52 -47
- package/src/theme/devtools/ColorLineVisualizer.tsx +6 -6
- package/src/theme/devtools/ThemeDevtoolsPanel.setMarkers.spec.tsx +13 -6
- package/src/theme/devtools/ThemeDevtoolsPanel.tsx +14 -77
- package/src/theme/devtools/animationOptions.spec.ts +23 -37
- package/src/theme/devtools/animationOptions.ts +4 -6
- package/src/theme/devtools/buildSnapshot.ts +0 -3
- package/src/theme/devtools/knobIcons.tsx +4 -24
- package/src/theme/focusState.spec.ts +9 -30
- package/src/theme/index.ts +17 -0
- package/src/theme/intentFill.spec.ts +42 -0
- package/src/theme/knobs.ts +14 -42
- package/src/theme/layoutTokens.ts +15 -1
- package/src/theme/layoutTokensHooks.spec.tsx +8 -4
- package/src/theme/mergedTokens.ts +20 -0
- package/src/theme/motion.spec.ts +84 -0
- package/src/theme/motion.ts +53 -0
- package/src/theme/motionStops.ts +17 -0
- package/src/theme/motionTiming.ts +59 -0
- package/src/theme/mpo13Proof.spec.ts +43 -46
- package/src/theme/mpo19Proof.spec.ts +13 -14
- package/src/theme/namedInkFloor.spec.ts +60 -0
- package/src/theme/overlaySurfaces.tsx +330 -0
- package/src/theme/preset.types.ts +16 -0
- package/src/theme/presetPreview.ts +32 -0
- package/src/theme/presetRoot.spec.tsx +89 -0
- package/src/theme/presetStore.persistence.spec.ts +141 -0
- package/src/theme/presetStore.spec.ts +205 -0
- package/src/theme/presetStore.ts +286 -0
- package/src/theme/presetUserSync.spec.tsx +168 -0
- package/src/theme/presetUserSync.ts +47 -0
- package/src/theme/presets.spec.ts +22 -15
- package/src/theme/presets.ts +22 -10
- package/src/theme/radiusClass.spec.ts +60 -41
- package/src/theme/radiusClass.ts +17 -4
- package/src/theme/radiusClassTable.generated.ts +3 -3
- package/src/theme/readableColor.spec.ts +59 -152
- package/src/theme/readableColor.ts +34 -174
- package/src/theme/recipeInputs.ts +153 -295
- package/src/theme/recipes.ts +58 -18
- package/src/theme/resolveKnobs.spec.ts +528 -588
- package/src/theme/resolveKnobs.ts +250 -325
- package/src/theme/scale/ScaleStyles.native.tsx +19 -0
- package/src/theme/scale/ScaleStyles.tsx +48 -0
- package/src/theme/scale/activeScale.ts +30 -0
- package/src/theme/scale/deriveRecipeInputs.ts +110 -0
- package/src/theme/scale/generateScale.spec.ts +260 -0
- package/src/theme/scale/generateScale.ts +147 -0
- package/src/theme/scale/index.ts +54 -0
- package/src/theme/scale/installScaleConfig.native.spec.ts +77 -0
- package/src/theme/scale/installScaleConfig.native.ts +57 -0
- package/src/theme/scale/installScaleConfig.ts +7 -0
- package/src/theme/scale/scaleAttribute.ts +21 -0
- package/src/theme/scale/scaleCss.probe.spec.tsx +64 -0
- package/src/theme/scale/scaleCss.spec.ts +132 -0
- package/src/theme/scale/scaleCss.ts +95 -0
- package/src/theme/scale/scaleFonts.ts +106 -0
- package/src/theme/scale/scaleInputs.ts +322 -0
- package/src/theme/scale/themeScales.ts +181 -0
- package/src/theme/scale/useActiveScale.spec.tsx +129 -0
- package/src/theme/scale/useActiveScale.ts +95 -0
- package/src/theme/schemeStore.spec.ts +81 -0
- package/src/theme/schemeStore.ts +67 -0
- package/src/theme/shared.spec.ts +7 -6
- package/src/theme/shared.tsx +37 -3
- package/src/theme/sizeLadder.spec.ts +37 -36
- package/src/theme/sizeRecipes.spec.ts +179 -85
- package/src/theme/sizeRecipes.ts +48 -25
- package/src/theme/subsetThemes.spec.ts +9 -3
- package/src/theme/switchThumb.spec.ts +69 -0
- package/src/theme/syntaxFloor.spec.ts +11 -8
- package/src/theme/theme.hydration.native.spec.tsx +51 -0
- package/src/theme/theme.native.tsx +59 -21
- package/src/theme/theme.palette.spec.tsx +76 -0
- package/src/theme/theme.preset.native.spec.tsx +73 -0
- package/src/theme/theme.provider.spec.ts +143 -1
- package/src/theme/theme.tsx +61 -25
- package/src/theme/tileSizes.ts +6 -7
- package/src/theme/transitionProps.native.ts +25 -2
- package/src/theme/transitionProps.spec.ts +34 -0
- package/src/theme/transitionProps.ts +26 -2
- package/src/theme/usePresetSwitch.native.spec.tsx +68 -0
- package/src/theme/usePresetSwitch.native.ts +32 -0
- package/src/theme/usePresetSwitch.spec.tsx +103 -0
- package/src/theme/usePresetSwitch.ts +54 -0
- package/src/theme/useResolvedKnobs.hydration.spec.tsx +2 -2
- package/src/theme/useResolvedKnobs.ts +23 -90
- package/src/theme/useResolvedKnobsBehavior.spec.tsx +25 -30
- package/src/theme/useSchemePreference.native.ts +33 -0
- package/src/theme/useSchemePreference.spec.tsx +51 -0
- package/src/theme/useSchemePreference.ts +32 -0
- package/src/theme/useSchemePreference.web.spec.tsx +32 -0
- package/src/theme/useTheme.native.spec.tsx +68 -0
- package/src/theme/useTheme.native.ts +49 -24
- package/src/theme/useTheme.ts +7 -4
- package/types/audit/constraintAudit.d.ts +6 -5
- package/types/audit/constraintAudit.d.ts.map +1 -1
- package/types/audit/designTokens.d.ts +13 -0
- package/types/audit/designTokens.d.ts.map +1 -0
- package/types/audit/themeMatrix.d.ts +10 -0
- package/types/audit/themeMatrix.d.ts.map +1 -1
- package/types/figma/figmaTokens.d.ts +11 -28
- package/types/figma/figmaTokens.d.ts.map +1 -1
- package/types/fonts/createFontLoader.d.ts.map +1 -1
- package/types/menuRow.d.ts +4 -1
- package/types/menuRow.d.ts.map +1 -1
- package/types/theme/FontKnobStyles.d.ts.map +1 -1
- package/types/theme/Preset.d.ts.map +1 -1
- package/types/theme/PresetContext.d.ts +4 -0
- package/types/theme/PresetContext.d.ts.map +1 -1
- package/types/theme/Surface.d.ts +57 -26
- package/types/theme/Surface.d.ts.map +1 -1
- package/types/theme/activateThemeConfig.d.ts +5 -3
- package/types/theme/activateThemeConfig.d.ts.map +1 -1
- package/types/theme/animations/css.d.ts +27 -34
- package/types/theme/animations/css.d.ts.map +1 -1
- package/types/theme/animations/reactNative.d.ts +196 -45
- package/types/theme/animations/reactNative.d.ts.map +1 -1
- package/types/theme/chartPalette.d.ts +11 -3
- package/types/theme/chartPalette.d.ts.map +1 -1
- package/types/theme/colorRules.d.ts +1 -1
- package/types/theme/cookies.d.ts +12 -1
- package/types/theme/cookies.d.ts.map +1 -1
- package/types/theme/createDefaultThemeConfig.d.ts +13 -13
- package/types/theme/createDefaultThemeConfig.d.ts.map +1 -1
- package/types/theme/createThemes.d.ts +58 -2
- package/types/theme/createThemes.d.ts.map +1 -1
- package/types/theme/defaults/accent.d.ts.map +1 -1
- package/types/theme/defaults/base.d.ts.map +1 -1
- package/types/theme/defaults/builderOptions.d.ts.map +1 -1
- package/types/theme/defaults/categoryFonts.d.ts +10 -0
- package/types/theme/defaults/categoryFonts.d.ts.map +1 -1
- package/types/theme/defaults/fonts.d.ts +330 -30
- package/types/theme/defaults/fonts.d.ts.map +1 -1
- package/types/theme/defaults/house.d.ts +8 -0
- package/types/theme/defaults/house.d.ts.map +1 -0
- package/types/theme/defaults/index.d.ts +1 -0
- package/types/theme/defaults/index.d.ts.map +1 -1
- package/types/theme/devtools/ThemeDevtoolsPanel.d.ts +3 -3
- package/types/theme/devtools/ThemeDevtoolsPanel.d.ts.map +1 -1
- package/types/theme/devtools/animationOptions.d.ts.map +1 -1
- package/types/theme/devtools/buildSnapshot.d.ts.map +1 -1
- package/types/theme/devtools/knobIcons.d.ts +0 -3
- package/types/theme/devtools/knobIcons.d.ts.map +1 -1
- package/types/theme/index.d.ts +11 -0
- package/types/theme/index.d.ts.map +1 -1
- package/types/theme/knobs.d.ts +8 -36
- package/types/theme/knobs.d.ts.map +1 -1
- package/types/theme/layoutTokens.d.ts +13 -1
- package/types/theme/layoutTokens.d.ts.map +1 -1
- package/types/theme/mergedTokens.d.ts +11 -0
- package/types/theme/mergedTokens.d.ts.map +1 -0
- package/types/theme/motion.d.ts +17 -0
- package/types/theme/motion.d.ts.map +1 -0
- package/types/theme/motionStops.d.ts +3 -0
- package/types/theme/motionStops.d.ts.map +1 -0
- package/types/theme/motionTiming.d.ts +36 -0
- package/types/theme/motionTiming.d.ts.map +1 -0
- package/types/theme/overlaySurfaces.d.ts +70 -0
- package/types/theme/overlaySurfaces.d.ts.map +1 -0
- package/types/theme/preset.types.d.ts +16 -0
- package/types/theme/preset.types.d.ts.map +1 -1
- package/types/theme/presetPreview.d.ts +14 -0
- package/types/theme/presetPreview.d.ts.map +1 -0
- package/types/theme/presetStore.d.ts +40 -0
- package/types/theme/presetStore.d.ts.map +1 -0
- package/types/theme/presetUserSync.d.ts +7 -0
- package/types/theme/presetUserSync.d.ts.map +1 -0
- package/types/theme/presets.d.ts +12 -4
- package/types/theme/presets.d.ts.map +1 -1
- package/types/theme/radiusClass.d.ts +5 -2
- package/types/theme/radiusClass.d.ts.map +1 -1
- package/types/theme/radiusClassTable.generated.d.ts +3 -3
- package/types/theme/readableColor.d.ts +11 -49
- package/types/theme/readableColor.d.ts.map +1 -1
- package/types/theme/recipeInputs.d.ts +39 -70
- package/types/theme/recipeInputs.d.ts.map +1 -1
- package/types/theme/recipes.d.ts +79 -18
- package/types/theme/recipes.d.ts.map +1 -1
- package/types/theme/resolveKnobs.d.ts +64 -32
- package/types/theme/resolveKnobs.d.ts.map +1 -1
- package/types/theme/scale/ScaleStyles.d.ts +18 -0
- package/types/theme/scale/ScaleStyles.d.ts.map +1 -0
- package/types/theme/scale/ScaleStyles.native.d.ts +10 -0
- package/types/theme/scale/ScaleStyles.native.d.ts.map +1 -0
- package/types/theme/scale/activeScale.d.ts +13 -0
- package/types/theme/scale/activeScale.d.ts.map +1 -0
- package/types/theme/scale/deriveRecipeInputs.d.ts +10 -0
- package/types/theme/scale/deriveRecipeInputs.d.ts.map +1 -0
- package/types/theme/scale/generateScale.d.ts +38 -0
- package/types/theme/scale/generateScale.d.ts.map +1 -0
- package/types/theme/scale/index.d.ts +17 -0
- package/types/theme/scale/index.d.ts.map +1 -0
- package/types/theme/scale/installScaleConfig.d.ts +4 -0
- package/types/theme/scale/installScaleConfig.d.ts.map +1 -0
- package/types/theme/scale/installScaleConfig.native.d.ts +13 -0
- package/types/theme/scale/installScaleConfig.native.d.ts.map +1 -0
- package/types/theme/scale/scaleAttribute.d.ts +14 -0
- package/types/theme/scale/scaleAttribute.d.ts.map +1 -0
- package/types/theme/scale/scaleCss.d.ts +25 -0
- package/types/theme/scale/scaleCss.d.ts.map +1 -0
- package/types/theme/scale/scaleFonts.d.ts +16 -0
- package/types/theme/scale/scaleFonts.d.ts.map +1 -0
- package/types/theme/scale/scaleInputs.d.ts +66 -0
- package/types/theme/scale/scaleInputs.d.ts.map +1 -0
- package/types/theme/scale/themeScales.d.ts +52 -0
- package/types/theme/scale/themeScales.d.ts.map +1 -0
- package/types/theme/scale/useActiveScale.d.ts +31 -0
- package/types/theme/scale/useActiveScale.d.ts.map +1 -0
- package/types/theme/schemeStore.d.ts +6 -0
- package/types/theme/schemeStore.d.ts.map +1 -0
- package/types/theme/shared.d.ts +18 -0
- package/types/theme/shared.d.ts.map +1 -1
- package/types/theme/sizeRecipes.d.ts +20 -15
- package/types/theme/sizeRecipes.d.ts.map +1 -1
- package/types/theme/theme.d.ts +2 -1
- package/types/theme/theme.d.ts.map +1 -1
- package/types/theme/theme.native.d.ts +10 -1
- package/types/theme/theme.native.d.ts.map +1 -1
- package/types/theme/tileSizes.d.ts +6 -7
- package/types/theme/tileSizes.d.ts.map +1 -1
- package/types/theme/transitionProps.d.ts +3 -1
- package/types/theme/transitionProps.d.ts.map +1 -1
- package/types/theme/transitionProps.native.d.ts +3 -1
- package/types/theme/transitionProps.native.d.ts.map +1 -1
- package/types/theme/usePresetSwitch.d.ts +10 -0
- package/types/theme/usePresetSwitch.d.ts.map +1 -0
- package/types/theme/usePresetSwitch.native.d.ts +10 -0
- package/types/theme/usePresetSwitch.native.d.ts.map +1 -0
- package/types/theme/useResolvedKnobs.d.ts +13 -13
- package/types/theme/useResolvedKnobs.d.ts.map +1 -1
- package/types/theme/useSchemePreference.d.ts +8 -0
- package/types/theme/useSchemePreference.d.ts.map +1 -0
- package/types/theme/useSchemePreference.native.d.ts +8 -0
- package/types/theme/useSchemePreference.native.d.ts.map +1 -0
- package/types/theme/useTheme.d.ts +4 -2
- package/types/theme/useTheme.d.ts.map +1 -1
- package/types/theme/useTheme.native.d.ts +10 -1
- package/types/theme/useTheme.native.d.ts.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deriveRecipeInputs.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/deriveRecipeInputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAA6C,MAAM,iBAAiB,CAAC;AACnG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA6DjD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,gBAAgB,CAyCrE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { SizeRecipeInputs } from "../recipeInputs";
|
|
2
|
+
import { type FontKey, type RadiusKey, type ResolvedScaleInputs, type ScaleInputs, type SizeKey, type SpaceKey, type ZIndexKey } from "./scaleInputs";
|
|
3
|
+
/** Raw Tamagui token groups, in `@tamagui/themes/v5` key order (the order `getCSS()` emits). */
|
|
4
|
+
export type ScaleTokens = {
|
|
5
|
+
radius: Record<RadiusKey, number>;
|
|
6
|
+
zIndex: Record<ZIndexKey, number>;
|
|
7
|
+
space: Record<SpaceKey, number>;
|
|
8
|
+
size: Record<SizeKey, number>;
|
|
9
|
+
};
|
|
10
|
+
export type ScaleFonts = {
|
|
11
|
+
bodySizes: Record<FontKey, number>;
|
|
12
|
+
bodyLineHeights: Record<FontKey, number>;
|
|
13
|
+
headingSizes: Record<FontKey, number>;
|
|
14
|
+
headingLineHeights: Record<FontKey, number>;
|
|
15
|
+
};
|
|
16
|
+
export type ScaleCore = {
|
|
17
|
+
inputs: ResolvedScaleInputs;
|
|
18
|
+
tokens: ScaleTokens;
|
|
19
|
+
fonts: ScaleFonts;
|
|
20
|
+
};
|
|
21
|
+
export type GeneratedScale = ScaleCore & {
|
|
22
|
+
recipeInputs: SizeRecipeInputs;
|
|
23
|
+
};
|
|
24
|
+
export type ScalePlatform = "web" | "native";
|
|
25
|
+
/** `@tamagui/themes/v5` `sizeToSpace`, the function v5 derives every `$space` from. */
|
|
26
|
+
export declare function sizeToSpace(v: number): number;
|
|
27
|
+
/** Same test `@tamagui/config/v5` uses to pick its web or native type ladder. */
|
|
28
|
+
export declare function scalePlatform(): ScalePlatform;
|
|
29
|
+
export declare function generateScaleTokens(inputs: ResolvedScaleInputs): ScaleTokens;
|
|
30
|
+
export declare function generateScaleFonts(type: number, platform: ScalePlatform): ScaleFonts;
|
|
31
|
+
/**
|
|
32
|
+
* One scale from a few inputs: the Tamagui `$size`/`$space`/`$radius`/`$zIndex`
|
|
33
|
+
* token groups, the body and heading type tables, and the size-recipe inputs
|
|
34
|
+
* Button/Input read, all from the same numbers so `$size` props and
|
|
35
|
+
* `knobProps.control` cannot disagree.
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateScale(inputs?: Partial<ScaleInputs>, platform?: ScalePlatform): GeneratedScale;
|
|
38
|
+
//# sourceMappingURL=generateScale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateScale.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/generateScale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,SAAS,EAGd,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAGhB,KAAK,OAAO,EAEZ,KAAK,QAAQ,EAKb,KAAK,SAAS,EAGf,MAAM,eAAe,CAAC;AAEvB,gGAAgG;AAChG,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAClC,K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latform, sizeToSpace, } from "./generateScale";
|
|
3
|
+
export type { GeneratedScale, ScaleCore, ScaleFonts, ScalePlatform, ScaleTokens, } from "./generateScale";
|
|
4
|
+
export { CHIP_ICON_SHAPE, CONTROL_ICON_SHAPE, FONT_KEYS, NATIVE_TYPE_SHAPE, RADIUS_KEYS, RADIUS_SHAPE, SIZE_KEYS, SIZE_SHAPE, SPACE_SHAPE, SUBUNIT_SHAPE, TYPE_SHAPE, ZINDEX_KEYS, defaultScaleInputs, v5ScaleInputs, resolveScaleInputs, scaleInputDefaults, } from "./scaleInputs";
|
|
5
|
+
export type { FontKey, RadiusKey, ResolvedScaleInputs, ScaleInputs, SizeKey, SpaceKey, SubunitKey, ZIndexKey, } from "./scaleInputs";
|
|
6
|
+
export { SCALE_ATTRIBUTE, scaleCss, scaleRootSelectors } from "./scaleCss";
|
|
7
|
+
export type { ScaleCssSource } from "./scaleCss";
|
|
8
|
+
export { rescaleFont, scaleFontSet } from "./scaleFonts";
|
|
9
|
+
export { DEFAULT_SCALE_ID, buildThemeScales, uniqueScales } from "./themeScales";
|
|
10
|
+
export type { ThemeScale, ThemeScaleBuildOptions } from "./themeScales";
|
|
11
|
+
export { applyThemeScale, resolveThemeScale, useActiveScale } from "./useActiveScale";
|
|
12
|
+
export type { PublishedScale, ScaleSource } from "./useActiveScale";
|
|
13
|
+
export { ScaleStyles, scaleAttributeValue, scaleStyleSheet } from "./ScaleStyles";
|
|
14
|
+
export type { ScaleStylesProps } from "./ScaleStyles";
|
|
15
|
+
export { scaleAttributeFromCookie, scaleAttributeScript } from "./scaleAttribute";
|
|
16
|
+
export { getActiveScaleTokens, scaleRadiusPx, setActiveScaleTokens } from "./activeScale";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBA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,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TamaguiInternalConfig } from "@tamagui/web";
|
|
2
|
+
/** Make a scale's built config the one token reads resolve against; true when anything changed. */
|
|
3
|
+
export declare function installScaleConfig(config: TamaguiInternalConfig): boolean;
|
|
4
|
+
//# sourceMappingURL=installScaleConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installScaleConfig.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/installScaleConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAG1D,mGAAmG;AACnG,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAEzE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TamaguiInternalConfig } from "@tamagui/web";
|
|
2
|
+
/**
|
|
3
|
+
* Native Tamagui resolves `$` tokens against the config it held on its first
|
|
4
|
+
* render (getSplitStyles and every styled component keep that object), so
|
|
5
|
+
* installing another config object changes nothing they paint. A scale is
|
|
6
|
+
* installed here by copying its token and font fields into that first config;
|
|
7
|
+
* the first config's own fields are kept so the default scale can come back.
|
|
8
|
+
* Returns true when anything changed.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installScaleConfig(config: TamaguiInternalConfig): boolean;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare function resetInstalledScaleForTests(): void;
|
|
13
|
+
//# sourceMappingURL=installScaleConfig.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installScaleConfig.native.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/installScaleConfig.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAgC,MAAM,cAAc,CAAC;AAyBxF;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAYzE;AAED,gBAAgB;AAChB,wBAAgB,2BAA2B,IAAI,IAAI,CAQlD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cookiePreset } from "../cookies";
|
|
2
|
+
/** The `<html>` attribute that names the active preset; scale blocks key off it. */
|
|
3
|
+
export declare const SCALE_ATTRIBUTE = "data-mp-scale";
|
|
4
|
+
export { cookiePreset };
|
|
5
|
+
/** The `data-mp-scale` value for a raw `mp.preset` cookie value (none for an empty or foreign one). */
|
|
6
|
+
export declare function scaleAttributeFromCookie(value: unknown): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Blocking `<head>` script for web root layouts: copies the `mp.preset`
|
|
9
|
+
* cookie onto `<html data-mp-scale>` before first paint, so a cold load of a
|
|
10
|
+
* cached or client-rendered document paints the stored preset's scale
|
|
11
|
+
* without waiting for hydration.
|
|
12
|
+
*/
|
|
13
|
+
export declare const scaleAttributeScript: string;
|
|
14
|
+
//# sourceMappingURL=scaleAttribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaleAttribute.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/scaleAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC;AAE5D,oFAAoF;AACpF,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,uGAAuG;AACvG,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE3E;AAID;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAgQ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ScaleTokens } from "./generateScale";
|
|
2
|
+
import { SCALE_ATTRIBUTE } from "./scaleAttribute";
|
|
3
|
+
export { SCALE_ATTRIBUTE };
|
|
4
|
+
type ParsedVariable = {
|
|
5
|
+
name?: string;
|
|
6
|
+
variable?: string;
|
|
7
|
+
val?: unknown;
|
|
8
|
+
};
|
|
9
|
+
/** The slice of a built Tamagui config the scale CSS reads its variable names from. */
|
|
10
|
+
export type ScaleCssSource = {
|
|
11
|
+
tokensParsed?: Record<string, Record<string, ParsedVariable | undefined> | undefined>;
|
|
12
|
+
fontsParsed?: Record<string, Record<string, unknown> | undefined>;
|
|
13
|
+
};
|
|
14
|
+
type FontTables = Record<string, Record<string, unknown> | string | undefined>;
|
|
15
|
+
/** One `:root[data-mp-scale="<name>"]` selector per preset name, plus an optional bare fallback. */
|
|
16
|
+
export declare function scaleRootSelectors(presetNames: readonly string[], fallback?: boolean): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The CSS that repaints every token-driven style for one scale on web: the
|
|
19
|
+
* scale's token values under the same `--c-*` variables Tamagui's `:root`
|
|
20
|
+
* block declares, and its font tables under each `.font_<family>` scope.
|
|
21
|
+
* Only values that differ from `base` are written, so the default scale
|
|
22
|
+
* produces nothing and a scale block stays small.
|
|
23
|
+
*/
|
|
24
|
+
export declare function scaleCss(roots: readonly string[], base: ScaleCssSource, tokens: ScaleTokens, fonts: Record<string, FontTables | undefined>): string;
|
|
25
|
+
//# sourceMappingURL=scaleCss.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaleCss.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/scaleCss.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,KAAK,cAAc,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1E,uFAAuF;AACvF,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;CACnE,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAe/E,oGAAoG;AACpG,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,UAAQ,GAAG,MAAM,EAAE,CAI7F;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC,GAC5C,MAAM,CA8CR"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GenericFont } from "@tamagui/web";
|
|
2
|
+
import type { ScaleFonts } from "./generateScale";
|
|
3
|
+
/**
|
|
4
|
+
* Move a font that was built on the `from` ladder onto the `to` ladder: a
|
|
5
|
+
* size or leading that IS the `from` body value at its key becomes the `to`
|
|
6
|
+
* value there, anything else scales with the type ratio (leading with its own
|
|
7
|
+
* size). Family, face, weight and tracking are untouched.
|
|
8
|
+
*/
|
|
9
|
+
export declare function rescaleFont<F extends GenericFont>(font: F, from: ScaleFonts, to: ScaleFonts): F;
|
|
10
|
+
/**
|
|
11
|
+
* A scale's font map. The built-in heading/body and category fonts are
|
|
12
|
+
* rebuilt on the scale's own type tables; any other font (a consumer's
|
|
13
|
+
* `createDefaultFont` family) is moved onto the new ladder by `rescaleFont`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function scaleFontSet(fonts: Record<string, GenericFont>, from: ScaleFonts, to: ScaleFonts): Record<string, GenericFont>;
|
|
16
|
+
//# sourceMappingURL=scaleFonts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaleFonts.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/scaleFonts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAUhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQlD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,CAAC,CAqC/F;AAQD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAClC,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,UAAU,GACb,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA2B7B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The few numbers a token scale is generated from, and the canonical
|
|
3
|
+
* proportions every key is generated against.
|
|
4
|
+
*
|
|
5
|
+
* The shape tables are Tamagui v5's own ladders (`@tamagui/themes/v5`
|
|
6
|
+
* tokens, `@tamagui/config/v5` fonts) divided by their anchor: `$size` by 44,
|
|
7
|
+
* `$space` by 18, `$radius` by 9, type by the 15px web body. At
|
|
8
|
+
* `v5ScaleInputs` the generator reproduces v5 key for key
|
|
9
|
+
* (`generateScale.spec.ts`), and any other inputs keep v5's proportions,
|
|
10
|
+
* including its `$16`/`$17` duplicate. The house default is 40/15.
|
|
11
|
+
*/
|
|
12
|
+
export type ScaleInputs = {
|
|
13
|
+
/** `$size.$4` and `$size.true` in px: the default control height. */
|
|
14
|
+
control: number;
|
|
15
|
+
/** Body `$true` in px on web. Every type ladder is proportional to it. */
|
|
16
|
+
type: number;
|
|
17
|
+
/** Fine-grain step in px: `$size.$0.25`/`$0.5`/`$0.75` are `unit/2`, `unit` and `2·unit`. */
|
|
18
|
+
unit?: number;
|
|
19
|
+
/** `$size` keys from `$1` up round to a multiple of this (2 = even px). */
|
|
20
|
+
snap?: number;
|
|
21
|
+
/** `$radius.true` as a fraction of `control`. */
|
|
22
|
+
radius?: number;
|
|
23
|
+
};
|
|
24
|
+
export type ResolvedScaleInputs = Required<ScaleInputs>;
|
|
25
|
+
export declare const defaultScaleInputs: ScaleInputs;
|
|
26
|
+
export declare const v5ScaleInputs: ScaleInputs;
|
|
27
|
+
export declare const scaleInputDefaults: {
|
|
28
|
+
readonly unit: 4;
|
|
29
|
+
readonly snap: 2;
|
|
30
|
+
readonly radius: number;
|
|
31
|
+
};
|
|
32
|
+
export declare function resolveScaleInputs(inputs?: Partial<ScaleInputs>): ResolvedScaleInputs;
|
|
33
|
+
export declare const SIZE_KEYS: readonly ["$0", "$0.25", "$0.5", "$0.75", "$1", "$1.5", "$2", "$2.5", "$3", "$3.5", "$4", "$true", "$4.5", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19", "$20"];
|
|
34
|
+
export type SizeKey = (typeof SIZE_KEYS)[number];
|
|
35
|
+
export type NegativeSpaceKey = `-${SizeKey extends `$${infer Key}` ? Key : never}`;
|
|
36
|
+
export type SpaceKey = SizeKey | Exclude<NegativeSpaceKey, "-0">;
|
|
37
|
+
export declare const RADIUS_KEYS: readonly ["0", "1", "2", "3", "4", "true", "5", "6", "7", "8", "9", "10", "11", "12"];
|
|
38
|
+
export type RadiusKey = (typeof RADIUS_KEYS)[number];
|
|
39
|
+
export declare const ZINDEX_KEYS: readonly ["0", "1", "2", "3", "4", "5"];
|
|
40
|
+
export type ZIndexKey = (typeof ZINDEX_KEYS)[number];
|
|
41
|
+
export declare const FONT_KEYS: readonly ["1", "2", "3", "4", "true", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"];
|
|
42
|
+
export type FontKey = (typeof FONT_KEYS)[number];
|
|
43
|
+
export type SubunitKey = "$0.25" | "$0.5" | "$0.75";
|
|
44
|
+
/** `$size` sub-`$1` keys in multiples of `unit`. */
|
|
45
|
+
export declare const SUBUNIT_SHAPE: Record<SubunitKey, number>;
|
|
46
|
+
/** v5 `$size` / 44. */
|
|
47
|
+
export declare const SIZE_SHAPE: Record<Exclude<SizeKey, SubunitKey>, number>;
|
|
48
|
+
/** v5 `$space` / 18 (Tamagui's `sizeToSpace` of each v5 `$size`). */
|
|
49
|
+
export declare const SPACE_SHAPE: Record<SizeKey, number>;
|
|
50
|
+
/** v5 `$radius` / 9. */
|
|
51
|
+
export declare const RADIUS_SHAPE: Record<RadiusKey, number>;
|
|
52
|
+
export declare const ZINDEX: Record<ZIndexKey, number>;
|
|
53
|
+
/** v5 web font sizes / 15. Body and heading share the ladder. */
|
|
54
|
+
export declare const TYPE_SHAPE: Record<FontKey, number>;
|
|
55
|
+
/** v5 native font sizes (iOS HIG, 17pt body) / the 15px web body, so one `type` drives both. */
|
|
56
|
+
export declare const NATIVE_TYPE_SHAPE: Record<FontKey, number>;
|
|
57
|
+
export declare const SIZE_RECIPE_TOKENS: readonly ["$1", "$1.5", "$2", "$2.5", "$3", "$3.5", "$4", "$true", "$5", "$6"];
|
|
58
|
+
export type SizeRecipeToken = (typeof SIZE_RECIPE_TOKENS)[number];
|
|
59
|
+
export declare const SIZE_TOKEN_EXPONENTS: Record<SizeRecipeToken, number>;
|
|
60
|
+
type RecipeKey = Exclude<SizeRecipeToken, "$true">;
|
|
61
|
+
/** Control icon px / 15 per recipe key (rendered reference §6.1). */
|
|
62
|
+
export declare const CONTROL_ICON_SHAPE: Record<RecipeKey, number>;
|
|
63
|
+
/** chip icon px / 15 per recipe key. */
|
|
64
|
+
export declare const CHIP_ICON_SHAPE: Record<RecipeKey, number>;
|
|
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AS,EAAE,MAAM,CAUxD,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAUrD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type CreateTamaguiProps, type GenericFont, type TamaguiInternalConfig } from "@tamagui/web";
|
|
2
|
+
import type { Preset } from "../preset.types";
|
|
3
|
+
import type { SizeRecipeInputs } from "../recipeInputs";
|
|
4
|
+
import { type ScaleFonts, type ScaleTokens } from "./generateScale";
|
|
5
|
+
import { type ResolvedScaleInputs } from "./scaleInputs";
|
|
6
|
+
/** Scale id of the default inputs, and the `scales` key of the implicit default preset. */
|
|
7
|
+
export declare const DEFAULT_SCALE_ID = "default";
|
|
8
|
+
/**
|
|
9
|
+
* One token scale a ThemeConfig can switch to at runtime. Presets with equal
|
|
10
|
+
* inputs share one entry (and one `tamagui()` config).
|
|
11
|
+
*/
|
|
12
|
+
export type ThemeScale = {
|
|
13
|
+
/** `"default"` for the default inputs, else the first preset name that carries these inputs. */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Every preset name that resolves to this scale. */
|
|
16
|
+
presets: string[];
|
|
17
|
+
inputs: ResolvedScaleInputs;
|
|
18
|
+
tokens: ScaleTokens;
|
|
19
|
+
fonts: ScaleFonts;
|
|
20
|
+
/** Size-recipe inputs read off this scale; `setSizeRecipeInputs` takes them as is. */
|
|
21
|
+
recipeInputs: SizeRecipeInputs;
|
|
22
|
+
/** Web repaint block (`:root[data-mp-scale=…]`); empty for the default scale. */
|
|
23
|
+
css: string;
|
|
24
|
+
/** The built Tamagui config with this scale's tokens and fonts, built on first call. */
|
|
25
|
+
tamagui: () => TamaguiInternalConfig;
|
|
26
|
+
};
|
|
27
|
+
export type ThemeScaleBuildOptions = {
|
|
28
|
+
/** The base config, already built on the default scale. */
|
|
29
|
+
base: TamaguiInternalConfig;
|
|
30
|
+
/** The exact props `base` was built from; a scale config swaps only `tokens` and `fonts`. */
|
|
31
|
+
props: CreateTamaguiProps;
|
|
32
|
+
presets?: Record<string, Preset>;
|
|
33
|
+
defaultPreset?: string;
|
|
34
|
+
/** Size-recipe inputs live for the default scale. */
|
|
35
|
+
recipeInputs: SizeRecipeInputs;
|
|
36
|
+
/** Consumer recipe overrides that are not scale-derived (tile ladder, touch floor). */
|
|
37
|
+
recipeOverrides?: Partial<SizeRecipeInputs>;
|
|
38
|
+
/** The font map for a scale's type tables (default: rescale `props.fonts`). */
|
|
39
|
+
fonts: (tables: ScaleFonts) => Record<string, GenericFont>;
|
|
40
|
+
createConfig: (props: CreateTamaguiProps) => TamaguiInternalConfig;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The scales a ThemeConfig can switch between, keyed by preset name (plus
|
|
44
|
+
* `"default"` for the implicit default preset). The default scale reuses
|
|
45
|
+
* `base`; every other scale generates its tokens, fonts and recipe inputs
|
|
46
|
+
* from its preset's `scale` inputs and builds its Tamagui config lazily
|
|
47
|
+
* from the same props, so its color themes are the base's themes object.
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildThemeScales(options: ThemeScaleBuildOptions): Record<string, ThemeScale>;
|
|
50
|
+
/** Every distinct scale once, default first. */
|
|
51
|
+
export declare function uniqueScales(scales: Record<string, ThemeScale> | undefined): ThemeScale[];
|
|
52
|
+
//# sourceMappingURL=themeScales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeScales.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/themeScales.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAG3B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAiB,MAAM,iBA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C,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,GAAG,UAAU,EAAE,CAKzF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ThemeConfig } from "../shared";
|
|
2
|
+
import { type ThemeScale } from "./themeScales";
|
|
3
|
+
/** What a provider needs to pick a scale: the config's scales and its default preset name. */
|
|
4
|
+
export type ScaleSource = Partial<Pick<ThemeConfig, "scales" | "defaultPreset">>;
|
|
5
|
+
/** The px maps `globalThis.__MPO_SCALE__` publishes for in-page audits. */
|
|
6
|
+
export type PublishedScale = Pick<ThemeScale, "id" | "inputs" | "tokens" | "fonts"> & {
|
|
7
|
+
size: ThemeScale["tokens"]["size"];
|
|
8
|
+
space: ThemeScale["tokens"]["space"];
|
|
9
|
+
radius: ThemeScale["tokens"]["radius"];
|
|
10
|
+
type: number;
|
|
11
|
+
controlGaps: number[];
|
|
12
|
+
};
|
|
13
|
+
/** The scale a preset name resolves to; unknown and empty names take the default preset's. */
|
|
14
|
+
export declare function resolveThemeScale(config: ScaleSource | undefined, presetName?: string): ThemeScale | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Install `scale` for every JS reader: its Tamagui config becomes the global
|
|
17
|
+
* one (`getTokenValue`, native `.val` resolution) and its recipe inputs
|
|
18
|
+
* rewrite the live size-recipe tables (`knobProps.control`, Button/Input).
|
|
19
|
+
* Idempotent; returns true when anything changed.
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyThemeScale(scale: ThemeScale): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Keep the active preset's scale installed and return its id.
|
|
24
|
+
*
|
|
25
|
+
* The first render installs it synchronously, so SSR markup and the
|
|
26
|
+
* hydrating render read the same recipe tables. Later switches install in a
|
|
27
|
+
* layout effect and then return the new id, so a context keyed on it
|
|
28
|
+
* re-renders every reader after the tables changed and before paint.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useActiveScale(config: ScaleSource | undefined, presetName?: string): string;
|
|
31
|
+
//# sourceMappingURL=useActiveScale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveScale.d.ts","sourceRoot":"","sources":["../../../src/theme/scale/useActiveScale.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAElE,8FAA8F;AAC9F,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;AAEjF,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG;IACpF,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IACnC,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAMF,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,UAAU,CAAC,EAAE,MAAM,GAClB,UAAU,GAAG,SAAS,CAKxB;AAwBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAQ1D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAc3F"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ThemeScheme } from "./useTheme";
|
|
2
|
+
export declare function hydrateStoredScheme(): Promise<void>;
|
|
3
|
+
export declare function getStoredScheme(): ThemeScheme;
|
|
4
|
+
export declare function subscribeStoredScheme(listener: () => void): () => void;
|
|
5
|
+
export declare function setStoredScheme(value: ThemeScheme): void;
|
|
6
|
+
//# sourceMappingURL=schemeStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemeStore.d.ts","sourceRoot":"","sources":["../../src/theme/schemeStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAmB9C,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBnD;AAED,wBAAgB,eAAe,IAAI,WAAW,CAI7C;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAOtE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAKxD"}
|
package/types/theme/shared.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { GenericFont } from "@tamagui/web";
|
|
1
2
|
import { type CreateTamaguiProps, createTamagui } from "tamagui";
|
|
2
3
|
import type { Knobs } from "./knobs";
|
|
3
4
|
import type { Preset } from "./preset.types";
|
|
4
5
|
import type { RecipeFamilies, RecipeInputs } from "./recipeInputs";
|
|
6
|
+
import type { ScaleFonts } from "./scale/generateScale";
|
|
7
|
+
import { type ThemeScale } from "./scale/themeScales";
|
|
5
8
|
export declare function registerPreset(name: string, preset: Preset): void;
|
|
6
9
|
/**
|
|
7
10
|
* Look up a registered preset by name.
|
|
@@ -39,11 +42,26 @@ export type ThemeConfig<T extends CreateTamaguiProps = CreateTamaguiProps> = {
|
|
|
39
42
|
*/
|
|
40
43
|
recipeInputs?: RecipeInputs;
|
|
41
44
|
recipeFamilies?: RecipeFamilies;
|
|
45
|
+
/**
|
|
46
|
+
* The token scales this config can switch to at runtime, keyed by preset
|
|
47
|
+
* name (`"default"` = the implicit default preset). Presets on equal scale
|
|
48
|
+
* inputs share one entry. Present when the config was built from a
|
|
49
|
+
* generated scale (`createDefaultThemeConfig`).
|
|
50
|
+
*/
|
|
51
|
+
scales?: Record<string, ThemeScale>;
|
|
42
52
|
};
|
|
53
|
+
/** How `createThemeConfig` builds the preset scales of a generated-scale config. */
|
|
54
|
+
export interface ThemeConfigScaleOptions {
|
|
55
|
+
/** The font map a scale's type tables produce. */
|
|
56
|
+
fonts: (tables: ScaleFonts) => Record<string, GenericFont>;
|
|
57
|
+
/** Consumer recipe overrides that are not scale-derived (tile ladder, touch floor). */
|
|
58
|
+
recipeOverrides?: Partial<RecipeInputs>;
|
|
59
|
+
}
|
|
43
60
|
export declare function createThemeConfig<T extends CreateTamaguiProps>(tamagui: T, options?: {
|
|
44
61
|
presets?: Record<string, Preset>;
|
|
45
62
|
defaultPreset?: string;
|
|
46
63
|
recipeInputs?: RecipeInputs;
|
|
47
64
|
recipeFamilies?: RecipeFamilies;
|
|
65
|
+
scale?: ThemeConfigScaleOptions;
|
|
48
66
|
}): ThemeConfig<T>;
|
|
49
67
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/theme/shared.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/theme/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAoC,MAAM,cAAc,CAAC;AAClF,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;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAA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E;IACR,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,CAAC,EAAE,uBAAuB,CAAC;CACjC,GACA,WAAW,CAAC,CAAC,CAAC,CA6ChB"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Coordinated control-size recipes (LC-75 SIZE-RECIPE, LC-80 RECIPE-INPUTS).
|
|
3
3
|
*
|
|
4
|
-
* The default ladder is the
|
|
4
|
+
* The default ladder is read off the generated token scale in recipeInputs
|
|
5
5
|
* (padX / font / icon / radius per size token). Default gap equals the
|
|
6
6
|
* size-table radius; corner shape overrides leave that spacing intact.
|
|
7
|
-
* A linear ratio is only the `{ baseHeight }` fallback — not a
|
|
8
|
-
* documented divergence (MPO-46 / R6).
|
|
9
7
|
*
|
|
10
8
|
* Tables are GENERATED from `defaultRecipeInputs` at module eval (Tamagui
|
|
11
9
|
* 2.0.0-rc.41 flattens `styled(View, { variants: { size: tables } })` when
|
|
@@ -15,20 +13,25 @@
|
|
|
15
13
|
* reserve it for non-enumerable values only. Do NOT put recipe tables on a
|
|
16
14
|
* `createStyledContext` primitive (`neverFlatten`).
|
|
17
15
|
*
|
|
18
|
-
* Reference md ($4 / $true): height
|
|
19
|
-
* gap
|
|
16
|
+
* Reference md ($4 / $true): height 40, padX 16, font 15, icon 16, radius 8,
|
|
17
|
+
* gap 8. The v5 44px control is generated with `v5ScaleInputs`.
|
|
20
18
|
* `sizeToken` remains the recipe KEY (string "$4") so styled() variants
|
|
21
19
|
* can switch; it is not a height scalar.
|
|
22
20
|
*
|
|
23
|
-
* Families
|
|
24
|
-
* `
|
|
21
|
+
* Families (`SIZE_RECIPE_FAMILY_NAMES`), all generated from the scale:
|
|
22
|
+
* - `control` reads `inputs.tokenTable`.
|
|
23
|
+
* - `chip` reads `chipTokenTable` at the SAME heights (Input padX, type one
|
|
24
|
+
* key below).
|
|
25
|
+
* - `menuRow` (menu / listbox / command rows): height one key below the
|
|
26
|
+
* control token (36 at default), padX `$3`, the token's own type.
|
|
27
|
+
* - `tab`: height and padX one key below, the token's own type.
|
|
25
28
|
*
|
|
26
29
|
* On touch (LC-77), `applyTouchFloor` / `sizeRecipeForToken(token, { touch: true })`
|
|
27
30
|
* lift painted height to ≥ 44. Static `sizeRecipe*Variants` stay on the
|
|
28
31
|
* desktop table — runtime fragments carry the floor; consumers spread
|
|
29
32
|
* `knobProps.control` after `size`.
|
|
30
33
|
*/
|
|
31
|
-
export { DEFAULT_SIZE_RECIPE_INPUTS, SIZE_RECIPE_RADIUS_STOPS, SIZE_RECIPE_TOKENS, SIZE_TOKEN_EXPONENTS,
|
|
34
|
+
export { DEFAULT_SIZE_RECIPE_INPUTS, SIZE_RECIPE_RADIUS_STOPS, SIZE_RECIPE_TOKENS, SIZE_TOKEN_EXPONENTS, TOUCH_HEIGHT_FLOOR, applyRadiusStop, SIZE_RECIPE_RADIUS_TOKEN_TO_STOP, cloneSizeRecipeInputs, resolveControlRadius, createRecipeFamilies, defaultRecipeInputs, recipeKeyAbove, recipeKeyBelow, generateSizeRecipeTables, generateSizeRecipes, mergeRecipeInputs, recipeFromTokenChannels, resolveSizeRecipeInputs, } from "./recipeInputs";
|
|
32
35
|
export type { GeneratedSizeRecipes, RecipeFamilies, RecipeFamilyName, RecipeInputs, SizeRecipe, SizeRecipeBoxVariant, SizeRecipeFamily, SizeRecipeFamilyName, SizeRecipeIconVariant, SizeRecipeInputs, SizeRecipeRadiusStop, SizeRecipeRatios, SizeRecipeTables, SizeRecipeToken, SizeRecipeTokenChannels, SizeRecipeTokenTable, SizeRecipeTypeVariant, } from "./recipeInputs";
|
|
33
36
|
import { type GeneratedSizeRecipes, type RecipeFamilyName, type RecipeInputs, type SizeRecipe, type SizeRecipeFamily } from "./recipeInputs";
|
|
34
37
|
/**
|
|
@@ -45,8 +48,8 @@ export declare const SIZE_RECIPE_HEIGHTS: Record<string, number>;
|
|
|
45
48
|
export declare const SIZE_RECIPE_HEIGHTS_TOUCH: Record<string, number>;
|
|
46
49
|
export declare const SIZE_RECIPE_RADII: Record<string, number>;
|
|
47
50
|
export declare const SIZE_RECIPE_RATIOS: import("./recipeInputs").SizeRecipeRatios;
|
|
48
|
-
export declare const
|
|
49
|
-
export declare const SIZE_RECIPE_FAMILY_NAMES: readonly ["control", "
|
|
51
|
+
export declare const SIZE_RECIPE_CHIP_RATIOS: import("./recipeInputs").SizeRecipeRatios;
|
|
52
|
+
export declare const SIZE_RECIPE_FAMILY_NAMES: readonly ["control", "chip", "menuRow", "tab"];
|
|
50
53
|
/**
|
|
51
54
|
* Live tile-size ladder (MPO-31) — generated from `inputs.tile` over the
|
|
52
55
|
* measured defaults, adopted in place on `setSizeRecipeInputs` like every
|
|
@@ -80,13 +83,15 @@ export declare function sizeRecipeForToken(token: string, options?: {
|
|
|
80
83
|
*/
|
|
81
84
|
export declare function sizeRecipeEscape<T>(value: T, _reason?: string): T;
|
|
82
85
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
+
* TEXT-INSET — optical vertical inset of a text field, never larger than the
|
|
87
|
+
* recipe padX, snapped down to the largest `$space` value of the active
|
|
88
|
+
* scale at or under it so the inset is a token on every preset (LC-100).
|
|
89
|
+
* Extra horizontal space is legal only when an icon well occupies that side,
|
|
90
|
+
* not as empty-field padX.
|
|
86
91
|
*
|
|
87
|
-
* min(paddingHorizontal, floor((height − fontSize) / 2))
|
|
92
|
+
* snap(min(paddingHorizontal, floor((height − fontSize) / 2)))
|
|
88
93
|
*
|
|
89
|
-
* `$4` (
|
|
94
|
+
* `$4` (40 / 16 / 15) → 12 (`$3`); roomy 48 / 21 / 16 → 15; dense 36 / 13 / 14 → 9.
|
|
90
95
|
*/
|
|
91
96
|
export declare function textFieldInset(recipe: Pick<SizeRecipe, "height" | "paddingHorizontal" | "fontSize">): number;
|
|
92
97
|
//# sourceMappingURL=sizeRecipes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizeRecipes.d.ts","sourceRoot":"","sources":["../../src/theme/sizeRecipes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sizeRecipes.d.ts","sourceRoot":"","sources":["../../src/theme/sizeRecipes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,gCAAgC,EAChC,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,gBAAgB,EAEtB,MAAM,gBAAgB,CAAC;AA0BxB;;;GAGG;AACH,eAAO,MAAM,cAAc,yCAAmB,CAAC;AAE/C,oFAAoF;AACpF,eAAO,MAAM,WAAW,4BAAiC,CAAC;AAC1D,eAAO,MAAM,qBAAqB,+DAAqC,CAAC;AACxE,eAAO,MAAM,sBAAsB,gEAAsC,CAAC;AAC1E,eAA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,cAAc,CAC5B,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,mBAAmB,GAAG,UAAU,CAAC,GACpE,MAAM,CAUR"}
|
package/types/theme/theme.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CreateTamaguiProps, type TamaguiProviderProps } from "tamagui";
|
|
2
2
|
import type { PropsWithChildren } from "react";
|
|
3
|
+
import { type ThemeConfig } from "./shared";
|
|
3
4
|
/**
|
|
4
5
|
* Animate a DOM mutation (typically a theme/scheme switch) using the View
|
|
5
6
|
* Transitions API where available, falling back to a temporary class-gated
|
|
@@ -12,7 +13,7 @@ export declare function startThemeTransition(apply: () => void): void;
|
|
|
12
13
|
export interface ThemeProviderProps<T extends CreateTamaguiProps = CreateTamaguiProps> extends PropsWithChildren<Omit<TamaguiProviderProps, "config" | "defaultTheme">> {
|
|
13
14
|
config?: {
|
|
14
15
|
tamagui: ReturnType<typeof import("tamagui").createTamagui<T>>;
|
|
15
|
-
}
|
|
16
|
+
} & Partial<Pick<ThemeConfig, "scales" | "defaultPreset">>;
|
|
16
17
|
systemTheme?: "light" | "dark";
|
|
17
18
|
}
|
|
18
19
|
export declare function ThemeProvider<T extends CreateTamaguiProps>({ children, config, systemTheme, ...tamaguiProps }: ThemeProviderProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,EAG1B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAU/C,OAAO,EAAE,KAAK,WAAW,EAAa,MAAM,UAAU,CAAC;AAGvD;;;;;;;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,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;IAC3D,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAkBD,wBAAgB,aAAa,CAAC,CAAC,SAAS,kBAAkB,EAAE,EAC1D,QAAQ,EACR,MAAM,EACN,WAAW,EACX,GAAG,YAAY,EAChB,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAsGvB"}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { type CreateTamaguiProps, type TamaguiProviderProps } from "tamagui";
|
|
2
2
|
import type { PropsWithChildren } from "react";
|
|
3
|
+
import { type ThemeConfig } from "./shared";
|
|
3
4
|
export interface ThemeProviderProps<T extends CreateTamaguiProps = CreateTamaguiProps> extends PropsWithChildren<Omit<TamaguiProviderProps, "config" | "defaultTheme">> {
|
|
4
5
|
config?: {
|
|
5
6
|
tamagui: ReturnType<typeof import("tamagui").createTamagui<T>>;
|
|
6
|
-
}
|
|
7
|
+
} & Partial<Pick<ThemeConfig, "scales" | "defaultPreset">>;
|
|
7
8
|
systemTheme?: "light" | "dark";
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Native resolves token values (`.val`) at render and only theme subscribers
|
|
12
|
+
* re-render on a config change, so a preset whose scale differs remounts the
|
|
13
|
+
* subtree under the provider (keyed on the scale id). That is a settings-level
|
|
14
|
+
* action: local component state under the provider does not survive it.
|
|
15
|
+
* The preset persists in `@multiplatform.one/store` storage (`mp.preset`);
|
|
16
|
+
* first render waits for storage so a relaunch paints the stored scale.
|
|
17
|
+
*/
|
|
9
18
|
export declare function ThemeProvider<T extends CreateTamaguiProps>({ children, config, systemTheme, ...tamaguiProps }: ThemeProviderProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
10
19
|
//# sourceMappingURL=theme.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.native.d.ts","sourceRoot":"","sources":["../../src/theme/theme.native.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"theme.native.d.ts","sourceRoot":"","sources":["../../src/theme/theme.native.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,EAE1B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAQ/C,OAAO,EAAE,KAAK,WAAW,EAAa,MAAM,UAAU,CAAC;AAOvD,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,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;IAC3D,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAMD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,kBAAkB,EAAE,EAC1D,QAAQ,EACR,MAAM,EACN,WAAW,EACX,GAAG,YAAY,EAChB,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CA2BvB"}
|
|
@@ -30,13 +30,12 @@
|
|
|
30
30
|
* here, restyled only through recipe inputs
|
|
31
31
|
* (`setSizeRecipeInputs({ tile })` / `createDefaultThemeConfig({ recipeInputs:
|
|
32
32
|
* { tile } })`). WHICH rung a surface shows is per-app (a prop, often
|
|
33
|
-
* persisted per user). Tile gutters
|
|
34
|
-
*
|
|
33
|
+
* persisted per user). Tile gutters are the spacing roles and tile rounding
|
|
34
|
+
* the borderRadius knob — this module never emits a gap or a radius.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* here reads the density knob.
|
|
36
|
+
* SCALE (LC-100): a preset's token scale moves the gutters (role px) and
|
|
37
|
+
* never re-rungs the ladder — tile magnitude is content scale, not chrome
|
|
38
|
+
* scale.
|
|
40
39
|
*/
|
|
41
40
|
export declare const tileSizeRungs: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
42
41
|
export type TileSizeRung = (typeof tileSizeRungs)[number];
|
|
@@ -101,7 +100,7 @@ export declare function tileRungFlexProps(stop: TileSizeStop): TileRungFlexProps
|
|
|
101
100
|
/**
|
|
102
101
|
* Column count for a fixed-column tile grid (the ImageGrid / springboard
|
|
103
102
|
* idiom): as many columns as fit at the rung's minWidth. `gutter` is the
|
|
104
|
-
* inter-column gap (the
|
|
103
|
+
* inter-column gap (the gap role's px), never baked into the rung.
|
|
105
104
|
*
|
|
106
105
|
* The count is min-driven on purpose: adding a column to honor `maxWidth`
|
|
107
106
|
* would, by construction of the fit, drop every cell below `minWidth`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileSizes.d.ts","sourceRoot":"","sources":["../../src/theme/tileSizes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tileSizes.d.ts","sourceRoot":"","sources":["../../src/theme/tileSizes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;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