@titan-design/react-ui 0.3.0 → 0.4.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/dist/bodymap.js +441 -97
- package/dist/bodymap.js.map +1 -1
- package/dist/bodymap.mjs +49 -62
- package/dist/bodymap.mjs.map +1 -1
- package/dist/{chunk-TOD2WQBG.mjs → chunk-2SISKTWM.mjs} +22 -43
- package/dist/chunk-2SISKTWM.mjs.map +1 -0
- package/dist/{chunk-P7TSQUN6.mjs → chunk-SNVKL5WZ.mjs} +42 -5
- package/dist/chunk-SNVKL5WZ.mjs.map +1 -0
- package/dist/index.d.mts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +431 -328
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +397 -314
- package/dist/index.mjs.map +1 -1
- package/dist/theme/index.d.mts +28 -2
- package/dist/theme/index.d.ts +28 -2
- package/dist/theme/index.js +37 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/custom/Workout/ActiveWorkoutPage.tsx +10 -15
- package/src/components/custom/Workout/BodyMap.tsx +7 -8
- package/src/components/custom/Workout/BodyMapDetailPanel.tsx +25 -28
- package/src/components/custom/Workout/CapacityBandChart.tsx +2 -3
- package/src/components/custom/Workout/ExerciseCard.tsx +12 -27
- package/src/components/custom/Workout/ExerciseDetailPage.tsx +21 -27
- package/src/components/custom/Workout/InputBar.tsx +10 -11
- package/src/components/custom/Workout/MesoCard.tsx +2 -6
- package/src/components/custom/Workout/MesoStatusCard.tsx +17 -15
- package/src/components/custom/Workout/MuscleGroupChip.tsx +2 -4
- package/src/components/custom/Workout/PlaceholderStrip.tsx +2 -3
- package/src/components/custom/Workout/PrHistoryModal.tsx +12 -14
- package/src/components/custom/Workout/ProgramPlanningPage.tsx +8 -12
- package/src/components/custom/Workout/ReadinessCheck.tsx +13 -11
- package/src/components/custom/Workout/RestTimer.tsx +8 -7
- package/src/components/custom/Workout/SetRow.tsx +10 -7
- package/src/components/custom/Workout/StrengthTrendChart.tsx +15 -17
- package/src/components/custom/Workout/TempoBar.stories.tsx +95 -0
- package/src/components/custom/Workout/TempoBar.test.tsx +103 -0
- package/src/components/custom/Workout/TempoBar.tsx +215 -0
- package/src/components/custom/Workout/TrainingStatusPage.tsx +8 -17
- package/src/components/custom/Workout/VelocityStrip.tsx +7 -5
- package/src/components/custom/Workout/WeekRow.tsx +2 -1
- package/src/components/custom/Workout/WorkoutCard.tsx +3 -8
- package/src/components/custom/Workout/index.ts +9 -0
- package/src/test/nativewind-stub.ts +13 -0
- package/src/theme/ThemeProvider.test.tsx +24 -0
- package/src/theme/ThemeProvider.tsx +50 -0
- package/src/theme/index.ts +2 -0
- package/src/theme/resolve-color.ts +19 -0
- package/dist/chunk-P7TSQUN6.mjs.map +0 -1
- package/dist/chunk-TOD2WQBG.mjs.map +0 -1
package/dist/theme/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewStyle } from 'react-native';
|
|
1
|
+
import { ViewStyle, ViewProps } from 'react-native';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Elevation System
|
|
@@ -1615,6 +1615,32 @@ declare function validateCssPropertyManifest(candidate: unknown): ManifestValida
|
|
|
1615
1615
|
/** Type guard variant of validateCssPropertyManifest for use in narrowing contexts. */
|
|
1616
1616
|
declare function isCssPropertyManifest(candidate: unknown): candidate is CssPropertyManifest;
|
|
1617
1617
|
|
|
1618
|
+
type ThemeProviderMode = 'dark' | 'light';
|
|
1619
|
+
interface ThemeProviderProps extends ViewProps {
|
|
1620
|
+
/** Theme mode to register. Mobile is dark-only today; defaults to `dark`. */
|
|
1621
|
+
mode?: ThemeProviderMode;
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Wrap the app root so descendant titan components' `--color-*` className tokens
|
|
1625
|
+
* resolve on native. Fills its parent (`flex: 1`) by default; pass `style` to
|
|
1626
|
+
* override. On web it is harmless (the dashboard already loads `global.css`).
|
|
1627
|
+
*/
|
|
1628
|
+
declare function ThemeProvider({ mode, style, children, ...props }: ThemeProviderProps): React.JSX.Element;
|
|
1629
|
+
|
|
1630
|
+
type ColorToken = keyof ReturnType<typeof getSemanticColors>;
|
|
1631
|
+
/**
|
|
1632
|
+
* Resolve a semantic color token for an inline style where a nativewind
|
|
1633
|
+
* className can't apply — gradients (`backgroundImage`), per-edge borders
|
|
1634
|
+
* (`borderTopColor`, …), SVG attributes, and conditional hex/token mixes.
|
|
1635
|
+
*
|
|
1636
|
+
* The companion to className color tokens: on **web** it returns the CSS
|
|
1637
|
+
* variable (`var(--color-…)`), so the dashboard's light/dark switching keeps
|
|
1638
|
+
* working exactly as `global.css` intends; on **native** it returns the
|
|
1639
|
+
* resolved hex from `getSemanticColors` (mobile is dark-only). This is why
|
|
1640
|
+
* these spots stay theme-correct on web while also rendering on-device.
|
|
1641
|
+
*/
|
|
1642
|
+
declare function resolveColor(token: ColorToken, mode?: ThemeMode): string;
|
|
1643
|
+
|
|
1618
1644
|
interface ThemePresetColors {
|
|
1619
1645
|
'brand-primary'?: string;
|
|
1620
1646
|
'brand-primary-light'?: string;
|
|
@@ -1700,4 +1726,4 @@ declare const defaultPreset: ThemePreset;
|
|
|
1700
1726
|
*/
|
|
1701
1727
|
declare const audiobookPreset: ThemePreset;
|
|
1702
1728
|
|
|
1703
|
-
export { type ComponentType, type CssPropertyEntry, type CssPropertyManifest, type ElevationConfig, type ElevationLevel, type GlowIntensity, type ManifestValidationResult, type ShadowIntensity, type ShadowSurface, type ThemeConfig, type ThemeMode, type ThemePreset, type ThemePresetColors, type ThemePresetFonts, type ThemePresetRadii, type ThemePresetShadows, type VariantAxes, type VariantOverride, applyThemePreset, audiobookPreset, buttonSizes, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, defaultPreset, discreteRainbow, elevationSystem, getBaseSurfaceColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getGlowShadow, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isCssPropertyManifest, isDark, lightThemeCSSVars, lighten, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, shadowColors, validateCssPropertyManifest };
|
|
1729
|
+
export { type ComponentType, type CssPropertyEntry, type CssPropertyManifest, type ElevationConfig, type ElevationLevel, type GlowIntensity, type ManifestValidationResult, type ShadowIntensity, type ShadowSurface, type ThemeConfig, type ThemeMode, type ThemePreset, type ThemePresetColors, type ThemePresetFonts, type ThemePresetRadii, type ThemePresetShadows, ThemeProvider, type ThemeProviderMode, type ThemeProviderProps, type VariantAxes, type VariantOverride, applyThemePreset, audiobookPreset, buttonSizes, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, defaultPreset, discreteRainbow, elevationSystem, getBaseSurfaceColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getGlowShadow, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isCssPropertyManifest, isDark, lightThemeCSSVars, lighten, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, resolveColor, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, shadowColors, validateCssPropertyManifest };
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewStyle } from 'react-native';
|
|
1
|
+
import { ViewStyle, ViewProps } from 'react-native';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Elevation System
|
|
@@ -1615,6 +1615,32 @@ declare function validateCssPropertyManifest(candidate: unknown): ManifestValida
|
|
|
1615
1615
|
/** Type guard variant of validateCssPropertyManifest for use in narrowing contexts. */
|
|
1616
1616
|
declare function isCssPropertyManifest(candidate: unknown): candidate is CssPropertyManifest;
|
|
1617
1617
|
|
|
1618
|
+
type ThemeProviderMode = 'dark' | 'light';
|
|
1619
|
+
interface ThemeProviderProps extends ViewProps {
|
|
1620
|
+
/** Theme mode to register. Mobile is dark-only today; defaults to `dark`. */
|
|
1621
|
+
mode?: ThemeProviderMode;
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Wrap the app root so descendant titan components' `--color-*` className tokens
|
|
1625
|
+
* resolve on native. Fills its parent (`flex: 1`) by default; pass `style` to
|
|
1626
|
+
* override. On web it is harmless (the dashboard already loads `global.css`).
|
|
1627
|
+
*/
|
|
1628
|
+
declare function ThemeProvider({ mode, style, children, ...props }: ThemeProviderProps): React.JSX.Element;
|
|
1629
|
+
|
|
1630
|
+
type ColorToken = keyof ReturnType<typeof getSemanticColors>;
|
|
1631
|
+
/**
|
|
1632
|
+
* Resolve a semantic color token for an inline style where a nativewind
|
|
1633
|
+
* className can't apply — gradients (`backgroundImage`), per-edge borders
|
|
1634
|
+
* (`borderTopColor`, …), SVG attributes, and conditional hex/token mixes.
|
|
1635
|
+
*
|
|
1636
|
+
* The companion to className color tokens: on **web** it returns the CSS
|
|
1637
|
+
* variable (`var(--color-…)`), so the dashboard's light/dark switching keeps
|
|
1638
|
+
* working exactly as `global.css` intends; on **native** it returns the
|
|
1639
|
+
* resolved hex from `getSemanticColors` (mobile is dark-only). This is why
|
|
1640
|
+
* these spots stay theme-correct on web while also rendering on-device.
|
|
1641
|
+
*/
|
|
1642
|
+
declare function resolveColor(token: ColorToken, mode?: ThemeMode): string;
|
|
1643
|
+
|
|
1618
1644
|
interface ThemePresetColors {
|
|
1619
1645
|
'brand-primary'?: string;
|
|
1620
1646
|
'brand-primary-light'?: string;
|
|
@@ -1700,4 +1726,4 @@ declare const defaultPreset: ThemePreset;
|
|
|
1700
1726
|
*/
|
|
1701
1727
|
declare const audiobookPreset: ThemePreset;
|
|
1702
1728
|
|
|
1703
|
-
export { type ComponentType, type CssPropertyEntry, type CssPropertyManifest, type ElevationConfig, type ElevationLevel, type GlowIntensity, type ManifestValidationResult, type ShadowIntensity, type ShadowSurface, type ThemeConfig, type ThemeMode, type ThemePreset, type ThemePresetColors, type ThemePresetFonts, type ThemePresetRadii, type ThemePresetShadows, type VariantAxes, type VariantOverride, applyThemePreset, audiobookPreset, buttonSizes, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, defaultPreset, discreteRainbow, elevationSystem, getBaseSurfaceColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getGlowShadow, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isCssPropertyManifest, isDark, lightThemeCSSVars, lighten, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, shadowColors, validateCssPropertyManifest };
|
|
1729
|
+
export { type ComponentType, type CssPropertyEntry, type CssPropertyManifest, type ElevationConfig, type ElevationLevel, type GlowIntensity, type ManifestValidationResult, type ShadowIntensity, type ShadowSurface, type ThemeConfig, type ThemeMode, type ThemePreset, type ThemePresetColors, type ThemePresetFonts, type ThemePresetRadii, type ThemePresetShadows, ThemeProvider, type ThemeProviderMode, type ThemeProviderProps, type VariantAxes, type VariantOverride, applyThemePreset, audiobookPreset, buttonSizes, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, defaultPreset, discreteRainbow, elevationSystem, getBaseSurfaceColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getGlowShadow, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isCssPropertyManifest, isDark, lightThemeCSSVars, lighten, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, resolveColor, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, shadowColors, validateCssPropertyManifest };
|
package/dist/theme/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var reactNative = require('react-native');
|
|
4
|
+
var nativewind = require('nativewind');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
6
|
|
|
5
7
|
// src/theme/tokens/primitives.ts
|
|
6
8
|
var primitiveColors = {
|
|
@@ -1680,6 +1682,39 @@ function validateCssPropertyManifest(candidate) {
|
|
|
1680
1682
|
function isCssPropertyManifest(candidate) {
|
|
1681
1683
|
return validateCssPropertyManifest(candidate).valid;
|
|
1682
1684
|
}
|
|
1685
|
+
function wrapJsx(fn) {
|
|
1686
|
+
return function(type, props, ...rest) {
|
|
1687
|
+
if (props && typeof props.className === "string" && props.className) {
|
|
1688
|
+
const cn = props.className;
|
|
1689
|
+
const cssStyle = { $$css: true, [cn]: cn };
|
|
1690
|
+
const existing = props.style;
|
|
1691
|
+
props = {
|
|
1692
|
+
...props,
|
|
1693
|
+
style: existing ? [cssStyle, existing] : cssStyle
|
|
1694
|
+
};
|
|
1695
|
+
delete props.className;
|
|
1696
|
+
}
|
|
1697
|
+
return fn(type, props, ...rest);
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
var jsx = wrapJsx(jsxRuntime.jsx);
|
|
1701
|
+
|
|
1702
|
+
// src/theme/ThemeProvider.tsx
|
|
1703
|
+
var MODE_VARS = {
|
|
1704
|
+
dark: nativewind.vars(darkThemeCSSVars),
|
|
1705
|
+
light: nativewind.vars(lightThemeCSSVars)
|
|
1706
|
+
};
|
|
1707
|
+
function ThemeProvider({
|
|
1708
|
+
mode = "dark",
|
|
1709
|
+
style,
|
|
1710
|
+
children,
|
|
1711
|
+
...props
|
|
1712
|
+
}) {
|
|
1713
|
+
return /* @__PURE__ */ jsx(reactNative.View, { style: [MODE_VARS[mode], { flex: 1 }, style], ...props, children });
|
|
1714
|
+
}
|
|
1715
|
+
function resolveColor(token, mode = "dark") {
|
|
1716
|
+
return reactNative.Platform.OS === "web" ? `var(--color-${token})` : getSemanticColors(mode)[token];
|
|
1717
|
+
}
|
|
1683
1718
|
|
|
1684
1719
|
// src/theme/presets/apply.ts
|
|
1685
1720
|
function colorKeyToVar(key) {
|
|
@@ -1844,6 +1879,7 @@ var audiobookPreset = {
|
|
|
1844
1879
|
rootClasses: ["atmosphere-warm", "grain"]
|
|
1845
1880
|
};
|
|
1846
1881
|
|
|
1882
|
+
exports.ThemeProvider = ThemeProvider;
|
|
1847
1883
|
exports.applyThemePreset = applyThemePreset;
|
|
1848
1884
|
exports.audiobookPreset = audiobookPreset;
|
|
1849
1885
|
exports.buttonSizes = buttonSizes;
|
|
@@ -1883,6 +1919,7 @@ exports.primitiveShadows = primitiveShadows;
|
|
|
1883
1919
|
exports.primitiveSpacing = primitiveSpacing;
|
|
1884
1920
|
exports.primitiveTypography = primitiveTypography;
|
|
1885
1921
|
exports.primitiveZIndex = primitiveZIndex;
|
|
1922
|
+
exports.resolveColor = resolveColor;
|
|
1886
1923
|
exports.rgbToHex = rgbToHex;
|
|
1887
1924
|
exports.rgbToHsv = rgbToHsv;
|
|
1888
1925
|
exports.semanticColorsDark = semanticColorsDark;
|