@kbach/react-native 1.0.0-beta.43 → 1.0.0-beta.45
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/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
- package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
- package/dist/chunk-DKZM4NUU.mjs +564 -0
- package/dist/{chunk-45OSRKPS.mjs → chunk-KT6TQLWI.mjs} +1 -1
- package/dist/{chunk-ZURXKRQE.mjs → chunk-UFSVFF3V.mjs} +1 -1
- package/dist/index.d.ts +86 -0
- package/dist/index.js +24 -4
- package/dist/index.web.d.ts +86 -0
- package/dist/index.web.js +1 -1
- package/dist/index.web.mjs +2 -2
- package/dist/jsx-dev-runtime.js +24 -4
- package/dist/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.js +24 -4
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-BTIGG7K2.mjs +0 -564
package/dist/index.d.ts
CHANGED
|
@@ -14,3 +14,89 @@ interface StyleObject {
|
|
|
14
14
|
declare function resolveStyle(classString: string, pressed?: boolean): StyleObject;
|
|
15
15
|
|
|
16
16
|
export { type StyleObject, resolveStyle };
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Ambient module augmentation adding `className?: string` to React
|
|
20
|
+
* Native's own component prop types — without this, `<View
|
|
21
|
+
* className="...">` type-checks fine at RUNTIME (the babel plugin/
|
|
22
|
+
* jsx-runtime accept `className` on ANY host element regardless of its
|
|
23
|
+
* declared prop type — see jsxRuntimeCore.ts's own `processElement` doc
|
|
24
|
+
* comment) but fails `tsc`/editor type-checking, since `ViewProps`/
|
|
25
|
+
* `TextProps`/etc. (react-native's own types) have no `className` field at
|
|
26
|
+
* all. Confirmed as a real, reported gap: nothing in this package shipped
|
|
27
|
+
* this augmentation before, so a React Native CLI project running `tsc`
|
|
28
|
+
* (or just seeing red squiggles in-editor) hit "Property 'className' does
|
|
29
|
+
* not exist on type ... ViewProps ..." on every styled element.
|
|
30
|
+
*
|
|
31
|
+
* A plain `.d.ts` file has no effect on its own unless something actually
|
|
32
|
+
* pulls it into a consumer's type-checking. A side-effect `import
|
|
33
|
+
* './rnClassNameTypes'` from index.ts was the first thing tried here, but
|
|
34
|
+
* tsup's dts rollup (rollup-plugin-dts) tree-shakes a side-effect-only
|
|
35
|
+
* import with nothing it can trace a type reference through — confirmed by
|
|
36
|
+
* hand that this wasn't even consistent (survived one build, silently
|
|
37
|
+
* vanished from an immediately-following clean rebuild of the identical
|
|
38
|
+
* source). `scripts/append-classname-types.mjs` appends this file's own
|
|
39
|
+
* text onto the end of the built `dist/index.d.ts`/`dist/index.web.d.ts`
|
|
40
|
+
* directly as a deterministic post-build step instead — see that script's
|
|
41
|
+
* own doc comment. Anyone who imports ANYTHING from '@kbach/react-native'
|
|
42
|
+
* gets it with no extra tsconfig step needed either way. Same underlying
|
|
43
|
+
* problem (and the interface-merge half of this fix) nativewind — a React
|
|
44
|
+
* Native styling library solving this identical className-typing problem —
|
|
45
|
+
* also has to solve.
|
|
46
|
+
*
|
|
47
|
+
* Every interface below is `export interface XProps extends Readonly<...>
|
|
48
|
+
* {}` in react-native's own generated types (RN >= ~0.81's Flow-to-TS
|
|
49
|
+
* generation, `types_generated/`) — an otherwise-empty body, so merging a
|
|
50
|
+
* member in is exactly as safe as against a hand-written interface.
|
|
51
|
+
* Deliberately NOT listed here: `ImageProps`, `TouchableOpacityProps`,
|
|
52
|
+
* `ModalProps` — these are `export type X = Readonly<...>` TYPE ALIASES in
|
|
53
|
+
* the same generated types, which TypeScript cannot declaration-merge into
|
|
54
|
+
* at all (confirmed by hand: attempting it is a flat "Duplicate identifier"
|
|
55
|
+
* compile error, not a silent no-op). They don't need an entry anyway —
|
|
56
|
+
* confirmed against a real `tsc` run (RN 0.87) that `className` on
|
|
57
|
+
* `Image`/`TouchableOpacity`/`TouchableHighlight`/`Modal`/`SafeAreaView`
|
|
58
|
+
* ALL already type-check cleanly once `ViewProps` and
|
|
59
|
+
* `TouchableWithoutFeedbackProps` below are augmented — each of those
|
|
60
|
+
* components' real prop type composes one or the other somewhere in its
|
|
61
|
+
* own `Omit<...> & ...` chain (`SafeAreaView` in particular turned out to
|
|
62
|
+
* reuse `ViewProps` directly, with no separate props type of its own at
|
|
63
|
+
* all), so the merged `className` field flows through without needing its
|
|
64
|
+
* own dedicated entry.
|
|
65
|
+
*/
|
|
66
|
+
export {};
|
|
67
|
+
|
|
68
|
+
declare module 'react-native' {
|
|
69
|
+
interface ViewProps {
|
|
70
|
+
className?: string;
|
|
71
|
+
}
|
|
72
|
+
interface TextProps {
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
interface ScrollViewProps {
|
|
76
|
+
className?: string;
|
|
77
|
+
}
|
|
78
|
+
interface PressableProps {
|
|
79
|
+
className?: string;
|
|
80
|
+
}
|
|
81
|
+
interface TextInputProps {
|
|
82
|
+
className?: string;
|
|
83
|
+
}
|
|
84
|
+
interface TouchableHighlightProps {
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
interface TouchableWithoutFeedbackProps {
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
interface SwitchProps {
|
|
91
|
+
className?: string;
|
|
92
|
+
}
|
|
93
|
+
interface KeyboardAvoidingViewProps {
|
|
94
|
+
className?: string;
|
|
95
|
+
}
|
|
96
|
+
interface FlatListProps<ItemT> {
|
|
97
|
+
className?: string;
|
|
98
|
+
}
|
|
99
|
+
interface SectionListProps<ItemT, SectionT> {
|
|
100
|
+
className?: string;
|
|
101
|
+
}
|
|
102
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -908,6 +908,12 @@ function colorValue(theme, parsed) {
|
|
|
908
908
|
if (rgb === null) return hex;
|
|
909
909
|
return `rgba(${rgb.join(",")},${opacity / 100})`;
|
|
910
910
|
}
|
|
911
|
+
var LENGTH_UNITS = ["px", "rem", "em", "%", "vh", "vw"];
|
|
912
|
+
function looksLikeLength(value) {
|
|
913
|
+
const unit = LENGTH_UNITS.find((u) => value.endsWith(u));
|
|
914
|
+
const withoutUnit = unit ? value.slice(0, value.length - unit.length) : value;
|
|
915
|
+
return withoutUnit !== "" && Number.isFinite(Number(withoutUnit));
|
|
916
|
+
}
|
|
911
917
|
|
|
912
918
|
// src/jsEngine/resolvers/border.ts
|
|
913
919
|
function radiusSize(key) {
|
|
@@ -958,7 +964,9 @@ function borderValue(theme, parsed) {
|
|
|
958
964
|
if (value === "separate") return [decl("border-collapse", "separate")];
|
|
959
965
|
}
|
|
960
966
|
if (parsed.isArbitrary) {
|
|
961
|
-
return [decl("border-width", value)];
|
|
967
|
+
if (looksLikeLength(value)) return [decl("border-width", value)];
|
|
968
|
+
const color2 = colorValue(theme, parsed);
|
|
969
|
+
return color2 === null ? null : [decl("border-color", color2)];
|
|
962
970
|
}
|
|
963
971
|
if (Number.isFinite(Number(value)) && value.trim() !== "") {
|
|
964
972
|
const v = resolveLength(theme, parsed);
|
|
@@ -973,7 +981,11 @@ function borderValue(theme, parsed) {
|
|
|
973
981
|
function borderSideValue(theme, parsed, sideProperty) {
|
|
974
982
|
const value = parsed.value;
|
|
975
983
|
if (value === null) return null;
|
|
976
|
-
if (parsed.isArbitrary)
|
|
984
|
+
if (parsed.isArbitrary) {
|
|
985
|
+
if (looksLikeLength(value)) return [decl(`${sideProperty}-width`, value)];
|
|
986
|
+
const color2 = colorValue(theme, parsed);
|
|
987
|
+
return color2 === null ? null : [decl(`${sideProperty}-color`, color2)];
|
|
988
|
+
}
|
|
977
989
|
if (Number.isFinite(Number(value)) && value.trim() !== "") {
|
|
978
990
|
const v = resolveLength(theme, parsed);
|
|
979
991
|
return v === null ? null : [decl(`${sideProperty}-width`, v)];
|
|
@@ -987,7 +999,11 @@ function borderSideValue(theme, parsed, sideProperty) {
|
|
|
987
999
|
function borderAxisValue(theme, parsed, sideA, sideB) {
|
|
988
1000
|
const value = parsed.value;
|
|
989
1001
|
if (value === null) return null;
|
|
990
|
-
if (parsed.isArbitrary)
|
|
1002
|
+
if (parsed.isArbitrary) {
|
|
1003
|
+
if (looksLikeLength(value)) return [decl(`${sideA}-width`, value), decl(`${sideB}-width`, value)];
|
|
1004
|
+
const color2 = colorValue(theme, parsed);
|
|
1005
|
+
return color2 === null ? null : [decl(`${sideA}-color`, color2), decl(`${sideB}-color`, color2)];
|
|
1006
|
+
}
|
|
991
1007
|
if (Number.isFinite(Number(value)) && value.trim() !== "") {
|
|
992
1008
|
const v = resolveLength(theme, parsed);
|
|
993
1009
|
return v === null ? null : [decl(`${sideA}-width`, v), decl(`${sideB}-width`, v)];
|
|
@@ -1054,7 +1070,11 @@ function outlineWidthValue(key) {
|
|
|
1054
1070
|
function outlineValue(theme, parsed) {
|
|
1055
1071
|
const value = parsed.value;
|
|
1056
1072
|
if (value === null) return null;
|
|
1057
|
-
if (parsed.isArbitrary)
|
|
1073
|
+
if (parsed.isArbitrary) {
|
|
1074
|
+
if (looksLikeLength(value)) return [decl("outline-width", value)];
|
|
1075
|
+
const color2 = colorValue(theme, parsed);
|
|
1076
|
+
return color2 === null ? null : [decl("outline-color", color2)];
|
|
1077
|
+
}
|
|
1058
1078
|
const w = outlineWidthValue(value);
|
|
1059
1079
|
if (w !== null) return [decl("outline-width", w)];
|
|
1060
1080
|
if (OUTLINE_STYLES.includes(value)) return [decl("outline-style", value)];
|
package/dist/index.web.d.ts
CHANGED
|
@@ -16,3 +16,89 @@ import 'react';
|
|
|
16
16
|
declare function resolveClassName(classString: string): string;
|
|
17
17
|
|
|
18
18
|
export { resolveClassName };
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Ambient module augmentation adding `className?: string` to React
|
|
22
|
+
* Native's own component prop types — without this, `<View
|
|
23
|
+
* className="...">` type-checks fine at RUNTIME (the babel plugin/
|
|
24
|
+
* jsx-runtime accept `className` on ANY host element regardless of its
|
|
25
|
+
* declared prop type — see jsxRuntimeCore.ts's own `processElement` doc
|
|
26
|
+
* comment) but fails `tsc`/editor type-checking, since `ViewProps`/
|
|
27
|
+
* `TextProps`/etc. (react-native's own types) have no `className` field at
|
|
28
|
+
* all. Confirmed as a real, reported gap: nothing in this package shipped
|
|
29
|
+
* this augmentation before, so a React Native CLI project running `tsc`
|
|
30
|
+
* (or just seeing red squiggles in-editor) hit "Property 'className' does
|
|
31
|
+
* not exist on type ... ViewProps ..." on every styled element.
|
|
32
|
+
*
|
|
33
|
+
* A plain `.d.ts` file has no effect on its own unless something actually
|
|
34
|
+
* pulls it into a consumer's type-checking. A side-effect `import
|
|
35
|
+
* './rnClassNameTypes'` from index.ts was the first thing tried here, but
|
|
36
|
+
* tsup's dts rollup (rollup-plugin-dts) tree-shakes a side-effect-only
|
|
37
|
+
* import with nothing it can trace a type reference through — confirmed by
|
|
38
|
+
* hand that this wasn't even consistent (survived one build, silently
|
|
39
|
+
* vanished from an immediately-following clean rebuild of the identical
|
|
40
|
+
* source). `scripts/append-classname-types.mjs` appends this file's own
|
|
41
|
+
* text onto the end of the built `dist/index.d.ts`/`dist/index.web.d.ts`
|
|
42
|
+
* directly as a deterministic post-build step instead — see that script's
|
|
43
|
+
* own doc comment. Anyone who imports ANYTHING from '@kbach/react-native'
|
|
44
|
+
* gets it with no extra tsconfig step needed either way. Same underlying
|
|
45
|
+
* problem (and the interface-merge half of this fix) nativewind — a React
|
|
46
|
+
* Native styling library solving this identical className-typing problem —
|
|
47
|
+
* also has to solve.
|
|
48
|
+
*
|
|
49
|
+
* Every interface below is `export interface XProps extends Readonly<...>
|
|
50
|
+
* {}` in react-native's own generated types (RN >= ~0.81's Flow-to-TS
|
|
51
|
+
* generation, `types_generated/`) — an otherwise-empty body, so merging a
|
|
52
|
+
* member in is exactly as safe as against a hand-written interface.
|
|
53
|
+
* Deliberately NOT listed here: `ImageProps`, `TouchableOpacityProps`,
|
|
54
|
+
* `ModalProps` — these are `export type X = Readonly<...>` TYPE ALIASES in
|
|
55
|
+
* the same generated types, which TypeScript cannot declaration-merge into
|
|
56
|
+
* at all (confirmed by hand: attempting it is a flat "Duplicate identifier"
|
|
57
|
+
* compile error, not a silent no-op). They don't need an entry anyway —
|
|
58
|
+
* confirmed against a real `tsc` run (RN 0.87) that `className` on
|
|
59
|
+
* `Image`/`TouchableOpacity`/`TouchableHighlight`/`Modal`/`SafeAreaView`
|
|
60
|
+
* ALL already type-check cleanly once `ViewProps` and
|
|
61
|
+
* `TouchableWithoutFeedbackProps` below are augmented — each of those
|
|
62
|
+
* components' real prop type composes one or the other somewhere in its
|
|
63
|
+
* own `Omit<...> & ...` chain (`SafeAreaView` in particular turned out to
|
|
64
|
+
* reuse `ViewProps` directly, with no separate props type of its own at
|
|
65
|
+
* all), so the merged `className` field flows through without needing its
|
|
66
|
+
* own dedicated entry.
|
|
67
|
+
*/
|
|
68
|
+
export {};
|
|
69
|
+
|
|
70
|
+
declare module 'react-native' {
|
|
71
|
+
interface ViewProps {
|
|
72
|
+
className?: string;
|
|
73
|
+
}
|
|
74
|
+
interface TextProps {
|
|
75
|
+
className?: string;
|
|
76
|
+
}
|
|
77
|
+
interface ScrollViewProps {
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
interface PressableProps {
|
|
81
|
+
className?: string;
|
|
82
|
+
}
|
|
83
|
+
interface TextInputProps {
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
86
|
+
interface TouchableHighlightProps {
|
|
87
|
+
className?: string;
|
|
88
|
+
}
|
|
89
|
+
interface TouchableWithoutFeedbackProps {
|
|
90
|
+
className?: string;
|
|
91
|
+
}
|
|
92
|
+
interface SwitchProps {
|
|
93
|
+
className?: string;
|
|
94
|
+
}
|
|
95
|
+
interface KeyboardAvoidingViewProps {
|
|
96
|
+
className?: string;
|
|
97
|
+
}
|
|
98
|
+
interface FlatListProps<ItemT> {
|
|
99
|
+
className?: string;
|
|
100
|
+
}
|
|
101
|
+
interface SectionListProps<ItemT, SectionT> {
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
}
|