@hzblj/kara-router 0.1.0 → 0.2.1

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @hzblj/kara-router
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`be5be81`](https://github.com/hzblj/kara-ui/commit/be5be81a3764dfbd199c3c3cf90deadc6e53d268) Thanks [@hzblj](https://github.com/hzblj)! - Installable again: 0.2.0 was published with `workspace:^` ranges between the kara packages, which no package manager outside this repository resolves. The packages now go out through Yarn, which writes the real version ranges.
8
+
9
+ - Updated dependencies [[`be5be81`](https://github.com/hzblj/kara-ui/commit/be5be81a3764dfbd199c3c3cf90deadc6e53d268)]:
10
+ - @hzblj/kara-components@0.2.1
11
+ - @hzblj/kara-native@0.2.1
12
+ - @hzblj/kara-theme@0.2.1
13
+
14
+ ## 0.2.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [`c30bef6`](https://github.com/hzblj/kara-ui/commit/c30bef6be2639deb6d385ad209d1a2799b5b656f) Thanks [@hzblj](https://github.com/hzblj)! - Icons are now fully native and the app's own: `plugins: [['@hzblj/kara-ui', {icons: {source: './assets/icons'}}]]` turns every SVG in the folder into an iOS asset-catalog template image and an Android vector drawable at prebuild (`x.ios.svg` / `x.android.svg` for per-platform glyphs), and writes `kara-icons.d.ts` so `name` only accepts icons that exist; `npx kara-icons` does the same for CI. `Icon` draws them in a host, the new `RnIcon` anywhere, and `Tabs` passes them as `xcasset` / `drawable`. The built-in SF Symbol / Material icon names and the `@expo/vector-icons` peer dependency are gone.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`c30bef6`](https://github.com/hzblj/kara-ui/commit/c30bef6be2639deb6d385ad209d1a2799b5b656f), [`c30bef6`](https://github.com/hzblj/kara-ui/commit/c30bef6be2639deb6d385ad209d1a2799b5b656f)]:
23
+ - @hzblj/kara-components@0.2.0
24
+ - @hzblj/kara-native@0.2.0
25
+ - @hzblj/kara-theme@0.2.0
26
+
3
27
  ## 0.1.0
4
28
 
5
29
  ### Minor Changes
@@ -1,20 +1,13 @@
1
1
  "use strict";
2
2
 
3
- import MaterialIcons from '@expo/vector-icons/MaterialIcons';
4
- import { MATERIAL_ICONS, SF_SYMBOLS } from '@hzblj/kara-components';
3
+ import { iconResourceName } from '@hzblj/kara-native';
5
4
  import { NativeTabs } from 'expo-router/unstable-native-tabs';
6
5
  import { Children, isValidElement } from 'react';
7
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
7
  const {
9
8
  Icon,
10
- Label,
11
- VectorIcon
9
+ Label
12
10
  } = NativeTabs.Trigger;
13
- const sfSymbol = name => SF_SYMBOLS[name];
14
- const materialIcon = name => /*#__PURE__*/_jsx(VectorIcon, {
15
- family: MaterialIcons,
16
- name: MATERIAL_ICONS[name]
17
- });
18
11
 
19
12
  /**
20
13
  * Declares one tab and renders nothing itself — `Tabs` reads these props and emits the trigger.
@@ -22,6 +15,11 @@ const materialIcon = name => /*#__PURE__*/_jsx(VectorIcon, {
22
15
  * merely *renders* a trigger is invisible to it and the tab bar comes up empty.
23
16
  */
24
17
  const TabsScreen = () => null;
18
+
19
+ /**
20
+ * The tab's icon, natively on both sides: the app icon's image set in the iOS asset catalog, its vector drawable on
21
+ * Android — one name, the one the config plugin gave both. No icon font, no bitmap rendered in JavaScript.
22
+ */
25
23
  const renderTrigger = ({
26
24
  hidden,
27
25
  icon,
@@ -29,23 +27,27 @@ const renderTrigger = ({
29
27
  selectedIcon,
30
28
  testID,
31
29
  title
32
- }) => /*#__PURE__*/_jsxs(NativeTabs.Trigger, {
33
- hidden: hidden,
34
- name: name,
35
- testID: testID,
36
- children: [/*#__PURE__*/_jsx(Icon, {
37
- sf: selectedIcon ? {
38
- default: sfSymbol(icon),
39
- selected: sfSymbol(selectedIcon)
40
- } : sfSymbol(icon),
41
- src: selectedIcon ? {
42
- default: materialIcon(icon),
43
- selected: materialIcon(selectedIcon)
44
- } : materialIcon(icon)
45
- }), /*#__PURE__*/_jsx(Label, {
46
- children: title
47
- })]
48
- }, name);
30
+ }) => {
31
+ const asset = iconResourceName(icon);
32
+ const selected = selectedIcon ? iconResourceName(selectedIcon) : undefined;
33
+ return /*#__PURE__*/_jsxs(NativeTabs.Trigger, {
34
+ hidden: hidden,
35
+ name: name,
36
+ testID: testID,
37
+ children: [/*#__PURE__*/_jsx(Icon, {
38
+ drawable: selected ? {
39
+ default: asset,
40
+ selected
41
+ } : asset,
42
+ xcasset: selected ? {
43
+ default: asset,
44
+ selected
45
+ } : asset
46
+ }), /*#__PURE__*/_jsx(Label, {
47
+ children: title
48
+ })]
49
+ }, name);
50
+ };
49
51
  const TabsRoot = ({
50
52
  children,
51
53
  minimizeBehavior = 'never'
@@ -1 +1 @@
1
- {"version":3,"names":["MaterialIcons","MATERIAL_ICONS","SF_SYMBOLS","NativeTabs","Children","isValidElement","jsx","_jsx","jsxs","_jsxs","Icon","Label","VectorIcon","Trigger","sfSymbol","name","materialIcon","family","TabsScreen","renderTrigger","hidden","icon","selectedIcon","testID","title","children","sf","default","selected","src","TabsRoot","minimizeBehavior","map","child","type","props","Tabs","Object","assign","Screen"],"sourceRoot":"../../../src","sources":["tabs/tabs.tsx"],"mappings":";;AAAA,OAAOA,aAAa,MAAM,kCAAkC;AAC5D,SAAuBC,cAAc,EAAEC,UAAU,QAAO,wBAAwB;AAChF,SAAQC,UAAU,QAAO,kCAAkC;AAC3D,SAAQC,QAAQ,EAAEC,cAAc,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAI9C,MAAM;EAACC,IAAI;EAAEC,KAAK;EAAEC;AAAU,CAAC,GAAGT,UAAU,CAACU,OAAO;AAEpD,MAAMC,QAAQ,GAAIC,IAAc,IAAKb,UAAU,CAACa,IAAI,CAAa;AAEjE,MAAMC,YAAY,GAAID,IAAc,iBAAKR,IA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CACS,CACb;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,IAAmB,GAAGC,MAAM,CAACC,MAAM,CAACR,QAAQ,EAAE;EAACS,MAAM,EAAErB;AAAU,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["iconResourceName","NativeTabs","Children","isValidElement","jsx","_jsx","jsxs","_jsxs","Icon","Label","Trigger","TabsScreen","renderTrigger","hidden","icon","name","selectedIcon","testID","title","asset","selected","undefined","children","drawable","default","xcasset","TabsRoot","minimizeBehavior","map","child","type","props","Tabs","Object","assign","Screen"],"sourceRoot":"../../../src","sources":["tabs/tabs.tsx"],"mappings":";;AAAA,SAAQA,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,UAAU,QAAO,kCAAkC;AAC3D,SAAQC,QAAQ,EAAEC,cAAc,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAI9C,MAAM;EAACC,IAAI;EAAEC;AAAK,CAAC,GAAGR,UAAU,CAACS,OAAO;;AAExC;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAmC,GAAGA,CAAA,KAAM,IAAI;;AAEtD;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAGA,CAAC;EAACC,MAAM;EAAEC,IAAI;EAAEC,IAAI;EAAEC,YAAY;EAAEC,MAAM;EAAEC;AAAsB,CAAC,KAAK;EAC5F,MAAMC,KAAK,GAAGnB,gBAAgB,CAACc,IAAI,CAAC;EACpC,MAAMM,QAAQ,GAAGJ,YAAY,GAAGhB,gBAAgB,CAACgB,YAAY,CAAC,GAAGK,SAAS;EAE1E,oBACEd,KAAA,CAACN,UAAU,CAACS,OAAO;IAACG,MAAM,EAAEA,MAAO;IAAYE,IAAI,EAAEA,IAAK;IAACE,MAAM,EAAEA,MAAO;IAAAK,QAAA,gBACxEjB,IAAA,CAACG,IAAI;MACHe,QAAQ,EAAEH,QAAQ,GAAG;QAACI,OAAO,EAAEL,KAAK;QAAEC;MAAQ,CAAC,GAAGD,KAAM;MACxDM,OAAO,EAAEL,QAAQ,GAAG;QAACI,OAAO,EAAEL,KAAK;QAAEC;MAAQ,CAAC,GAAGD;IAAM,CACxD,CAAC,eACFd,IAAA,CAACI,KAAK;MAAAa,QAAA,EAAEJ;IAAK,CAAQ,CAAC;EAAA,GALiBH,IAMrB,CAAC;AAEzB,CAAC;AAED,MAAMW,QAAQ,GAAGA,CAAC;EAACJ,QAAQ;EAAEK,gBAAgB,GAAG;AAAkB,CAAC,kBACjEtB,IAAA,CAACJ,UAAU;EAAC0B,gBAAgB,EAAEA,gBAAiB;EAAAL,QAAA,EAC5CpB,QAAQ,CAAC0B,GAAG,CAACN,QAAQ,EAAEO,KAAK,IAC3B,aAAA1B,cAAc,CAAkB0B,KAAK,CAAC,IAAIA,KAAK,CAACC,IAAI,KAAKnB,UAAU,GAAGC,aAAa,CAACiB,KAAK,CAACE,KAAK,CAAC,GAAGF,KACrG;AAAC,CACS,CACb;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,IAAmB,GAAGC,MAAM,CAACC,MAAM,CAACR,QAAQ,EAAE;EAACS,MAAM,EAAExB;AAAU,CAAC,CAAC","ignoreList":[]}
@@ -7,9 +7,10 @@ export type TabsScreenProps = {
7
7
  * at runtime remounts the navigator, so pass a build constant.
8
8
  */
9
9
  hidden?: boolean;
10
+ /** One of the app's icons — the asset-catalog image on iOS, the vector drawable on Android. */
10
11
  icon: IconName;
11
12
  name: string;
12
- /** Swapped in while the tab is active — the filled/solid counterpart of `icon` on iOS. */
13
+ /** Swapped in while the tab is active — the filled counterpart of `icon`, say. */
13
14
  selectedIcon?: IconName;
14
15
  testID?: string;
15
16
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzblj/kara-router",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Expo Router pieces of @hzblj/kara-ui: native tabs and a navigation theme mapped from the active kara theme.",
5
5
  "author": "Jan Blazej",
6
6
  "license": "MIT",
@@ -59,19 +59,17 @@
59
59
  ]
60
60
  },
61
61
  "dependencies": {
62
- "@hzblj/kara-components": "^0.1.0",
63
- "@hzblj/kara-theme": "^0.1.0",
64
- "sf-symbols-typescript": "^2.2.0"
62
+ "@hzblj/kara-components": "^0.2.1",
63
+ "@hzblj/kara-native": "^0.2.1",
64
+ "@hzblj/kara-theme": "^0.2.1"
65
65
  },
66
66
  "peerDependencies": {
67
- "@expo/vector-icons": "*",
68
67
  "expo-router": "*",
69
68
  "react": "*",
70
69
  "react-native": "*"
71
70
  },
72
71
  "devDependencies": {
73
72
  "@expo/ui": "~57.0.18",
74
- "@expo/vector-icons": "^15.1.1",
75
73
  "@storybook/react-native": "^10.6.0",
76
74
  "@types/react": "~19.2.18",
77
75
  "expo": "~57.0.22",
package/src/tabs/tabs.tsx CHANGED
@@ -1,15 +1,10 @@
1
- import MaterialIcons from '@expo/vector-icons/MaterialIcons'
2
- import {type IconName, MATERIAL_ICONS, SF_SYMBOLS} from '@hzblj/kara-components'
1
+ import {iconResourceName} from '@hzblj/kara-native'
3
2
  import {NativeTabs} from 'expo-router/unstable-native-tabs'
4
3
  import {Children, isValidElement} from 'react'
5
- import type {SFSymbol} from 'sf-symbols-typescript'
6
- import type {TabsComponent, TabsProps, TabsScreenProps} from './tabs.types'
7
-
8
- const {Icon, Label, VectorIcon} = NativeTabs.Trigger
9
4
 
10
- const sfSymbol = (name: IconName) => SF_SYMBOLS[name] as SFSymbol
5
+ import type {TabsComponent, TabsProps, TabsScreenProps} from './tabs.types'
11
6
 
12
- const materialIcon = (name: IconName) => <VectorIcon family={MaterialIcons} name={MATERIAL_ICONS[name]} />
7
+ const {Icon, Label} = NativeTabs.Trigger
13
8
 
14
9
  /**
15
10
  * Declares one tab and renders nothing itself — `Tabs` reads these props and emits the trigger.
@@ -18,15 +13,24 @@ const materialIcon = (name: IconName) => <VectorIcon family={MaterialIcons} name
18
13
  */
19
14
  const TabsScreen: TabsComponent['Screen'] = () => null
20
15
 
21
- const renderTrigger = ({hidden, icon, name, selectedIcon, testID, title}: TabsScreenProps) => (
22
- <NativeTabs.Trigger hidden={hidden} key={name} name={name} testID={testID}>
23
- <Icon
24
- sf={selectedIcon ? {default: sfSymbol(icon), selected: sfSymbol(selectedIcon)} : sfSymbol(icon)}
25
- src={selectedIcon ? {default: materialIcon(icon), selected: materialIcon(selectedIcon)} : materialIcon(icon)}
26
- />
27
- <Label>{title}</Label>
28
- </NativeTabs.Trigger>
29
- )
16
+ /**
17
+ * The tab's icon, natively on both sides: the app icon's image set in the iOS asset catalog, its vector drawable on
18
+ * Android — one name, the one the config plugin gave both. No icon font, no bitmap rendered in JavaScript.
19
+ */
20
+ const renderTrigger = ({hidden, icon, name, selectedIcon, testID, title}: TabsScreenProps) => {
21
+ const asset = iconResourceName(icon)
22
+ const selected = selectedIcon ? iconResourceName(selectedIcon) : undefined
23
+
24
+ return (
25
+ <NativeTabs.Trigger hidden={hidden} key={name} name={name} testID={testID}>
26
+ <Icon
27
+ drawable={selected ? {default: asset, selected} : asset}
28
+ xcasset={selected ? {default: asset, selected} : asset}
29
+ />
30
+ <Label>{title}</Label>
31
+ </NativeTabs.Trigger>
32
+ )
33
+ }
30
34
 
31
35
  const TabsRoot = ({children, minimizeBehavior = 'never'}: TabsProps) => (
32
36
  <NativeTabs minimizeBehavior={minimizeBehavior}>
@@ -8,9 +8,10 @@ export type TabsScreenProps = {
8
8
  * at runtime remounts the navigator, so pass a build constant.
9
9
  */
10
10
  hidden?: boolean
11
+ /** One of the app's icons — the asset-catalog image on iOS, the vector drawable on Android. */
11
12
  icon: IconName
12
13
  name: string
13
- /** Swapped in while the tab is active — the filled/solid counterpart of `icon` on iOS. */
14
+ /** Swapped in while the tab is active — the filled counterpart of `icon`, say. */
14
15
  selectedIcon?: IconName
15
16
  testID?: string
16
17
  title: string