@hzblj/kara-components 0.11.0 → 0.13.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +2 -1
  3. package/lib/module/atoms/box/box.js +3 -0
  4. package/lib/module/atoms/box/box.js.map +1 -1
  5. package/lib/module/atoms/box/index.js +0 -1
  6. package/lib/module/atoms/box/index.js.map +1 -1
  7. package/lib/module/atoms/icon/icon.android.js +1 -1
  8. package/lib/module/atoms/icon/icon.android.js.map +1 -1
  9. package/lib/module/atoms/icon/icon.ios.js +1 -1
  10. package/lib/module/atoms/icon/icon.ios.js.map +1 -1
  11. package/lib/module/atoms/index.js +1 -0
  12. package/lib/module/atoms/index.js.map +1 -1
  13. package/lib/module/atoms/pressable/pressable.js +63 -16
  14. package/lib/module/atoms/pressable/pressable.js.map +1 -1
  15. package/lib/module/atoms/rn-icon/index.js +1 -1
  16. package/lib/module/atoms/rn-icon/index.js.map +1 -1
  17. package/lib/module/atoms/rn-icon/rn-icon.js +26 -0
  18. package/lib/module/atoms/rn-icon/rn-icon.js.map +1 -0
  19. package/lib/module/atoms/rn-text/rn-text.js +66 -26
  20. package/lib/module/atoms/rn-text/rn-text.js.map +1 -1
  21. package/lib/module/atoms/segmented-control/segmented-control.android.js +1 -1
  22. package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -1
  23. package/lib/module/atoms/skeleton/skeleton.js +3 -3
  24. package/lib/module/atoms/skeleton/skeleton.js.map +1 -1
  25. package/lib/module/atoms/slider/slider.android.js +1 -1
  26. package/lib/module/atoms/slider/slider.android.js.map +1 -1
  27. package/lib/module/atoms/stagger/index.js +5 -0
  28. package/lib/module/atoms/stagger/index.js.map +1 -0
  29. package/lib/module/atoms/stagger/stagger.js +102 -0
  30. package/lib/module/atoms/stagger/stagger.js.map +1 -0
  31. package/lib/module/atoms/stagger/stagger.types.js +4 -0
  32. package/lib/module/atoms/stagger/stagger.types.js.map +1 -0
  33. package/lib/module/atoms/switch/switch.android.js +1 -1
  34. package/lib/module/atoms/switch/switch.android.js.map +1 -1
  35. package/lib/module/glyph/rn-glyph.android.js +8 -3
  36. package/lib/module/glyph/rn-glyph.android.js.map +1 -1
  37. package/lib/module/index.js +0 -1
  38. package/lib/module/index.js.map +1 -1
  39. package/lib/module/molecules/navigation-bar/navigation-bar.android.js +1 -1
  40. package/lib/module/molecules/navigation-bar/navigation-bar.android.js.map +1 -1
  41. package/lib/module/molecules/navigation-bar/navigation-bar.ios.js +1 -1
  42. package/lib/module/molecules/navigation-bar/navigation-bar.ios.js.map +1 -1
  43. package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js +3 -3
  44. package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js.map +1 -1
  45. package/lib/module/organisms/context-menu/context-menu.android.js +1 -1
  46. package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
  47. package/lib/module/organisms/context-menu/context-menu.ios.js +1 -1
  48. package/lib/module/organisms/context-menu/context-menu.ios.js.map +1 -1
  49. package/lib/module/organisms/fab-menu/fab-menu.ios.js +1 -1
  50. package/lib/module/organisms/fab-menu/fab-menu.ios.js.map +1 -1
  51. package/lib/module/organisms/snackbar/snackbar.js +32 -20
  52. package/lib/module/organisms/snackbar/snackbar.js.map +1 -1
  53. package/lib/module/organisms/swipe-actions/swipe-actions.ios.js +1 -1
  54. package/lib/module/organisms/swipe-actions/swipe-actions.ios.js.map +1 -1
  55. package/lib/typescript/atoms/box/box.d.ts +3 -0
  56. package/lib/typescript/atoms/box/index.d.ts +0 -1
  57. package/lib/typescript/atoms/icon/icon.types.d.ts +6 -15
  58. package/lib/typescript/atoms/index.d.ts +1 -0
  59. package/lib/typescript/atoms/pressable/pressable.types.d.ts +5 -4
  60. package/lib/typescript/atoms/rn-icon/rn-icon.d.ts +6 -1
  61. package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +7 -4
  62. package/lib/typescript/atoms/stagger/index.d.ts +2 -0
  63. package/lib/typescript/atoms/stagger/stagger.d.ts +2 -0
  64. package/lib/typescript/atoms/stagger/stagger.types.d.ts +32 -0
  65. package/lib/typescript/index.d.ts +0 -1
  66. package/lib/typescript/organisms/snackbar/snackbar.types.d.ts +6 -8
  67. package/package.json +6 -4
  68. package/src/atoms/box/box.tsx +3 -0
  69. package/src/atoms/box/index.ts +0 -1
  70. package/src/atoms/icon/icon.android.tsx +1 -1
  71. package/src/atoms/icon/icon.ios.tsx +1 -1
  72. package/src/atoms/icon/icon.types.ts +6 -15
  73. package/src/atoms/index.ts +1 -0
  74. package/src/atoms/pressable/pressable.tsx +163 -107
  75. package/src/atoms/pressable/pressable.types.ts +5 -4
  76. package/src/atoms/rn-icon/rn-icon.tsx +28 -0
  77. package/src/atoms/rn-text/rn-text.tsx +101 -32
  78. package/src/atoms/rn-text/rn-text.types.ts +7 -3
  79. package/src/atoms/segmented-control/segmented-control.android.tsx +1 -1
  80. package/src/atoms/skeleton/skeleton.tsx +3 -3
  81. package/src/atoms/slider/slider.android.tsx +1 -1
  82. package/src/atoms/stagger/index.ts +2 -0
  83. package/src/atoms/stagger/stagger.tsx +98 -0
  84. package/src/atoms/stagger/stagger.types.ts +35 -0
  85. package/src/atoms/switch/switch.android.tsx +1 -1
  86. package/src/glyph/rn-glyph.android.tsx +14 -3
  87. package/src/index.ts +0 -1
  88. package/src/molecules/navigation-bar/navigation-bar.android.tsx +1 -1
  89. package/src/molecules/navigation-bar/navigation-bar.ios.tsx +1 -1
  90. package/src/molecules/scroll-edge-container/scroll-edge-container.android.tsx +3 -3
  91. package/src/organisms/context-menu/context-menu.android.tsx +1 -1
  92. package/src/organisms/context-menu/context-menu.ios.tsx +1 -1
  93. package/src/organisms/fab-menu/fab-menu.ios.tsx +1 -1
  94. package/src/organisms/snackbar/snackbar.tsx +20 -40
  95. package/src/organisms/snackbar/snackbar.types.ts +6 -8
  96. package/src/organisms/swipe-actions/swipe-actions.ios.tsx +1 -1
  97. package/lib/module/atoms/box/a-box.js +0 -6
  98. package/lib/module/atoms/box/a-box.js.map +0 -1
  99. package/lib/module/atoms/rn-icon/rn-icon.android.js +0 -29
  100. package/lib/module/atoms/rn-icon/rn-icon.android.js.map +0 -1
  101. package/lib/module/atoms/rn-icon/rn-icon.ios.js +0 -29
  102. package/lib/module/atoms/rn-icon/rn-icon.ios.js.map +0 -1
  103. package/lib/module/haptics/haptics.js +0 -56
  104. package/lib/module/haptics/haptics.js.map +0 -1
  105. package/lib/module/haptics/index.js +0 -5
  106. package/lib/module/haptics/index.js.map +0 -1
  107. package/lib/module/haptics/use-haptic-feedback.js +0 -33
  108. package/lib/module/haptics/use-haptic-feedback.js.map +0 -1
  109. package/lib/module/motion.js +0 -19
  110. package/lib/module/motion.js.map +0 -1
  111. package/lib/typescript/atoms/box/a-box.d.ts +0 -49
  112. package/lib/typescript/atoms/rn-icon/rn-icon.ios.d.ts +0 -3
  113. package/lib/typescript/haptics/haptics.d.ts +0 -61
  114. package/lib/typescript/haptics/index.d.ts +0 -2
  115. package/lib/typescript/haptics/use-haptic-feedback.d.ts +0 -15
  116. package/lib/typescript/motion.d.ts +0 -8
  117. package/src/atoms/box/a-box.ts +0 -5
  118. package/src/atoms/rn-icon/rn-icon.android.tsx +0 -28
  119. package/src/atoms/rn-icon/rn-icon.ios.tsx +0 -28
  120. package/src/haptics/haptics.ts +0 -68
  121. package/src/haptics/index.ts +0 -2
  122. package/src/haptics/use-haptic-feedback.ts +0 -36
  123. package/src/motion.ts +0 -13
