@apple-pie/slice-native 0.1.0 → 0.1.3

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/README.md CHANGED
@@ -1,9 +1,12 @@
1
- # @apple-pie/icons-native
1
+ # @apple-pie/slice-native
2
2
 
3
- React Native SVG icons, with the same names and artwork as the web UIKit.
3
+ Experimental React Native SVG icons, with the same names and artwork as the web UIKit.
4
+ Includes native light/dark theme tokens; other Slice components and a theme provider
5
+ are not included. It is built and published independently
6
+ of `@apple-pie/slice` and does not require that package at runtime.
4
7
 
5
8
  ```tsx
6
- import { Icon, SliceIcons } from '@apple-pie/icons-native';
9
+ import { Icon, SliceIcons } from '@apple-pie/slice-native';
7
10
 
8
11
  <Icon
9
12
  name={SliceIcons.ui.home}
@@ -43,7 +46,10 @@ dependencies installed and TypeScript available from the repository.
43
46
  From the repository root:
44
47
 
45
48
  ```sh
49
+ npm install
46
50
  npm install --prefix native
51
+ npm run lint --prefix native
52
+ npm test --prefix native
47
53
  npm run build --prefix native
48
54
  ```
49
55
 
@@ -51,6 +57,64 @@ The build refreshes generated icons, checks types, and produces `dist/cjs/index.
51
57
  `dist/esm/index.mjs`, and declarations under `dist/types`. React, React Native, and
52
58
  react-native-svg stay external peer dependencies. The web build is independent.
53
59
 
60
+ Native tests use their own `vitest.config.mts` and mocked native components. Install native
61
+ dependencies before running them. Root tests and coverage do not include the native package;
62
+ passing the native unit tests does not replace device rendering checks.
63
+
64
+ CI runs these checks independently in **Slice Native Lint, Build, Test** on Node 24.
65
+ It uses `npm run lint:ci --prefix native` to check formatting and types without writing
66
+ fixes, then runs native tests, builds, and inspects the package contents. Root dependencies
67
+ provide shared tooling such as Biome; native dependencies are installed separately.
68
+
54
69
  Run `npm pack --dry-run` from `native/` to inspect the publishable files, or
55
70
  `npm pack` to create a tarball. The `prepack` hook builds automatically. Build and
56
71
  pack from this repository: generation uses the web artwork in `src/components/Icon`.
72
+
73
+ ## Theme tokens
74
+
75
+ ```tsx
76
+ import { Text, View, useColorScheme } from 'react-native';
77
+ import { lightTheme, darkTheme } from '@apple-pie/slice-native/theme';
78
+
79
+ function Card() {
80
+ const theme = useColorScheme() === 'dark' ? darkTheme : lightTheme;
81
+ return (
82
+ <View style={{
83
+ backgroundColor: theme.colors['core-surface-primary'],
84
+ padding: theme.spacing.m,
85
+ borderRadius: theme.corners['corner-m'],
86
+ ...theme.shadows['surface-shadow-soft'],
87
+ }}>
88
+ <Text style={{ ...theme.type['body-m-regular'], color: theme.colors['core-text-primary'] }}>
89
+ Hello Slice
90
+ </Text>
91
+ </View>
92
+ );
93
+ }
94
+ ```
95
+
96
+ `lightTheme`, `darkTheme`, `createTypography`, and the `SliceNativeTheme` type are
97
+ also available from the package root. `SliceTheme` aliases the native theme type.
98
+ The dedicated `/theme` entry has no runtime React Native, React, or SVG imports.
99
+ It also exports `coreColors`, `corners`, `spacing`, `elevations`, `type`, and `motion`.
100
+
101
+ Colors, spacing, corners, and stacking levels are sourced from the web tokens at
102
+ build time and bundled into this package. No web package is needed in an app.
103
+ CSS shadow strings are removed from `colors` and `coreColors`; use `theme.shadows`
104
+ instead. Shadows use native `boxShadow` arrays, which require the New Architecture
105
+ and supported Android versions (outset shadows require Android 9+).
106
+
107
+ Typography uses a fixed 16dp base for rem conversion and numeric line heights and
108
+ letter spacing. Load Funnel Sans in your app, or replace `theme.type` with
109
+ `createTypography('YourLoadedFontName')`. Exact font weights depend on the font
110
+ and platform; test your loaded font on devices. This package does not load fonts.
111
+
112
+ Motion durations are milliseconds. Curve tokens are easing functions suitable for
113
+ `Animated.timing`'s `easing` option; the CSS spring is interpolated from its original
114
+ samples, preserving overshoot. They are ordinary JavaScript functions, not Reanimated
115
+ worklets. `elevations` retains the web stacking levels for `zIndex`; do not pass these
116
+ values to Android's `elevation` property.
117
+
118
+ Build from the repository so shared source tokens are available. All generated
119
+ JavaScript and declarations are included under `dist/`, including declarations for
120
+ shared source types. Changes to web tokens are picked up by the next native build.
package/dist/cjs/index.js CHANGED
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var react = require('react');
5
5
  var reactNative = require('react-native');
6
6
  var Svg = require('react-native-svg');
7
+ var theme = require('./theme.js');
7
8
 
8
9
  /**
9
10
  * Static icon registry created once at module load.
@@ -805,6 +806,9 @@ const SliceIcons = {
805
806
  },
806
807
  };
807
808
 
809
+ exports.createTypography = theme.createTypography;
810
+ exports.darkTheme = theme.darkTheme;
811
+ exports.lightTheme = theme.lightTheme;
808
812
  exports.Icon = NativeIcon;
809
813
  exports.NativeIcon = NativeIcon;
810
814
  exports.SliceIcons = SliceIcons;