@bsky.app/peek-menu 0.2.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.
- package/.eslintrc.js +5 -0
- package/CHANGELOG.md +7 -0
- package/README.md +121 -0
- package/build/ExpoContextMenuNativeView.android.d.ts +6 -0
- package/build/ExpoContextMenuNativeView.android.d.ts.map +1 -0
- package/build/ExpoContextMenuNativeView.android.js +9 -0
- package/build/ExpoContextMenuNativeView.android.js.map +1 -0
- package/build/ExpoContextMenuNativeView.d.ts +5 -0
- package/build/ExpoContextMenuNativeView.d.ts.map +1 -0
- package/build/ExpoContextMenuNativeView.js +4 -0
- package/build/ExpoContextMenuNativeView.js.map +1 -0
- package/build/ExpoContextMenuNativeView.web.d.ts +7 -0
- package/build/ExpoContextMenuNativeView.web.d.ts.map +1 -0
- package/build/ExpoContextMenuNativeView.web.js +10 -0
- package/build/ExpoContextMenuNativeView.web.js.map +1 -0
- package/build/Menu.d.ts +6 -0
- package/build/Menu.d.ts.map +1 -0
- package/build/Menu.js +10 -0
- package/build/Menu.js.map +1 -0
- package/build/MenuItem.d.ts +11 -0
- package/build/MenuItem.d.ts.map +1 -0
- package/build/MenuItem.js +10 -0
- package/build/MenuItem.js.map +1 -0
- package/build/MenuItemIcon.d.ts +6 -0
- package/build/MenuItemIcon.d.ts.map +1 -0
- package/build/MenuItemIcon.js +11 -0
- package/build/MenuItemIcon.js.map +1 -0
- package/build/MenuItemText.d.ts +5 -0
- package/build/MenuItemText.d.ts.map +1 -0
- package/build/MenuItemText.js +11 -0
- package/build/MenuItemText.js.map +1 -0
- package/build/Root.d.ts +8 -0
- package/build/Root.d.ts.map +1 -0
- package/build/Root.js +81 -0
- package/build/Root.js.map +1 -0
- package/build/Trigger.d.ts +15 -0
- package/build/Trigger.d.ts.map +1 -0
- package/build/Trigger.js +10 -0
- package/build/Trigger.js.map +1 -0
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -0
- package/build/registry.d.ts +13 -0
- package/build/registry.d.ts.map +1 -0
- package/build/registry.js +18 -0
- package/build/registry.js.map +1 -0
- package/build/types.d.ts +70 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/expo-module.config.json +6 -0
- package/ios/ExpoBlueskyPeekMenu.podspec +22 -0
- package/ios/ExpoBlueskyPeekMenuModule.swift +24 -0
- package/ios/ExpoBlueskyPeekMenuView.swift +111 -0
- package/ios/IconRenderer.swift +69 -0
- package/ios/ImagePreviewController.swift +133 -0
- package/ios/MenuBuilder.swift +51 -0
- package/ios/PreviewFactory.swift +27 -0
- package/ios/SVGPathParser.swift +320 -0
- package/package.json +38 -0
- package/src/ExpoContextMenuNativeView.android.tsx +10 -0
- package/src/ExpoContextMenuNativeView.tsx +10 -0
- package/src/ExpoContextMenuNativeView.web.tsx +11 -0
- package/src/Menu.tsx +17 -0
- package/src/MenuItem.tsx +22 -0
- package/src/MenuItemIcon.tsx +17 -0
- package/src/MenuItemText.tsx +16 -0
- package/src/Root.tsx +119 -0
- package/src/Trigger.tsx +26 -0
- package/src/index.ts +12 -0
- package/src/registry.ts +32 -0
- package/src/types.ts +71 -0
- package/tsconfig.json +9 -0
- package/vitest.config.ts +7 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {type ReactNode} from 'react'
|
|
2
|
+
import {type StyleProp, type ViewStyle} from 'react-native'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The subset of SVG metadata needed by the native menu icon renderer.
|
|
6
|
+
* Any icon component that carries these three properties can be passed
|
|
7
|
+
* to `MenuItemIcon`. In practice this is satisfied by every icon
|
|
8
|
+
* created with `createSinglePathSVG` / `createMultiPathSVG`.
|
|
9
|
+
*/
|
|
10
|
+
export type SvgIconMeta = {
|
|
11
|
+
svgPaths: string[]
|
|
12
|
+
svgViewBox: string
|
|
13
|
+
svgStrokeWidth: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Content to show during the peek preview. Discriminated by `type`; the native
|
|
18
|
+
* side dispatches on it to build the right `UIViewController`.
|
|
19
|
+
*
|
|
20
|
+
* Only `image` is implemented on iOS today. `video` and `externalCard` are the
|
|
21
|
+
* planned follow-ups; leaving them in the type keeps the JS call-sites honest.
|
|
22
|
+
*/
|
|
23
|
+
export type PreviewContent =
|
|
24
|
+
| {
|
|
25
|
+
type: 'image'
|
|
26
|
+
uri: string
|
|
27
|
+
/** Thumb URL. When present, the native side paints it in as an instant
|
|
28
|
+
* placeholder (reading from the shared SDWebImage cache) while the
|
|
29
|
+
* fullsize loads — avoids the black flash on first peek. */
|
|
30
|
+
thumbUri?: string
|
|
31
|
+
/** Aspect ratio as width / height. */
|
|
32
|
+
aspectRatio: number
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
type: 'video'
|
|
36
|
+
uri: string
|
|
37
|
+
poster?: string
|
|
38
|
+
aspectRatio: number
|
|
39
|
+
}
|
|
40
|
+
| {
|
|
41
|
+
type: 'externalCard'
|
|
42
|
+
thumbUri?: string
|
|
43
|
+
title: string
|
|
44
|
+
description?: string
|
|
45
|
+
url: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type MenuItemSpec = {
|
|
49
|
+
id: string
|
|
50
|
+
label: string
|
|
51
|
+
destructive?: boolean
|
|
52
|
+
disabled?: boolean
|
|
53
|
+
icon?: {
|
|
54
|
+
paths: string[]
|
|
55
|
+
viewBox: string
|
|
56
|
+
strokeWidth: number
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type MenuItemIconSource = SvgIconMeta
|
|
61
|
+
|
|
62
|
+
export type NativeViewProps = {
|
|
63
|
+
preview?: PreviewContent
|
|
64
|
+
menuItems: MenuItemSpec[]
|
|
65
|
+
/** Named distinctly from `borderRadius`, which RN owns as a style prop. */
|
|
66
|
+
previewCornerRadius: number
|
|
67
|
+
onItemPress: (e: {nativeEvent: {id: string}}) => void
|
|
68
|
+
onPreviewPress: (e: {nativeEvent: {}}) => void
|
|
69
|
+
style?: StyleProp<ViewStyle>
|
|
70
|
+
children?: ReactNode
|
|
71
|
+
}
|
package/tsconfig.json
ADDED