@@ -1 +0,0 @@
1
- {"version":3,"names":["iconResourceName","IconView","spacing","useAppTheme","useMemo","jsx","_jsx","RnIcon","accessibilityLabel","color","name","size","testID","theme","style","height","width","iconColor","resourceName"],"sourceRoot":"../../../../src","sources":["atoms/rn-icon/rn-icon.android.tsx"],"mappings":";;AAAA,SAAQA,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,QAAQ,QAAO,oCAAoC;AAC3D,SAAQC,OAAO,EAAEC,WAAW,QAAO,mBAAmB;AACtD,SAAQC,OAAO,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAI7B;AACA,OAAO,MAAMC,MAAuB,GAAGA,CAAC;EACtCC,kBAAkB;EAClBC,KAAK,GAAG,iBAAiB;EACzBC,IAAI;EACJC,IAAI,GAAG,KAAK;EACZC;AACW,CAAC,KAAK;EACjB,MAAMC,KAAK,GAAGV,WAAW,CAAC,CAAC;EAC3B,MAAMW,KAAK,GAAGV,OAAO,CAAC,OAAO;IAACW,MAAM,EAAEb,OAAO,CAACS,IAAI,CAAC;IAAEK,KAAK,EAAEd,OAAO,CAACS,IAAI;EAAC,CAAC,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAEpF,oBACEL,IAAA,CAACL,QAAQ;IACPO,kBAAkB,EAAEA,kBAAmB;IACvCS,SAAS,EAAEJ,KAAK,CAACJ,KAAK,CAACA,KAAK,CAAE;IAC9BS,YAAY,EAAElB,gBAAgB,CAACU,IAAI,CAAE;IACrCI,KAAK,EAAEA,KAAM;IACbF,MAAM,EAAEA;EAAO,CAChB,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- import { iconResourceName } from '@hzblj/kara-native';
4
- import { IconView } from '@hzblj/kara-native/swift-ui';
5
- import { spacing, useAppTheme } from '@hzblj/kara-theme';
6
- import { useMemo } from 'react';
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- /** A `UIImageView` over the app's asset-catalog icon — what a list row wants, rather than a SwiftUI host per row. */
9
- export const RnIcon = ({
10
- accessibilityLabel,
11
- color = 'content.primary',
12
- name,
13
- size = 's24',
14
- testID
15
- }) => {
16
- const theme = useAppTheme();
17
- const style = useMemo(() => ({
18
- height: spacing[size],
19
- width: spacing[size]
20
- }), [size]);
21
- return /*#__PURE__*/_jsx(IconView, {
22
- accessibilityLabel: accessibilityLabel,
23
- assetName: iconResourceName(name),
24
- iconColor: theme.color(color),
25
- style: style,
26
- testID: testID
27
- });
28
- };
29
- //# sourceMappingURL=rn-icon.ios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["iconResourceName","IconView","spacing","useAppTheme","useMemo","jsx","_jsx","RnIcon","accessibilityLabel","color","name","size","testID","theme","style","height","width","assetName","iconColor"],"sourceRoot":"../../../../src","sources":["atoms/rn-icon/rn-icon.ios.tsx"],"mappings":";;AAAA,SAAQA,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,QAAQ,QAAO,6BAA6B;AACpD,SAAQC,OAAO,EAAEC,WAAW,QAAO,mBAAmB;AACtD,SAAQC,OAAO,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAI7B;AACA,OAAO,MAAMC,MAAuB,GAAGA,CAAC;EACtCC,kBAAkB;EAClBC,KAAK,GAAG,iBAAiB;EACzBC,IAAI;EACJC,IAAI,GAAG,KAAK;EACZC;AACW,CAAC,KAAK;EACjB,MAAMC,KAAK,GAAGV,WAAW,CAAC,CAAC;EAC3B,MAAMW,KAAK,GAAGV,OAAO,CAAC,OAAO;IAACW,MAAM,EAAEb,OAAO,CAACS,IAAI,CAAC;IAAEK,KAAK,EAAEd,OAAO,CAACS,IAAI;EAAC,CAAC,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAEpF,oBACEL,IAAA,CAACL,QAAQ;IACPO,kBAAkB,EAAEA,kBAAmB;IACvCS,SAAS,EAAEjB,gBAAgB,CAACU,IAAI,CAAE;IAClCQ,SAAS,EAAEL,KAAK,CAACJ,KAAK,CAACA,KAAK,CAAE;IAC9BK,KAAK,EAAEA,KAAM;IACbF,MAAM,EAAEA;EAAO,CAChB,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- import { HAPTICS, playHaptic, prepareHaptic } from '@hzblj/kara-native';
4
- let enabled = true;
5
- const play = (haptic, options) => {
6
- if (enabled) {
7
- playHaptic(haptic, options?.intensity);
8
- }
9
- };
10
- const prepare = haptic => {
11
- if (enabled) {
12
- prepareHaptic(haptic);
13
- }
14
- };
15
- const shorthands = Object.fromEntries(HAPTICS.map(haptic => [haptic, options => play(haptic, options)]));
16
-
17
- /**
18
- * The platform's own haptic feedback, named for what happened: UIKit's feedback generators on iOS, the system's
19
- * `HapticFeedbackConstants` on Android — never a raw vibration. Both follow the user's system haptics setting, and
20
- * every call is synchronous, with nothing to await.
21
- *
22
- * ```ts
23
- * haptics.success() // a name you know: one function per haptic
24
- * haptics.play(haptic) // a name that arrives as data
25
- * haptics.light({intensity: 0.6}) // impacts scale on iOS
26
- * haptics.prepare('selection') // iOS: warm the Taptic Engine as a gesture begins
27
- * haptics.setEnabled(userPreference) // silences every kara haptic, the components' own too
28
- * ```
29
- *
30
- * - `selection` — a choice changed: a segment, a chip, a picker row.
31
- * - `tick` — one step of a continuous gesture: a slider detent, a scrubbed value.
32
- * - `toggleOn` / `toggleOff` — a switch flipped.
33
- * - `success` / `warning` / `error` — how a task ended. Android has no warning of its own; it plays a rejection.
34
- * - `longPress` / `dragStart` — a long press was recognised; an item lifted to be dragged.
35
- * - `thresholdActivate` / `thresholdDeactivate` — a gesture crossed its commit point, or went back over it.
36
- * - `keyPress` — a key of the app's own keypad.
37
- * - `soft`, `light`, `medium`, `rigid`, `heavy` — a collision none of the names above describes.
38
- *
39
- * On Android the names that came with Android 14's constants fall back to the nearest older feedback, so every name
40
- * plays on every version. Haptics are silent in a build without kara's native module.
41
- */
42
- export const haptics = {
43
- ...shorthands,
44
- /** Whether kara plays haptics — `true` until `setEnabled(false)`. */
45
- isEnabled: () => enabled,
46
- play,
47
- prepare,
48
- /**
49
- * Switches every kara haptic on or off, the ones its components play included — for an app's own "Haptics" setting.
50
- * Not persisted: call it at start-up with the stored preference. The system setting applies either way.
51
- */
52
- setEnabled: value => {
53
- enabled = value;
54
- }
55
- };
56
- //# sourceMappingURL=haptics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["HAPTICS","playHaptic","prepareHaptic","enabled","play","haptic","options","intensity","prepare","shorthands","Object","fromEntries","map","haptics","isEnabled","setEnabled","value"],"sourceRoot":"../../../src","sources":["haptics/haptics.ts"],"mappings":";;AAAA,SAAQA,OAAO,EAAeC,UAAU,EAAEC,aAAa,QAAO,oBAAoB;AAWlF,IAAIC,OAAO,GAAG,IAAI;AAElB,MAAMC,IAAI,GAAGA,CAACC,MAAc,EAAEC,OAAuB,KAAW;EAC9D,IAAIH,OAAO,EAAE;IACXF,UAAU,CAACI,MAAM,EAAEC,OAAO,EAAEC,SAAS,CAAC;EACxC;AACF,CAAC;AAED,MAAMC,OAAO,GAAIH,MAAc,IAAW;EACxC,IAAIF,OAAO,EAAE;IACXD,aAAa,CAACG,MAAM,CAAC;EACvB;AACF,CAAC;AAED,MAAMI,UAAU,GAAGC,MAAM,CAACC,WAAW,CACnCX,OAAO,CAACY,GAAG,CAACP,MAAM,IAAI,CAACA,MAAM,EAAGC,OAAuB,IAAKF,IAAI,CAACC,MAAM,EAAEC,OAAO,CAAC,CAAC,CACpF,CAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,OAAO,GAAG;EACrB,GAAGJ,UAAU;EACb;EACAK,SAAS,EAAEA,CAAA,KAAeX,OAAO;EACjCC,IAAI;EACJI,OAAO;EACP;AACF;AACA;AACA;EACEO,UAAU,EAAGC,KAAc,IAAW;IACpCb,OAAO,GAAGa,KAAK;EACjB;AACF,CAAC","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- export { haptics } from "./haptics.js";
4
- export { useHapticFeedback } from "./use-haptic-feedback.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["haptics","useHapticFeedback"],"sourceRoot":"../../../src","sources":["haptics/index.ts"],"mappings":";;AAAA,SAAyCA,OAAO,QAAO,cAAW;AAClE,SAA6BC,iBAAiB,QAAO,0BAAuB","ignoreList":[]}
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect, useRef } from 'react';
4
- import { haptics } from "./haptics.js";
5
-
6
- /** Picks the haptic for one change of a trigger — or none, to stay silent for that change. */
7
-
8
- /**
9
- * Plays a haptic whenever `trigger` changes — never on mount — like SwiftUI's `sensoryFeedback(_:trigger:)`. Give it
10
- * a haptic, or a function of the previous and next value that picks one per change. Changes are compared with
11
- * `Object.is`, so a trigger is a primitive or a stable reference.
12
- *
13
- * ```ts
14
- * useHapticFeedback(tab, 'selection')
15
- * useHapticFeedback(quantity, (before, after) => (after > before ? 'tick' : 'soft'))
16
- * useHapticFeedback(payment.status, (_, status) => status === 'paid' ? 'success' : status === 'failed' && 'error')
17
- * ```
18
- */
19
- export const useHapticFeedback = (trigger, feedback) => {
20
- const previous = useRef(trigger);
21
- useEffect(() => {
22
- const before = previous.current;
23
- if (Object.is(before, trigger)) {
24
- return;
25
- }
26
- previous.current = trigger;
27
- const haptic = typeof feedback === 'function' ? feedback(before, trigger) : feedback;
28
- if (haptic) {
29
- haptics.play(haptic);
30
- }
31
- }, [feedback, trigger]);
32
- };
33
- //# sourceMappingURL=use-haptic-feedback.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useRef","haptics","useHapticFeedback","trigger","feedback","previous","before","current","Object","is","haptic","play"],"sourceRoot":"../../../src","sources":["haptics/use-haptic-feedback.ts"],"mappings":";;AAAA,SAAQA,SAAS,EAAEC,MAAM,QAAO,OAAO;AAEvC,SAAqBC,OAAO,QAAO,cAAW;;AAE9C;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGA,CAAIC,OAAU,EAAEC,QAAoC,KAAW;EAC9F,MAAMC,QAAQ,GAAGL,MAAM,CAACG,OAAO,CAAC;EAEhCJ,SAAS,CAAC,MAAM;IACd,MAAMO,MAAM,GAAGD,QAAQ,CAACE,OAAO;IAE/B,IAAIC,MAAM,CAACC,EAAE,CAACH,MAAM,EAAEH,OAAO,CAAC,EAAE;MAC9B;IACF;IAEAE,QAAQ,CAACE,OAAO,GAAGJ,OAAO;IAC1B,MAAMO,MAAM,GAAG,OAAON,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACE,MAAM,EAAEH,OAAO,CAAC,GAAGC,QAAQ;IAEpF,IAAIM,MAAM,EAAE;MACVT,OAAO,CAACU,IAAI,CAACD,MAAM,CAAC;IACtB;EACF,CAAC,EAAE,CAACN,QAAQ,EAAED,OAAO,CAAC,CAAC;AACzB,CAAC","ignoreList":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- import { duration, easing } from '@hzblj/kara-theme';
4
- import { Easing, ReduceMotion } from 'react-native-reanimated';
5
-
6
- /**
7
- * A Reanimated timing from the motion tokens, `smoothOut` unless told otherwise. `ReduceMotion.Never`, because a
8
- * component has applied `useReducedMotion` before it animates: what is left (a fade, a dim) is meant to run, and
9
- * Reanimated's own check reads the setting once at launch and never hears of `KaraProvider reduceMotion`.
10
- */
11
- export const timing = (size, curve = 'smoothOut') => {
12
- const [x1, y1, x2, y2] = easing[curve];
13
- return {
14
- duration: duration[size],
15
- easing: Easing.bezier(x1, y1, x2, y2),
16
- reduceMotion: ReduceMotion.Never
17
- };
18
- };
19
- //# sourceMappingURL=motion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["duration","easing","Easing","ReduceMotion","timing","size","curve","x1","y1","x2","y2","bezier","reduceMotion","Never"],"sourceRoot":"../../src","sources":["motion.ts"],"mappings":";;AAAA,SAA2BA,QAAQ,EAAmBC,MAAM,QAAO,mBAAmB;AACtF,SAAQC,MAAM,EAAEC,YAAY,QAA8B,yBAAyB;;AAEnF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,GAAGA,CAACC,IAAkB,EAAEC,KAAiB,GAAG,WAAW,KAAuB;EAC/F,MAAM,CAACC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,EAAE,CAAC,GAAGT,MAAM,CAACK,KAAK,CAAC;EAEtC,OAAO;IAACN,QAAQ,EAAEA,QAAQ,CAACK,IAAI,CAAC;IAAEJ,MAAM,EAAEC,MAAM,CAACS,MAAM,CAACJ,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,EAAE,CAAC;IAAEE,YAAY,EAAET,YAAY,CAACU;EAAK,CAAC;AAC5G,CAAC","ignoreList":[]}
@@ -1,49 +0,0 @@
1
- export declare const ABox: import("react-native-reanimated/lib/typescript/createAnimatedComponent").AnimatedComponentType<Readonly<Omit<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>, "align" | "alignContent" | "alignSelf" | "aspectRatio" | "basis" | "bg" | "blur" | "borderColor" | "borderRadius" | "borderWidth" | "bottom" | "columnGap" | "display" | "flex" | "flexDirection" | "gap" | "grow" | "h" | "inset" | "justify" | "left" | "m" | "maxH" | "maxW" | "mb" | "minH" | "minW" | "ml" | "mr" | "mt" | "mx" | "my" | "offsetX" | "offsetY" | "opacity" | "overflow" | "p" | "pb" | "pl" | "position" | "pr" | "pt" | "px" | "py" | "right" | "rotate" | "rowGap" | "scale" | "shadow" | "shrink" | "style" | "tall" | "top" | "w" | "wide" | "wrap" | "zIndex" | keyof {
2
- borderBottomWidth?: number;
3
- borderLeftWidth?: number;
4
- borderRightWidth?: number;
5
- borderStyle?: import("react-native").ViewStyle['borderStyle'];
6
- borderTopWidth?: number;
7
- } | keyof import("@hzblj/kara-sx").ViewRadiiSx> & Omit<import("@hzblj/kara-sx").ViewSx, "align" | "alignContent" | "alignSelf" | "basis" | "columnGap" | "display" | "flex" | "flexDirection" | "gap" | "grow" | "h" | "justify" | "m" | "maxH" | "maxW" | "mb" | "minH" | "minW" | "ml" | "mr" | "mt" | "mx" | "my" | "p" | "pb" | "pl" | "pr" | "pt" | "px" | "py" | "rowGap" | "shrink" | "tall" | "w" | "wide" | "wrap"> & {
8
- p?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
9
- pb?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
10
- pl?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
11
- pr?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
12
- pt?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
13
- px?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
14
- py?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
15
- tall?: import("@hzblj/kara-sx").Responsive<NonNullable<boolean | undefined>> | undefined;
16
- wide?: import("@hzblj/kara-sx").Responsive<NonNullable<boolean | undefined>> | undefined;
17
- h?: import("@hzblj/kara-sx").Responsive<NonNullable<import("@hzblj/kara-sx").SxDimension | undefined>> | undefined;
18
- minH?: import("@hzblj/kara-sx").Responsive<NonNullable<import("@hzblj/kara-sx").SxDimension | undefined>> | undefined;
19
- minW?: import("@hzblj/kara-sx").Responsive<NonNullable<import("@hzblj/kara-sx").SxDimension | undefined>> | undefined;
20
- w?: import("@hzblj/kara-sx").Responsive<NonNullable<import("@hzblj/kara-sx").SxDimension | undefined>> | undefined;
21
- maxH?: import("@hzblj/kara-sx").Responsive<NonNullable<import("@hzblj/kara-sx").SxDimension | undefined>> | undefined;
22
- maxW?: import("@hzblj/kara-sx").Responsive<NonNullable<import("@hzblj/kara-sx").SxDimension | undefined>> | undefined;
23
- align?: import("@hzblj/kara-sx").Responsive<NonNullable<import("react-native").FlexAlignType | undefined>> | undefined;
24
- alignContent?: import("@hzblj/kara-sx").Responsive<NonNullable<"center" | "flex-end" | "flex-start" | "space-around" | "space-between" | "space-evenly" | "stretch" | undefined>> | undefined;
25
- alignSelf?: import("@hzblj/kara-sx").Responsive<NonNullable<"auto" | import("react-native").FlexAlignType | undefined>> | undefined;
26
- basis?: import("@hzblj/kara-sx").Responsive<NonNullable<import("@hzblj/kara-sx").SxDimension | undefined>> | undefined;
27
- columnGap?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
28
- flex?: import("@hzblj/kara-sx").Responsive<number> | undefined;
29
- flexDirection?: import("@hzblj/kara-sx").Responsive<NonNullable<"column" | "column-reverse" | "row" | "row-reverse" | undefined>> | undefined;
30
- gap?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
31
- grow?: import("@hzblj/kara-sx").Responsive<number> | undefined;
32
- justify?: import("@hzblj/kara-sx").Responsive<NonNullable<"center" | "flex-end" | "flex-start" | "space-around" | "space-between" | "space-evenly" | undefined>> | undefined;
33
- rowGap?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
34
- shrink?: import("@hzblj/kara-sx").Responsive<number> | undefined;
35
- wrap?: import("@hzblj/kara-sx").Responsive<NonNullable<"nowrap" | "wrap" | "wrap-reverse" | undefined>> | undefined;
36
- m?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
37
- mb?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
38
- ml?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
39
- mr?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
40
- mt?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
41
- mx?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
42
- my?: import("@hzblj/kara-sx").Responsive<NonNullable<"s0" | "s1" | "s10" | "s12" | "s16" | "s2" | "s20" | "s24" | "s28" | "s32" | "s36" | "s4" | "s40" | "s48" | "s56" | "s6" | "s64" | "s72" | "s8" | "s80" | "s96" | undefined>> | undefined;
43
- display?: import("@hzblj/kara-sx").Responsive<NonNullable<"contents" | "flex" | "none" | undefined>> | undefined;
44
- } & {
45
- style?: import("react-native").RecursiveArray<import("react-native").TextStyle | import("react-native").ViewStyle | import("react-native").Falsy> | import("react-native").TextStyle | import("react-native").ViewStyle | import("react-native").Falsy;
46
- }>, import("react").MemoExoticComponent<{
47
- ({ style, ...props }: import("@hzblj/kara-sx").SxProps<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>>): import("react").JSX.Element;
48
- displayName: string;
49
- }>>;
@@ -1,3 +0,0 @@
1
- import type { RnIconComponent } from './rn-icon.types';
2
- /** A `UIImageView` over the app's asset-catalog icon — what a list row wants, rather than a SwiftUI host per row. */
3
- export declare const RnIcon: RnIconComponent;
@@ -1,61 +0,0 @@
1
- import { type Haptic } from '@hzblj/kara-native';
2
- export type { Haptic };
3
- export type HapticOptions = {
4
- /** iOS: scales an impact — `soft`, `light`, `medium`, `rigid`, `heavy` — from 0 to 1. Everything else ignores it. */
5
- intensity?: number;
6
- };
7
- declare const play: (haptic: Haptic, options?: HapticOptions) => void;
8
- declare const prepare: (haptic: Haptic) => void;
9
- /**
10
- * The platform's own haptic feedback, named for what happened: UIKit's feedback generators on iOS, the system's
11
- * `HapticFeedbackConstants` on Android — never a raw vibration. Both follow the user's system haptics setting, and
12
- * every call is synchronous, with nothing to await.
13
- *
14
- * ```ts
15
- * haptics.success() // a name you know: one function per haptic
16
- * haptics.play(haptic) // a name that arrives as data
17
- * haptics.light({intensity: 0.6}) // impacts scale on iOS
18
- * haptics.prepare('selection') // iOS: warm the Taptic Engine as a gesture begins
19
- * haptics.setEnabled(userPreference) // silences every kara haptic, the components' own too
20
- * ```
21
- *
22
- * - `selection` — a choice changed: a segment, a chip, a picker row.
23
- * - `tick` — one step of a continuous gesture: a slider detent, a scrubbed value.
24
- * - `toggleOn` / `toggleOff` — a switch flipped.
25
- * - `success` / `warning` / `error` — how a task ended. Android has no warning of its own; it plays a rejection.
26
- * - `longPress` / `dragStart` — a long press was recognised; an item lifted to be dragged.
27
- * - `thresholdActivate` / `thresholdDeactivate` — a gesture crossed its commit point, or went back over it.
28
- * - `keyPress` — a key of the app's own keypad.
29
- * - `soft`, `light`, `medium`, `rigid`, `heavy` — a collision none of the names above describes.
30
- *
31
- * On Android the names that came with Android 14's constants fall back to the nearest older feedback, so every name
32
- * plays on every version. Haptics are silent in a build without kara's native module.
33
- */
34
- export declare const haptics: {
35
- /** Whether kara plays haptics — `true` until `setEnabled(false)`. */
36
- isEnabled: () => boolean;
37
- play: typeof play;
38
- prepare: typeof prepare;
39
- /**
40
- * Switches every kara haptic on or off, the ones its components play included — for an app's own "Haptics" setting.
41
- * Not persisted: call it at start-up with the stored preference. The system setting applies either way.
42
- */
43
- setEnabled: (value: boolean) => void;
44
- dragStart: (options?: HapticOptions) => void;
45
- error: (options?: HapticOptions) => void;
46
- heavy: (options?: HapticOptions) => void;
47
- keyPress: (options?: HapticOptions) => void;
48
- light: (options?: HapticOptions) => void;
49
- longPress: (options?: HapticOptions) => void;
50
- medium: (options?: HapticOptions) => void;
51
- rigid: (options?: HapticOptions) => void;
52
- selection: (options?: HapticOptions) => void;
53
- soft: (options?: HapticOptions) => void;
54
- success: (options?: HapticOptions) => void;
55
- thresholdActivate: (options?: HapticOptions) => void;
56
- thresholdDeactivate: (options?: HapticOptions) => void;
57
- tick: (options?: HapticOptions) => void;
58
- toggleOff: (options?: HapticOptions) => void;
59
- toggleOn: (options?: HapticOptions) => void;
60
- warning: (options?: HapticOptions) => void;
61
- };
@@ -1,2 +0,0 @@
1
- export { type Haptic, type HapticOptions, haptics } from './haptics';
2
- export { type HapticResolver, useHapticFeedback } from './use-haptic-feedback';
@@ -1,15 +0,0 @@
1
- import { type Haptic } from './haptics';
2
- /** Picks the haptic for one change of a trigger — or none, to stay silent for that change. */
3
- export type HapticResolver<T> = (previous: T, next: T) => Haptic | false | null | undefined;
4
- /**
5
- * Plays a haptic whenever `trigger` changes — never on mount — like SwiftUI's `sensoryFeedback(_:trigger:)`. Give it
6
- * a haptic, or a function of the previous and next value that picks one per change. Changes are compared with
7
- * `Object.is`, so a trigger is a primitive or a stable reference.
8
- *
9
- * ```ts
10
- * useHapticFeedback(tab, 'selection')
11
- * useHapticFeedback(quantity, (before, after) => (after > before ? 'tick' : 'soft'))
12
- * useHapticFeedback(payment.status, (_, status) => status === 'paid' ? 'success' : status === 'failed' && 'error')
13
- * ```
14
- */
15
- export declare const useHapticFeedback: <T>(trigger: T, feedback: Haptic | HapticResolver<T>) => void;
@@ -1,8 +0,0 @@
1
- import { type DurationSize, type EasingName } from '@hzblj/kara-theme';
2
- import { type WithTimingConfig } from 'react-native-reanimated';
3
- /**
4
- * A Reanimated timing from the motion tokens, `smoothOut` unless told otherwise. `ReduceMotion.Never`, because a
5
- * component has applied `useReducedMotion` before it animates: what is left (a fade, a dim) is meant to run, and
6
- * Reanimated's own check reads the setting once at launch and never hears of `KaraProvider reduceMotion`.
7
- */
8
- export declare const timing: (size: DurationSize, curve?: EasingName) => WithTimingConfig;
@@ -1,5 +0,0 @@
1
- import Animated from 'react-native-reanimated'
2
-
3
- import {Box} from './box'
4
-
5
- export const ABox = Animated.createAnimatedComponent(Box)
@@ -1,28 +0,0 @@
1
- import {iconResourceName} from '@hzblj/kara-native'
2
- import {IconView} from '@hzblj/kara-native/jetpack-compose'
3
- import {spacing, useAppTheme} from '@hzblj/kara-theme'
4
- import {useMemo} from 'react'
5
-
6
- import type {RnIconComponent, RnIconProps} from './rn-icon.types'
7
-
8
- /** An `ImageView` over the app's vector drawable — what a list row wants, rather than a Compose host per row. */
9
- export const RnIcon: RnIconComponent = ({
10
- accessibilityLabel,
11
- color = 'content.primary',
12
- name,
13
- size = 's24',
14
- testID,
15
- }: RnIconProps) => {
16
- const theme = useAppTheme()
17
- const style = useMemo(() => ({height: spacing[size], width: spacing[size]}), [size])
18
-
19
- return (
20
- <IconView
21
- accessibilityLabel={accessibilityLabel}
22
- iconColor={theme.color(color)}
23
- resourceName={iconResourceName(name)}
24
- style={style}
25
- testID={testID}
26
- />
27
- )
28
- }
@@ -1,28 +0,0 @@
1
- import {iconResourceName} from '@hzblj/kara-native'
2
- import {IconView} from '@hzblj/kara-native/swift-ui'
3
- import {spacing, useAppTheme} from '@hzblj/kara-theme'
4
- import {useMemo} from 'react'
5
-
6
- import type {RnIconComponent, RnIconProps} from './rn-icon.types'
7
-
8
- /** A `UIImageView` over the app's asset-catalog icon — what a list row wants, rather than a SwiftUI host per row. */
9
- export const RnIcon: RnIconComponent = ({
10
- accessibilityLabel,
11
- color = 'content.primary',
12
- name,
13
- size = 's24',
14
- testID,
15
- }: RnIconProps) => {
16
- const theme = useAppTheme()
17
- const style = useMemo(() => ({height: spacing[size], width: spacing[size]}), [size])
18
-
19
- return (
20
- <IconView
21
- accessibilityLabel={accessibilityLabel}
22
- assetName={iconResourceName(name)}
23
- iconColor={theme.color(color)}
24
- style={style}
25
- testID={testID}
26
- />
27
- )
28
- }
@@ -1,68 +0,0 @@
1
- import {HAPTICS, type Haptic, playHaptic, prepareHaptic} from '@hzblj/kara-native'
2
-
3
- export type {Haptic}
4
-
5
- export type HapticOptions = {
6
- /** iOS: scales an impact — `soft`, `light`, `medium`, `rigid`, `heavy` — from 0 to 1. Everything else ignores it. */
7
- intensity?: number
8
- }
9
-
10
- type HapticShorthands = {readonly [K in Haptic]: (options?: HapticOptions) => void}
11
-
12
- let enabled = true
13
-
14
- const play = (haptic: Haptic, options?: HapticOptions): void => {
15
- if (enabled) {
16
- playHaptic(haptic, options?.intensity)
17
- }
18
- }
19
-
20
- const prepare = (haptic: Haptic): void => {
21
- if (enabled) {
22
- prepareHaptic(haptic)
23
- }
24
- }
25
-
26
- const shorthands = Object.fromEntries(
27
- HAPTICS.map(haptic => [haptic, (options?: HapticOptions) => play(haptic, options)])
28
- ) as HapticShorthands
29
-
30
- /**
31
- * The platform's own haptic feedback, named for what happened: UIKit's feedback generators on iOS, the system's
32
- * `HapticFeedbackConstants` on Android — never a raw vibration. Both follow the user's system haptics setting, and
33
- * every call is synchronous, with nothing to await.
34
- *
35
- * ```ts
36
- * haptics.success() // a name you know: one function per haptic
37
- * haptics.play(haptic) // a name that arrives as data
38
- * haptics.light({intensity: 0.6}) // impacts scale on iOS
39
- * haptics.prepare('selection') // iOS: warm the Taptic Engine as a gesture begins
40
- * haptics.setEnabled(userPreference) // silences every kara haptic, the components' own too
41
- * ```
42
- *
43
- * - `selection` — a choice changed: a segment, a chip, a picker row.
44
- * - `tick` — one step of a continuous gesture: a slider detent, a scrubbed value.
45
- * - `toggleOn` / `toggleOff` — a switch flipped.
46
- * - `success` / `warning` / `error` — how a task ended. Android has no warning of its own; it plays a rejection.
47
- * - `longPress` / `dragStart` — a long press was recognised; an item lifted to be dragged.
48
- * - `thresholdActivate` / `thresholdDeactivate` — a gesture crossed its commit point, or went back over it.
49
- * - `keyPress` — a key of the app's own keypad.
50
- * - `soft`, `light`, `medium`, `rigid`, `heavy` — a collision none of the names above describes.
51
- *
52
- * On Android the names that came with Android 14's constants fall back to the nearest older feedback, so every name
53
- * plays on every version. Haptics are silent in a build without kara's native module.
54
- */
55
- export const haptics = {
56
- ...shorthands,
57
- /** Whether kara plays haptics — `true` until `setEnabled(false)`. */
58
- isEnabled: (): boolean => enabled,
59
- play,
60
- prepare,
61
- /**
62
- * Switches every kara haptic on or off, the ones its components play included — for an app's own "Haptics" setting.
63
- * Not persisted: call it at start-up with the stored preference. The system setting applies either way.
64
- */
65
- setEnabled: (value: boolean): void => {
66
- enabled = value
67
- },
68
- }
@@ -1,2 +0,0 @@
1
- export {type Haptic, type HapticOptions, haptics} from './haptics'
2
- export {type HapticResolver, useHapticFeedback} from './use-haptic-feedback'
@@ -1,36 +0,0 @@
1
- import {useEffect, useRef} from 'react'
2
-
3
- import {type Haptic, haptics} from './haptics'
4
-
5
- /** Picks the haptic for one change of a trigger — or none, to stay silent for that change. */
6
- export type HapticResolver<T> = (previous: T, next: T) => Haptic | false | null | undefined
7
-
8
- /**
9
- * Plays a haptic whenever `trigger` changes — never on mount — like SwiftUI's `sensoryFeedback(_:trigger:)`. Give it
10
- * a haptic, or a function of the previous and next value that picks one per change. Changes are compared with
11
- * `Object.is`, so a trigger is a primitive or a stable reference.
12
- *
13
- * ```ts
14
- * useHapticFeedback(tab, 'selection')
15
- * useHapticFeedback(quantity, (before, after) => (after > before ? 'tick' : 'soft'))
16
- * useHapticFeedback(payment.status, (_, status) => status === 'paid' ? 'success' : status === 'failed' && 'error')
17
- * ```
18
- */
19
- export const useHapticFeedback = <T>(trigger: T, feedback: Haptic | HapticResolver<T>): void => {
20
- const previous = useRef(trigger)
21
-
22
- useEffect(() => {
23
- const before = previous.current
24
-
25
- if (Object.is(before, trigger)) {
26
- return
27
- }
28
-
29
- previous.current = trigger
30
- const haptic = typeof feedback === 'function' ? feedback(before, trigger) : feedback
31
-
32
- if (haptic) {
33
- haptics.play(haptic)
34
- }
35
- }, [feedback, trigger])
36
- }
package/src/motion.ts DELETED
@@ -1,13 +0,0 @@
1
- import {type DurationSize, duration, type EasingName, easing} from '@hzblj/kara-theme'
2
- import {Easing, ReduceMotion, type WithTimingConfig} from 'react-native-reanimated'
3
-
4
- /**
5
- * A Reanimated timing from the motion tokens, `smoothOut` unless told otherwise. `ReduceMotion.Never`, because a
6
- * component has applied `useReducedMotion` before it animates: what is left (a fade, a dim) is meant to run, and
7
- * Reanimated's own check reads the setting once at launch and never hears of `KaraProvider reduceMotion`.
8
- */
9
- export const timing = (size: DurationSize, curve: EasingName = 'smoothOut'): WithTimingConfig => {
10
- const [x1, y1, x2, y2] = easing[curve]
11
-
12
- return {duration: duration[size], easing: Easing.bezier(x1, y1, x2, y2), reduceMotion: ReduceMotion.Never}
13
- }