@ankhorage/surface 9.1.115 → 9.2.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/features/badge/adapters/inbound/Badge.d.ts.map +1 -1
- package/dist/features/badge/adapters/inbound/Badge.js +1 -1
- package/dist/features/badge/adapters/inbound/Badge.js.map +1 -1
- package/dist/features/button/adapters/inbound/Button.js +1 -2
- package/dist/features/button/adapters/inbound/Button.js.map +1 -1
- package/dist/features/icon/adapters/inbound/Icon.d.ts.map +1 -1
- package/dist/features/icon/adapters/inbound/Icon.js +9 -1
- package/dist/features/icon/adapters/inbound/Icon.js.map +1 -1
- package/dist/features/theme/adapters/inbound/ThemeProvider.d.ts.map +1 -1
- package/dist/features/theme/adapters/inbound/ThemeProvider.js +1 -0
- package/dist/features/theme/adapters/inbound/ThemeProvider.js.map +1 -1
- package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.d.ts.map +1 -1
- package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.js +1 -0
- package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.js.map +1 -1
- package/dist/features/theme/adapters/inbound/ThemeScope.d.ts +2 -2
- package/dist/features/theme/adapters/inbound/ThemeScope.d.ts.map +1 -1
- package/dist/features/theme/adapters/inbound/ThemeScope.js +5 -4
- package/dist/features/theme/adapters/inbound/ThemeScope.js.map +1 -1
- package/dist/features/theme/application/use-cases/createTheme.d.ts +2 -2
- package/dist/features/theme/application/use-cases/createTheme.d.ts.map +1 -1
- package/dist/features/theme/application/use-cases/createTheme.js +6 -3
- package/dist/features/theme/application/use-cases/createTheme.js.map +1 -1
- package/dist/features/theme/domain/projectInvertedTheme.d.ts +4 -0
- package/dist/features/theme/domain/projectInvertedTheme.d.ts.map +1 -0
- package/dist/features/theme/domain/projectInvertedTheme.js +178 -0
- package/dist/features/theme/domain/projectInvertedTheme.js.map +1 -0
- package/dist/features/theme/domain/resolveInverseSurface.d.ts +10 -0
- package/dist/features/theme/domain/resolveInverseSurface.d.ts.map +1 -0
- package/dist/features/theme/domain/resolveInverseSurface.js +31 -0
- package/dist/features/theme/domain/resolveInverseSurface.js.map +1 -0
- package/dist/features/typography/adapters/inbound/Text.d.ts +1 -1
- package/dist/features/typography/adapters/inbound/Text.d.ts.map +1 -1
- package/dist/features/typography/adapters/inbound/Text.js +2 -1
- package/dist/features/typography/adapters/inbound/Text.js.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.js +10 -2
- package/dist/internal/resolvers/resolveInteractiveColors.js.map +1 -1
- package/dist/internal/resolvers/resolveTextColor.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveTextColor.js +2 -1
- package/dist/internal/resolvers/resolveTextColor.js.map +1 -1
- package/dist/types/theme.d.ts +3 -0
- package/dist/types/theme.d.ts.map +1 -1
- package/dist/types/theme.js.map +1 -1
- package/dist/types/typography.d.ts +1 -0
- package/dist/types/typography.d.ts.map +1 -1
- package/dist/types/typography.js.map +1 -1
- package/package.json +3 -3
- package/src/features/badge/adapters/inbound/Badge.tsx +1 -6
- package/src/features/button/adapters/inbound/Button.tsx +1 -3
- package/src/features/icon/adapters/inbound/Icon.tsx +12 -1
- package/src/features/icon/adapters/inbound/PortableIcon.test.tsx +32 -0
- package/src/features/theme/adapters/inbound/ThemeProvider.tsx +1 -0
- package/src/features/theme/adapters/inbound/ThemeRuntimeContext.tsx +1 -0
- package/src/features/theme/adapters/inbound/ThemeScope.test.tsx +38 -7
- package/src/features/theme/adapters/inbound/ThemeScope.tsx +7 -6
- package/src/features/theme/application/use-cases/createTheme.ts +6 -2
- package/src/features/theme/domain/projectInvertedTheme.ts +300 -0
- package/src/features/theme/domain/resolveInverseSurface.ts +55 -0
- package/src/features/typography/adapters/inbound/Text.tsx +2 -0
- package/src/internal/resolvers/resolveInteractiveColors.test.ts +1 -1
- package/src/internal/resolvers/resolveInteractiveColors.ts +12 -2
- package/src/internal/resolvers/resolveTextColor.test.ts +5 -0
- package/src/internal/resolvers/resolveTextColor.ts +2 -1
- package/src/invertedThemeAcceptance.test.ts +204 -0
- package/src/types/theme.ts +3 -0
- package/src/types/typography.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInverseSurface.d.ts","sourceRoot":"","sources":["../../../../src/features/theme/domain/resolveInverseSurface.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EACzB,gBAAgB,EAChB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAErG,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAE1E,+EAA+E;AAC/E,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,OAAO,EACrB,SAAS,EAAE,SAAS,GACnB;IAAE,OAAO,EAAE,gBAAgB,CAAC;IAAC,iBAAiB,EAAE,yBAAyB,EAAE,CAAA;CAAE,CAgB/E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { parseHexColorOrThrow } from '@ankhorage/color-theory';
|
|
2
|
+
import { SURFACE_COLOR_POLICY } from '../constants';
|
|
3
|
+
/*** Resolve inverted surface levels and measure their effective separation. */
|
|
4
|
+
export function resolveInverseSurface(theme, lightSurface, collector) {
|
|
5
|
+
const { neutral } = theme.swatches;
|
|
6
|
+
const base = theme.semantics.surface.inverse;
|
|
7
|
+
const adjacent = lightSurface ? neutral[100] : neutral[800];
|
|
8
|
+
const sunken = lightSurface ? neutral[200] : neutral[950];
|
|
9
|
+
const surface = {
|
|
10
|
+
...theme.semantics.surface,
|
|
11
|
+
default: base,
|
|
12
|
+
subtle: adjacent,
|
|
13
|
+
raised: adjacent,
|
|
14
|
+
sunken,
|
|
15
|
+
overlay: adjacent,
|
|
16
|
+
disabled: adjacent,
|
|
17
|
+
inverse: theme.semantics.surface.default,
|
|
18
|
+
};
|
|
19
|
+
return { surface, surfaceSeparation: measureInverseSurfaceSeparation(surface, collector) };
|
|
20
|
+
}
|
|
21
|
+
/*** Measure the returned surface levels against their shared sunken background. */
|
|
22
|
+
function measureInverseSurfaceSeparation(surface, collector) {
|
|
23
|
+
const background = parseHexColorOrThrow(surface.sunken);
|
|
24
|
+
const surfaces = [
|
|
25
|
+
['surface.default', surface.default],
|
|
26
|
+
['surface.raised', surface.raised],
|
|
27
|
+
['surface.disabled', surface.disabled],
|
|
28
|
+
];
|
|
29
|
+
return surfaces.map(([id, foreground]) => collector.measureSurface(id, parseHexColorOrThrow(foreground), background, SURFACE_COLOR_POLICY.surfaceSeparation));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=resolveInverseSurface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInverseSurface.js","sourceRoot":"","sources":["../../../../src/features/theme/domain/resolveInverseSurface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAO/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAKpD,+EAA+E;AAC/E,MAAM,UAAU,qBAAqB,CACnC,KAAmB,EACnB,YAAqB,EACrB,SAAoB;IAEpB,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;IACnC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7C,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAqB;QAChC,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO;QAC1B,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;QAChB,MAAM;QACN,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;KACzC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,+BAA+B,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;AAC7F,CAAC;AAED,mFAAmF;AACnF,SAAS,+BAA+B,CACtC,OAAyB,EACzB,SAAoB;IAEpB,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG;QACf,CAAC,iBAAiB,EAAE,OAAO,CAAC,OAAO,CAAC;QACpC,CAAC,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC;QAClC,CAAC,kBAAkB,EAAE,OAAO,CAAC,QAAQ,CAAC;KAC9B,CAAC;IACX,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,CACvC,SAAS,CAAC,cAAc,CACtB,EAAE,EACF,oBAAoB,CAAC,UAAU,CAAC,EAChC,UAAU,EACV,oBAAoB,CAAC,iBAAiB,CACvC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import { parseHexColorOrThrow } from '@ankhorage/color-theory';\n\nimport type {\n SurfaceContrastDiagnostic,\n SurfaceSemantics,\n SurfaceTheme,\n} from '../../../types/theme';\nimport { SURFACE_COLOR_POLICY } from '../constants';\nimport type { createSurfaceColorDiagnosticCollector } from './createSurfaceColorDiagnosticCollector';\n\ntype Collector = ReturnType<typeof createSurfaceColorDiagnosticCollector>;\n\n/*** Resolve inverted surface levels and measure their effective separation. */\nexport function resolveInverseSurface(\n theme: SurfaceTheme,\n lightSurface: boolean,\n collector: Collector,\n): { surface: SurfaceSemantics; surfaceSeparation: SurfaceContrastDiagnostic[] } {\n const { neutral } = theme.swatches;\n const base = theme.semantics.surface.inverse;\n const adjacent = lightSurface ? neutral[100] : neutral[800];\n const sunken = lightSurface ? neutral[200] : neutral[950];\n const surface: SurfaceSemantics = {\n ...theme.semantics.surface,\n default: base,\n subtle: adjacent,\n raised: adjacent,\n sunken,\n overlay: adjacent,\n disabled: adjacent,\n inverse: theme.semantics.surface.default,\n };\n return { surface, surfaceSeparation: measureInverseSurfaceSeparation(surface, collector) };\n}\n\n/*** Measure the returned surface levels against their shared sunken background. */\nfunction measureInverseSurfaceSeparation(\n surface: SurfaceSemantics,\n collector: Collector,\n): SurfaceContrastDiagnostic[] {\n const background = parseHexColorOrThrow(surface.sunken);\n const surfaces = [\n ['surface.default', surface.default],\n ['surface.raised', surface.raised],\n ['surface.disabled', surface.disabled],\n ] as const;\n return surfaces.map(([id, foreground]) =>\n collector.measureSurface(\n id,\n parseHexColorOrThrow(foreground),\n background,\n SURFACE_COLOR_POLICY.surfaceSeparation,\n ),\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TextProps } from '../../../../types/typography';
|
|
3
3
|
/*** Renders body text using Surface semantic typography. */
|
|
4
|
-
export declare function Text({ children, i18nKey, variant, emphasis, color, align, weight, italic, numberOfLines, testID, }: TextProps): React.JSX.Element;
|
|
4
|
+
export declare function Text({ children, i18nKey, variant, emphasis, color, align, weight, italic, numberOfLines, testID, style, }: TextProps): React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../../src/features/typography/adapters/inbound/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,4DAA4D;AAC5D,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,OAAgB,EAChB,QAAoB,EACpB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAc,EACd,aAAa,EACb,MAAM,
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../../src/features/typography/adapters/inbound/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,4DAA4D;AAC5D,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,OAAgB,EAChB,QAAoB,EACpB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAc,EACd,aAAa,EACb,MAAM,EACN,KAAK,GACN,EAAE,SAAS,qBAiBX"}
|
|
@@ -3,12 +3,13 @@ import { Text as ReactNativeText } from 'react-native';
|
|
|
3
3
|
import { resolveTextColor, resolveTextStyles } from '../../../../internal/resolvers';
|
|
4
4
|
import { useTheme } from '../../../theme/runtime';
|
|
5
5
|
/*** Renders body text using Surface semantic typography. */
|
|
6
|
-
export function Text({ children, i18nKey, variant = 'body', emphasis = 'default', color, align, weight, italic = false, numberOfLines, testID, }) {
|
|
6
|
+
export function Text({ children, i18nKey, variant = 'body', emphasis = 'default', color, align, weight, italic = false, numberOfLines, testID, style, }) {
|
|
7
7
|
const { theme } = useTheme();
|
|
8
8
|
const content = children ?? i18nKey ?? null;
|
|
9
9
|
return (<ReactNativeText numberOfLines={numberOfLines} testID={testID} style={[
|
|
10
10
|
resolveTextStyles(theme, { align, italic, variant, weight }),
|
|
11
11
|
{ color: resolveTextColor(theme, emphasis, color) },
|
|
12
|
+
style,
|
|
12
13
|
]}>
|
|
13
14
|
{content}
|
|
14
15
|
</ReactNativeText>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../../../src/features/typography/adapters/inbound/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,4DAA4D;AAC5D,MAAM,UAAU,IAAI,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,OAAO,GAAG,MAAM,EAChB,QAAQ,GAAG,SAAS,EACpB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,GAAG,KAAK,EACd,aAAa,EACb,MAAM,
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../../../src/features/typography/adapters/inbound/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,4DAA4D;AAC5D,MAAM,UAAU,IAAI,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,OAAO,GAAG,MAAM,EAChB,QAAQ,GAAG,SAAS,EACpB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,GAAG,KAAK,EACd,aAAa,EACb,MAAM,EACN,KAAK,GACK;IACV,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,QAAQ,IAAI,OAAO,IAAI,IAAI,CAAC;IAE5C,OAAO,CACL,CAAC,eAAe,CACd,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC;YACL,iBAAiB,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;YAC5D,EAAE,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE;YACnD,KAAK;SACN,CAAC,CAEF;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Text as ReactNativeText } from 'react-native';\n\nimport { resolveTextColor, resolveTextStyles } from '../../../../internal/resolvers';\nimport type { TextProps } from '../../../../types/typography';\nimport { useTheme } from '../../../theme/runtime';\n\n/*** Renders body text using Surface semantic typography. */\nexport function Text({\n children,\n i18nKey,\n variant = 'body',\n emphasis = 'default',\n color,\n align,\n weight,\n italic = false,\n numberOfLines,\n testID,\n style,\n}: TextProps) {\n const { theme } = useTheme();\n const content = children ?? i18nKey ?? null;\n\n return (\n <ReactNativeText\n numberOfLines={numberOfLines}\n testID={testID}\n style={[\n resolveTextStyles(theme, { align, italic, variant, weight }),\n { color: resolveTextColor(theme, emphasis, color) },\n style,\n ]}\n >\n {content}\n </ReactNativeText>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveInteractiveColors.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,EACE,OAAO,EACP,KAAK,EACL,KAAK,GACN,EAAE;IACD,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC;CACzB,GACA,yBAAyB,CA8D3B;
|
|
1
|
+
{"version":3,"file":"resolveInteractiveColors.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,EACE,OAAO,EACP,KAAK,EACL,KAAK,GACN,EAAE;IACD,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC;CACzB,GACA,yBAAyB,CA8D3B;AAYD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,UAAU,GACrB,yBAAyB,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAA;CAAE,CA6C1D"}
|
|
@@ -17,7 +17,7 @@ export function resolveButtonColors(theme, { variant, color, state, }) {
|
|
|
17
17
|
? semanticTone.softHover
|
|
18
18
|
: 'transparent',
|
|
19
19
|
borderColor: semanticTone.outline,
|
|
20
|
-
contentColor: semanticTone
|
|
20
|
+
contentColor: resolveTransparentContentColor(semanticTone, state),
|
|
21
21
|
};
|
|
22
22
|
case 'ghost':
|
|
23
23
|
return {
|
|
@@ -27,7 +27,7 @@ export function resolveButtonColors(theme, { variant, color, state, }) {
|
|
|
27
27
|
? semanticTone.softHover
|
|
28
28
|
: 'transparent',
|
|
29
29
|
borderColor: 'transparent',
|
|
30
|
-
contentColor: semanticTone
|
|
30
|
+
contentColor: resolveTransparentContentColor(semanticTone, state),
|
|
31
31
|
};
|
|
32
32
|
case 'soft':
|
|
33
33
|
return {
|
|
@@ -60,6 +60,14 @@ export function resolveButtonColors(theme, { variant, color, state, }) {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
/*** Pair hovered and pressed transparent controls with their own soft fill. */
|
|
64
|
+
function resolveTransparentContentColor(role, state) {
|
|
65
|
+
if (state.pressed)
|
|
66
|
+
return role.onSoftActiveText;
|
|
67
|
+
if (state.hovered)
|
|
68
|
+
return role.onSoftHoverText;
|
|
69
|
+
return role.onSurfaceText;
|
|
70
|
+
}
|
|
63
71
|
export function resolveInputColors(theme, fieldState) {
|
|
64
72
|
if (fieldState.disabled) {
|
|
65
73
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveInteractiveColors.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveColors.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAS5D,MAAM,UAAU,mBAAmB,CACjC,KAAmB,EACnB,EACE,OAAO,EACP,KAAK,EACL,KAAK,GAKN;IAED,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnB,OAAO;YACL,eAAe,EAAE,KAAK,CA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C5F,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;YAC7C,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;SAChD,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,OAAO;YACL,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;YAChD,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK;YACzC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;YAC7C,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;SAChD,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,OAAO;YACL,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM;YAC/C,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO;YAC3C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;YAC7C,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;SAChD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;QAChD,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO;QAC3C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;QAC7C,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import type { ButtonVariant } from '../../types/button';\nimport type { InteractionState } from '../../types/pressable';\nimport type { SurfaceColor } from '../../types/surfaceColor';\nimport type { SurfaceTheme } from '../../types/theme';\nimport type { FieldState } from './resolveFieldState';\nimport { resolveSurfaceColor } from './resolveSurfaceColor';\n\nexport interface ResolvedInteractiveColors {\n backgroundColor: string;\n borderColor: string;\n contentColor: string;\n opacity?: number;\n}\n\nexport function resolveButtonColors(\n theme: SurfaceTheme,\n {\n variant,\n color,\n state,\n }: {\n variant: ButtonVariant;\n color: SurfaceColor;\n state: InteractionState;\n },\n): ResolvedInteractiveColors {\n if (state.disabled) {\n return {\n backgroundColor: theme.semantics.surface.disabled,\n borderColor: theme.semantics.border.subtle,\n contentColor: theme.semantics.content.disabled,\n };\n }\n\n const semanticTone = resolveSurfaceColor(theme, color);\n\n switch (variant) {\n case 'outline':\n return {\n backgroundColor: state.pressed\n ? semanticTone.softActive\n : state.hovered\n ? semanticTone.softHover\n : 'transparent',\n borderColor: semanticTone.outline,\n contentColor: resolveTransparentContentColor(semanticTone, state),\n };\n case 'ghost':\n return {\n backgroundColor: state.pressed\n ? semanticTone.softActive\n : state.hovered\n ? semanticTone.softHover\n : 'transparent',\n borderColor: 'transparent',\n contentColor: resolveTransparentContentColor(semanticTone, state),\n };\n case 'soft':\n return {\n backgroundColor: state.pressed\n ? semanticTone.softActive\n : state.hovered\n ? semanticTone.softHover\n : semanticTone.softBg,\n borderColor: 'transparent',\n contentColor: state.pressed\n ? semanticTone.onSoftActiveText\n : state.hovered\n ? semanticTone.onSoftHoverText\n : semanticTone.onSoftText,\n };\n case 'solid':\n default:\n return {\n backgroundColor: state.pressed\n ? semanticTone.strong\n : state.hovered\n ? semanticTone.hover\n : semanticTone.base,\n borderColor: semanticTone.base,\n contentColor: state.pressed\n ? semanticTone.onStrongText\n : state.hovered\n ? semanticTone.onHoverText\n : semanticTone.onSolidText,\n };\n }\n}\n\n/*** Pair hovered and pressed transparent controls with their own soft fill. */\nfunction resolveTransparentContentColor(\n role: ReturnType<typeof resolveSurfaceColor>,\n state: InteractionState,\n): string {\n if (state.pressed) return role.onSoftActiveText;\n if (state.hovered) return role.onSoftHoverText;\n return role.onSurfaceText;\n}\n\nexport function resolveInputColors(\n theme: SurfaceTheme,\n fieldState: FieldState,\n): ResolvedInteractiveColors & { placeholderColor: string } {\n if (fieldState.disabled) {\n return {\n backgroundColor: theme.semantics.surface.disabled,\n borderColor: theme.semantics.border.subtle,\n contentColor: theme.semantics.content.disabled,\n placeholderColor: theme.semantics.content.disabled,\n };\n }\n\n if (fieldState.invalid) {\n return {\n backgroundColor: fieldState.readOnly\n ? theme.semantics.surface.subtle\n : theme.semantics.surface.default,\n borderColor: fieldState.focused ? theme.semantics.error.base : theme.semantics.error.outline,\n contentColor: theme.semantics.content.default,\n placeholderColor: theme.semantics.content.muted,\n };\n }\n\n if (fieldState.focused) {\n return {\n backgroundColor: theme.semantics.surface.default,\n borderColor: theme.semantics.border.focus,\n contentColor: theme.semantics.content.default,\n placeholderColor: theme.semantics.content.muted,\n };\n }\n\n if (fieldState.readOnly) {\n return {\n backgroundColor: theme.semantics.surface.subtle,\n borderColor: theme.semantics.border.default,\n contentColor: theme.semantics.content.default,\n placeholderColor: theme.semantics.content.muted,\n };\n }\n\n return {\n backgroundColor: theme.semantics.surface.default,\n borderColor: theme.semantics.border.default,\n contentColor: theme.semantics.content.default,\n placeholderColor: theme.semantics.content.muted,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTextColor.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,QAAQ,GAAE,eAA2B,EACrC,KAAK,CAAC,EAAE,YAAY,GACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"resolveTextColor.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,QAAQ,GAAE,eAA2B,EACrC,KAAK,CAAC,EAAE,YAAY,GACnB,MAAM,CAoBR"}
|
|
@@ -4,7 +4,8 @@ export function resolveTextColor(theme, emphasis = 'default', color) {
|
|
|
4
4
|
if (emphasis === 'inverse') {
|
|
5
5
|
return resolveSurfaceColor(theme, color).onSolidText;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
const role = resolveSurfaceColor(theme, color);
|
|
8
|
+
return theme.inverted ? role.onSurfaceText : role.base;
|
|
8
9
|
}
|
|
9
10
|
switch (emphasis) {
|
|
10
11
|
case 'muted':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTextColor.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextColor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,gBAAgB,CAC9B,KAAmB,EACnB,WAA4B,SAAS,EACrC,KAAoB;IAEpB,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,WAAW,CAAC;QACvD,CAAC;QAED,
|
|
1
|
+
{"version":3,"file":"resolveTextColor.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextColor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,gBAAgB,CAC9B,KAAmB,EACnB,WAA4B,SAAS,EACrC,KAAoB;IAEpB,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,WAAW,CAAC;QACvD,CAAC;QAED,MAAM,IAAI,GAAG,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACzD,CAAC;IAED,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;QACvC,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;QACxC,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QACzC;YACE,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;IAC3C,CAAC;AACH,CAAC","sourcesContent":["import type { SurfaceColor, SurfaceEmphasis } from '../../types/surfaceColor';\nimport type { SurfaceTheme } from '../../types/theme';\nimport { resolveSurfaceColor } from './resolveSurfaceColor';\n\nexport function resolveTextColor(\n theme: SurfaceTheme,\n emphasis: SurfaceEmphasis = 'default',\n color?: SurfaceColor,\n): string {\n if (color) {\n if (emphasis === 'inverse') {\n return resolveSurfaceColor(theme, color).onSolidText;\n }\n\n const role = resolveSurfaceColor(theme, color);\n return theme.inverted ? role.onSurfaceText : role.base;\n }\n\n switch (emphasis) {\n case 'muted':\n return theme.semantics.content.muted;\n case 'subtle':\n return theme.semantics.content.subtle;\n case 'inverse':\n return theme.semantics.content.inverse;\n default:\n return theme.semantics.content.default;\n }\n}\n"]}
|
package/dist/types/theme.d.ts
CHANGED
|
@@ -202,11 +202,13 @@ export interface ThemeTokens {
|
|
|
202
202
|
}
|
|
203
203
|
export interface SurfaceTheme extends ThemeTokens {
|
|
204
204
|
config: ContractsThemeConfig;
|
|
205
|
+
inverted?: boolean;
|
|
205
206
|
}
|
|
206
207
|
export type ThemeMode = 'light' | 'dark';
|
|
207
208
|
export interface ThemeRuntime {
|
|
208
209
|
theme: SurfaceTheme;
|
|
209
210
|
mode: ThemeMode;
|
|
211
|
+
inverted?: boolean;
|
|
210
212
|
setThemeConfig: (config: Partial<ContractsThemeConfig>) => void;
|
|
211
213
|
setMode: (mode: ThemeMode) => void;
|
|
212
214
|
}
|
|
@@ -219,5 +221,6 @@ export interface ThemeScopeProps {
|
|
|
219
221
|
children: ReactNode;
|
|
220
222
|
themeConfig?: Partial<ContractsThemeConfig>;
|
|
221
223
|
mode?: ThemeMode;
|
|
224
|
+
inverted?: boolean;
|
|
222
225
|
}
|
|
223
226
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,QAAQ,EACR,yBAAyB,EACzB,cAAc,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,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AAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/dist/types/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ColorSwatchDiagnostics,\n ColorSwatchSelectionResult,\n DefaultSemanticStatusRole,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n ThemeColorMode,\n} from '@ankhorage/color-theory';\nimport type { ThemeConfig as ContractsThemeConfig } from '@ankhorage/contracts';\nimport type { ReactNode } from 'react';\n\nexport interface NeutralSemantics {\n bg: string;\n bgSubtle: string;\n surface: string;\n surfaceHover: string;\n surfaceActive: string;\n border: string;\n borderStrong: string;\n divider: string;\n text: string;\n textMuted: string;\n textSubtle: string;\n disabledBg: string;\n disabledText: string;\n}\n\nexport interface RoleSemantics {\n base: string;\n hover: string;\n strong: string;\n softBg: string;\n softHover: string;\n softActive: string;\n outline: string;\n onSurfaceText: string;\n onSolidText: string;\n onHoverText: string;\n onStrongText: string;\n onSoftText: string;\n onSoftHoverText: string;\n onSoftActiveText: string;\n disabledBg: string;\n onDisabledText: string;\n}\n\nexport interface SurfaceSemantics {\n default: string;\n subtle: string;\n raised: string;\n sunken: string;\n overlay: string;\n scrim: string;\n disabled: string;\n inverse: string;\n}\n\nexport interface ContentSemantics {\n default: string;\n muted: string;\n subtle: string;\n disabled: string;\n icon: string;\n link: string;\n visited: string;\n inverse: string;\n}\n\nexport interface BorderSemantics {\n default: string;\n subtle: string;\n strong: string;\n divider: string;\n focus: string;\n}\n\nexport interface SelectionSemantics {\n background: string;\n content: string;\n border: string;\n}\n\nexport interface ActionSemantics {\n primary: RoleSemantics;\n neutral: RoleSemantics;\n danger: RoleSemantics;\n}\n\nexport interface ThemeSemantics {\n neutral: NeutralSemantics;\n brand: RoleSemantics;\n secondary: RoleSemantics;\n accent: RoleSemantics;\n highlight: RoleSemantics;\n danger: RoleSemantics;\n success: RoleSemantics;\n warning: RoleSemantics;\n error: RoleSemantics;\n info: RoleSemantics;\n surface: SurfaceSemantics;\n content: ContentSemantics;\n border: BorderSemantics;\n selection: SelectionSemantics;\n action: ActionSemantics;\n}\n\nexport interface SurfaceContrastDiagnostic {\n id: string;\n foreground: HexColor;\n background: HexColor;\n contrast: number;\n minimumContrast: number;\n passes: boolean;\n}\n\n/** A Color Theory swatch selection together with its stable Surface purpose. */\nexport interface SurfaceColorSelectionDiagnostic {\n id: string;\n result: ColorSwatchSelectionResult;\n}\n\n/** Owner-produced color evidence used to explain a resolved Surface theme. */\nexport interface SurfaceColorDiagnostics {\n mode: ThemeColorMode;\n generated: GeneratedThemeModeColors;\n semanticReferences: SemanticColorReferenceMap;\n statusSwatches: Record<DefaultSemanticStatusRole, ColorSwatchDiagnostics>;\n selections: readonly SurfaceColorSelectionDiagnostic[];\n contrasts: readonly SurfaceContrastDiagnostic[];\n surfaceSeparation: readonly SurfaceContrastDiagnostic[];\n}\n\nexport type FontWeight =\n '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | 'bold' | 'normal';\n\nexport interface ThemeTokens {\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n highlight: string;\n tertiary: string;\n quaternary: string;\n background: string;\n surface: string;\n text: string;\n textSecondary: string;\n border: string;\n error: string;\n success: string;\n warning: string;\n info: string;\n [key: string]: string;\n };\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n /** Generated owner evidence; this is runtime output and is not persisted in ThemeConfig. */\n colorDiagnostics: SurfaceColorDiagnostics;\n spacing: {\n none: 0;\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n [key: string]: number;\n };\n radii: {\n none: 0;\n s: number;\n m: number;\n l: number;\n full: number;\n [key: string]: number;\n };\n typography: {\n headings: Record<\n 1 | 2 | 3 | 4 | 5 | 6,\n {\n size: number;\n lineHeight: number;\n weight: 'regular' | 'medium' | 'semiBold' | 'bold';\n }\n >;\n sizes: {\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n '3xl': number;\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n [key: string]: number;\n };\n weights: {\n thin: FontWeight;\n extraLight: FontWeight;\n light: FontWeight;\n regular: FontWeight;\n medium: FontWeight;\n semiBold: FontWeight;\n bold: FontWeight;\n extraBold: FontWeight;\n black: FontWeight;\n };\n fonts: {\n /** Map of weight -> fontFamily name for normal style */\n normal: Record<FontWeight, string | undefined>;\n /** Map of weight -> fontFamily name for italic style */\n italic: Record<FontWeight, string | undefined>;\n };\n };\n shadows: {\n soft: number;\n medium: number;\n hard: number;\n [key: string]: number;\n };\n}\n\nexport interface SurfaceTheme extends ThemeTokens {\n config: ContractsThemeConfig;\n}\n\nexport type ThemeMode = 'light' | 'dark';\n\nexport interface ThemeRuntime {\n theme: SurfaceTheme;\n mode: ThemeMode;\n setThemeConfig: (config: Partial<ContractsThemeConfig>) => void;\n setMode: (mode: ThemeMode) => void;\n}\n\nexport interface ThemeProviderProps {\n children: ReactNode;\n initialConfig?: Partial<ContractsThemeConfig>;\n initialMode?: ThemeMode;\n}\n\nexport interface ThemeScopeProps {\n children: ReactNode;\n themeConfig?: Partial<ContractsThemeConfig>;\n mode?: ThemeMode;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ColorSwatchDiagnostics,\n ColorSwatchSelectionResult,\n DefaultSemanticStatusRole,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n ThemeColorMode,\n} from '@ankhorage/color-theory';\nimport type { ThemeConfig as ContractsThemeConfig } from '@ankhorage/contracts';\nimport type { ReactNode } from 'react';\n\nexport interface NeutralSemantics {\n bg: string;\n bgSubtle: string;\n surface: string;\n surfaceHover: string;\n surfaceActive: string;\n border: string;\n borderStrong: string;\n divider: string;\n text: string;\n textMuted: string;\n textSubtle: string;\n disabledBg: string;\n disabledText: string;\n}\n\nexport interface RoleSemantics {\n base: string;\n hover: string;\n strong: string;\n softBg: string;\n softHover: string;\n softActive: string;\n outline: string;\n onSurfaceText: string;\n onSolidText: string;\n onHoverText: string;\n onStrongText: string;\n onSoftText: string;\n onSoftHoverText: string;\n onSoftActiveText: string;\n disabledBg: string;\n onDisabledText: string;\n}\n\nexport interface SurfaceSemantics {\n default: string;\n subtle: string;\n raised: string;\n sunken: string;\n overlay: string;\n scrim: string;\n disabled: string;\n inverse: string;\n}\n\nexport interface ContentSemantics {\n default: string;\n muted: string;\n subtle: string;\n disabled: string;\n icon: string;\n link: string;\n visited: string;\n inverse: string;\n}\n\nexport interface BorderSemantics {\n default: string;\n subtle: string;\n strong: string;\n divider: string;\n focus: string;\n}\n\nexport interface SelectionSemantics {\n background: string;\n content: string;\n border: string;\n}\n\nexport interface ActionSemantics {\n primary: RoleSemantics;\n neutral: RoleSemantics;\n danger: RoleSemantics;\n}\n\nexport interface ThemeSemantics {\n neutral: NeutralSemantics;\n brand: RoleSemantics;\n secondary: RoleSemantics;\n accent: RoleSemantics;\n highlight: RoleSemantics;\n danger: RoleSemantics;\n success: RoleSemantics;\n warning: RoleSemantics;\n error: RoleSemantics;\n info: RoleSemantics;\n surface: SurfaceSemantics;\n content: ContentSemantics;\n border: BorderSemantics;\n selection: SelectionSemantics;\n action: ActionSemantics;\n}\n\nexport interface SurfaceContrastDiagnostic {\n id: string;\n foreground: HexColor;\n background: HexColor;\n contrast: number;\n minimumContrast: number;\n passes: boolean;\n}\n\n/** A Color Theory swatch selection together with its stable Surface purpose. */\nexport interface SurfaceColorSelectionDiagnostic {\n id: string;\n result: ColorSwatchSelectionResult;\n}\n\n/** Owner-produced color evidence used to explain a resolved Surface theme. */\nexport interface SurfaceColorDiagnostics {\n mode: ThemeColorMode;\n generated: GeneratedThemeModeColors;\n semanticReferences: SemanticColorReferenceMap;\n statusSwatches: Record<DefaultSemanticStatusRole, ColorSwatchDiagnostics>;\n selections: readonly SurfaceColorSelectionDiagnostic[];\n contrasts: readonly SurfaceContrastDiagnostic[];\n surfaceSeparation: readonly SurfaceContrastDiagnostic[];\n}\n\nexport type FontWeight =\n '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | 'bold' | 'normal';\n\nexport interface ThemeTokens {\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n highlight: string;\n tertiary: string;\n quaternary: string;\n background: string;\n surface: string;\n text: string;\n textSecondary: string;\n border: string;\n error: string;\n success: string;\n warning: string;\n info: string;\n [key: string]: string;\n };\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n /** Generated owner evidence; this is runtime output and is not persisted in ThemeConfig. */\n colorDiagnostics: SurfaceColorDiagnostics;\n spacing: {\n none: 0;\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n [key: string]: number;\n };\n radii: {\n none: 0;\n s: number;\n m: number;\n l: number;\n full: number;\n [key: string]: number;\n };\n typography: {\n headings: Record<\n 1 | 2 | 3 | 4 | 5 | 6,\n {\n size: number;\n lineHeight: number;\n weight: 'regular' | 'medium' | 'semiBold' | 'bold';\n }\n >;\n sizes: {\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n '3xl': number;\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n [key: string]: number;\n };\n weights: {\n thin: FontWeight;\n extraLight: FontWeight;\n light: FontWeight;\n regular: FontWeight;\n medium: FontWeight;\n semiBold: FontWeight;\n bold: FontWeight;\n extraBold: FontWeight;\n black: FontWeight;\n };\n fonts: {\n /** Map of weight -> fontFamily name for normal style */\n normal: Record<FontWeight, string | undefined>;\n /** Map of weight -> fontFamily name for italic style */\n italic: Record<FontWeight, string | undefined>;\n };\n };\n shadows: {\n soft: number;\n medium: number;\n hard: number;\n [key: string]: number;\n };\n}\n\nexport interface SurfaceTheme extends ThemeTokens {\n config: ContractsThemeConfig;\n inverted?: boolean;\n}\n\nexport type ThemeMode = 'light' | 'dark';\n\nexport interface ThemeRuntime {\n theme: SurfaceTheme;\n mode: ThemeMode;\n inverted?: boolean;\n setThemeConfig: (config: Partial<ContractsThemeConfig>) => void;\n setMode: (mode: ThemeMode) => void;\n}\n\nexport interface ThemeProviderProps {\n children: ReactNode;\n initialConfig?: Partial<ContractsThemeConfig>;\n initialMode?: ThemeMode;\n}\n\nexport interface ThemeScopeProps {\n children: ReactNode;\n themeConfig?: Partial<ContractsThemeConfig>;\n mode?: ThemeMode;\n inverted?: boolean;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/types/typography.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAC9E,MAAM,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;AAElF,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,G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AC,GAAG,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzD,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../../src/types/typography.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { TextStyle } from 'react-native';\n\nimport type { SurfaceColor, SurfaceEmphasis } from './surfaceColor';\nimport type { FontWeight, SurfaceTheme } from './theme';\n\nexport type TextVariant = 'body' | 'bodySmall' | 'caption' | 'label' | 'mono';\nexport type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n level?: HeadingLevel;\n align?: 'auto' | 'left' | 'right' | 'center' | 'justify';\n color?: SurfaceColor;\n emphasis?: SurfaceEmphasis;\n numberOfLines?: number;\n i18nKey?: string;\n testID?: string;\n}\n\nexport interface TextProps {\n children?: React.ReactNode;\n i18nKey?: string;\n variant?: TextVariant;\n emphasis?: SurfaceEmphasis;\n color?: SurfaceColor;\n align?: TextStyle['textAlign'];\n weight?: TextWeight;\n italic?: boolean;\n numberOfLines?: number;\n testID?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../../src/types/typography.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { TextStyle } from 'react-native';\n\nimport type { SurfaceColor, SurfaceEmphasis } from './surfaceColor';\nimport type { FontWeight, SurfaceTheme } from './theme';\n\nexport type TextVariant = 'body' | 'bodySmall' | 'caption' | 'label' | 'mono';\nexport type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n level?: HeadingLevel;\n align?: 'auto' | 'left' | 'right' | 'center' | 'justify';\n color?: SurfaceColor;\n emphasis?: SurfaceEmphasis;\n numberOfLines?: number;\n i18nKey?: string;\n testID?: string;\n}\n\nexport interface TextProps {\n children?: React.ReactNode;\n i18nKey?: string;\n variant?: TextVariant;\n emphasis?: SurfaceEmphasis;\n color?: SurfaceColor;\n align?: TextStyle['textAlign'];\n weight?: TextWeight;\n italic?: boolean;\n numberOfLines?: number;\n testID?: string;\n style?: TextStyle;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/surface",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.2.0",
|
|
5
5
|
"description": "Stable UI foundation for React Native and React Native Web.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/surface#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@ankhorage/color-theory": "^0.3.1",
|
|
47
|
-
"@ankhorage/contracts": "^22.8.
|
|
47
|
+
"@ankhorage/contracts": "^22.8.103",
|
|
48
48
|
"@ankhorage/utility": "^1.9.85",
|
|
49
49
|
"@gorhom/bottom-sheet": "^5.2.14"
|
|
50
50
|
},
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"version-packages": "ankhorage-changeset version"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@ankhorage/devtools": "^2.1.
|
|
110
|
+
"@ankhorage/devtools": "^2.1.12",
|
|
111
111
|
"@ankhorage/paradox": "^0.2.28",
|
|
112
112
|
"@react-native-vector-icons/fontawesome": "^13.1.4",
|
|
113
113
|
"@react-native-vector-icons/fontawesome5": "^13.1.4",
|
|
@@ -31,12 +31,7 @@ export function Badge({
|
|
|
31
31
|
style={resolveBadgeStyle(colors.backgroundColor, colors.borderColor, variant)}
|
|
32
32
|
testID={testID}
|
|
33
33
|
>
|
|
34
|
-
<Text
|
|
35
|
-
color={color}
|
|
36
|
-
emphasis={variant === 'solid' ? 'inverse' : 'default'}
|
|
37
|
-
variant="bodySmall"
|
|
38
|
-
weight="medium"
|
|
39
|
-
>
|
|
34
|
+
<Text style={{ color: colors.contentColor }} variant="bodySmall" weight="medium">
|
|
40
35
|
{content}
|
|
41
36
|
</Text>
|
|
42
37
|
</View>
|
|
@@ -76,7 +76,6 @@ function ButtonContent({
|
|
|
76
76
|
variant,
|
|
77
77
|
}: ButtonContentProps) {
|
|
78
78
|
const colors = resolveButtonColors(theme, { variant, color, state });
|
|
79
|
-
const muted = colors.contentColor === theme.semantics.content.muted;
|
|
80
79
|
const iconSize = resolveIconSize(theme, size);
|
|
81
80
|
|
|
82
81
|
return (
|
|
@@ -96,8 +95,7 @@ function ButtonContent({
|
|
|
96
95
|
</ReactNativeView>
|
|
97
96
|
) : null}
|
|
98
97
|
<Text
|
|
99
|
-
|
|
100
|
-
emphasis={muted ? 'muted' : variant === 'solid' ? 'inverse' : 'default'}
|
|
98
|
+
style={{ color: colors.contentColor }}
|
|
101
99
|
variant={controlSize.textVariant}
|
|
102
100
|
weight="semiBold"
|
|
103
101
|
>
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { SURFACE_COLORS } from '../../../../constants/surfaceColor';
|
|
2
|
+
import { resolveTextColor } from '../../../../internal/resolvers/resolveTextColor';
|
|
1
3
|
import type { IconProps } from '../../../../types/icon';
|
|
4
|
+
import type { SurfaceColor } from '../../../../types/surfaceColor';
|
|
2
5
|
import { useTheme } from '../../../theme/runtime';
|
|
3
6
|
import { resolveToken } from '../../../theme/utils/resolveToken';
|
|
4
7
|
import { PortableIcon } from './PortableIcon';
|
|
@@ -9,6 +12,14 @@ export function Icon(props: IconProps) {
|
|
|
9
12
|
const size = props.size ?? 'm';
|
|
10
13
|
const color = props.color ?? 'text';
|
|
11
14
|
const resolvedSize = typeof size === 'number' ? size : resolveToken(theme.spacing, size);
|
|
12
|
-
const resolvedColor =
|
|
15
|
+
const resolvedColor =
|
|
16
|
+
typeof color === 'string' && isSurfaceColor(color)
|
|
17
|
+
? resolveTextColor(theme, 'default', color)
|
|
18
|
+
: resolveToken(theme.colors, color);
|
|
13
19
|
return <PortableIcon {...props} color={resolvedColor} size={resolvedSize} />;
|
|
14
20
|
}
|
|
21
|
+
|
|
22
|
+
/*** Distinguish semantic color roles from raw icon colors and other tokens. */
|
|
23
|
+
function isSurfaceColor(value: string): value is SurfaceColor {
|
|
24
|
+
return SURFACE_COLORS.some((role) => role === value);
|
|
25
|
+
}
|
|
@@ -37,6 +37,8 @@ await mock.module('react-native-svg', () => ({
|
|
|
37
37
|
const { SUPPORTED_ICON_PROVIDERS } = await import('../../constants');
|
|
38
38
|
const { Icon } = await import('./Icon');
|
|
39
39
|
const { PortableIcon } = await import('./PortableIcon');
|
|
40
|
+
const { createTheme } = await import('../../../theme/application/use-cases/createTheme');
|
|
41
|
+
const { ThemeRuntimeContext } = await import('../../../theme/adapters/inbound/ThemeRuntimeContext');
|
|
40
42
|
|
|
41
43
|
describe('portable icon rendering', () => {
|
|
42
44
|
test('renders Ionicons through the public Icon API', () => {
|
|
@@ -90,6 +92,36 @@ describe('portable icon rendering', () => {
|
|
|
90
92
|
});
|
|
91
93
|
});
|
|
92
94
|
|
|
95
|
+
test('semantic icon roles follow polarity while raw colors remain unchanged', () => {
|
|
96
|
+
for (const mode of ['light', 'dark'] as const) {
|
|
97
|
+
const normal = createTheme(undefined, mode);
|
|
98
|
+
const inverted = createTheme(undefined, mode, undefined, true);
|
|
99
|
+
const renderColor = (theme: typeof normal, color: string) =>
|
|
100
|
+
renderToStaticMarkup(
|
|
101
|
+
<ThemeRuntimeContext
|
|
102
|
+
value={{
|
|
103
|
+
theme,
|
|
104
|
+
mode,
|
|
105
|
+
inverted: theme.inverted,
|
|
106
|
+
setThemeConfig: () => undefined,
|
|
107
|
+
setMode: () => undefined,
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
<Icon color={color} size={18} source="https://example.com/icons/home.svg" />
|
|
111
|
+
</ThemeRuntimeContext>,
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
expect(renderColor(normal, 'primary')).toContain(`data-color="${normal.semantics.brand.base}"`);
|
|
115
|
+
expect(renderColor(inverted, 'primary')).toContain(
|
|
116
|
+
`data-color="${inverted.semantics.brand.onSurfaceText}"`,
|
|
117
|
+
);
|
|
118
|
+
expect(renderColor(inverted, 'text')).toContain(
|
|
119
|
+
`data-color="${inverted.semantics.content.default}"`,
|
|
120
|
+
);
|
|
121
|
+
expect(renderColor(inverted, '#123456')).toContain('data-color="#123456"');
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
93
125
|
describe('portable icon web assets', () => {
|
|
94
126
|
test('renders a bundled SVG asset through React Native Web Image', () => {
|
|
95
127
|
const markup = renderToStaticMarkup(
|
|
@@ -8,8 +8,10 @@ import { ThemeScope } from './ThemeScope';
|
|
|
8
8
|
import { useTheme } from './useTheme';
|
|
9
9
|
|
|
10
10
|
function ThemeProbe() {
|
|
11
|
-
const { mode, theme } = useTheme();
|
|
12
|
-
return
|
|
11
|
+
const { mode, theme, inverted } = useTheme();
|
|
12
|
+
return (
|
|
13
|
+
<span>{`${theme.config.id}:${mode}:${theme.colorDiagnostics.mode}:${inverted}:${theme.semantics.surface.default}`}</span>
|
|
14
|
+
);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
const parentRuntime: ThemeRuntime = {
|
|
@@ -30,9 +32,9 @@ test('overrides mode without mutating the parent theme runtime', () => {
|
|
|
30
32
|
</ThemeRuntimeContext>,
|
|
31
33
|
);
|
|
32
34
|
|
|
33
|
-
expect(markup).toContain('default:light:light');
|
|
34
|
-
expect(markup).toContain('default:dark:dark');
|
|
35
|
-
expect(markup.match(/default:light:light/g)).toHaveLength(2);
|
|
35
|
+
expect(markup).toContain('default:light:light:undefined');
|
|
36
|
+
expect(markup).toContain('default:dark:dark:false');
|
|
37
|
+
expect(markup.match(/default:light:light:undefined/g)).toHaveLength(2);
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
test('deep-merges a nested config override while preserving the parent config', () => {
|
|
@@ -46,7 +48,36 @@ test('deep-merges a nested config override while preserving the parent config',
|
|
|
46
48
|
</ThemeRuntimeContext>,
|
|
47
49
|
);
|
|
48
50
|
|
|
49
|
-
expect(markup).toContain('scoped:light:light');
|
|
50
|
-
expect(markup.match(/default:light:light/g)).toHaveLength(2);
|
|
51
|
+
expect(markup).toContain('scoped:light:light:false');
|
|
52
|
+
expect(markup.match(/default:light:light:undefined/g)).toHaveLength(2);
|
|
51
53
|
expect(parentRuntime.theme.config.id).toBe('default');
|
|
52
54
|
});
|
|
55
|
+
|
|
56
|
+
test.each(['light', 'dark'] as const)(
|
|
57
|
+
'inherits and resets inverted polarity in %s mode',
|
|
58
|
+
(mode) => {
|
|
59
|
+
const root = { ...parentRuntime, mode, theme: createTheme(undefined, mode) };
|
|
60
|
+
const { default: normal, inverse } = root.theme.semantics.surface;
|
|
61
|
+
const markup = renderToStaticMarkup(
|
|
62
|
+
<ThemeRuntimeContext value={root}>
|
|
63
|
+
<ThemeScope inverted>
|
|
64
|
+
<ThemeProbe />
|
|
65
|
+
<ThemeScope>
|
|
66
|
+
<ThemeProbe />
|
|
67
|
+
<ThemeScope inverted={false}>
|
|
68
|
+
<ThemeProbe />
|
|
69
|
+
<ThemeScope inverted>
|
|
70
|
+
<ThemeProbe />
|
|
71
|
+
</ThemeScope>
|
|
72
|
+
</ThemeScope>
|
|
73
|
+
</ThemeScope>
|
|
74
|
+
</ThemeScope>
|
|
75
|
+
</ThemeRuntimeContext>,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
expect(markup.match(new RegExp(`${mode}:${mode}:true:${inverse}`, 'g'))).toHaveLength(3);
|
|
79
|
+
expect(markup).toContain(`${mode}:${mode}:false:${normal}`);
|
|
80
|
+
expect(root.inverted).toBeUndefined();
|
|
81
|
+
expect(root.theme.semantics.surface.default).toBe(normal);
|
|
82
|
+
},
|
|
83
|
+
);
|
|
@@ -7,22 +7,23 @@ import { createTheme } from '../../application/use-cases/createTheme';
|
|
|
7
7
|
import { ThemeRuntimeContext } from './ThemeRuntimeContext';
|
|
8
8
|
import { useTheme } from './useTheme';
|
|
9
9
|
|
|
10
|
-
/*** Apply
|
|
11
|
-
export function ThemeScope({ children, themeConfig, mode }: ThemeScopeProps) {
|
|
10
|
+
/*** Apply nested theme, mode, or inherited surface-polarity overrides without remounting providers. */
|
|
11
|
+
export function ThemeScope({ children, themeConfig, mode, inverted }: ThemeScopeProps) {
|
|
12
12
|
const parent = useTheme();
|
|
13
13
|
const { activeFontId } = useFontRuntime();
|
|
14
14
|
const scopedMode = mode ?? parent.mode;
|
|
15
|
+
const scopedInverted = inverted ?? parent.inverted ?? false;
|
|
15
16
|
const scopedConfig = useMemo(
|
|
16
17
|
() => (themeConfig ? deepMerge(parent.theme.config, themeConfig) : parent.theme.config),
|
|
17
18
|
[parent.theme.config, themeConfig],
|
|
18
19
|
);
|
|
19
20
|
const theme = useMemo(
|
|
20
|
-
() => createTheme(scopedConfig, scopedMode, activeFontId),
|
|
21
|
-
[activeFontId, scopedConfig, scopedMode],
|
|
21
|
+
() => createTheme(scopedConfig, scopedMode, activeFontId, scopedInverted),
|
|
22
|
+
[activeFontId, scopedConfig, scopedMode, scopedInverted],
|
|
22
23
|
);
|
|
23
24
|
const value = useMemo<ThemeRuntime>(
|
|
24
|
-
() => ({ ...parent, theme, mode: scopedMode }),
|
|
25
|
-
[parent, scopedMode, theme],
|
|
25
|
+
() => ({ ...parent, theme, mode: scopedMode, inverted: scopedInverted }),
|
|
26
|
+
[parent, scopedMode, scopedInverted, theme],
|
|
26
27
|
);
|
|
27
28
|
|
|
28
29
|
return <ThemeRuntimeContext value={value}>{children}</ThemeRuntimeContext>;
|
|
@@ -2,6 +2,7 @@ import type { ThemeConfig } from '@ankhorage/contracts';
|
|
|
2
2
|
|
|
3
3
|
import type { FontWeight, SurfaceTheme } from '../../../../types/theme';
|
|
4
4
|
import { generatePalette } from '../../domain/generatePalette';
|
|
5
|
+
import { projectInvertedTheme } from '../../domain/projectInvertedTheme';
|
|
5
6
|
import { resolveGlobalTokens } from '../../utils/resolveGlobalTokens';
|
|
6
7
|
|
|
7
8
|
const DEFAULT_CONFIG: ThemeConfig = {
|
|
@@ -11,11 +12,12 @@ const DEFAULT_CONFIG: ThemeConfig = {
|
|
|
11
12
|
dark: { primaryColor: '#3B82F6', harmony: 'monochromatic' },
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
/*** Resolve canonical
|
|
15
|
+
/*** Resolve canonical theme source into a normal or inverted Surface runtime theme. */
|
|
15
16
|
export function createTheme(
|
|
16
17
|
config: ThemeConfig = DEFAULT_CONFIG,
|
|
17
18
|
mode: 'light' | 'dark' = 'light',
|
|
18
19
|
activeFontId?: string | null,
|
|
20
|
+
inverted = false,
|
|
19
21
|
): SurfaceTheme {
|
|
20
22
|
const { colors, swatches, semantics, colorDiagnostics } = generatePalette(config, mode);
|
|
21
23
|
const baseTheme: SurfaceTheme = {
|
|
@@ -25,8 +27,10 @@ export function createTheme(
|
|
|
25
27
|
semantics,
|
|
26
28
|
colorDiagnostics,
|
|
27
29
|
config,
|
|
30
|
+
inverted: false,
|
|
28
31
|
};
|
|
29
|
-
|
|
32
|
+
const themed = activeFontId ? withActiveFont(baseTheme, activeFontId) : baseTheme;
|
|
33
|
+
return inverted ? projectInvertedTheme(themed) : themed;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
/*** Return a theme with generated module font-family names without mutating the base theme. */
|