@apple-pie/slice-native 0.0.0-stage → 0.1.2
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 +74 -2
- package/dist/cjs/index.js +810 -0
- package/dist/esm/index.mjs +806 -0
- package/dist/types/components/Icon/NativeIcon.d.ts +2 -0
- package/dist/types/components/Icon/_types.d.ts +16 -0
- package/dist/types/components/Icon/iconRegistry.d.ts +17 -0
- package/dist/types/components/Icon/icons.d.ts +137 -0
- package/dist/types/components/Icon/index.d.ts +3 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +45 -5
package/README.md
CHANGED
|
@@ -1,3 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @apple-pie/slice-native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Experimental React Native SVG icons, with the same names and artwork as the web UIKit.
|
|
4
|
+
Currently **icons only**: this package does not provide the rest of Slice's components,
|
|
5
|
+
theme provider, or shared light/dark palettes. It is built and published independently
|
|
6
|
+
of `@apple-pie/slice` and does not require that package at runtime.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Icon, SliceIcons } from '@apple-pie/slice-native';
|
|
10
|
+
|
|
11
|
+
<Icon
|
|
12
|
+
name={SliceIcons.ui.home}
|
|
13
|
+
size={24}
|
|
14
|
+
strokeColor="#334155"
|
|
15
|
+
accessibilityLabel="Go home"
|
|
16
|
+
onPress={() => navigation.navigate('Home')}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`NativeIcon` is also exported as an alias of `Icon`. Supply native SVG props and
|
|
21
|
+
native `style` objects; use `onPress` instead of `onClick`. CSS classes, cursor
|
|
22
|
+
styling (`pointer`), and browser keyboard handlers are not part of this API.
|
|
23
|
+
Use an enclosing React Native `Pressable` when you need a larger touch target or
|
|
24
|
+
button feedback, and mark the icon `accessible={false}` when it is decorative.
|
|
25
|
+
|
|
26
|
+
Defaults are 20×20, stroke width 1.5, and black/white colors based on the system
|
|
27
|
+
color scheme. Pass `strokeColor` and `coverUp` explicitly to match an app theme.
|
|
28
|
+
`fillColor` retains the web API's meaning: **opacity from 0 to 1**, not a color.
|
|
29
|
+
`fill` enables that opacity (default 0.125 in light mode, 0.2 in dark mode).
|
|
30
|
+
`toggle` selects the on variant when available; unknown names render nothing.
|
|
31
|
+
`disabled` blocks press callbacks and halves the specified opacity.
|
|
32
|
+
|
|
33
|
+
The package requires React, React Native, and react-native-svg as peers. Install
|
|
34
|
+
the native SVG dependency in the consuming app using its normal native/Expo setup.
|
|
35
|
+
|
|
36
|
+
## Development
|
|
37
|
+
|
|
38
|
+
The package manifest and entry point live in `native/`. Icon components, types,
|
|
39
|
+
generated artwork, and tests live in `native/components/Icon/`.
|
|
40
|
+
|
|
41
|
+
From this directory, run `npm run generate` after changing the web icon registry
|
|
42
|
+
or `SliceIcons` constants. Generated files contain native SVG components and have
|
|
43
|
+
no runtime imports from the web UIKit. Run `npm run typecheck` with the peer
|
|
44
|
+
dependencies installed and TypeScript available from the repository.
|
|
45
|
+
|
|
46
|
+
From the repository root:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
npm install
|
|
50
|
+
npm install --prefix native
|
|
51
|
+
npm run lint --prefix native
|
|
52
|
+
npm test --prefix native
|
|
53
|
+
npm run build --prefix native
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The build refreshes generated icons, checks types, and produces `dist/cjs/index.js`,
|
|
57
|
+
`dist/esm/index.mjs`, and declarations under `dist/types`. React, React Native, and
|
|
58
|
+
react-native-svg stay external peer dependencies. The web build is independent.
|
|
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
|
+
|
|
69
|
+
Run `npm pack --dry-run` from `native/` to inspect the publishable files, or
|
|
70
|
+
`npm pack` to create a tarball. The `prepack` hook builds automatically. Build and
|
|
71
|
+
pack from this repository: generation uses the web artwork in `src/components/Icon`.
|
|
72
|
+
|
|
73
|
+
Contributor architecture and future theme-data extraction are documented in
|
|
74
|
+
`contributor-docs/native.md` in the source repository. Shared plain TypeScript color
|
|
75
|
+
constants are planned; the current system light/dark defaults are only icon defaults.
|