@ankhorage/surface 3.2.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/primitives/icon/Icon.d.ts +1 -1
- package/dist/primitives/icon/Icon.d.ts.map +1 -1
- package/dist/primitives/icon/Icon.js.map +1 -1
- package/dist/primitives/icon/PortableIcon.d.ts +9 -1
- package/dist/primitives/icon/PortableIcon.d.ts.map +1 -1
- package/dist/primitives/icon/PortableIcon.js +11 -1
- package/dist/primitives/icon/PortableIcon.js.map +1 -1
- package/dist/primitives/icon/index.d.ts +1 -1
- package/dist/primitives/icon/index.d.ts.map +1 -1
- package/dist/primitives/icon/index.js.map +1 -1
- package/dist/theme/index.d.ts +1 -4
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -4
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/public.d.ts +5 -0
- package/dist/theme/public.d.ts.map +1 -0
- package/dist/theme/public.js +5 -0
- package/dist/theme/public.js.map +1 -0
- package/package.json +12 -2
- package/src/index.test.ts +10 -0
- package/src/index.ts +8 -1
- package/src/primitives/icon/Icon.tsx +7 -1
- package/src/primitives/icon/PortableIcon.tsx +34 -2
- package/src/primitives/icon/PortableIcon.web.test.tsx +20 -0
- package/src/primitives/icon/index.ts +8 -1
- package/src/theme/index.ts +1 -4
- package/src/theme/public.test.ts +43 -0
- package/src/theme/public.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ankhorage/surface
|
|
2
2
|
|
|
3
|
+
## 3.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2ceb0de: Render SVG assets through the existing `Icon` component by accepting a mutually exclusive
|
|
8
|
+
`source` prop backed by `react-native-svg`.
|
|
9
|
+
|
|
10
|
+
## 3.3.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 79e8f63: Add a pure `@ankhorage/surface/theme` package entrypoint so non-React tooling can resolve themes and inspect canonical color diagnostics without loading the component runtime.
|
|
15
|
+
|
|
3
16
|
## 3.2.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export type { ButtonBaseProps } from './primitives/button-base';
|
|
|
51
51
|
export { ButtonBase } from './primitives/button-base';
|
|
52
52
|
export type { HeadingLevel, HeadingProps } from './primitives/heading';
|
|
53
53
|
export { Heading } from './primitives/heading';
|
|
54
|
-
export type { IconProps, IconProvider, IconSource, IconVariant } from './primitives/icon';
|
|
54
|
+
export type { FontIconSource, IconProps, IconProvider, IconSource, IconVariant, SvgIconSource, } from './primitives/icon';
|
|
55
55
|
export { Icon, SUPPORTED_ICON_PROVIDERS } from './primitives/icon';
|
|
56
56
|
export type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';
|
|
57
57
|
export { Image } from './primitives/image';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,M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AAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';\nexport { ActionSheet, ActionSheetItem } from './components/action-sheet';\nexport type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonIconSpec, ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxProps } from './components/checkbox';\nexport { Checkbox } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { LabelProps } from './components/label';\nexport { Label } from './components/label';\nexport type { ListItemProps } from './components/list-item';\nexport { ListItem } from './components/list-item';\nexport type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './components/menu';\nexport { Menu } from './components/menu';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type {\n DrawerNavigationItemProps,\n DrawerNavigationProps,\n NavigationItemIcon,\n NavigationItemProps,\n NavigationItemSpec,\n NavigationListProps,\n TabBarItemProps,\n TabBarProps,\n} from './components/navigation';\nexport {\n DrawerNavigation,\n DrawerNavigationItem,\n NavigationItem,\n NavigationList,\n TabBar,\n TabBarItem,\n} from './components/navigation';\nexport type { RadioProps } from './components/radio';\nexport { Radio } from './components/radio';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './components/tabs';\nexport { Tab, TabList, TabPanel, Tabs } from './components/tabs';\nexport type { TextInputProps } from './components/text-input';\nexport { TextInput } from './components/text-input';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToastOptions, ToastProps, ToastStatus } from './components/toast';\nexport { Toast, ToastProvider, useToast } from './components/toast';\nexport type { TooltipProps } from './components/tooltip';\nexport { Tooltip } from './components/tooltip';\nexport type { FontRuntime } from './context/FontContext';\nexport { FontProvider, useFontContext } from './context/FontContext';\nexport type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';\nexport { TranslationProvider, useTranslationContext } from './context/TranslationContext';\nexport * from './core/responsive';\nexport type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';\nexport * from './layout';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\nexport type { HeadingLevel, HeadingProps } from './primitives/heading';\nexport { Heading } from './primitives/heading';\nexport type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './primitives/icon';\nexport { Icon, SUPPORTED_ICON_PROVIDERS } from './primitives/icon';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';\nexport { Image } from './primitives/image';\nexport type { TextProps } from './primitives/text';\nexport { Text } from './primitives/text';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './surfaceColor';\nexport {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './surfaceColor';\nexport * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type StyleProp, type TextStyle } from 'react-native';
|
|
2
2
|
import type { SurfaceTheme } from '../../theme/types';
|
|
3
3
|
import { type IconSource } from './PortableIcon';
|
|
4
|
-
export type { IconProvider, IconSource, IconVariant } from './PortableIcon';
|
|
4
|
+
export type { FontIconSource, IconProvider, IconSource, IconVariant, SvgIconSource, } from './PortableIcon';
|
|
5
5
|
interface IconPresentationProps {
|
|
6
6
|
size?: keyof SurfaceTheme['spacing'] | number;
|
|
7
7
|
color?: keyof SurfaceTheme['colors'] | string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,gBAAgB,CAAC;AAE/D,YAAY,
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,gBAAgB,CAAC;AAE/D,YAAY,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,UAAU,qBAAqB;IAC7B,IAAI,CAAC,EAAE,MAAM,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,YAAY,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAC9C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,qBAAqB,CAAC;AAE3D,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,+BAQpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAmB/D,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC;IACpC,MAAM,YAAY,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzF,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAExD,OAAO,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,EAAG,CAAC;AAC/E,CAAC","sourcesContent":["import { type StyleProp, type TextStyle } from 'react-native';\n\nimport { resolveToken } from '../../theme/resolveToken';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { SurfaceTheme } from '../../theme/types';\nimport { type IconSource, PortableIcon } from './PortableIcon';\n\nexport type {\n FontIconSource,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './PortableIcon';\n\ninterface IconPresentationProps {\n size?: keyof SurfaceTheme['spacing'] | number;\n color?: keyof SurfaceTheme['colors'] | string;\n style?: StyleProp<TextStyle>;\n testID?: string;\n}\n\nexport type IconProps = IconSource & IconPresentationProps;\n\nexport function Icon(props: IconProps) {\n const { theme } = useTheme();\n const size = props.size ?? 'm';\n const color = props.color ?? 'text';\n const resolvedSize = typeof size === 'number' ? size : resolveToken(theme.spacing, size);\n const resolvedColor = resolveToken(theme.colors, color);\n\n return <PortableIcon {...props} color={resolvedColor} size={resolvedSize} />;\n}\n"]}
|
|
@@ -5,10 +5,11 @@ import { type IoniconsIconName } from '@react-native-vector-icons/ionicons/stati
|
|
|
5
5
|
import { type MaterialDesignIconsIconName } from '@react-native-vector-icons/material-design-icons/static';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { type StyleProp, type TextStyle } from 'react-native';
|
|
8
|
+
import type { SurfaceImageSource } from '../image';
|
|
8
9
|
export declare const SUPPORTED_ICON_PROVIDERS: readonly ["Ionicons", "FontAwesome", "FontAwesome5", "FontAwesome6", "MaterialDesignIcons"];
|
|
9
10
|
export type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];
|
|
10
11
|
export type IconVariant = 'regular' | 'solid' | 'brand';
|
|
11
|
-
export type
|
|
12
|
+
export type FontIconSource = {
|
|
12
13
|
name: IoniconsIconName;
|
|
13
14
|
provider?: 'Ionicons';
|
|
14
15
|
variant?: never;
|
|
@@ -45,6 +46,13 @@ export type IconSource = {
|
|
|
45
46
|
provider: 'MaterialDesignIcons';
|
|
46
47
|
variant?: never;
|
|
47
48
|
};
|
|
49
|
+
export interface SvgIconSource {
|
|
50
|
+
source: SurfaceImageSource;
|
|
51
|
+
name?: never;
|
|
52
|
+
provider?: never;
|
|
53
|
+
variant?: never;
|
|
54
|
+
}
|
|
55
|
+
export type IconSource = FontIconSource | SvgIconSource;
|
|
48
56
|
type PortableIconProps = IconSource & {
|
|
49
57
|
color: string;
|
|
50
58
|
size: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortableIcon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/PortableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"PortableIcon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/PortableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,E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,QAAQ,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAC/E;IAAE,IAAI,EAAE,2BAA2B,CAAC;IAAC,QAAQ,EAAE,qBAAqB,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE5F,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,aAAa,CAAC;AAExD,KAAK,iBAAiB,GAAG,UAAU,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAmDF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBAqCpD"}
|
|
@@ -4,7 +4,8 @@ import { FontAwesome6, } from '@react-native-vector-icons/fontawesome6/static';
|
|
|
4
4
|
import { Ionicons } from '@react-native-vector-icons/ionicons/static';
|
|
5
5
|
import { MaterialDesignIcons, } from '@react-native-vector-icons/material-design-icons/static';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import {} from 'react-native';
|
|
7
|
+
import { Image } from 'react-native';
|
|
8
|
+
import { SvgUri } from 'react-native-svg';
|
|
8
9
|
export const SUPPORTED_ICON_PROVIDERS = [
|
|
9
10
|
'Ionicons',
|
|
10
11
|
'FontAwesome',
|
|
@@ -12,6 +13,12 @@ export const SUPPORTED_ICON_PROVIDERS = [
|
|
|
12
13
|
'FontAwesome6',
|
|
13
14
|
'MaterialDesignIcons',
|
|
14
15
|
];
|
|
16
|
+
/*** Resolve either a direct URI or a React Native bundled image module to its SVG URI. */
|
|
17
|
+
function resolveSvgIconUri(source) {
|
|
18
|
+
if (typeof source === 'string')
|
|
19
|
+
return source;
|
|
20
|
+
return Image.resolveAssetSource(source).uri;
|
|
21
|
+
}
|
|
15
22
|
function assertNever(value, configuration) {
|
|
16
23
|
throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);
|
|
17
24
|
}
|
|
@@ -42,6 +49,9 @@ function renderFontAwesome6(props, sharedProps) {
|
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
export function PortableIcon(props) {
|
|
52
|
+
if ('source' in props) {
|
|
53
|
+
return (<SvgUri color={props.color} height={props.size} style={props.style} testID={props.testID} uri={resolveSvgIconUri(props.source)} width={props.size}/>);
|
|
54
|
+
}
|
|
45
55
|
const { provider } = props;
|
|
46
56
|
const sharedProps = {
|
|
47
57
|
color: props.color,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortableIcon.js","sourceRoot":"","sources":["../../../src/primitives/icon/PortableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAEZ,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,YAAY,GAIb,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,YAAY,GAIb,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAyB,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EACL,mBAAmB,GAEpB,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"PortableIcon.js","sourceRoot":"","sources":["../../../src/primitives/icon/PortableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAEZ,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,YAAY,GAIb,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,YAAY,GAIb,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAyB,MAAM,4CAA4C,C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;IAC3B,MAAM,WAAW,GAAG;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC;IAEF,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,KAAK,UAAU;YACb,OAAO,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QACzD,KAAK,aAAa;YAChB,OAAO,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QAC5D,KAAK,cAAc;YACjB,OAAO,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD,KAAK,cAAc;YACjB,OAAO,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD,KAAK,qBAAqB;YACxB,OAAO,CAAC,mBAAmB,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QACpE;YACE,OAAO,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC","sourcesContent":["import {\n FontAwesome,\n type FontAwesomeIconName,\n} from '@react-native-vector-icons/fontawesome/static';\nimport {\n FontAwesome5,\n type FontAwesome5BrandIconName,\n type FontAwesome5RegularIconName,\n type FontAwesome5SolidIconName,\n} from '@react-native-vector-icons/fontawesome5/static';\nimport {\n FontAwesome6,\n type FontAwesome6BrandIconName,\n type FontAwesome6RegularIconName,\n type FontAwesome6SolidIconName,\n} from '@react-native-vector-icons/fontawesome6/static';\nimport { Ionicons, type IoniconsIconName } from '@react-native-vector-icons/ionicons/static';\nimport {\n MaterialDesignIcons,\n type MaterialDesignIconsIconName,\n} from '@react-native-vector-icons/material-design-icons/static';\nimport React from 'react';\nimport { Image, type StyleProp, type TextStyle } from 'react-native';\nimport { SvgUri } from 'react-native-svg';\n\nimport type { SurfaceImageSource } from '../image';\n\nexport const SUPPORTED_ICON_PROVIDERS = [\n 'Ionicons',\n 'FontAwesome',\n 'FontAwesome5',\n 'FontAwesome6',\n 'MaterialDesignIcons',\n] as const;\n\nexport type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];\nexport type IconVariant = 'regular' | 'solid' | 'brand';\n\nexport type FontIconSource =\n | { name: IoniconsIconName; provider?: 'Ionicons'; variant?: never }\n | { name: FontAwesomeIconName; provider: 'FontAwesome'; variant?: never }\n | { name: FontAwesome5RegularIconName; provider: 'FontAwesome5'; variant: 'regular' }\n | { name: FontAwesome5SolidIconName; provider: 'FontAwesome5'; variant: 'solid' }\n | { name: FontAwesome5BrandIconName; provider: 'FontAwesome5'; variant: 'brand' }\n | { name: FontAwesome6RegularIconName; provider: 'FontAwesome6'; variant: 'regular' }\n | { name: FontAwesome6SolidIconName; provider: 'FontAwesome6'; variant: 'solid' }\n | { name: FontAwesome6BrandIconName; provider: 'FontAwesome6'; variant: 'brand' }\n | { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };\n\nexport interface SvgIconSource {\n source: SurfaceImageSource;\n name?: never;\n provider?: never;\n variant?: never;\n}\n\nexport type IconSource = FontIconSource | SvgIconSource;\n\ntype PortableIconProps = IconSource & {\n color: string;\n size: number;\n style?: StyleProp<TextStyle>;\n testID?: string;\n};\n\ntype SharedIconProps = Pick<PortableIconProps, 'color' | 'size' | 'style' | 'testID'>;\n\n/*** Resolve either a direct URI or a React Native bundled image module to its SVG URI. */\nfunction resolveSvgIconUri(source: SurfaceImageSource): string {\n if (typeof source === 'string') return source;\n\n return Image.resolveAssetSource(source).uri;\n}\n\nfunction assertNever(value: never, configuration: string): never {\n throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);\n}\n\nfunction renderFontAwesome5(\n props: Extract<IconSource, { provider: 'FontAwesome5' }>,\n sharedProps: SharedIconProps,\n) {\n const { variant } = props;\n\n switch (variant) {\n case 'brand':\n return <FontAwesome5 {...sharedProps} iconStyle=\"brand\" name={props.name} />;\n case 'regular':\n return <FontAwesome5 {...sharedProps} iconStyle=\"regular\" name={props.name} />;\n case 'solid':\n return <FontAwesome5 {...sharedProps} iconStyle=\"solid\" name={props.name} />;\n default:\n return assertNever(variant, 'FontAwesome5 variant');\n }\n}\n\nfunction renderFontAwesome6(\n props: Extract<IconSource, { provider: 'FontAwesome6' }>,\n sharedProps: SharedIconProps,\n) {\n const { variant } = props;\n\n switch (variant) {\n case 'brand':\n return <FontAwesome6 {...sharedProps} iconStyle=\"brand\" name={props.name} />;\n case 'regular':\n return <FontAwesome6 {...sharedProps} iconStyle=\"regular\" name={props.name} />;\n case 'solid':\n return <FontAwesome6 {...sharedProps} iconStyle=\"solid\" name={props.name} />;\n default:\n return assertNever(variant, 'FontAwesome6 variant');\n }\n}\n\nexport function PortableIcon(props: PortableIconProps) {\n if ('source' in props) {\n return (\n <SvgUri\n color={props.color}\n height={props.size}\n style={props.style}\n testID={props.testID}\n uri={resolveSvgIconUri(props.source)}\n width={props.size}\n />\n );\n }\n\n const { provider } = props;\n const sharedProps = {\n color: props.color,\n size: props.size,\n style: props.style,\n testID: props.testID,\n };\n\n switch (provider) {\n case undefined:\n case 'Ionicons':\n return <Ionicons {...sharedProps} name={props.name} />;\n case 'FontAwesome':\n return <FontAwesome {...sharedProps} name={props.name} />;\n case 'FontAwesome5':\n return renderFontAwesome5(props, sharedProps);\n case 'FontAwesome6':\n return renderFontAwesome6(props, sharedProps);\n case 'MaterialDesignIcons':\n return <MaterialDesignIcons {...sharedProps} name={props.name} />;\n default:\n return assertNever(provider, 'provider');\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { IconProps, IconProvider, IconSource, IconVariant } from './Icon';
|
|
1
|
+
export type { FontIconSource, IconProps, IconProvider, IconSource, IconVariant, SvgIconSource, } from './Icon';
|
|
2
2
|
export { Icon } from './Icon';
|
|
3
3
|
export { SUPPORTED_ICON_PROVIDERS } from './PortableIcon';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './Icon';\nexport { Icon } from './Icon';\nexport { SUPPORTED_ICON_PROVIDERS } from './PortableIcon';\n"]}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/theme/index.js
CHANGED
package/dist/theme/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './public';\nexport * from './ThemeContext';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/theme/public.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../src/theme/public.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC","sourcesContent":["export * from './colorEngine';\nexport * from './createTheme';\nexport * from './resolveToken';\nexport * from './types';\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/surface",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.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": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"react": "19.2.3",
|
|
36
36
|
"react-native": "0.86.x",
|
|
37
37
|
"react-native-safe-area-context": "~5.7.0",
|
|
38
|
+
"react-native-svg": "15.15.4",
|
|
38
39
|
"react-native-web": "~0.21.0"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
@@ -56,6 +57,14 @@
|
|
|
56
57
|
"import": "./dist/index.js",
|
|
57
58
|
"default": "./dist/index.js"
|
|
58
59
|
},
|
|
60
|
+
"./theme": {
|
|
61
|
+
"bun": "./src/theme/public.ts",
|
|
62
|
+
"react-native": "./src/theme/public.ts",
|
|
63
|
+
"browser": "./src/theme/public.ts",
|
|
64
|
+
"types": "./dist/theme/public.d.ts",
|
|
65
|
+
"import": "./dist/theme/public.js",
|
|
66
|
+
"default": "./dist/theme/public.js"
|
|
67
|
+
},
|
|
59
68
|
"./package.json": "./package.json"
|
|
60
69
|
},
|
|
61
70
|
"publishConfig": {
|
|
@@ -77,7 +86,7 @@
|
|
|
77
86
|
"version-packages": "ankhorage-changeset version"
|
|
78
87
|
},
|
|
79
88
|
"devDependencies": {
|
|
80
|
-
"@ankhorage/devtools": "^1.
|
|
89
|
+
"@ankhorage/devtools": "^1.10.2",
|
|
81
90
|
"@ankhorage/paradox": "^0.1.24",
|
|
82
91
|
"@react-native-vector-icons/fontawesome": "^13.1.3",
|
|
83
92
|
"@react-native-vector-icons/fontawesome5": "^13.1.3",
|
|
@@ -94,6 +103,7 @@
|
|
|
94
103
|
"react-dom": "19.2.3",
|
|
95
104
|
"react-native": "0.86.3",
|
|
96
105
|
"react-native-safe-area-context": "~5.7.0",
|
|
106
|
+
"react-native-svg": "15.15.4",
|
|
97
107
|
"react-native-web": "~0.21.0",
|
|
98
108
|
"typescript": "~6.0.3"
|
|
99
109
|
},
|
package/src/index.test.ts
CHANGED
|
@@ -70,6 +70,14 @@ describe('public package contract', () => {
|
|
|
70
70
|
import: './dist/index.js',
|
|
71
71
|
types: './dist/index.d.ts',
|
|
72
72
|
},
|
|
73
|
+
'./theme': {
|
|
74
|
+
bun: './src/theme/public.ts',
|
|
75
|
+
'react-native': './src/theme/public.ts',
|
|
76
|
+
browser: './src/theme/public.ts',
|
|
77
|
+
default: './dist/theme/public.js',
|
|
78
|
+
import: './dist/theme/public.js',
|
|
79
|
+
types: './dist/theme/public.d.ts',
|
|
80
|
+
},
|
|
73
81
|
'./package.json': './package.json',
|
|
74
82
|
});
|
|
75
83
|
});
|
|
@@ -77,6 +85,8 @@ describe('public package contract', () => {
|
|
|
77
85
|
it('supports RN 0.86 patches while validating the canonical RN 0.86.3 baseline', () => {
|
|
78
86
|
expect(packageJson.peerDependencies['react-native']).toBe('0.86.x');
|
|
79
87
|
expect(packageJson.devDependencies['react-native']).toBe('0.86.3');
|
|
88
|
+
expect(packageJson.peerDependencies['react-native-svg']).toBe('15.15.4');
|
|
89
|
+
expect(packageJson.devDependencies['react-native-svg']).toBe('15.15.4');
|
|
80
90
|
});
|
|
81
91
|
|
|
82
92
|
it('exports the resolved semantic and diagnostic contracts from the public root', () => {
|
package/src/index.ts
CHANGED
|
@@ -67,7 +67,14 @@ export type { ButtonBaseProps } from './primitives/button-base';
|
|
|
67
67
|
export { ButtonBase } from './primitives/button-base';
|
|
68
68
|
export type { HeadingLevel, HeadingProps } from './primitives/heading';
|
|
69
69
|
export { Heading } from './primitives/heading';
|
|
70
|
-
export type {
|
|
70
|
+
export type {
|
|
71
|
+
FontIconSource,
|
|
72
|
+
IconProps,
|
|
73
|
+
IconProvider,
|
|
74
|
+
IconSource,
|
|
75
|
+
IconVariant,
|
|
76
|
+
SvgIconSource,
|
|
77
|
+
} from './primitives/icon';
|
|
71
78
|
export { Icon, SUPPORTED_ICON_PROVIDERS } from './primitives/icon';
|
|
72
79
|
export type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';
|
|
73
80
|
export { Image } from './primitives/image';
|
|
@@ -5,7 +5,13 @@ import { useTheme } from '../../theme/ThemeContext';
|
|
|
5
5
|
import type { SurfaceTheme } from '../../theme/types';
|
|
6
6
|
import { type IconSource, PortableIcon } from './PortableIcon';
|
|
7
7
|
|
|
8
|
-
export type {
|
|
8
|
+
export type {
|
|
9
|
+
FontIconSource,
|
|
10
|
+
IconProvider,
|
|
11
|
+
IconSource,
|
|
12
|
+
IconVariant,
|
|
13
|
+
SvgIconSource,
|
|
14
|
+
} from './PortableIcon';
|
|
9
15
|
|
|
10
16
|
interface IconPresentationProps {
|
|
11
17
|
size?: keyof SurfaceTheme['spacing'] | number;
|
|
@@ -20,7 +20,10 @@ import {
|
|
|
20
20
|
type MaterialDesignIconsIconName,
|
|
21
21
|
} from '@react-native-vector-icons/material-design-icons/static';
|
|
22
22
|
import React from 'react';
|
|
23
|
-
import { type StyleProp, type TextStyle } from 'react-native';
|
|
23
|
+
import { Image, type StyleProp, type TextStyle } from 'react-native';
|
|
24
|
+
import { SvgUri } from 'react-native-svg';
|
|
25
|
+
|
|
26
|
+
import type { SurfaceImageSource } from '../image';
|
|
24
27
|
|
|
25
28
|
export const SUPPORTED_ICON_PROVIDERS = [
|
|
26
29
|
'Ionicons',
|
|
@@ -33,7 +36,7 @@ export const SUPPORTED_ICON_PROVIDERS = [
|
|
|
33
36
|
export type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];
|
|
34
37
|
export type IconVariant = 'regular' | 'solid' | 'brand';
|
|
35
38
|
|
|
36
|
-
export type
|
|
39
|
+
export type FontIconSource =
|
|
37
40
|
| { name: IoniconsIconName; provider?: 'Ionicons'; variant?: never }
|
|
38
41
|
| { name: FontAwesomeIconName; provider: 'FontAwesome'; variant?: never }
|
|
39
42
|
| { name: FontAwesome5RegularIconName; provider: 'FontAwesome5'; variant: 'regular' }
|
|
@@ -44,6 +47,15 @@ export type IconSource =
|
|
|
44
47
|
| { name: FontAwesome6BrandIconName; provider: 'FontAwesome6'; variant: 'brand' }
|
|
45
48
|
| { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };
|
|
46
49
|
|
|
50
|
+
export interface SvgIconSource {
|
|
51
|
+
source: SurfaceImageSource;
|
|
52
|
+
name?: never;
|
|
53
|
+
provider?: never;
|
|
54
|
+
variant?: never;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type IconSource = FontIconSource | SvgIconSource;
|
|
58
|
+
|
|
47
59
|
type PortableIconProps = IconSource & {
|
|
48
60
|
color: string;
|
|
49
61
|
size: number;
|
|
@@ -53,6 +65,13 @@ type PortableIconProps = IconSource & {
|
|
|
53
65
|
|
|
54
66
|
type SharedIconProps = Pick<PortableIconProps, 'color' | 'size' | 'style' | 'testID'>;
|
|
55
67
|
|
|
68
|
+
/*** Resolve either a direct URI or a React Native bundled image module to its SVG URI. */
|
|
69
|
+
function resolveSvgIconUri(source: SurfaceImageSource): string {
|
|
70
|
+
if (typeof source === 'string') return source;
|
|
71
|
+
|
|
72
|
+
return Image.resolveAssetSource(source).uri;
|
|
73
|
+
}
|
|
74
|
+
|
|
56
75
|
function assertNever(value: never, configuration: string): never {
|
|
57
76
|
throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);
|
|
58
77
|
}
|
|
@@ -94,6 +113,19 @@ function renderFontAwesome6(
|
|
|
94
113
|
}
|
|
95
114
|
|
|
96
115
|
export function PortableIcon(props: PortableIconProps) {
|
|
116
|
+
if ('source' in props) {
|
|
117
|
+
return (
|
|
118
|
+
<SvgUri
|
|
119
|
+
color={props.color}
|
|
120
|
+
height={props.size}
|
|
121
|
+
style={props.style}
|
|
122
|
+
testID={props.testID}
|
|
123
|
+
uri={resolveSvgIconUri(props.source)}
|
|
124
|
+
width={props.size}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
97
129
|
const { provider } = props;
|
|
98
130
|
const sharedProps = {
|
|
99
131
|
color: props.color,
|
|
@@ -6,6 +6,15 @@ import { renderToStaticMarkup } from 'react-dom/server';
|
|
|
6
6
|
import * as ReactNativeWeb from 'react-native-web';
|
|
7
7
|
|
|
8
8
|
await mock.module('react-native', () => ReactNativeWeb);
|
|
9
|
+
await mock.module('react-native-svg', () => ({
|
|
10
|
+
SvgUri: ({ color, height, uri, width }: Record<string, unknown>) =>
|
|
11
|
+
React.createElement('svg', {
|
|
12
|
+
'data-color': color,
|
|
13
|
+
'data-uri': uri,
|
|
14
|
+
height,
|
|
15
|
+
width,
|
|
16
|
+
}),
|
|
17
|
+
}));
|
|
9
18
|
|
|
10
19
|
const { Icon } = await import('./Icon');
|
|
11
20
|
const { PortableIcon, SUPPORTED_ICON_PROVIDERS } = await import('./PortableIcon');
|
|
@@ -56,6 +65,17 @@ describe('portable icon rendering', () => {
|
|
|
56
65
|
|
|
57
66
|
expect(markup).toContain('font-family:MaterialDesignIcons');
|
|
58
67
|
});
|
|
68
|
+
|
|
69
|
+
test('renders an SVG URI through the same public Icon API', () => {
|
|
70
|
+
const markup = renderToStaticMarkup(
|
|
71
|
+
<Icon color="#123456" size={18} source="https://example.com/icons/home.svg" />,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
expect(markup).toContain('data-uri="https://example.com/icons/home.svg"');
|
|
75
|
+
expect(markup).toContain('data-color="#123456"');
|
|
76
|
+
expect(markup).toContain('width="18"');
|
|
77
|
+
expect(markup).toContain('height="18"');
|
|
78
|
+
});
|
|
59
79
|
});
|
|
60
80
|
|
|
61
81
|
describe('portable icon contract', () => {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type {
|
|
2
|
+
FontIconSource,
|
|
3
|
+
IconProps,
|
|
4
|
+
IconProvider,
|
|
5
|
+
IconSource,
|
|
6
|
+
IconVariant,
|
|
7
|
+
SvgIconSource,
|
|
8
|
+
} from './Icon';
|
|
2
9
|
export { Icon } from './Icon';
|
|
3
10
|
export { SUPPORTED_ICON_PROVIDERS } from './PortableIcon';
|
package/src/theme/index.ts
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from 'bun:test';
|
|
4
|
+
|
|
5
|
+
import { createTheme, type SurfaceTheme } from './public';
|
|
6
|
+
|
|
7
|
+
describe('public theme subpath', () => {
|
|
8
|
+
test('resolves a complete theme through the pure owner entrypoint', () => {
|
|
9
|
+
const theme: SurfaceTheme = createTheme();
|
|
10
|
+
|
|
11
|
+
expect(theme.colorDiagnostics.generated.swatches).toBe(theme.swatches);
|
|
12
|
+
expect(theme.semantics.selection.background).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('keeps React and React Native outside the public module graph root', () => {
|
|
16
|
+
const source = readFileSync(new URL('./public.ts', import.meta.url), 'utf8');
|
|
17
|
+
|
|
18
|
+
expect(source).not.toContain('ThemeContext');
|
|
19
|
+
expect(source).not.toMatch(/from ['"]react(?:-native)?['"]/);
|
|
20
|
+
expect(source).toContain("export * from './createTheme';");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('imports and executes through the package subpath in plain Bun', async () => {
|
|
24
|
+
const script = [
|
|
25
|
+
"import { createTheme } from '@ankhorage/surface/theme';",
|
|
26
|
+
'const theme = createTheme();',
|
|
27
|
+
'process.stdout.write(`${theme.config.id}:${theme.colorDiagnostics.mode}`);',
|
|
28
|
+
].join('\n');
|
|
29
|
+
const subprocess = Bun.spawn({
|
|
30
|
+
cmd: [process.execPath, '-e', script],
|
|
31
|
+
stdout: 'pipe',
|
|
32
|
+
stderr: 'pipe',
|
|
33
|
+
});
|
|
34
|
+
const [stdout, stderr, exitCode] = await Promise.all([
|
|
35
|
+
new Response(subprocess.stdout).text(),
|
|
36
|
+
new Response(subprocess.stderr).text(),
|
|
37
|
+
subprocess.exited,
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
expect(exitCode, stderr).toBe(0);
|
|
41
|
+
expect(stdout).toBe('default:light');
|
|
42
|
+
});
|
|
43
|
+
});
|