react-native-tinyui 0.1.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/LICENSE +20 -0
- package/README.md +172 -0
- package/Tinyui.podspec +85 -0
- package/ios/Core/Tinyui.h +8 -0
- package/ios/Core/Tinyui.mm +30 -0
- package/ios/Core/TinyuiComponentClasses.mm +27 -0
- package/ios/Core/TinyuiHostingHelpers.swift +74 -0
- package/ios/Menu/TinyuiMenuProvider.swift +110 -0
- package/ios/Menu/TinyuiMenuView.h +14 -0
- package/ios/Menu/TinyuiMenuView.mm +120 -0
- package/ios/Menu/TinyuiMenuViewSwift.swift +368 -0
- package/ios/Popover/TinyuiPopoverProvider.swift +111 -0
- package/ios/Popover/TinyuiPopoverView.h +14 -0
- package/ios/Popover/TinyuiPopoverView.mm +124 -0
- package/ios/Popover/TinyuiPopoverViewSwift.swift +88 -0
- package/lib/module/Menu.js +43 -0
- package/lib/module/Menu.js.map +1 -0
- package/lib/module/Menu.types.js +4 -0
- package/lib/module/Menu.types.js.map +1 -0
- package/lib/module/MenuNativeComponent.ts +14 -0
- package/lib/module/MenuOptions.js +73 -0
- package/lib/module/MenuOptions.js.map +1 -0
- package/lib/module/NativeTinyui.js +5 -0
- package/lib/module/NativeTinyui.js.map +1 -0
- package/lib/module/Popover.js +71 -0
- package/lib/module/Popover.js.map +1 -0
- package/lib/module/Popover.types.js +4 -0
- package/lib/module/Popover.types.js.map +1 -0
- package/lib/module/PopoverNativeComponent.ts +13 -0
- package/lib/module/PopoverPrimitives.js +33 -0
- package/lib/module/PopoverPrimitives.js.map +1 -0
- package/lib/module/getNativeTinyui.js +30 -0
- package/lib/module/getNativeTinyui.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/react-native.d.js +2 -0
- package/lib/module/react-native.d.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Menu.d.ts +4 -0
- package/lib/typescript/src/Menu.d.ts.map +1 -0
- package/lib/typescript/src/Menu.types.d.ts +63 -0
- package/lib/typescript/src/Menu.types.d.ts.map +1 -0
- package/lib/typescript/src/MenuNativeComponent.d.ts +14 -0
- package/lib/typescript/src/MenuNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/MenuOptions.d.ts +7 -0
- package/lib/typescript/src/MenuOptions.d.ts.map +1 -0
- package/lib/typescript/src/NativeTinyui.d.ts +11 -0
- package/lib/typescript/src/NativeTinyui.d.ts.map +1 -0
- package/lib/typescript/src/Popover.d.ts +7 -0
- package/lib/typescript/src/Popover.d.ts.map +1 -0
- package/lib/typescript/src/Popover.types.d.ts +35 -0
- package/lib/typescript/src/Popover.types.d.ts.map +1 -0
- package/lib/typescript/src/PopoverNativeComponent.d.ts +13 -0
- package/lib/typescript/src/PopoverNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/PopoverPrimitives.d.ts +21 -0
- package/lib/typescript/src/PopoverPrimitives.d.ts.map +1 -0
- package/lib/typescript/src/getNativeTinyui.d.ts +13 -0
- package/lib/typescript/src/getNativeTinyui.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +175 -0
- package/src/Menu.tsx +52 -0
- package/src/Menu.types.ts +77 -0
- package/src/MenuNativeComponent.ts +14 -0
- package/src/MenuOptions.ts +146 -0
- package/src/NativeTinyui.ts +12 -0
- package/src/Popover.tsx +92 -0
- package/src/Popover.types.ts +49 -0
- package/src/PopoverNativeComponent.ts +13 -0
- package/src/PopoverPrimitives.tsx +36 -0
- package/src/getNativeTinyui.ts +38 -0
- package/src/index.tsx +23 -0
- package/src/react-native.d.ts +5 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import NativeTinyui, { type Spec } from './NativeTinyui';
|
|
2
|
+
|
|
3
|
+
export type TinyuiComponent = 'Menu' | 'Popover';
|
|
4
|
+
|
|
5
|
+
let nativeTinyui: Spec | null | undefined;
|
|
6
|
+
let enabledComponents: ReadonlySet<string> | undefined;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Returns the Tinyui TurboModule instance. The native module is always
|
|
10
|
+
* compiled (Core), so this is safe to call.
|
|
11
|
+
*/
|
|
12
|
+
export function getNativeTinyui(): Spec {
|
|
13
|
+
nativeTinyui ??= NativeTinyui;
|
|
14
|
+
if (nativeTinyui == null) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
'[TinyUI] The native Tinyui module is not available. ' +
|
|
17
|
+
'Make sure react-native-tinyui is linked and run pod install.'
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return nativeTinyui;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Throws if the given component was not compiled into the native binary.
|
|
25
|
+
* Use this before rendering a component whose native view is optional.
|
|
26
|
+
*/
|
|
27
|
+
export function assertComponentEnabled(component: TinyuiComponent): void {
|
|
28
|
+
const tinyui = getNativeTinyui();
|
|
29
|
+
enabledComponents ??= new Set(tinyui.getEnabledComponents());
|
|
30
|
+
|
|
31
|
+
if (!enabledComponents.has(component)) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`[TinyUI] The ${component} component is not installed. ` +
|
|
34
|
+
`Add '${component}' to the 'react-native-tinyui.components' array ` +
|
|
35
|
+
`in package.json and run pod install.`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { Menu } from './Menu';
|
|
2
|
+
export type {
|
|
3
|
+
MenuActionOption,
|
|
4
|
+
MenuDividerOption,
|
|
5
|
+
MenuItemState,
|
|
6
|
+
MenuOption,
|
|
7
|
+
MenuProps,
|
|
8
|
+
MenuSectionOption,
|
|
9
|
+
MenuSubmenuOption,
|
|
10
|
+
} from './Menu.types';
|
|
11
|
+
|
|
12
|
+
export { Popover, PopoverClose } from './Popover';
|
|
13
|
+
export type {
|
|
14
|
+
PopoverArrowEdge,
|
|
15
|
+
PopoverAttachmentAnchor,
|
|
16
|
+
PopoverCloseProps,
|
|
17
|
+
PopoverContent,
|
|
18
|
+
PopoverContentRenderArgs,
|
|
19
|
+
PopoverProps,
|
|
20
|
+
} from './Popover.types';
|
|
21
|
+
|
|
22
|
+
export { getNativeTinyui, assertComponentEnabled } from './getNativeTinyui';
|
|
23
|
+
export type { TinyuiComponent } from './getNativeTinyui';
|