@ankhorage/surface 9.1.116 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/tabs/adapters/inbound/Tab.d.ts.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tab.js +14 -2
- package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/TabPanel.d.ts +1 -1
- package/dist/features/tabs/adapters/inbound/TabPanel.d.ts.map +1 -1
- package/dist/features/tabs/adapters/inbound/TabPanel.js +8 -3
- package/dist/features/tabs/adapters/inbound/TabPanel.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tabs.d.ts +1 -1
- package/dist/features/tabs/adapters/inbound/Tabs.d.ts.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tabs.js +2 -2
- package/dist/features/tabs/adapters/inbound/Tabs.js.map +1 -1
- package/dist/features/tabs/composition/useTabsController.d.ts +1 -1
- package/dist/features/tabs/composition/useTabsController.d.ts.map +1 -1
- package/dist/features/tabs/composition/useTabsController.js +3 -2
- package/dist/features/tabs/composition/useTabsController.js.map +1 -1
- package/dist/features/tabs/public.d.ts +1 -1
- package/dist/features/tabs/public.d.ts.map +1 -1
- package/dist/features/tabs/public.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.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/tabs.d.ts +3 -0
- package/dist/types/tabs.d.ts.map +1 -1
- package/dist/types/tabs.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 +2 -2
- 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/tabs/adapters/inbound/Tab.tsx +23 -1
- package/src/features/tabs/adapters/inbound/TabPanel.tsx +8 -2
- package/src/features/tabs/adapters/inbound/Tabs.presentation.test.tsx +70 -1
- package/src/features/tabs/adapters/inbound/Tabs.tsx +2 -1
- package/src/features/tabs/composition/useTabsController.ts +7 -2
- package/src/features/tabs/public.ts +7 -1
- 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/index.ts +7 -1
- 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/tabs.ts +4 -0
- package/src/types/theme.ts +3 -0
- package/src/types/typography.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.js","sourceRoot":"","sources":["../../../../../src/features/theme/application/use-cases/createTheme.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,cAAc,GAAgB;IAClC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE;IAC5D,IAAI,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE;CAC5D,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"createTheme.js","sourceRoot":"","sources":["../../../../../src/features/theme/application/use-cases/createTheme.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,cAAc,GAAgB;IAClC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE;IAC5D,IAAI,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE;CAC5D,CAAC;AAEF,uFAAuF;AACvF,MAAM,UAAU,WAAW,CACzB,SAAsB,cAAc,EACpC,OAAyB,OAAO,EAChC,YAA4B,EAC5B,QAAQ,GAAG,KAAK;IAEhB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxF,MAAM,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UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;KACnC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK;SACT,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC","sourcesContent":["import type { ThemeConfig } from '@ankhorage/contracts';\n\nimport type { FontWeight, SurfaceTheme } from '../../../../types/theme';\nimport { generatePalette } from '../../domain/generatePalette';\nimport { projectInvertedTheme } from '../../domain/projectInvertedTheme';\nimport { resolveGlobalTokens } from '../../utils/resolveGlobalTokens';\n\nconst DEFAULT_CONFIG: ThemeConfig = {\n id: 'default',\n name: 'Default',\n light: { primaryColor: '#3B82F6', harmony: 'monochromatic' },\n dark: { primaryColor: '#3B82F6', harmony: 'monochromatic' },\n};\n\n/*** Resolve canonical theme source into a normal or inverted Surface runtime theme. */\nexport function createTheme(\n config: ThemeConfig = DEFAULT_CONFIG,\n mode: 'light' | 'dark' = 'light',\n activeFontId?: string | null,\n inverted = false,\n): SurfaceTheme {\n const { colors, swatches, semantics, colorDiagnostics } = generatePalette(config, mode);\n const baseTheme: SurfaceTheme = {\n ...resolveGlobalTokens(config.tokens),\n colors,\n swatches,\n semantics,\n colorDiagnostics,\n config,\n inverted: false,\n };\n const themed = activeFontId ? withActiveFont(baseTheme, activeFontId) : baseTheme;\n return inverted ? projectInvertedTheme(themed) : themed;\n}\n\n/*** Return a theme with generated module font-family names without mutating the base theme. */\nfunction withActiveFont(theme: SurfaceTheme, activeFontId: string): SurfaceTheme {\n const familyName = toPascalCase(activeFontId);\n return {\n ...theme,\n typography: {\n ...theme.typography,\n fonts: {\n normal: createFontMap(theme.typography.fonts.normal, familyName, 'Regular'),\n italic: createFontMap(theme.typography.fonts.italic, familyName, 'Italic'),\n },\n },\n };\n}\n\nfunction createFontMap(\n fallback: Record<FontWeight, string | undefined>,\n familyName: string,\n style: 'Regular' | 'Italic',\n): Record<FontWeight, string | undefined> {\n return {\n ...fallback,\n '100': `${familyName}_100${style}`,\n '200': `${familyName}_200${style}`,\n '300': `${familyName}_300${style}`,\n '400': `${familyName}_400${style}`,\n '500': `${familyName}_500${style}`,\n '600': `${familyName}_600${style}`,\n '700': `${familyName}_700${style}`,\n '800': `${familyName}_800${style}`,\n '900': `${familyName}_900${style}`,\n };\n}\n\nfunction toPascalCase(value: string): string {\n return value\n .split(/[- ]+/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SurfaceTheme } from '../../../types/theme';
|
|
2
|
+
/*** Project normal canonical theme semantics onto the opposite surface polarity. */
|
|
3
|
+
export declare function projectInvertedTheme(theme: SurfaceTheme): SurfaceTheme;
|
|
4
|
+
//# sourceMappingURL=projectInvertedTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectInvertedTheme.d.ts","sourceRoot":"","sources":["../../../../src/features/theme/domain/projectInvertedTheme.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAMV,YAAY,EAEb,MAAM,sBAAsB,CAAC;AAkB9B,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CA6CtE"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { createDefaultSemanticStatusSwatches, parseHexColorOrThrow, selectColorSwatchStep, } from '@ankhorage/color-theory';
|
|
2
|
+
import { SURFACE_COLOR_POLICY } from '../constants';
|
|
3
|
+
import { createSurfaceColorDiagnosticCollector } from './createSurfaceColorDiagnosticCollector';
|
|
4
|
+
import { resolveInverseSurface } from './resolveInverseSurface';
|
|
5
|
+
/*** Project normal canonical theme semantics onto the opposite surface polarity. */
|
|
6
|
+
export function projectInvertedTheme(theme) {
|
|
7
|
+
const collector = createSurfaceColorDiagnosticCollector();
|
|
8
|
+
const lightSurface = theme.colorDiagnostics.mode === 'dark';
|
|
9
|
+
const { neutral } = theme.swatches;
|
|
10
|
+
const { surface, surfaceSeparation } = resolveInverseSurface(theme, lightSurface, collector);
|
|
11
|
+
const selection = createInverseSelection(collector, surface, neutral, lightSurface);
|
|
12
|
+
const content = resolveInverseContent(theme, selection);
|
|
13
|
+
const border = resolveInverseBorder(theme, selection);
|
|
14
|
+
const roles = resolveInverseRoles(theme, selection);
|
|
15
|
+
const { neutralAction, ...semanticRoles } = roles;
|
|
16
|
+
const semantics = {
|
|
17
|
+
...theme.semantics,
|
|
18
|
+
neutral: resolveInverseNeutral(theme, surface, content, border, neutral, lightSurface),
|
|
19
|
+
surface,
|
|
20
|
+
content,
|
|
21
|
+
border,
|
|
22
|
+
...semanticRoles,
|
|
23
|
+
error: roles.danger,
|
|
24
|
+
selection: {
|
|
25
|
+
background: roles.brand.softBg,
|
|
26
|
+
content: roles.brand.onSoftText,
|
|
27
|
+
border: border.focus,
|
|
28
|
+
},
|
|
29
|
+
action: { primary: roles.brand, neutral: neutralAction, danger: roles.danger },
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
...theme,
|
|
33
|
+
inverted: true,
|
|
34
|
+
semantics,
|
|
35
|
+
colors: {
|
|
36
|
+
...theme.colors,
|
|
37
|
+
background: surface.sunken,
|
|
38
|
+
surface: surface.default,
|
|
39
|
+
text: content.default,
|
|
40
|
+
textSecondary: content.muted,
|
|
41
|
+
border: border.default,
|
|
42
|
+
},
|
|
43
|
+
colorDiagnostics: {
|
|
44
|
+
...theme.colorDiagnostics,
|
|
45
|
+
selections: [...theme.colorDiagnostics.selections, ...collector.selections],
|
|
46
|
+
contrasts: [...theme.colorDiagnostics.contrasts, ...collector.contrasts],
|
|
47
|
+
surfaceSeparation,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/*** Select swatch steps against both inverse surface levels. */
|
|
52
|
+
function createInverseSelection(collector, surface, neutral, lightSurface) {
|
|
53
|
+
return {
|
|
54
|
+
collector,
|
|
55
|
+
neutral,
|
|
56
|
+
contexts: [
|
|
57
|
+
{
|
|
58
|
+
id: 'inverse-surface',
|
|
59
|
+
against: parseHexColorOrThrow(surface.default),
|
|
60
|
+
minimumContrast: SURFACE_COLOR_POLICY.textContrast,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'inverse-subtle',
|
|
64
|
+
against: parseHexColorOrThrow(surface.subtle),
|
|
65
|
+
minimumContrast: SURFACE_COLOR_POLICY.textContrast,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'inverse-sunken',
|
|
69
|
+
against: parseHexColorOrThrow(surface.sunken),
|
|
70
|
+
minimumContrast: SURFACE_COLOR_POLICY.textContrast,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
tiePolicy: lightSurface ? 'higher-step' : 'lower-step',
|
|
74
|
+
textTarget: { lightness: lightSurface ? 0.2 : 0.9, chroma: 0.02 },
|
|
75
|
+
mutedTarget: { lightness: lightSurface ? 0.35 : 0.75, chroma: 0.02 },
|
|
76
|
+
subtleTarget: { lightness: lightSurface ? 0.4 : 0.7, chroma: 0.02 },
|
|
77
|
+
borderTarget: { lightness: lightSurface ? 0.45 : 0.65, chroma: 0.02 },
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/*** Resolve all surface-relative content colors against inverse backgrounds. */
|
|
81
|
+
function resolveInverseContent(theme, selection) {
|
|
82
|
+
const { neutral, primary } = theme.swatches;
|
|
83
|
+
const secondary = theme.swatches.secondary ?? primary;
|
|
84
|
+
return {
|
|
85
|
+
default: selectText('content.default', neutral, selection.textTarget, selection),
|
|
86
|
+
muted: selectText('content.muted', neutral, selection.mutedTarget, selection),
|
|
87
|
+
subtle: selectText('content.subtle', neutral, selection.subtleTarget, selection),
|
|
88
|
+
disabled: selectText('content.disabled', neutral, selection.subtleTarget, selection, SURFACE_COLOR_POLICY.disabledContrast),
|
|
89
|
+
icon: selectText('content.icon', neutral, selection.textTarget, selection),
|
|
90
|
+
link: selectText('content.link', primary, selection.textTarget, selection),
|
|
91
|
+
visited: selectText('content.visited', secondary, selection.textTarget, selection),
|
|
92
|
+
inverse: theme.semantics.content.default,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/*** Resolve separators and focus chrome against inverse backgrounds. */
|
|
96
|
+
function resolveInverseBorder(theme, selection) {
|
|
97
|
+
const { neutral } = theme.swatches;
|
|
98
|
+
const outline = selection.borderTarget;
|
|
99
|
+
return {
|
|
100
|
+
default: selectOutline('border.default', neutral, outline, selection),
|
|
101
|
+
subtle: selectOutline('border.subtle', neutral, outline, selection),
|
|
102
|
+
strong: selectOutline('border.strong', neutral, outline, selection),
|
|
103
|
+
divider: selectOutline('border.divider', neutral, outline, selection),
|
|
104
|
+
focus: selectOutline('border.focus', theme.swatches.primary, selection.textTarget, selection),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/*** Project only surface-relative role fields and preserve self-owned color pairs. */
|
|
108
|
+
function resolveInverseRoles(theme, selection) {
|
|
109
|
+
const status = createDefaultSemanticStatusSwatches().swatches;
|
|
110
|
+
const { semantics } = theme;
|
|
111
|
+
return {
|
|
112
|
+
brand: projectRole('brand', semantics.brand, theme.swatches.primary, selection),
|
|
113
|
+
secondary: projectRole('secondary', semantics.secondary, theme.swatches.secondary ?? theme.swatches.primary, selection),
|
|
114
|
+
accent: projectRole('accent', semantics.accent, theme.swatches.tertiary ?? theme.swatches.primary, selection),
|
|
115
|
+
highlight: projectRole('highlight', semantics.highlight, theme.swatches.quaternary ?? theme.swatches.primary, selection),
|
|
116
|
+
danger: projectRole('danger', semantics.danger, status.danger, selection),
|
|
117
|
+
success: projectRole('success', semantics.success, status.success, selection),
|
|
118
|
+
warning: projectRole('warning', semantics.warning, status.warning, selection),
|
|
119
|
+
info: projectRole('info', semantics.info, status.info, selection),
|
|
120
|
+
neutralAction: projectRole('neutral', semantics.action.neutral, theme.swatches.neutral, selection),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/*** Keep opaque and soft role pairs intact while selecting inverse-safe transparent colors. */
|
|
124
|
+
function projectRole(id, role, swatch, selection) {
|
|
125
|
+
return {
|
|
126
|
+
...role,
|
|
127
|
+
onSurfaceText: selectText(`${id}.onSurfaceText`, swatch, selection.textTarget, selection),
|
|
128
|
+
outline: selectOutline(`${id}.outline`, swatch, selection.borderTarget, selection),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/*** Keep direct neutral semantic reads aligned with active surface polarity. */
|
|
132
|
+
function resolveInverseNeutral(theme, surface, content, border, swatch, lightSurface) {
|
|
133
|
+
return {
|
|
134
|
+
...theme.semantics.neutral,
|
|
135
|
+
bg: surface.sunken,
|
|
136
|
+
bgSubtle: surface.subtle,
|
|
137
|
+
surface: surface.default,
|
|
138
|
+
surfaceHover: lightSurface ? swatch[200] : swatch[700],
|
|
139
|
+
surfaceActive: lightSurface ? swatch[300] : swatch[600],
|
|
140
|
+
border: border.default,
|
|
141
|
+
borderStrong: border.strong,
|
|
142
|
+
divider: border.divider,
|
|
143
|
+
text: content.default,
|
|
144
|
+
textMuted: content.muted,
|
|
145
|
+
textSubtle: content.subtle,
|
|
146
|
+
disabledBg: surface.disabled,
|
|
147
|
+
disabledText: content.disabled,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/*** Select and measure inverse-surface text through Color Theory. */
|
|
151
|
+
function selectText(id, swatch, target, selection, minimumContrast = SURFACE_COLOR_POLICY.textContrast) {
|
|
152
|
+
const contexts = selection.contexts.map((context) => ({ ...context, minimumContrast }));
|
|
153
|
+
const color = selectInverseColor(id, swatch, target, contexts, selection);
|
|
154
|
+
for (const context of contexts) {
|
|
155
|
+
selection.collector.measureForeground(`inverse.${id}/${context.id}`, color, context.against, minimumContrast);
|
|
156
|
+
}
|
|
157
|
+
return color;
|
|
158
|
+
}
|
|
159
|
+
/*** Select inverse-surface outlines with the UI contrast policy. */
|
|
160
|
+
function selectOutline(id, swatch, target, selection) {
|
|
161
|
+
const contexts = selection.contexts.map((context) => ({
|
|
162
|
+
...context,
|
|
163
|
+
minimumContrast: SURFACE_COLOR_POLICY.uiContrast,
|
|
164
|
+
}));
|
|
165
|
+
const color = selectInverseColor(id, swatch, target, contexts, selection);
|
|
166
|
+
for (const context of contexts) {
|
|
167
|
+
selection.collector.measureForeground(`inverse.${id}/${context.id}`, color, context.against, SURFACE_COLOR_POLICY.uiContrast);
|
|
168
|
+
}
|
|
169
|
+
return color;
|
|
170
|
+
}
|
|
171
|
+
/*** Keep inverse contrast safe when a chromatic swatch cannot meet the policy. */
|
|
172
|
+
function selectInverseColor(id, swatch, target, contexts, selection) {
|
|
173
|
+
const result = selectColorSwatchStep(swatch, target, contexts, selection.tiePolicy);
|
|
174
|
+
selection.collector.selections.push({ id: `inverse.${id}`, result });
|
|
175
|
+
return (result.selected?.hex ??
|
|
176
|
+
selection.collector.selectColor(`inverse.${id}.neutralFallback`, selection.neutral, target, contexts, selection.tiePolicy));
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=projectInvertedTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectInvertedTheme.js","sourceRoot":"","sources":["../../../../src/features/theme/domain/projectInvertedTheme.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,mCAAmC,EACnC,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAWjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC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rE,OAAO,CACL,MAAM,CAAC,QAAQ,EAAE,GAAG;QACpB,SAAS,CAAC,SAAS,CAAC,WAAW,CAC7B,WAAW,EAAE,kBAAkB,EAC/B,SAAS,CAAC,OAAO,EACjB,MAAM,EACN,QAAQ,EACR,SAAS,CAAC,SAAS,CACpB,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n ColorContrastContext,\n ColorSelectionTarget,\n ColorSwatch,\n ColorSwatchTiePolicy,\n HexColor,\n} from '@ankhorage/color-theory';\nimport {\n createDefaultSemanticStatusSwatches,\n parseHexColorOrThrow,\n selectColorSwatchStep,\n} from '@ankhorage/color-theory';\n\nimport type {\n BorderSemantics,\n ContentSemantics,\n NeutralSemantics,\n RoleSemantics,\n SurfaceSemantics,\n SurfaceTheme,\n ThemeSemantics,\n} from '../../../types/theme';\nimport { SURFACE_COLOR_POLICY } from '../constants';\nimport { createSurfaceColorDiagnosticCollector } from './createSurfaceColorDiagnosticCollector';\nimport { resolveInverseSurface } from './resolveInverseSurface';\n\ntype Collector = ReturnType<typeof createSurfaceColorDiagnosticCollector>;\n\ninterface InverseSelection {\n collector: Collector;\n contexts: readonly ColorContrastContext[];\n tiePolicy: ColorSwatchTiePolicy;\n textTarget: ColorSelectionTarget;\n mutedTarget: ColorSelectionTarget;\n subtleTarget: ColorSelectionTarget;\n borderTarget: ColorSelectionTarget;\n neutral: ColorSwatch;\n}\n\n/*** Project normal canonical theme semantics onto the opposite surface polarity. */\nexport function projectInvertedTheme(theme: SurfaceTheme): SurfaceTheme {\n const collector = createSurfaceColorDiagnosticCollector();\n const lightSurface = theme.colorDiagnostics.mode === 'dark';\n const { neutral } = theme.swatches;\n const { surface, surfaceSeparation } = resolveInverseSurface(theme, lightSurface, collector);\n const selection = createInverseSelection(collector, surface, neutral, lightSurface);\n const content = resolveInverseContent(theme, selection);\n const border = resolveInverseBorder(theme, selection);\n const roles = resolveInverseRoles(theme, selection);\n const { neutralAction, ...semanticRoles } = roles;\n const semantics: ThemeSemantics = {\n ...theme.semantics,\n neutral: resolveInverseNeutral(theme, surface, content, border, neutral, lightSurface),\n surface,\n content,\n border,\n ...semanticRoles,\n error: roles.danger,\n selection: {\n background: roles.brand.softBg,\n content: roles.brand.onSoftText,\n border: border.focus,\n },\n action: { primary: roles.brand, neutral: neutralAction, danger: roles.danger },\n };\n\n return {\n ...theme,\n inverted: true,\n semantics,\n colors: {\n ...theme.colors,\n background: surface.sunken,\n surface: surface.default,\n text: content.default,\n textSecondary: content.muted,\n border: border.default,\n },\n colorDiagnostics: {\n ...theme.colorDiagnostics,\n selections: [...theme.colorDiagnostics.selections, ...collector.selections],\n contrasts: [...theme.colorDiagnostics.contrasts, ...collector.contrasts],\n surfaceSeparation,\n },\n };\n}\n\n/*** Select swatch steps against both inverse surface levels. */\nfunction createInverseSelection(\n collector: Collector,\n surface: SurfaceSemantics,\n neutral: ColorSwatch,\n lightSurface: boolean,\n): InverseSelection {\n return {\n collector,\n neutral,\n contexts: [\n {\n id: 'inverse-surface',\n against: parseHexColorOrThrow(surface.default),\n minimumContrast: SURFACE_COLOR_POLICY.textContrast,\n },\n {\n id: 'inverse-subtle',\n against: parseHexColorOrThrow(surface.subtle),\n minimumContrast: SURFACE_COLOR_POLICY.textContrast,\n },\n {\n id: 'inverse-sunken',\n against: parseHexColorOrThrow(surface.sunken),\n minimumContrast: SURFACE_COLOR_POLICY.textContrast,\n },\n ],\n tiePolicy: lightSurface ? 'higher-step' : 'lower-step',\n textTarget: { lightness: lightSurface ? 0.2 : 0.9, chroma: 0.02 },\n mutedTarget: { lightness: lightSurface ? 0.35 : 0.75, chroma: 0.02 },\n subtleTarget: { lightness: lightSurface ? 0.4 : 0.7, chroma: 0.02 },\n borderTarget: { lightness: lightSurface ? 0.45 : 0.65, chroma: 0.02 },\n };\n}\n\n/*** Resolve all surface-relative content colors against inverse backgrounds. */\nfunction resolveInverseContent(theme: SurfaceTheme, selection: InverseSelection): ContentSemantics {\n const { neutral, primary } = theme.swatches;\n const secondary = theme.swatches.secondary ?? primary;\n return {\n default: selectText('content.default', neutral, selection.textTarget, selection),\n muted: selectText('content.muted', neutral, selection.mutedTarget, selection),\n subtle: selectText('content.subtle', neutral, selection.subtleTarget, selection),\n disabled: selectText(\n 'content.disabled',\n neutral,\n selection.subtleTarget,\n selection,\n SURFACE_COLOR_POLICY.disabledContrast,\n ),\n icon: selectText('content.icon', neutral, selection.textTarget, selection),\n link: selectText('content.link', primary, selection.textTarget, selection),\n visited: selectText('content.visited', secondary, selection.textTarget, selection),\n inverse: theme.semantics.content.default,\n };\n}\n\n/*** Resolve separators and focus chrome against inverse backgrounds. */\nfunction resolveInverseBorder(theme: SurfaceTheme, selection: InverseSelection): BorderSemantics {\n const { neutral } = theme.swatches;\n const outline = selection.borderTarget;\n return {\n default: selectOutline('border.default', neutral, outline, selection),\n subtle: selectOutline('border.subtle', neutral, outline, selection),\n strong: selectOutline('border.strong', neutral, outline, selection),\n divider: selectOutline('border.divider', neutral, outline, selection),\n focus: selectOutline('border.focus', theme.swatches.primary, selection.textTarget, selection),\n };\n}\n\n/*** Project only surface-relative role fields and preserve self-owned color pairs. */\nfunction resolveInverseRoles(theme: SurfaceTheme, selection: InverseSelection) {\n const status = createDefaultSemanticStatusSwatches().swatches;\n const { semantics } = theme;\n return {\n brand: projectRole('brand', semantics.brand, theme.swatches.primary, selection),\n secondary: projectRole(\n 'secondary',\n semantics.secondary,\n theme.swatches.secondary ?? theme.swatches.primary,\n selection,\n ),\n accent: projectRole(\n 'accent',\n semantics.accent,\n theme.swatches.tertiary ?? theme.swatches.primary,\n selection,\n ),\n highlight: projectRole(\n 'highlight',\n semantics.highlight,\n theme.swatches.quaternary ?? theme.swatches.primary,\n selection,\n ),\n danger: projectRole('danger', semantics.danger, status.danger, selection),\n success: projectRole('success', semantics.success, status.success, selection),\n warning: projectRole('warning', semantics.warning, status.warning, selection),\n info: projectRole('info', semantics.info, status.info, selection),\n neutralAction: projectRole(\n 'neutral',\n semantics.action.neutral,\n theme.swatches.neutral,\n selection,\n ),\n };\n}\n\n/*** Keep opaque and soft role pairs intact while selecting inverse-safe transparent colors. */\nfunction projectRole(\n id: string,\n role: RoleSemantics,\n swatch: ColorSwatch,\n selection: InverseSelection,\n): RoleSemantics {\n return {\n ...role,\n onSurfaceText: selectText(`${id}.onSurfaceText`, swatch, selection.textTarget, selection),\n outline: selectOutline(`${id}.outline`, swatch, selection.borderTarget, selection),\n };\n}\n\n/*** Keep direct neutral semantic reads aligned with active surface polarity. */\nfunction resolveInverseNeutral(\n theme: SurfaceTheme,\n surface: SurfaceSemantics,\n content: ContentSemantics,\n border: BorderSemantics,\n swatch: ColorSwatch,\n lightSurface: boolean,\n): NeutralSemantics {\n return {\n ...theme.semantics.neutral,\n bg: surface.sunken,\n bgSubtle: surface.subtle,\n surface: surface.default,\n surfaceHover: lightSurface ? swatch[200] : swatch[700],\n surfaceActive: lightSurface ? swatch[300] : swatch[600],\n border: border.default,\n borderStrong: border.strong,\n divider: border.divider,\n text: content.default,\n textMuted: content.muted,\n textSubtle: content.subtle,\n disabledBg: surface.disabled,\n disabledText: content.disabled,\n };\n}\n\n/*** Select and measure inverse-surface text through Color Theory. */\nfunction selectText(\n id: string,\n swatch: ColorSwatch,\n target: ColorSelectionTarget,\n selection: InverseSelection,\n minimumContrast: number = SURFACE_COLOR_POLICY.textContrast,\n): HexColor {\n const contexts = selection.contexts.map((context) => ({ ...context, minimumContrast }));\n const color = selectInverseColor(id, swatch, target, contexts, selection);\n for (const context of contexts) {\n selection.collector.measureForeground(\n `inverse.${id}/${context.id}`,\n color,\n context.against,\n minimumContrast,\n );\n }\n return color;\n}\n\n/*** Select inverse-surface outlines with the UI contrast policy. */\nfunction selectOutline(\n id: string,\n swatch: ColorSwatch,\n target: ColorSelectionTarget,\n selection: InverseSelection,\n): HexColor {\n const contexts = selection.contexts.map((context) => ({\n ...context,\n minimumContrast: SURFACE_COLOR_POLICY.uiContrast,\n }));\n const color = selectInverseColor(id, swatch, target, contexts, selection);\n for (const context of contexts) {\n selection.collector.measureForeground(\n `inverse.${id}/${context.id}`,\n color,\n context.against,\n SURFACE_COLOR_POLICY.uiContrast,\n );\n }\n return color;\n}\n\n/*** Keep inverse contrast safe when a chromatic swatch cannot meet the policy. */\nfunction selectInverseColor(\n id: string,\n swatch: ColorSwatch,\n target: ColorSelectionTarget,\n contexts: readonly ColorContrastContext[],\n selection: InverseSelection,\n): HexColor {\n const result = selectColorSwatchStep(swatch, target, contexts, selection.tiePolicy);\n selection.collector.selections.push({ id: `inverse.${id}`, result });\n return (\n result.selected?.hex ??\n selection.collector.selectColor(\n `inverse.${id}.neutralFallback`,\n selection.neutral,\n target,\n contexts,\n selection.tiePolicy,\n )\n );\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SurfaceContrastDiagnostic, SurfaceSemantics, SurfaceTheme } from '../../../types/theme';
|
|
2
|
+
import type { createSurfaceColorDiagnosticCollector } from './createSurfaceColorDiagnosticCollector';
|
|
3
|
+
type Collector = ReturnType<typeof createSurfaceColorDiagnosticCollector>;
|
|
4
|
+
/*** Resolve inverted surface levels and measure their effective separation. */
|
|
5
|
+
export declare function resolveInverseSurface(theme: SurfaceTheme, lightSurface: boolean, collector: Collector): {
|
|
6
|
+
surface: SurfaceSemantics;
|
|
7
|
+
surfaceSeparation: SurfaceContrastDiagnostic[];
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=resolveInverseSurface.d.ts.map
|
|
@@ -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"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export type { PressableProps } from './features/pressable/public';
|
|
|
42
42
|
export { Pressable } from './features/pressable/public';
|
|
43
43
|
export type { SurfaceProps, SurfaceVariant } from './features/surface/public';
|
|
44
44
|
export { Surface } from './features/surface/public';
|
|
45
|
-
export type { TabListProps, TabPanelProps, TabProps, TabsProps } from './features/tabs/public';
|
|
45
|
+
export type { TabListProps, TabPanelProps, TabProps, TabsProps, TabsVariant, } from './features/tabs/public';
|
|
46
46
|
export { Tab, TabList, TabPanel, Tabs } from './features/tabs/public';
|
|
47
47
|
export type { ActionSemantics, BorderSemantics, ContentSemantics, FontWeight, NeutralSemantics, RoleSemantics, SelectionSemantics, SurfaceColorDiagnostics, SurfaceColorSelectionDiagnostic, SurfaceContrastDiagnostic, SurfaceSemantics, SurfaceTheme, ThemeMode, ThemeSemantics, ThemeTokens, } from './features/theme/public';
|
|
48
48
|
export { createTheme } from './features/theme/public';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,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AO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAS9D,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAKhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAMhD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAMpD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAQpD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAkBtE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ/E,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './constants/surfaceColor';\nexport * from './core/responsive';\nexport type {\n AccordionContentProps,\n AccordionItemProps,\n AccordionMode,\n AccordionMultipleProps,\n AccordionProps,\n AccordionSingleProps,\n AccordionTriggerProps,\n} from './features/accordion/public';\nexport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from './features/accordion/public';\nexport type { AppBarProps } from './features/app-bar/public';\nexport { AppBar } from './features/app-bar/public';\nexport type { BadgeProps } from './features/badge/public';\nexport { Badge } from './features/badge/public';\nexport type { ButtonIconSpec, ButtonProps, IconButtonProps } from './features/button/public';\nexport { Button, IconButton } from './features/button/public';\nexport type { CardProps } from './features/card/public';\nexport { Card } from './features/card/public';\nexport type { FontProviderProps, FontRuntime } from './features/font/public';\nexport { FontProvider } from './features/font/public';\nexport type { CheckboxProps } from './features/form/checkbox/public';\nexport { Checkbox } from './features/form/checkbox/public';\nexport type { FieldProps } from './features/form/field/public';\nexport { Field } from './features/form/field/public';\nexport type { RadioProps } from './features/form/radio/public';\nexport { Radio } from './features/form/radio/public';\nexport type { SwitchProps } from './features/form/switch/public';\nexport { Switch } from './features/form/switch/public';\nexport type { TextInputProps } from './features/form/text-input/public';\nexport { TextInput } from './features/form/text-input/public';\nexport type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './features/icon/public';\nexport { Icon, SUPPORTED_ICON_PROVIDERS } from './features/icon/public';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './features/image/public';\nexport { Image } from './features/image/public';\nexport type {\n KeyboardAvoidingViewBehavior,\n KeyboardAvoidingViewProps,\n} from './features/keyboard-avoiding-view/public';\nexport { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';\nexport type { DividerProps, GridProps, ScrollViewProps, ViewProps } from './features/layout/public';\nexport { Divider, Grid, ScrollView, View } from './features/layout/public';\nexport type { ListItemProps, ListProps } from './features/list/public';\nexport { List, ListItem } from './features/list/public';\nexport type { ModalProps } from './features/modal/public';\nexport { Modal } from './features/modal/public';\nexport type {\n PopoverAnchorRenderProps,\n PopoverPlacement,\n PopoverProps,\n} from './features/popover/public';\nexport { Popover } from './features/popover/public';\nexport type {\n PopoverMenuAction,\n PopoverMenuActionIntent,\n PopoverMenuProps,\n} from './features/popover-menu/public';\nexport { PopoverMenu } from './features/popover-menu/public';\nexport type { PressableProps } from './features/pressable/public';\nexport { Pressable } from './features/pressable/public';\nexport type { SurfaceProps, SurfaceVariant } from './features/surface/public';\nexport { Surface } from './features/surface/public';\nexport type {\n TabListProps,\n TabPanelProps,\n TabProps,\n TabsProps,\n TabsVariant,\n} from './features/tabs/public';\nexport { Tab, TabList, TabPanel, Tabs } from './features/tabs/public';\nexport type {\n ActionSemantics,\n BorderSemantics,\n ContentSemantics,\n FontWeight,\n NeutralSemantics,\n RoleSemantics,\n SelectionSemantics,\n SurfaceColorDiagnostics,\n SurfaceColorSelectionDiagnostic,\n SurfaceContrastDiagnostic,\n SurfaceSemantics,\n SurfaceTheme,\n ThemeMode,\n ThemeSemantics,\n ThemeTokens,\n} from './features/theme/public';\nexport { createTheme } from './features/theme/public';\nexport type { ThemeProviderProps, ThemeRuntime, ThemeScopeProps } from './features/theme/runtime';\nexport { ThemeProvider, ThemeScope, useTheme } from './features/theme/runtime';\nexport type {\n ToastController,\n ToastOptions,\n ToastProps,\n ToastProviderProps,\n ToastStatus,\n} from './features/toast/public';\nexport { Toast, ToastProvider, useToast } from './features/toast/public';\nexport type { TooltipProps } from './features/tooltip/public';\nexport { Tooltip } from './features/tooltip/public';\nexport type { HeadingLevel, HeadingProps, TextProps } from './features/typography/public';\nexport { Heading, Text } from './features/typography/public';\nexport type { InteractionPolicy, InteractionPolicyProps } from './types/interactionPolicy';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './types/surfaceColor';\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,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ;YACjD,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM;YAC1C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ;SAC/C,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAEvD,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO;gBACL,eAAe,EAAE,KAAK,CAAC,OAAO;oBAC5B,CAAC,CAAC,YAAY,CAAC,UAAU;oBACzB,CAAC,CAAC,KAAK,CAAC,OAAO;wBACb,CAAC,CAAC,YAAY,CAAC,SAAS;wBACxB,CAAC,CAAC,aAAa;gBACnB,WAAW,EAAE,YAAY,CAAC,OAAO;gBACjC,YAAY,EAAE,YAAY,CAAC
|
|
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,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ;YACjD,WAAW,EAAE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,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/tabs.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { InteractionPolicy } from './interactionPolicy';
|
|
3
3
|
import type { ViewStyleProps } from './layout';
|
|
4
|
+
export type TabsVariant = 'line' | 'attached';
|
|
4
5
|
export interface TabsProps extends ViewStyleProps {
|
|
5
6
|
children?: React.ReactNode;
|
|
6
7
|
value?: string;
|
|
7
8
|
defaultValue?: string;
|
|
8
9
|
onValueChange?: ((value: string) => void) | undefined;
|
|
9
10
|
testID?: string;
|
|
11
|
+
variant?: TabsVariant;
|
|
10
12
|
}
|
|
11
13
|
export interface TabListProps {
|
|
12
14
|
children?: React.ReactNode;
|
|
@@ -41,6 +43,7 @@ export interface TabsContextValue {
|
|
|
41
43
|
setFocusedValue: (value: string | undefined) => void;
|
|
42
44
|
tabs: readonly TabRegistration[];
|
|
43
45
|
unregisterTab: (value: string) => void;
|
|
46
|
+
variant: TabsVariant;
|
|
44
47
|
}
|
|
45
48
|
export type TabNavigationKey = 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown' | 'Home' | 'End';
|
|
46
49
|
//# sourceMappingURL=tabs.d.ts.map
|
package/dist/types/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/types/tabs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,Q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C;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,WAAW,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACrD,IAAI,EAAE,SAAS,eAAe,EAAE,CAAC;IACjC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,MAAM,gBAAgB,GAC1B,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC"}
|
package/dist/types/tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/types/tabs.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { InteractionPolicy } from './interactionPolicy';\nimport type { ViewStyleProps } from './layout';\n\nexport interface TabsProps extends ViewStyleProps {\n children?: React.ReactNode;\n value?: string;\n defaultValue?: string;\n onValueChange?: ((value: string) => void) | undefined;\n testID?: string;\n}\n\nexport interface TabListProps {\n children?: React.ReactNode;\n fill?: boolean;\n testID?: string;\n}\n\nexport interface TabProps {\n value: string;\n children?: React.ReactNode;\n disabled?: boolean;\n interactionPolicy?: InteractionPolicy;\n testID?: string;\n trailing?: React.ReactNode;\n}\n\nexport interface TabPanelProps extends ViewStyleProps {\n value: string;\n children?: React.ReactNode;\n testID?: string;\n}\n\nexport interface TabRegistration {\n disabled: boolean;\n focus: () => void;\n value: string;\n}\n\nexport interface TabsContextValue {\n activeValue: string | undefined;\n focusedValue: string | undefined;\n getPanelId: (value: string) => string;\n getTabId: (value: string) => string;\n registerTab: (tab: TabRegistration) => void;\n setActiveValue: (value: string) => void;\n setFocusedValue: (value: string | undefined) => void;\n tabs: readonly TabRegistration[];\n unregisterTab: (value: string) => void;\n}\n\nexport type TabNavigationKey =\n 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown' | 'Home' | 'End';\n"]}
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/types/tabs.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { InteractionPolicy } from './interactionPolicy';\nimport type { ViewStyleProps } from './layout';\n\nexport type TabsVariant = 'line' | 'attached';\n\nexport interface TabsProps extends ViewStyleProps {\n children?: React.ReactNode;\n value?: string;\n defaultValue?: string;\n onValueChange?: ((value: string) => void) | undefined;\n testID?: string;\n variant?: TabsVariant;\n}\n\nexport interface TabListProps {\n children?: React.ReactNode;\n fill?: boolean;\n testID?: string;\n}\n\nexport interface TabProps {\n value: string;\n children?: React.ReactNode;\n disabled?: boolean;\n interactionPolicy?: InteractionPolicy;\n testID?: string;\n trailing?: React.ReactNode;\n}\n\nexport interface TabPanelProps extends ViewStyleProps {\n value: string;\n children?: React.ReactNode;\n testID?: string;\n}\n\nexport interface TabRegistration {\n disabled: boolean;\n focus: () => void;\n value: string;\n}\n\nexport interface TabsContextValue {\n activeValue: string | undefined;\n focusedValue: string | undefined;\n getPanelId: (value: string) => string;\n getTabId: (value: string) => string;\n registerTab: (tab: TabRegistration) => void;\n setActiveValue: (value: string) => void;\n setFocusedValue: (value: string | undefined) => void;\n tabs: readonly TabRegistration[];\n unregisterTab: (value: string) => void;\n variant: TabsVariant;\n}\n\nexport type TabNavigationKey =\n 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown' | 'Home' | 'End';\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
|