@bsky.app/peek-menu 0.2.0 → 0.2.3

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,23 @@
1
1
  # @bsky.app/peek-menu
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`818b97d`](https://github.com/bluesky-social/toolbox/commit/818b97d984bdfccfcf05db2e252b3789c1fa8487) Thanks [@mozzius](https://github.com/mozzius)! - Add --provenance flag to publish
8
+
9
+ ## 0.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#45](https://github.com/bluesky-social/toolbox/pull/45) [`3edc0b3`](https://github.com/bluesky-social/toolbox/commit/3edc0b369f8a563763a240ba829fae20e0cf54e5) Thanks [@mozzius](https://github.com/mozzius)! - Fix trusted publishing
14
+
15
+ ## 0.2.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [#43](https://github.com/bluesky-social/toolbox/pull/43) [`a5feb85`](https://github.com/bluesky-social/toolbox/commit/a5feb85c7eef69385d459d2b0d26a474548ea6db) Thanks [@mozzius](https://github.com/mozzius)! - Enable trusted publishing
20
+
3
21
  ## 0.2.0
4
22
 
5
23
  ### Minor Changes
package/README.md CHANGED
@@ -16,7 +16,6 @@ Declarative, compound-component API. `Root` collects children tagged as `Trigger
16
16
 
17
17
  ```tsx
18
18
  import * as PeekMenu from '@bsky.app/peek-menu'
19
-
20
19
  ;<PeekMenu.Root>
21
20
  <PeekMenu.Trigger
22
21
  preview={{
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoContextMenuNativeView.d.ts","sourceRoot":"","sources":["../src/ExpoContextMenuNativeView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,aAAa,EAAC,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,SAAS,CAAA;AAE5C,QAAA,MAAM,UAAU,EAAE,aAAa,CAAC,eAAe,CAE9C,CAAA;AAED,eAAe,UAAU,CAAA"}
1
+ {"version":3,"file":"ExpoContextMenuNativeView.d.ts","sourceRoot":"","sources":["../src/ExpoContextMenuNativeView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,aAAa,EAAC,MAAM,OAAO,CAAA;AAExC,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,SAAS,CAAA;AAE5C,QAAA,MAAM,UAAU,EAAE,aAAa,CAAC,eAAe,CAE9C,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoContextMenuNativeView.js","sourceRoot":"","sources":["../src/ExpoContextMenuNativeView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAA;AAI1D,MAAM,UAAU,GAAmC,wBAAwB,CACzE,qBAAqB,CACtB,CAAA;AAED,eAAe,UAAU,CAAA","sourcesContent":["import {type ComponentType} from 'react'\nimport {requireNativeViewManager} from 'expo-modules-core'\n\nimport {type NativeViewProps} from './types'\n\nconst NativeView: ComponentType<NativeViewProps> = requireNativeViewManager(\n 'ExpoBlueskyPeekMenu',\n)\n\nexport default NativeView\n"]}
1
+ {"version":3,"file":"ExpoContextMenuNativeView.js","sourceRoot":"","sources":["../src/ExpoContextMenuNativeView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAA;AAK1D,MAAM,UAAU,GAAmC,wBAAwB,CACzE,qBAAqB,CACtB,CAAA;AAED,eAAe,UAAU,CAAA","sourcesContent":["import {requireNativeViewManager} from 'expo-modules-core'\nimport {type ComponentType} from 'react'\n\nimport {type NativeViewProps} from './types'\n\nconst NativeView: ComponentType<NativeViewProps> = requireNativeViewManager(\n 'ExpoBlueskyPeekMenu',\n)\n\nexport default NativeView\n"]}
package/build/Root.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Root.js","sourceRoot":"","sources":["../src/Root.tsx"],"names":[],"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EAAE,QAAQ,EAAE,QAAQ,EAAC,GAAG,OAAO,CAAC,KAAK,CAAA;IACrE,IAAI,KAAK,GAAG,EAAE,CAAA;IACd,IAAI,IAA0B,CAAA;IAC9B,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE;QACjC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;YAAE,OAAM;QAClC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;YACzB,MAAM,IAAI,GAAI,KAAyC,CAAC,KAAK,CAAC,QAAQ,CAAA;YACtE,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,KAAK,GAAG,IAAI,CAAA;QAC5C,CAAC;aAAM,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;YAChC,MAAM,UAAU,GAAI,KAAyC,CAAC,KAAK,CAAC,IAAI,CAAA;YACxE,IAAI,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACjC,IAAI,GAAG;oBACL,KAAK,EAAE,UAAU,CAAC,QAAQ;oBAC1B,OAAO,EAAE,UAAU,CAAC,UAAU;oBAC9B,WAAW,EAAE,UAAU,CAAC,cAAc;iBACvC,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,OAAO;QACL,IAAI,EAAE,EAAC,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAC;QAC9C,QAAQ;KACT,CAAA;AACH,CAAC","sourcesContent":["import {\n Children,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useMemo,\n} from 'react'\nimport {type StyleProp, type ViewStyle} from 'react-native'\n\nimport NativeView from './ExpoContextMenuNativeView'\nimport {type MenuProps} from './Menu'\nimport {type MenuItemProps} from './MenuItem'\nimport {type MenuItemIconProps} from './MenuItemIcon'\nimport {type MenuItemTextProps} from './MenuItemText'\nimport {kindOf} from './registry'\nimport {type TriggerProps} from './Trigger'\nimport {type MenuItemSpec} from './types'\n\nexport type RootProps = {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nexport function Root({children, style}: RootProps) {\n const {trigger, menu} = collectTriggerAndMenu(children)\n\n const {menuItems, selectById} = useMemo(() => {\n const items: MenuItemSpec[] = []\n const map: Record<string, () => void> = {}\n if (menu) {\n Children.forEach(menu.props.children, child => {\n if (!isValidElement(child)) return\n if (kindOf(child.type) !== 'item') return\n const spec = specFromItem(child as ReactElement<MenuItemProps>)\n if (!spec) return\n items.push(spec.item)\n map[spec.item.id] = spec.onSelect\n })\n }\n return {menuItems: items, selectById: map}\n }, [menu])\n\n const handleItemPress = useCallback(\n (e: {nativeEvent: {id: string}}) => {\n selectById[e.nativeEvent.id]?.()\n },\n [selectById],\n )\n\n const onPreviewPress = trigger?.props.onPreviewPress\n const handlePreviewPress = useCallback(() => {\n onPreviewPress?.()\n }, [onPreviewPress])\n\n if (!trigger) {\n return <>{children}</>\n }\n\n return (\n <NativeView\n preview={trigger.props.preview}\n menuItems={menuItems}\n previewCornerRadius={trigger.props.borderRadius ?? 0}\n onItemPress={handleItemPress}\n onPreviewPress={handlePreviewPress}\n style={[style, trigger.props.style]}>\n {trigger.props.children}\n </NativeView>\n )\n}\n\n// -----------------------------------------------------------------------------\n\ntype Collected = {\n trigger?: ReactElement<TriggerProps>\n menu?: ReactElement<MenuProps>\n}\n\nfunction collectTriggerAndMenu(children: ReactNode): Collected {\n const result: Collected = {}\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n const kind = kindOf(child.type)\n if (kind === 'trigger') result.trigger = child as ReactElement<TriggerProps>\n else if (kind === 'menu') result.menu = child as ReactElement<MenuProps>\n })\n return result\n}\n\nfunction specFromItem(\n element: ReactElement<MenuItemProps>,\n): {item: MenuItemSpec; onSelect: () => void} | null {\n const {id, destructive, disabled, onSelect, children} = element.props\n let label = ''\n let icon: MenuItemSpec['icon']\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n const kind = kindOf(child.type)\n if (kind === 'item-text') {\n const text = (child as ReactElement<MenuItemTextProps>).props.children\n if (typeof text === 'string') label = text\n } else if (kind === 'item-icon') {\n const iconSource = (child as ReactElement<MenuItemIconProps>).props.icon\n if (iconSource?.svgPaths?.length) {\n icon = {\n paths: iconSource.svgPaths,\n viewBox: iconSource.svgViewBox,\n strokeWidth: iconSource.svgStrokeWidth,\n }\n }\n }\n })\n if (!label) return null\n return {\n item: {id, label, destructive, disabled, icon},\n onSelect,\n }\n}\n"]}
1
+ {"version":3,"file":"Root.js","sourceRoot":"","sources":["../src/Root.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,cAAc,EAGd,WAAW,EACX,OAAO,GACR,MAAM,OAAO,CAAA;AAGd,OAAO,UAAU,MAAM,6BAA6B,CAAA;AAMpD,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAA;AAQjC,MAAM,UAAU,IAAI,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAY;IAC/C,MAAM,EAAC,OAAO,EAAE,IAAI,EAAC,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAA;IAEvD,MAAM,EAAC,SAAS,EAAE,UAAU,EAAC,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3C,MAAM,KAAK,GAAmB,EAAE,CAAA;QAChC,MAAM,GAAG,GAA+B,EAAE,CAAA;QAC1C,IAAI,IAAI,EAAE,CAAC;YACT,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE;gBAC5C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;oBAAE,OAAM;gBAClC,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM;oBAAE,OAAM;gBACzC,MAAM,IAAI,GAAG,YAAY,CAAC,KAAoC,CAAC,CAAA;gBA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AC,cAAc;iBACvC,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,OAAO;QACL,IAAI,EAAE,EAAC,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAC;QAC9C,QAAQ;KACT,CAAA;AACH,CAAC","sourcesContent":["import {\n Children,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useMemo,\n} from 'react'\nimport {type StyleProp, type ViewStyle} from 'react-native'\n\nimport NativeView from './ExpoContextMenuNativeView'\nimport {type MenuProps} from './Menu'\nimport {type MenuItemProps} from './MenuItem'\nimport {type MenuItemIconProps} from './MenuItemIcon'\nimport {type MenuItemTextProps} from './MenuItemText'\nimport {type TriggerProps} from './Trigger'\nimport {kindOf} from './registry'\nimport {type MenuItemSpec} from './types'\n\nexport type RootProps = {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nexport function Root({children, style}: RootProps) {\n const {trigger, menu} = collectTriggerAndMenu(children)\n\n const {menuItems, selectById} = useMemo(() => {\n const items: MenuItemSpec[] = []\n const map: Record<string, () => void> = {}\n if (menu) {\n Children.forEach(menu.props.children, child => {\n if (!isValidElement(child)) return\n if (kindOf(child.type) !== 'item') return\n const spec = specFromItem(child as ReactElement<MenuItemProps>)\n if (!spec) return\n items.push(spec.item)\n map[spec.item.id] = spec.onSelect\n })\n }\n return {menuItems: items, selectById: map}\n }, [menu])\n\n const handleItemPress = useCallback(\n (e: {nativeEvent: {id: string}}) => {\n selectById[e.nativeEvent.id]?.()\n },\n [selectById],\n )\n\n const onPreviewPress = trigger?.props.onPreviewPress\n const handlePreviewPress = useCallback(() => {\n onPreviewPress?.()\n }, [onPreviewPress])\n\n if (!trigger) {\n return <>{children}</>\n }\n\n return (\n <NativeView\n preview={trigger.props.preview}\n menuItems={menuItems}\n previewCornerRadius={trigger.props.borderRadius ?? 0}\n onItemPress={handleItemPress}\n onPreviewPress={handlePreviewPress}\n style={[style, trigger.props.style]}>\n {trigger.props.children}\n </NativeView>\n )\n}\n\n// -----------------------------------------------------------------------------\n\ntype Collected = {\n trigger?: ReactElement<TriggerProps>\n menu?: ReactElement<MenuProps>\n}\n\nfunction collectTriggerAndMenu(children: ReactNode): Collected {\n const result: Collected = {}\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n const kind = kindOf(child.type)\n if (kind === 'trigger') result.trigger = child as ReactElement<TriggerProps>\n else if (kind === 'menu') result.menu = child as ReactElement<MenuProps>\n })\n return result\n}\n\nfunction specFromItem(\n element: ReactElement<MenuItemProps>,\n): {item: MenuItemSpec; onSelect: () => void} | null {\n const {id, destructive, disabled, onSelect, children} = element.props\n let label = ''\n let icon: MenuItemSpec['icon']\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n const kind = kindOf(child.type)\n if (kind === 'item-text') {\n const text = (child as ReactElement<MenuItemTextProps>).props.children\n if (typeof text === 'string') label = text\n } else if (kind === 'item-icon') {\n const iconSource = (child as ReactElement<MenuItemIconProps>).props.icon\n if (iconSource?.svgPaths?.length) {\n icon = {\n paths: iconSource.svgPaths,\n viewBox: iconSource.svgViewBox,\n strokeWidth: iconSource.svgStrokeWidth,\n }\n }\n }\n })\n if (!label) return null\n return {\n item: {id, label, destructive, disabled, icon},\n onSelect,\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // @generated by expo-module-scripts
2
+ const {defineConfig} = require('eslint/config')
3
+ const baseConfig = require('expo-module-scripts/eslint.config.base')
4
+ module.exports = defineConfig([baseConfig])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsky.app/peek-menu",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "description": "Native iOS context menu with peek preview for images.",
6
6
  "repository": "https://github.com/bluesky-social/toolbox",
@@ -16,7 +16,7 @@
16
16
  "ios"
17
17
  ],
18
18
  "devDependencies": {
19
- "@types/react": "~19.1.1",
19
+ "@types/react": "~19.2.15",
20
20
  "expo": "^55.0.8",
21
21
  "expo-module-scripts": "^55.0.2",
22
22
  "expo-modules-core": "^55.0.22",
@@ -32,7 +32,7 @@
32
32
  "build": "expo-module clean && EXPO_NONINTERACTIVE=1 expo-module build",
33
33
  "clean": "expo-module clean",
34
34
  "lint": "expo-module lint",
35
- "test": "vitest run",
35
+ "typecheck": "tsc --noEmit",
36
36
  "expo-module": "expo-module"
37
37
  }
38
38
  }
@@ -1,5 +1,5 @@
1
- import {type ComponentType} from 'react'
2
1
  import {requireNativeViewManager} from 'expo-modules-core'
2
+ import {type ComponentType} from 'react'
3
3
 
4
4
  import {type NativeViewProps} from './types'
5
5
 
package/src/Root.tsx CHANGED
@@ -13,8 +13,8 @@ import {type MenuProps} from './Menu'
13
13
  import {type MenuItemProps} from './MenuItem'
14
14
  import {type MenuItemIconProps} from './MenuItemIcon'
15
15
  import {type MenuItemTextProps} from './MenuItemText'
16
- import {kindOf} from './registry'
17
16
  import {type TriggerProps} from './Trigger'
17
+ import {kindOf} from './registry'
18
18
  import {type MenuItemSpec} from './types'
19
19
 
20
20
  export type RootProps = {
package/tsconfig.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "extends": "expo-module-scripts/tsconfig.base",
3
3
  "compilerOptions": {
4
+ "rootDir": "./src",
4
5
  "outDir": "./build",
5
6
  "jsx": "react-jsx"
6
7
  },
package/.eslintrc.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ['universe/native', 'universe/web'],
4
- ignorePatterns: ['build'],
5
- }