@ng-native/components 0.28.0 → 0.29.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/android/src/main/java/dev/ngnative/components/ColorSchemeModule.kt +116 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/menu.d.ts +11 -5
- package/dist/menu.js +12 -32
- package/dist/menu.js.map +1 -1
- package/dist/native-button.d.ts +25 -3
- package/dist/native-button.js +101 -7
- package/dist/native-button.js.map +1 -1
- package/dist/press-menu.d.ts +29 -8
- package/dist/press-menu.js +56 -16
- package/dist/press-menu.js.map +1 -1
- package/dist/pressable.js +2 -1
- package/dist/pressable.js.map +1 -1
- package/dist/scroll-view.d.ts +3 -1
- package/dist/scroll-view.js +7 -2
- package/dist/scroll-view.js.map +1 -1
- package/dist/sidebar.js +4 -3
- package/dist/sidebar.js.map +1 -1
- package/dist/split-view.d.ts +23 -2
- package/dist/split-view.js +32 -5
- package/dist/split-view.js.map +1 -1
- package/dist/sticky-headers.d.ts +19 -0
- package/dist/sticky-headers.js +67 -10
- package/dist/sticky-headers.js.map +1 -1
- package/dist/sticky-rows.d.ts +13 -11
- package/dist/sticky-rows.js +35 -21
- package/dist/sticky-rows.js.map +1 -1
- package/dist/svg-icon.d.ts +16 -2
- package/dist/svg-icon.js +19 -3
- package/dist/svg-icon.js.map +1 -1
- package/dist/tray-icon.d.ts +7 -1
- package/dist/tray-icon.js +15 -3
- package/dist/tray-icon.js.map +1 -1
- package/dist/virtual-list-sticky-level.d.ts +0 -6
- package/dist/virtual-list-sticky-level.js +2 -26
- package/dist/virtual-list-sticky-level.js.map +1 -1
- package/dist/virtual-list.d.ts +24 -6
- package/dist/virtual-list.js +79 -28
- package/dist/virtual-list.js.map +1 -1
- package/dist/written-props.js +2 -0
- package/dist/written-props.js.map +1 -1
- package/ios/NgNativeButtonComponentView.mm +8 -4
- package/ios/NgNativeButtonMetrics.h +9 -2
- package/ios/NgNativeButtonMetrics.mm +33 -4
- package/ios/NgNativeButtonShadowNode.h +2 -0
- package/ios/NgNativeButtonShadowNode.mm +5 -1
- package/ios/NgNativeMenus.mm +42 -2
- package/ios/NgNativePressMenu.h +28 -0
- package/ios/NgNativePressMenu.mm +45 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-button.js","sourceRoot":"","sources":["../src/native-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EACL,eAAe,EACf,cAAc,EACd,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;;AAgB9C;;;GAGG;AACH,gBAAgB,CACd,eAAe,EACf,EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,EACnE,SAAS,EACT,EAAE,WAAW,EAAE,OAAO,EAAE,CACzB,CAAC;AAEF;;;;;;;;;;GAUG;AAcH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;OAGG;IACM,IAAI,GAAG,KAAK;wFAAc,CAAC;IACpC,yFAAyF;IAChF,WAAW,GAAG,KAAK;+FAAe,CAAC;IAC5C,uDAAuD;IAC9C,QAAQ,GAAG,KAAK;4FAAU,CAAC;IACpC,qDAAqD;IAC5C,YAAY,GAAG,KAAK,CAAS,SAAS,oFAAI,KAAK,EAAE,UAAU,GAAG,CAAC;IACxE,6DAA6D;IACpD,IAAI,GAAG,KAAK;wFAAc,CAAC;IAEjB,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CA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CAAC,KAAK,EAAE,EAAE;YACR,IAAI,IAAI,CAAC,aAAa,EAAE;gBAAE,OAAO;YACjC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,KAAc,EAAE,OAAO,CAAC,CAAC;QAClE,CAAC,CACF,CAAC;IACJ,CAAC;IAEQ,WAAW;QAClB,KAAK,CAAC,WAAW,EAAE,CAAC;QACpB,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;IACrB,CAAC;uGAtEU,YAAY;2FAAZ,YAAY,m4BAVZ,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,iDAD1E,gBAAgB;;2FAWf,YAAY;kBAbxB,SAAS;mBAAC;oBACT,QAAQ,EAAE,eAAe;oBACzB,QAAQ,EAAE,gBAAgB;oBAC1B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC;oBACpF,IAAI,EAAE;wBACJ,QAAQ,EAAE,QAAQ;wBAClB,eAAe,EAAE,eAAe;wBAChC,YAAY,EAAE,UAAU;wBACxB,YAAY,EAAE,oBAAoB;wBAClC,WAAW,EAAE,WAAW;wBACxB,WAAW,EAAE,kBAAkB;qBAChC;iBACF","sourcesContent":["import { Component, computed, forwardRef, input } from '@angular/core';\nimport {\n isApplePlatform,\n nativePlatform,\n registerViewName,\n type HostNode,\n} from '@ng-native/fabric';\nimport type { ControlSize } from '@ng-native/device';\nimport { ControlBase, TouchableBase } from './pressable.ts';\nimport { svgIconMarkup } from './svg-icon.ts';\n\n/**\n * What a button does in its window: on macOS, Return presses `default` and Escape presses `cancel`.\n * On iOS they are styles only.\n */\nexport type ButtonKind = 'default' | 'cancel' | 'destructive' | 'plain';\n\n/**\n * A button's picture, as on `<native-tab>`: an SF Symbol on Apple's OSes, a drawable on Android, or\n * an icon's SVG markup, such as an `@ng-icons` set's, on macOS and Linux. The host draws the markup\n * in the button's text colour, as it does a symbol, and an SF Symbol given too wins on macOS.\n */\nexport type ButtonIcon =\n { readonly sfSymbol: string } | { readonly drawable: string } | { readonly svg: string };\n\n/**\n * The button on Apple's OSes is the host's: NSButton on macOS and UIButton on iOS. Android has no\n * platform button React Native draws, so there it is a view this component makes pressable.\n */\nregisterViewName(\n 'native-button',\n { ios: 'NgNativeButton', android: 'View', macos: 'NgNativeButton' },\n undefined,\n { textContent: 'title' },\n);\n\n/**\n * A platform button, its label the text inside it:\n *\n * <native-button kind=\"default\" (press)=\"save()\">Save</native-button>\n *\n * On macOS it is an NSButton, on Linux a GtkButton and on iOS a UIButton, drawn by the host, which sends\n * `topButtonPress` when it is clicked, tapped, or pressed by Space, and on macOS by Return (a\n * `default` button) or Escape (a `cancel` one). On Android it is a view pressed through the responder, as a\n * `<pressable>` is, and takes `android_ripple` as one does. The web host draws an HTML `button`.\n * It is a button to assistive technology everywhere, and takes focus.\n */\n@Component({\n selector: 'native-button',\n template: '<ng-content />',\n providers: [{ provide: TouchableBase, useExisting: forwardRef(() => NativeButton) }],\n host: {\n '[kind]': 'kind()',\n '[controlSize]': 'controlSize()',\n '[sfSymbol]': 'symbol()',\n '[drawable]': 'drawableResource()',\n '[svgIcon]': 'svgIcon()',\n '[enabled]': '!pressDisabled()',\n },\n})\nexport class NativeButton extends ControlBase {\n /**\n * What the button does in its window. In a desktop window `default` takes Return and `cancel`\n * takes Escape; elsewhere the kind is a style alone. Unset, it is a plain push button.\n */\n readonly kind = input<ButtonKind>();\n /** AppKit's control size on macOS, and UIKit's button size on iOS. Ignored elsewhere. */\n readonly controlSize = input<ControlSize>();\n /** An SF Symbol beside the label, on iOS and macOS. */\n readonly sfSymbol = input<string>();\n /** Android: a drawable resource beside the label. */\n readonly drawableName = input<string>(undefined, { alias: 'drawable' });\n /** The picture for each OS at once, as on `<native-tab>`. */\n readonly icon = input<ButtonIcon>();\n\n protected readonly symbol = computed(() => {\n const icon = this.icon();\n return this.sfSymbol() ?? (icon && 'sfSymbol' in icon ? icon.sfSymbol : undefined);\n });\n\n protected readonly drawableResource = computed(() => {\n const icon = this.icon();\n return this.drawableName() ?? (icon && 'drawable' in icon ? icon.drawable : undefined);\n });\n\n protected readonly svgIcon = computed(() => svgIconMarkup(this.icon(), 'native-button', true));\n\n /**\n * Where the host draws the button (AppKit, UIKit, GTK), it presses it: the responder would press\n * it twice.\n */\n private readonly drawnByHost = isApplePlatform() || nativePlatform() === 'linux';\n private stopPress: (() => void) | null = null;\n\n protected override roleByDefault(): 'button' {\n return 'button';\n }\n\n protected override accessibleByDefault(): boolean {\n return true;\n }\n\n protected override focusableByDefault(): boolean {\n return true;\n }\n\n protected override disabledForAccessibility(): boolean | undefined {\n return this.disabled();\n }\n\n protected override claims(): boolean {\n return !this.drawnByHost && super.claims();\n }\n\n override ngOnInit(): void {\n super.ngOnInit();\n if (!this.drawnByHost || this.stopPress) return;\n this.stopPress = this.engine.setEventListener(\n this.node as HostNode,\n 'topButtonPress',\n (event) => {\n if (this.pressDisabled()) return;\n this.emitReported(this.press, 'click', event as never, 'click');\n },\n );\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this.stopPress?.();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"native-button.js","sourceRoot":"","sources":["../src/native-button.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,cAAc,EACd,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAoB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAuB,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,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EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,iDAN1E;;;;;GAKT,4DANS,KAAK;;2FAqBJ,YAAY;kBAvBxB,SAAS;mBAAC;oBACT,QAAQ,EAAE,eAAe;oBACzB,OAAO,EAAE,CAAC,KAAK,CAAC;oBAChB,QAAQ,EAAE;;;;;GAKT;oBACD,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC;oBACpF,IAAI,EAAE;wBACJ,QAAQ,EAAE,QAAQ;wBAClB,eAAe,EAAE,eAAe;wBAChC,YAAY,EAAE,UAAU;wBACxB,YAAY,EAAE,0CAA0C;wBACxD,WAAW,EAAE,WAAW;wBACxB,aAAa,EAAE,mBAAmB;wBAClC,uBAAuB,EAAE,sCAAsC;wBAC/D,oBAAoB,EAAE,yCAAyC;wBAC/D,aAAa,EAAE,sCAAsC;wBACrD,WAAW,EAAE,kBAAkB;qBAChC;iBACF;;AAwID,oGAAoG;AACpG,SAAS,cAAc;IACrB,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO;IACzF,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACzB,OAAO,CAAC,IAAI,CACV,8EAA8E,EAAE,UAAU;QACxF,oFAAoF;QACpF,oFAAoF,CACvF,CAAC;AACJ,CAAC","sourcesContent":["import {\n Component,\n ErrorHandler,\n ViewContainerRef,\n computed,\n effect,\n forwardRef,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport {\n isApplePlatform,\n nativePlatform,\n registerViewName,\n type HostNode,\n} from '@ng-native/fabric';\nimport { SVG_ICON_RENDERER, type ControlSize } from '@ng-native/device';\nimport { Image, type ImageURISource } from './image.ts';\nimport { ControlBase, TouchableBase } from './pressable.ts';\nimport { svgIconMarkup } from './svg-icon.ts';\n\ndeclare const ngDevMode: unknown;\n\n/** Platforms already told that a button's SVG icon has nothing to draw it. */\nconst warnedNoRenderer = new Set<string>();\n\n/**\n * The side of an SVG icon drawn for iOS, in points. The button sizes it to its title's font, so\n * it is drawn large enough for the largest text size to scale it down rather than up.\n */\nconst IOS_SVG_SIZE = 40;\n\n/** The side of an Android button's icon, in points: Material's for an icon in a button. */\nconst ANDROID_ICON_SIZE = 18;\n\n/**\n * What a button does in its window: on macOS, Return presses `default` and Escape presses `cancel`.\n * On iOS they are styles only.\n */\nexport type ButtonKind = 'default' | 'cancel' | 'destructive' | 'plain';\n\n/**\n * A button's picture, as on `<native-tab>`: an SF Symbol on Apple's OSes, a drawable on Android, or\n * an icon's SVG markup, such as an `@ng-icons` set's. macOS and Linux draw the markup themselves,\n * and iOS and Android draw it through the renderer `SVG_ICON_RENDERER` provides. It is drawn in the\n * button's text colour, as a symbol is, and an SF Symbol given too wins on macOS.\n */\nexport type ButtonIcon =\n { readonly sfSymbol: string } | { readonly drawable: string } | { readonly svg: string };\n\n/**\n * The button on Apple's OSes is the host's: NSButton on macOS and UIButton on iOS. Android has no\n * platform button React Native draws, so there it is a view this component makes pressable.\n */\nregisterViewName(\n 'native-button',\n { ios: 'NgNativeButton', android: 'View', macos: 'NgNativeButton' },\n undefined,\n { textContent: 'title' },\n);\n\n/**\n * A platform button, its label the text inside it:\n *\n * <native-button kind=\"default\" (press)=\"save()\">Save</native-button>\n *\n * On macOS it is an NSButton, on Linux a GtkButton and on iOS a UIButton, drawn by the host, which sends\n * `topButtonPress` when it is clicked, tapped, or pressed by Space, and on macOS by Return (a\n * `default` button) or Escape (a `cancel` one). On Android it is a view pressed through the responder, as a\n * `<pressable>` is, and takes `android_ripple` as one does. The web host draws an HTML `button`.\n * It is a button to assistive technology everywhere, and takes focus.\n */\n@Component({\n selector: 'native-button',\n imports: [Image],\n template: `\n @if (androidPicture(); as source) {\n <image [source]=\"source\" [tintColor]=\"tint()\" style=\"width: 18px; height: 18px\" />\n }\n <ng-content />\n `,\n providers: [{ provide: TouchableBase, useExisting: forwardRef(() => NativeButton) }],\n host: {\n '[kind]': 'kind()',\n '[controlSize]': 'controlSize()',\n '[sfSymbol]': 'symbol()',\n '[drawable]': 'android ? undefined : drawableResource()',\n '[svgIcon]': 'svgIcon()',\n '[iconImage]': 'iosPicture()?.uri',\n '[style.flexDirection]': 'androidPicture() ? \"row\" : undefined',\n '[style.alignItems]': 'androidPicture() ? \"center\" : undefined',\n '[style.gap]': 'androidPicture() ? \"8px\" : undefined',\n '[enabled]': '!pressDisabled()',\n },\n})\nexport class NativeButton extends ControlBase {\n /**\n * What the button does in its window. In a desktop window `default` takes Return and `cancel`\n * takes Escape; elsewhere the kind is a style alone. Unset, it is a plain push button.\n */\n readonly kind = input<ButtonKind>();\n /** AppKit's control size on macOS, and UIKit's button size on iOS. Ignored elsewhere. */\n readonly controlSize = input<ControlSize>();\n /** An SF Symbol beside the label, on iOS and macOS. */\n readonly sfSymbol = input<string>();\n /** Android: a drawable resource beside the label. */\n readonly drawableName = input<string>(undefined, { alias: 'drawable' });\n /** The picture for each OS at once, as on `<native-tab>`. */\n readonly icon = input<ButtonIcon>();\n\n protected readonly symbol = computed(() => {\n const icon = this.icon();\n return this.sfSymbol() ?? (icon && 'sfSymbol' in icon ? icon.sfSymbol : undefined);\n });\n\n protected readonly drawableResource = computed(() => {\n const icon = this.icon();\n return this.drawableName() ?? (icon && 'drawable' in icon ? icon.drawable : undefined);\n });\n\n private readonly svgRenderer = inject(SVG_ICON_RENDERER);\n private readonly svgHost = inject(ViewContainerRef);\n private readonly errors = inject(ErrorHandler);\n protected readonly android = nativePlatform() === 'android';\n /** Where the markup is drawn here, by the app's renderer, as an image. */\n private readonly drawsSvg = this.android || nativePlatform() === 'ios';\n\n protected readonly svgIcon = computed(() =>\n svgIconMarkup(this.icon(), 'native-button', !this.drawsSvg, 'macOS, Linux, iOS and Android'),\n );\n\n /** The markup drawn as an image, on iOS and Android, once the renderer has answered. */\n private readonly drawnSvg = this.drawSvg();\n\n /** The image iOS draws before the title, tinted as a symbol is. */\n protected readonly iosPicture = computed(() =>\n this.android ? undefined : (this.drawnSvg() as ImageURISource | undefined),\n );\n\n /** Android: the image before the label, a drawable's or the drawn markup. */\n protected readonly androidPicture = computed((): ImageURISource | undefined => {\n if (!this.android) return undefined;\n const drawable = this.drawableResource();\n if (drawable) return { uri: drawable };\n return this.drawnSvg() as ImageURISource | undefined;\n });\n\n /** The label's colour, which an Android icon is tinted in: black, as text is, where none is set. */\n protected readonly tint = signal<string | undefined>(undefined);\n\n constructor() {\n super();\n // Only a button with an icon follows its colour: a watch is a look at every commit.\n effect((onCleanup) => {\n if (!this.androidPicture()) return;\n const follow = (colour: unknown) => this.tint.set((colour as string | undefined) ?? 'black');\n follow(this.engine.colour(this.node));\n onCleanup(this.engine.watchColour(this.node, follow));\n });\n }\n\n /**\n * The markup drawn once by the app's renderer, where the platform draws no SVG itself. An answer\n * for an icon the button no longer has is dropped.\n */\n private drawSvg() {\n const drawn = signal<unknown>(undefined);\n if (!this.drawsSvg) return drawn;\n effect((onCleanup) => {\n const markup = this.svgIcon();\n drawn.set(undefined);\n if (!markup) return;\n if (!this.svgRenderer) return warnNoRenderer();\n let current = true;\n onCleanup(() => (current = false));\n const size = this.android ? ANDROID_ICON_SIZE : IOS_SVG_SIZE;\n this.svgRenderer.render(markup, size, this.svgHost).then(\n (source) => current && drawn.set(source ?? undefined),\n (error: unknown) => this.errors.handleError(error),\n );\n });\n return drawn;\n }\n\n /**\n * Where the host draws the button (AppKit, UIKit, GTK), it presses it: the responder would press\n * it twice.\n */\n private readonly drawnByHost = isApplePlatform() || nativePlatform() === 'linux';\n private stopPress: (() => void) | null = null;\n\n protected override roleByDefault(): 'button' {\n return 'button';\n }\n\n protected override accessibleByDefault(): boolean {\n return true;\n }\n\n protected override focusableByDefault(): boolean {\n return true;\n }\n\n protected override disabledForAccessibility(): boolean | undefined {\n return this.disabled();\n }\n\n protected override claims(): boolean {\n return !this.drawnByHost && super.claims();\n }\n\n override ngOnInit(): void {\n super.ngOnInit();\n if (!this.drawnByHost || this.stopPress) return;\n this.stopPress = this.engine.setEventListener(\n this.node as HostNode,\n 'topButtonPress',\n (event) => {\n if (this.pressDisabled()) return;\n this.emitReported(this.press, 'click', event as never, 'click');\n },\n );\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this.stopPress?.();\n }\n}\n\n/** Says once, in development, that a button's SVG icon has nothing to draw it, so it shows none. */\nfunction warnNoRenderer(): void {\n const os = nativePlatform();\n if ((typeof ngDevMode !== 'undefined' && !ngDevMode) || warnedNoRenderer.has(os)) return;\n warnedNoRenderer.add(os);\n console.warn(\n `[angular-native] <native-button> has an SVG icon and nothing to draw it on ${os}, so it ` +\n `shows none. Add withSvgIcons(SvgImages) to provideNativeRouter (withSvgIcons from ` +\n `@ng-native/router, SvgImages from @ng-native/icons), or provide SVG_ICON_RENDERER.`,\n );\n}\n"]}
|
package/dist/press-menu.d.ts
CHANGED
|
@@ -2,7 +2,10 @@ import { InjectionToken, type TemplateRef } from '@angular/core';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
/** The `[menu]` on a `<pressable>`, which a press opens instead of firing `(press)`. */
|
|
4
4
|
export declare const PRESS_MENU: InjectionToken<{
|
|
5
|
-
|
|
5
|
+
/** Whether a press opened the menu, or the host's own touch did, so `(press)` does not fire. */
|
|
6
|
+
takePress(): boolean;
|
|
7
|
+
/** Tell it when the pressable refuses presses, so the host draws no menu then. */
|
|
8
|
+
disableWhile(disabled: () => boolean): void;
|
|
6
9
|
}>;
|
|
7
10
|
/**
|
|
8
11
|
* A menu a press opens: `<pressable [menu]="menu">`, with `<ng-template #menu>` holding
|
|
@@ -11,29 +14,47 @@ export declare const PRESS_MENU: InjectionToken<{
|
|
|
11
14
|
* select is a menu of `[checked]` items. `open()` opens it from code: `#sort="pressMenu"` names it in
|
|
12
15
|
* the template.
|
|
13
16
|
*
|
|
14
|
-
* macOS draws it as an `NSMenu` under the element, Linux as a popover menu below it,
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* macOS draws it as an `NSMenu` under the element, Linux as a popover menu below it, Android as a
|
|
18
|
+
* PopupMenu below it, and iOS as a UIMenu from a clear button laid over the element, which a touch
|
|
19
|
+
* or VoiceOver's activation opens. Android and iOS take the `NgNativeMenus` module that Expo Go
|
|
20
|
+
* lacks. iOS has no way to open the menu from code, so `open()` there opens none. Other hosts
|
|
21
|
+
* (Expo Go, the web) draw none yet: there a press fires `(press)`, with one warning in development.
|
|
18
22
|
*
|
|
19
23
|
* The host contract: `Menus.popUpMenu(view, entries)` with the view's tag and the menu as
|
|
20
|
-
* `serializeMenu` makes it
|
|
21
|
-
*
|
|
24
|
+
* `serializeMenu` makes it, and the item chosen sent as the view's `topContextMenuSelect`, as a
|
|
25
|
+
* context menu's. On iOS, `Menus.setPressMenu(nativeID, entries)` instead, as the menu changes, and
|
|
26
|
+
* null while the pressable is disabled; the choice comes back by the view's `nativeID`.
|
|
22
27
|
*/
|
|
23
28
|
export declare class PressMenu {
|
|
24
29
|
readonly menu: import("@angular/core").InputSignal<TemplateRef<unknown> | null | undefined>;
|
|
25
30
|
private readonly node;
|
|
26
31
|
private readonly engine;
|
|
27
32
|
private readonly menus;
|
|
33
|
+
private readonly os;
|
|
28
34
|
private readonly built;
|
|
35
|
+
/** iOS's host, which takes the menu by `nativeID` and opens it on a touch itself. */
|
|
36
|
+
private readonly byNativeId;
|
|
37
|
+
private readonly disabled;
|
|
29
38
|
constructor();
|
|
39
|
+
disableWhile(disabled: () => boolean): void;
|
|
40
|
+
/**
|
|
41
|
+
* Whether a press is the menu's: on iOS the host's own touch opened it, wherever it has the
|
|
42
|
+
* menu; elsewhere `open()` opens it now.
|
|
43
|
+
*/
|
|
44
|
+
takePress(): boolean;
|
|
30
45
|
/**
|
|
31
46
|
* Ask the host to open the menu under the element now. True once the request is sent, which
|
|
32
47
|
* does not mean the menu showed: the host draws none for a view it is not showing (no window on
|
|
33
48
|
* macOS, not mapped on Linux), and does not report that. False when no request is sent: the menu
|
|
34
|
-
* shows no item, the element has no view yet, or the host draws no press menu
|
|
49
|
+
* shows no item, the element has no view yet, or the host draws no press menu, or opens it only
|
|
50
|
+
* on a touch (iOS).
|
|
35
51
|
*/
|
|
36
52
|
open(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Keep the host's menu on the view as the menu and the pressable's disabled state change, by
|
|
55
|
+
* its `nativeID`, and take it away as the element goes.
|
|
56
|
+
*/
|
|
57
|
+
private sendByNativeId;
|
|
37
58
|
static ɵfac: i0.ɵɵFactoryDeclaration<PressMenu, never>;
|
|
38
59
|
static ɵdir: i0.ɵɵDirectiveDeclaration<PressMenu, "pressable[menu]", ["pressMenu"], { "menu": { "alias": "menu"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
39
60
|
}
|
package/dist/press-menu.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import { DestroyRef, Directive, ElementRef, InjectionToken, Injector, forwardRef, inject, input, untracked, } from '@angular/core';
|
|
1
|
+
import { DestroyRef, Directive, ElementRef, InjectionToken, Injector, effect, forwardRef, inject, input, signal, untracked, } from '@angular/core';
|
|
2
2
|
import { Menus, OS } from '@ng-native/device';
|
|
3
3
|
import { HostEngine } from '@ng-native/fabric';
|
|
4
4
|
import { templateMenu } from "./context-menu.js";
|
|
5
|
+
import { byNativeId } from "./native-id.js";
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
/** The `[menu]` on a `<pressable>`, which a press opens instead of firing `(press)`. */
|
|
7
8
|
export const PRESS_MENU = new InjectionToken('angular-native.pressMenu');
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const drawsNone = '[menu] on a <pressable>: this host draws no menu on a press yet (macOS, Linux, Android and ' +
|
|
10
|
+
'iOS do), so the press fires (press) instead.';
|
|
11
|
+
const opensNoneOnIos = "PressMenu.open(): iOS opens a press menu only on a touch or a screen reader's press, and has " +
|
|
12
|
+
'no way to open one from code, so this opens none.';
|
|
13
|
+
/** The warnings given in development, each once. */
|
|
14
|
+
const warned = new Set();
|
|
15
|
+
function warnOnce(message) {
|
|
16
|
+
if (typeof ngDevMode === 'undefined' || !ngDevMode || warned.has(message))
|
|
17
|
+
return;
|
|
18
|
+
warned.add(message);
|
|
19
|
+
console.warn(message);
|
|
20
|
+
}
|
|
10
21
|
/**
|
|
11
22
|
* A menu a press opens: `<pressable [menu]="menu">`, with `<ng-template #menu>` holding
|
|
12
23
|
* `<menu-item>`s, as a `[contextMenu]` is written. A click, a screen reader's press or, on macOS,
|
|
@@ -14,14 +25,16 @@ let warned = false;
|
|
|
14
25
|
* select is a menu of `[checked]` items. `open()` opens it from code: `#sort="pressMenu"` names it in
|
|
15
26
|
* the template.
|
|
16
27
|
*
|
|
17
|
-
* macOS draws it as an `NSMenu` under the element, Linux as a popover menu below it,
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
28
|
+
* macOS draws it as an `NSMenu` under the element, Linux as a popover menu below it, Android as a
|
|
29
|
+
* PopupMenu below it, and iOS as a UIMenu from a clear button laid over the element, which a touch
|
|
30
|
+
* or VoiceOver's activation opens. Android and iOS take the `NgNativeMenus` module that Expo Go
|
|
31
|
+
* lacks. iOS has no way to open the menu from code, so `open()` there opens none. Other hosts
|
|
32
|
+
* (Expo Go, the web) draw none yet: there a press fires `(press)`, with one warning in development.
|
|
21
33
|
*
|
|
22
34
|
* The host contract: `Menus.popUpMenu(view, entries)` with the view's tag and the menu as
|
|
23
|
-
* `serializeMenu` makes it
|
|
24
|
-
*
|
|
35
|
+
* `serializeMenu` makes it, and the item chosen sent as the view's `topContextMenuSelect`, as a
|
|
36
|
+
* context menu's. On iOS, `Menus.setPressMenu(nativeID, entries)` instead, as the menu changes, and
|
|
37
|
+
* null while the pressable is disabled; the choice comes back by the view's `nativeID`.
|
|
25
38
|
*/
|
|
26
39
|
export class PressMenu {
|
|
27
40
|
menu = input(/* @ts-ignore */
|
|
@@ -29,7 +42,12 @@ export class PressMenu {
|
|
|
29
42
|
node = inject(ElementRef).nativeElement;
|
|
30
43
|
engine = inject(HostEngine);
|
|
31
44
|
menus = inject(Menus);
|
|
32
|
-
|
|
45
|
+
os = inject(OS);
|
|
46
|
+
built = templateMenu(() => this.menu() ?? null, inject(Injector), this.os);
|
|
47
|
+
/** iOS's host, which takes the menu by `nativeID` and opens it on a touch itself. */
|
|
48
|
+
byNativeId = this.os === 'ios' && this.menus.pressMenuByNativeId;
|
|
49
|
+
disabled = signal(() => false, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
33
51
|
constructor() {
|
|
34
52
|
const stop = this.engine.setEventListener(this.node, 'topContextMenuSelect', (event) => {
|
|
35
53
|
const id = event.nativeEvent?.id;
|
|
@@ -37,23 +55,32 @@ export class PressMenu {
|
|
|
37
55
|
this.built.choose(id);
|
|
38
56
|
});
|
|
39
57
|
inject(DestroyRef).onDestroy(stop);
|
|
58
|
+
if (this.byNativeId)
|
|
59
|
+
this.sendByNativeId();
|
|
60
|
+
}
|
|
61
|
+
disableWhile(disabled) {
|
|
62
|
+
this.disabled.set(disabled);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Whether a press is the menu's: on iOS the host's own touch opened it, wherever it has the
|
|
66
|
+
* menu; elsewhere `open()` opens it now.
|
|
67
|
+
*/
|
|
68
|
+
takePress() {
|
|
69
|
+
return this.byNativeId ? untracked(this.built.sent) !== null : this.open();
|
|
40
70
|
}
|
|
41
71
|
/**
|
|
42
72
|
* Ask the host to open the menu under the element now. True once the request is sent, which
|
|
43
73
|
* does not mean the menu showed: the host draws none for a view it is not showing (no window on
|
|
44
74
|
* macOS, not mapped on Linux), and does not report that. False when no request is sent: the menu
|
|
45
|
-
* shows no item, the element has no view yet, or the host draws no press menu
|
|
75
|
+
* shows no item, the element has no view yet, or the host draws no press menu, or opens it only
|
|
76
|
+
* on a touch (iOS).
|
|
46
77
|
*/
|
|
47
78
|
open() {
|
|
48
79
|
const entries = untracked(this.built.sent);
|
|
49
80
|
if (!entries)
|
|
50
81
|
return false;
|
|
51
82
|
if (!this.menus.popsUpMenus) {
|
|
52
|
-
|
|
53
|
-
warned = true;
|
|
54
|
-
console.warn('[menu] on a <pressable>: this host draws no menu on a press yet (macOS, Linux and ' +
|
|
55
|
-
'Android do), so the press fires (press) instead.');
|
|
56
|
-
}
|
|
83
|
+
warnOnce(this.byNativeId ? opensNoneOnIos : drawsNone);
|
|
57
84
|
return false;
|
|
58
85
|
}
|
|
59
86
|
const view = this.engine.tagOf?.(this.node) ?? null;
|
|
@@ -62,6 +89,19 @@ export class PressMenu {
|
|
|
62
89
|
this.menus.popUpMenu(view, entries);
|
|
63
90
|
return true;
|
|
64
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Keep the host's menu on the view as the menu and the pressable's disabled state change, by
|
|
94
|
+
* its `nativeID`, and take it away as the element goes.
|
|
95
|
+
*/
|
|
96
|
+
sendByNativeId() {
|
|
97
|
+
const choose = (id) => this.built.choose(id);
|
|
98
|
+
const shown = () => (this.disabled()() ? null : this.built.sent());
|
|
99
|
+
const send = byNativeId(this.engine, this.node, (nativeID) => this.menus.setPressMenu(nativeID, untracked(shown), choose), (nativeID) => this.menus.setPressMenu(nativeID, null, choose));
|
|
100
|
+
effect(() => {
|
|
101
|
+
shown();
|
|
102
|
+
send();
|
|
103
|
+
});
|
|
104
|
+
}
|
|
65
105
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: PressMenu, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
66
106
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.0", type: PressMenu, isStandalone: true, selector: "pressable[menu]", inputs: { menu: { classPropertyName: "menu", publicName: "menu", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: PRESS_MENU, useExisting: forwardRef(() => PressMenu) }], exportAs: ["pressMenu"], ngImport: i0 });
|
|
67
107
|
}
|
package/dist/press-menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"press-menu.js","sourceRoot":"","sources":["../src/press-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,SAAS,GAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAiB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;;
|
|
1
|
+
{"version":3,"file":"press-menu.js","sourceRoot":"","sources":["../src/press-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,QAAQ,EACR,MAAM,EACN,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,GAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAiB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;;AAE5C,wFAAwF;AACxF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,cAAc,CAKzC,0BAA0B,CAAC,CAAC;AAI/B,MAAM,SAAS,GACb,6FAA6F;IAC7F,8CAA8C,CAAC;AACjD,MAAM,cAAc,GAClB,+FAA+F;IAC/F,mDAAmD,CAAC;AAEtD,oDAAoD;AACpD,MAAM,MAAM,GAAG,I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,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QACnE,MAAM,IAAI,GAAG,UAAU,CACrB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,IAAI,EACT,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,EACzE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAC9D,CAAC;QACF,MAAM,CAAC,GAAG,EAAE;YACV,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC;uGAtEU,SAAS;2FAAT,SAAS,+LAFT,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;;2FAEnE,SAAS;kBALrB,SAAS;mBAAC;oBACT,QAAQ,EAAE,iBAAiB;oBAC3B,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC;iBAC/E","sourcesContent":["import {\n DestroyRef,\n Directive,\n ElementRef,\n InjectionToken,\n Injector,\n effect,\n forwardRef,\n inject,\n input,\n signal,\n untracked,\n type TemplateRef,\n} from '@angular/core';\nimport { Menus, OS } from '@ng-native/device';\nimport { HostEngine, type HostNode } from '@ng-native/fabric';\nimport { templateMenu } from './context-menu.ts';\nimport { byNativeId } from './native-id.ts';\n\n/** The `[menu]` on a `<pressable>`, which a press opens instead of firing `(press)`. */\nexport const PRESS_MENU = new InjectionToken<{\n /** Whether a press opened the menu, or the host's own touch did, so `(press)` does not fire. */\n takePress(): boolean;\n /** Tell it when the pressable refuses presses, so the host draws no menu then. */\n disableWhile(disabled: () => boolean): void;\n}>('angular-native.pressMenu');\n\ndeclare const ngDevMode: unknown;\n\nconst drawsNone =\n '[menu] on a <pressable>: this host draws no menu on a press yet (macOS, Linux, Android and ' +\n 'iOS do), so the press fires (press) instead.';\nconst opensNoneOnIos =\n \"PressMenu.open(): iOS opens a press menu only on a touch or a screen reader's press, and has \" +\n 'no way to open one from code, so this opens none.';\n\n/** The warnings given in development, each once. */\nconst warned = new Set<string>();\n\nfunction warnOnce(message: string): void {\n if (typeof ngDevMode === 'undefined' || !ngDevMode || warned.has(message)) return;\n warned.add(message);\n console.warn(message);\n}\n\n/**\n * A menu a press opens: `<pressable [menu]=\"menu\">`, with `<ng-template #menu>` holding\n * `<menu-item>`s, as a `[contextMenu]` is written. A click, a screen reader's press or, on macOS,\n * Space on the focused element opens it under the element, and `(press)` does not fire. A pop-up\n * select is a menu of `[checked]` items. `open()` opens it from code: `#sort=\"pressMenu\"` names it in\n * the template.\n *\n * macOS draws it as an `NSMenu` under the element, Linux as a popover menu below it, Android as a\n * PopupMenu below it, and iOS as a UIMenu from a clear button laid over the element, which a touch\n * or VoiceOver's activation opens. Android and iOS take the `NgNativeMenus` module that Expo Go\n * lacks. iOS has no way to open the menu from code, so `open()` there opens none. Other hosts\n * (Expo Go, the web) draw none yet: there a press fires `(press)`, with one warning in development.\n *\n * The host contract: `Menus.popUpMenu(view, entries)` with the view's tag and the menu as\n * `serializeMenu` makes it, and the item chosen sent as the view's `topContextMenuSelect`, as a\n * context menu's. On iOS, `Menus.setPressMenu(nativeID, entries)` instead, as the menu changes, and\n * null while the pressable is disabled; the choice comes back by the view's `nativeID`.\n */\n@Directive({\n selector: 'pressable[menu]',\n exportAs: 'pressMenu',\n providers: [{ provide: PRESS_MENU, useExisting: forwardRef(() => PressMenu) }],\n})\nexport class PressMenu {\n readonly menu = input<TemplateRef<unknown> | null>();\n\n private readonly node = inject(ElementRef).nativeElement as HostNode;\n private readonly engine = inject(HostEngine);\n private readonly menus = inject(Menus);\n private readonly os = inject(OS);\n private readonly built = templateMenu(() => this.menu() ?? null, inject(Injector), this.os);\n /** iOS's host, which takes the menu by `nativeID` and opens it on a touch itself. */\n private readonly byNativeId = this.os === 'ios' && this.menus.pressMenuByNativeId;\n private readonly disabled = signal<() => boolean>(() => false);\n\n constructor() {\n const stop = this.engine.setEventListener(this.node, 'topContextMenuSelect', (event) => {\n const id = (event as { nativeEvent?: { id?: string } }).nativeEvent?.id;\n if (id !== undefined) this.built.choose(id);\n });\n inject(DestroyRef).onDestroy(stop);\n if (this.byNativeId) this.sendByNativeId();\n }\n\n disableWhile(disabled: () => boolean): void {\n this.disabled.set(disabled);\n }\n\n /**\n * Whether a press is the menu's: on iOS the host's own touch opened it, wherever it has the\n * menu; elsewhere `open()` opens it now.\n */\n takePress(): boolean {\n return this.byNativeId ? untracked(this.built.sent) !== null : this.open();\n }\n\n /**\n * Ask the host to open the menu under the element now. True once the request is sent, which\n * does not mean the menu showed: the host draws none for a view it is not showing (no window on\n * macOS, not mapped on Linux), and does not report that. False when no request is sent: the menu\n * shows no item, the element has no view yet, or the host draws no press menu, or opens it only\n * on a touch (iOS).\n */\n open(): boolean {\n const entries = untracked(this.built.sent);\n if (!entries) return false;\n if (!this.menus.popsUpMenus) {\n warnOnce(this.byNativeId ? opensNoneOnIos : drawsNone);\n return false;\n }\n const view = this.engine.tagOf?.(this.node) ?? null;\n if (view === null) return false;\n this.menus.popUpMenu(view, entries);\n return true;\n }\n\n /**\n * Keep the host's menu on the view as the menu and the pressable's disabled state change, by\n * its `nativeID`, and take it away as the element goes.\n */\n private sendByNativeId(): void {\n const choose = (id: string) => this.built.choose(id);\n const shown = () => (this.disabled()() ? null : this.built.sent());\n const send = byNativeId(\n this.engine,\n this.node,\n (nativeID) => this.menus.setPressMenu(nativeID, untracked(shown), choose),\n (nativeID) => this.menus.setPressMenu(nativeID, null, choose),\n );\n effect(() => {\n shown();\n send();\n });\n }\n}\n"]}
|
package/dist/pressable.js
CHANGED
|
@@ -201,6 +201,7 @@ export class TouchableBase extends ViewBase {
|
|
|
201
201
|
},
|
|
202
202
|
};
|
|
203
203
|
};
|
|
204
|
+
this.pressMenu?.disableWhile(() => this.pressDisabled());
|
|
204
205
|
}
|
|
205
206
|
/** Called as a press starts and ends, for a subclass that shows it natively. `Text` does. */
|
|
206
207
|
pressedChanged(_pressed) { }
|
|
@@ -491,7 +492,7 @@ export class TouchableBase extends ViewBase {
|
|
|
491
492
|
emitReported(output, type, event, source) {
|
|
492
493
|
const observers = interactionObservers(this.injector);
|
|
493
494
|
const interaction = observers && this.describeInteraction(type, event, source);
|
|
494
|
-
if (output !== this.press || !this.pressMenu?.
|
|
495
|
+
if (output !== this.press || !this.pressMenu?.takePress())
|
|
495
496
|
output.emit(event);
|
|
496
497
|
if (observers && interaction)
|
|
497
498
|
notifyInteraction(observers, interaction);
|
package/dist/pressable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressable.js","sourceRoot":"","sources":["../src/pressable.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,MAAM,GAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,cAAc,GAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,GAGX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAA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a;kBAHzB,SAAS;mBAAC;oBACT,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,CAAC;iBACtF;;AAqCD;;;;;;GAMG;AAMH,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC,4FAA4F;IACzE,mBAAmB;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAEkB,kBAAkB;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEkB,wBAAwB;QACzC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;uGAZU,SAAS;2FAAT,SAAS,wDAFT,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;;2FAEtE,SAAS;kBALrB,SAAS;mBAAC;oBACT,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC;iBAClF","sourcesContent":["/**\n * Press handling, built on the engine's responder system as RN's `Pressability` is.\n *\n * `onPress` is not a native event: RN synthesises it in JS from the touch primitives, with a\n * press rectangle, delays and a long-press timer around them. This is that machine, on the same\n * responder negotiation, so a button and an enclosing scroll view agree on who owns a drag.\n */\nimport {\n Directive,\n Injector,\n computed,\n forwardRef,\n inject,\n input,\n output,\n runInInjectionContext,\n signal,\n type Signal,\n} from '@angular/core';\nimport { Menus } from '@ng-native/device';\nimport {\n isTouchPointer,\n nativePlatform,\n type HostNode,\n type NativeSyntheticEvent,\n} from '@ng-native/fabric';\nimport { CONTEXT_MENU } from './context-menu.ts';\nimport { PRESS_MENU } from './press-menu.ts';\nimport type { Insets, TouchEvent } from './events.ts';\nimport {\n describeElement,\n interactionObservers,\n notifyInteraction,\n textWithin,\n type InteractionEvent,\n type InteractionType,\n} from './interaction-observer.ts';\nimport { byNativeId } from './native-id.ts';\nimport { booleanOr, numberOr, optionalBoolean } from './transforms.ts';\nimport { ViewBase } from './view-base.ts';\n\n/** What a press handler receives: RN's `{nativeEvent}` shape, passed straight through. */\nexport type PressEvent = TouchEvent;\n\n/**\n * Android's ripple, drawn natively. `foreground` paints it over the content rather than behind.\n */\nexport interface AndroidRipple {\n readonly color?: string | number;\n readonly borderless?: boolean;\n readonly radius?: number;\n readonly foreground?: boolean;\n}\n\n/**\n * How far outside its own bounds a control keeps a press: RN's `DEFAULT_PRESS_RECT_OFFSETS`.\n * More room below, because a thumb rolls downwards as it lifts.\n */\nconst DEFAULT_PRESS_RETENTION: Required<Insets> = { top: 20, left: 20, right: 20, bottom: 30 };\n/** RN's `DEFAULT_LONG_PRESS_DELAY_MS`. */\nconst DEFAULT_LONG_PRESS_DELAY = 500;\n/** RN's `DEFAULT_MIN_PRESS_DURATION`: the pressed look stays at least this long on a quick tap. */\nconst DEFAULT_MIN_PRESS_DURATION = 130;\n\n/**\n * Used only until a control has been measured. RN measures the view and cancels when the touch\n * leaves its bounds plus the retention offset; before the first layout arrives there are no\n * bounds to compare against, so fall back to a small movement threshold rather than treating a\n * drag of any length as a tap.\n */\nconst PRESS_CANCEL_DISTANCE = 15;\n\nconst insets = (value: Insets | number | undefined, fallback: Required<Insets>) => {\n if (value === undefined) return fallback;\n if (typeof value === 'number') return { top: value, left: value, right: value, bottom: value };\n return {\n top: value.top ?? 0,\n left: value.left ?? 0,\n right: value.right ?? 0,\n bottom: value.bottom ?? 0,\n };\n};\n\n/** Page-space touch point, tolerating the several shapes a Fabric touch payload can take. */\nfunction touchPoint(event: NativeSyntheticEvent): { x: number; y: number } {\n const native = (event.nativeEvent ?? {}) as {\n pageX?: number;\n pageY?: number;\n touches?: { pageX?: number; pageY?: number }[];\n };\n const touch = native.touches?.[0];\n return {\n x: native.pageX ?? touch?.pageX ?? 0,\n y: native.pageY ?? touch?.pageY ?? 0,\n };\n}\n\ntype TouchPosition = { pageX?: number; pageY?: number; locationX?: number; locationY?: number };\n\n/**\n * Where the touch was, in the window and in the view it landed on, or nothing for a press that\n * had no touch. A release carries the point on the event itself or in `changedTouches`, since the\n * lifted touch is no longer in `touches`.\n */\nfunction touchPosition(event: NativeSyntheticEvent): TouchPosition {\n const native = (event.nativeEvent ?? {}) as TouchPosition & {\n touches?: TouchPosition[];\n changedTouches?: TouchPosition[];\n };\n const touch = native.changedTouches?.[0] ?? native.touches?.[0];\n const position: TouchPosition = {};\n for (const key of ['pageX', 'pageY', 'locationX', 'locationY'] as const) {\n const value = native[key] ?? touch?.[key];\n if (typeof value === 'number') position[key] = value;\n }\n return position;\n}\n\n/** What `rippleDrawable` builds: Android's `RippleAndroid` drawable description. */\ninterface RippleDrawable {\n readonly type: 'RippleAndroid';\n readonly color: unknown;\n readonly borderless: boolean;\n readonly rippleRadius: number | undefined;\n}\n\nconst now = (): number => globalThis.performance?.now?.() ?? Date.now();\n\n/**\n * The press machine, and the base of every primitive that takes a touch.\n *\n * It declares no host bindings of its own, because `Text` extends it and a host binding runs on\n * every element that carries it, on every pass. The controls bind theirs through `ControlBase`.\n */\n@Directive()\nexport abstract class TouchableBase extends ViewBase {\n /**\n * Ignore touches entirely. Undefined until set, because React Native tells \"not passed\" from\n * \"passed false\": only a passed `disabled` wins over `aria-disabled` in what is announced.\n */\n readonly disabled = input(undefined, { transform: optionalBoolean });\n\n /**\n * How far outside the hit area a touch may wander before the press is cancelled. Native's\n * `hitSlop` grows the area a touch can start in; this grows the area it may move within.\n */\n readonly pressRetentionOffset = input<Insets | number>();\n /** Milliseconds a touch must be held before `(longPress)` fires. */\n readonly delayLongPress = input(DEFAULT_LONG_PRESS_DELAY, {\n transform: numberOr(DEFAULT_LONG_PRESS_DELAY),\n });\n /** Milliseconds between the touch landing and `(pressIn)`, so a scroll can start first. */\n readonly delayPressIn = input(0, { transform: numberOr(0) });\n /** Milliseconds between the touch lifting and `(pressOut)`. */\n readonly delayPressOut = input(0, { transform: numberOr(0) });\n /** The pressed state lasts at least this long, so a quick tap still shows it. */\n readonly minPressDuration = input(DEFAULT_MIN_PRESS_DURATION, {\n transform: numberOr(DEFAULT_MIN_PRESS_DURATION),\n });\n /** Whether a scrolling ancestor may take the gesture away mid-press. */\n readonly cancelable = input(true, { transform: booleanOr(true) });\n /** Android: a native ripple on press. */\n readonly androidRipple = input<AndroidRipple>(undefined, { alias: 'android_ripple' });\n\n /** The touch lifted inside the press area. Not fired after a `(longPress)` that has a listener. */\n readonly press = output<PressEvent>();\n readonly pressIn = output<PressEvent>();\n readonly pressOut = output<PressEvent>();\n /**\n * The touch has been held for `delayLongPress`. With no listener there is no long press, as in\n * React Native, so a slow tap is still a `press`.\n */\n readonly longPress = output<PressEvent>();\n\n /** Whether a press is in progress, for the pressed look. */\n readonly pressed = signal(false);\n\n /**\n * Whether a pointer is over the control, which on this platform means an iPad with a trackpad\n * or a mouse. Always false on a phone, because a phone never sends a pointer event.\n *\n * Opted into by exactly the elements that opt into being measured, which is the same question\n * asked twice: is this a control, or is it a piece of text that merely inherits the machinery.\n * Registering on everything was the first attempt and put two props on every paragraph on\n * screen, which is the most numerous node in an app paying for a state a label cannot use.\n */\n readonly hovered = signal(false);\n\n /*\n * Methods rather than `computed()`s, because nearly every instance has no ripple and a computed\n * is an allocation per element whether or not it ever holds anything. The drawable is kept for as\n * long as the ripple it came from, which is the memo the computed was there to provide: a fresh\n * object on every pass would re-send the prop on every pass.\n */\n protected rippleBackground(): RippleDrawable | undefined {\n const ripple = this.androidRipple();\n return ripple && !ripple.foreground ? this.drawable(ripple) : undefined;\n }\n\n protected rippleForeground(): RippleDrawable | undefined {\n const ripple = this.androidRipple();\n return ripple?.foreground ? this.drawable(ripple) : undefined;\n }\n\n private drawn: { ripple: AndroidRipple; drawable: RippleDrawable } | null = null;\n\n private drawable(ripple: AndroidRipple): RippleDrawable {\n if (this.drawn?.ripple !== ripple)\n this.drawn = { ripple, drawable: this.rippleDrawable(ripple) };\n return this.drawn.drawable;\n }\n\n /**\n * The drawable description Android's `ReactDrawableHelper` reads.\n *\n * `color` goes through the engine the way every other colour prop does, and has to: the helper\n * switches on the value's runtime type and takes a number or a platform-colour map, and anything\n * else - a `'#ff0000'` written at the call site, say - falls through to `null` and the ripple\n * draws in the theme's own `colorControlHighlight` instead. Nothing is logged and nothing throws,\n * so the ripple appears and is simply the wrong colour. RN's own `TouchableNativeFeedback.Ripple`\n * calls `processColor` here for the same reason.\n */\n private rippleDrawable(ripple: AndroidRipple): RippleDrawable {\n return {\n type: 'RippleAndroid' as const,\n color: this.engine.color(ripple.color),\n borderless: ripple.borderless ?? false,\n rippleRadius: ripple.radius,\n };\n }\n\n /** Where the touch started, so a drag can be told apart from a tap. */\n private origin: { x: number; y: number } | null = null;\n /** The control's own size, from its last layout. Null until it has been measured once. */\n private size: { width: number; height: number } | null = null;\n private cancelled = false;\n private longPressed = false;\n /** How many `(longPress)` listeners there are; the long-press clock only runs with one. */\n private longPressListeners = 0;\n /** A `[contextMenu]` on the same element, whose menu a long press may open instead. */\n private readonly contextMenu = inject(CONTEXT_MENU, { self: true, optional: true });\n /** A `[menu]` on the same element, which a press opens instead of firing `(press)`. */\n private readonly pressMenu = inject(PRESS_MENU, { self: true, optional: true });\n /**\n * For `Menus`, read only where there is a `(longPress)` (see `takeLongPressFromMenus`), and for\n * the interaction observers, read only once something is pressed.\n */\n private readonly injector = inject(Injector);\n private pressedAt = 0;\n private pressInTimer: ReturnType<typeof setTimeout> | null = null;\n private longPressTimer: ReturnType<typeof setTimeout> | null = null;\n /** Whether a `[contextMenu]` inside this element took this press's hold, as the press began. */\n private menuOwnsHold = false;\n private pressOutTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n super();\n // output() has to be a member's own initializer for the compiler to see it, so its listeners\n // are counted here, through its public subscribe.\n const subscribe = this.longPress.subscribe.bind(this.longPress);\n this.longPress.subscribe = (callback) => {\n this.longPressListeners++;\n const subscription = subscribe(callback);\n let open = true;\n return {\n unsubscribe: () => {\n if (open) this.longPressListeners--;\n open = false;\n subscription.unsubscribe();\n },\n };\n };\n }\n\n /** Called as a press starts and ends, for a subclass that shows it natively. `Text` does. */\n protected pressedChanged(_pressed: boolean): void {}\n\n /** Whether a touch starting on this node should be claimed. `Text` narrows it. */\n protected claims(): boolean {\n return !this.pressDisabled();\n }\n\n /**\n * Whether presses are refused. `Pressable.js` gives Pressability `disabled` alone, so here\n * `aria-disabled` and `accessibilityState.disabled` change what is announced and nothing else.\n * `TouchableOpacity` and `Text` widen it.\n */\n protected pressDisabled(): boolean {\n return !!this.disabled();\n }\n\n /**\n * `TouchableOpacity.js` and `Text.js`: `disabled ?? aria-disabled ?? accessibilityState.disabled`,\n * which is the merged announced state whenever `disabled` is unset.\n */\n protected disabledByAnyState(): boolean {\n return (this.disabled() ?? this.accessibilityStateProp()?.disabled) === true;\n }\n\n /**\n * Whether the control's size should be tracked. Native only measures a view that asks, so\n * this must not be true for every `<text>`: a pressable text opts in, a label never does.\n */\n protected measures(): boolean {\n return true;\n }\n\n /**\n * Whether a touch this far from where it started is still on the control.\n *\n * Distance from the origin is the wrong question on anything large: a thumb tap on a full-width\n * button easily travels twenty points without ever leaving it, and cancelling there reads as\n * \"the button doesn't work\", intermittently and only for some people. What matters is whether\n * the finger is still within the control plus its hit slop, plus the slop RN allows.\n *\n * The touch began somewhere inside the control but we do not know where, so the bound is the\n * full extent rather than half of it. That errs towards keeping the press, which is the right\n * way to be wrong: a press that survives a drag the user meant as a scroll is a smaller sin\n * than a tap that does nothing.\n */\n private stillOnControl(dx: number, dy: number): boolean {\n if (!this.size) return Math.hypot(dx, dy) <= PRESS_CANCEL_DISTANCE;\n const slop = insets(this.hitSlop(), { top: 0, left: 0, right: 0, bottom: 0 });\n const keep = insets(this.pressRetentionOffset(), DEFAULT_PRESS_RETENTION);\n const horizontal = dx < 0 ? slop.left + keep.left : slop.right + keep.right;\n const vertical = dy < 0 ? slop.top + keep.top : slop.bottom + keep.bottom;\n return (\n Math.abs(dx) <= this.size.width + horizontal && Math.abs(dy) <= this.size.height + vertical\n );\n }\n\n /**\n * A lifecycle hook rather than `inject(DestroyRef).onDestroy`: Angular registers a hook once per\n * directive type, where the callback was a closure and a lookup for every instance - and every\n * `<text>` on screen is one.\n */\n ngOnDestroy(): void {\n this.clearTimers();\n this.stopResponding?.();\n this.stopLayout?.();\n this.stopHover?.();\n this.stopClick?.();\n }\n\n private stopResponding: (() => void) | null = null;\n private stopLayout: (() => void) | null = null;\n private stopHover: (() => void) | null = null;\n private stopClick: (() => void) | null = null;\n\n override ngOnInit(): void {\n super.ngOnInit();\n this.respondIfNeeded();\n this.measureIfNeeded();\n this.hoverIfNeeded();\n this.clickIfNeeded();\n if (this.longPressListeners) this.takeLongPressFromMenus();\n }\n\n /**\n * Tell a host that opens a `[contextMenu]` on a long press (Android, iOS) that this view takes\n * its own, so one on it opens no menu around it: the innermost handler wins, as in a native\n * app. Every such view, not only one inside a menu, since a menu can be around it from another\n * template. A view with its own menu still opens that.\n */\n private takeLongPressFromMenus(): void {\n const menus = this.injector.get(Menus);\n if (!menus.longPressByNativeId) return;\n runInInjectionContext(this.injector, () =>\n byNativeId(\n this.engine,\n this.node,\n (nativeID) => menus.setTakesLongPress(nativeID, true),\n (nativeID) => menus.setTakesLongPress(nativeID, false),\n ),\n )();\n }\n\n override ngOnChanges(): void {\n super.ngOnChanges();\n this.respondIfNeeded();\n this.measureIfNeeded();\n this.hoverIfNeeded();\n this.clickIfNeeded();\n }\n\n /**\n * A press with no touch: Android's `performClick()`, which is what Enter, the D-pad centre and\n * TalkBack's double-tap do to a focused view, and which reaches us as `topClick` alone.\n *\n * `Pressability.js` answers it in `onClick`: `onPress` and nothing around it, not while disabled,\n * and not for a click carrying a `pointerType`, which is the pointer event a touch already\n * pressed through. It presses only the view that was clicked: a touchable the click only bubbled\n * through stops it there, so neither it nor anything above it acts on a click meant for a\n * focusable view inside it.\n *\n * Android only. iOS sends a click only as a pointer event, and the web host binds `topClick` to\n * the DOM's own click, which a mouse press already reached through the responder.\n */\n private clickIfNeeded(): void {\n if (this.stopClick || !this.measures() || nativePlatform() !== 'android') return;\n this.stopClick = this.engine.setEventListener(this.node, 'topClick', (event) => {\n const click = event as PressEvent;\n if (!this.measures() || Object.hasOwn(click.nativeEvent ?? {}, 'pointerType')) return;\n if (click.target !== this.node) {\n click.stopPropagation();\n return;\n }\n if (!this.claims()) return;\n this.emitReported(this.press, 'click', click, 'click');\n });\n }\n\n /**\n * Join the responder negotiation, once this is something a touch can press.\n *\n * Behind `measures()` for the same reason as layout and hover: a `<text>` is the commonest node\n * on screen and almost never a control, and registering every one cost a handler object, six\n * closures and a responder entry apiece for a touch it would have refused anyway.\n */\n private respondIfNeeded(): void {\n if (this.stopResponding || !this.measures()) return;\n this.stopResponding = this.engine.setResponder(this.node, {\n // Claim the gesture on touch down unless disabled. Because this goes through the\n // negotiation, an ancestor can pre-empt us in the capture pass and a nested pressable\n // wins over us in the bubble pass, neither of which raw touch listeners could express.\n onStartShouldSetResponder: () => this.claims(),\n onResponderGrant: (event) => this.onGrant(event),\n onResponderMove: (event) => this.onMove(event),\n onResponderRelease: (event) => this.onRelease(event),\n onResponderTerminate: (event) => this.onTerminate(event),\n // Yield to an enclosing scroll view when it takes over the drag, unless told not to.\n onResponderTerminationRequest: () => this.cancelable(),\n });\n }\n\n /**\n * `onLayout` is opted into by the engine as soon as something listens for it, which is the only\n * way the native side reports a view's size at all, and the reason it is only asked for once\n * `measures()` says so - a `<text>` answers that from an input, and most of them say no.\n *\n * Called from the lifecycle rather than watched by an effect. An effect per element is an\n * allocation and a scheduler entry for every pressable and every piece of text on screen, to\n * notice a change these two hooks already see.\n */\n /**\n * Hover, on the same terms and behind the same question.\n *\n * Fabric will not dispatch a pointer event to a view whose props have not asked for one, and\n * the engine writes those props when something listens - so listening is the whole opt-in. The\n * gate is `measures()`, which is not what its name is about but is the right question underneath\n * it: is this an actual control, or a piece of text that merely inherits the machinery. A label\n * says no, and two props on every paragraph on screen is not a cost worth paying for a hover\n * state a label has no use for.\n *\n * Native sends pointer events only in an app that turned them on (the `pointerEvents` option\n * of `@ng-native/expo`'s config plugin), and then for a finger as well, entering what it lands\n * on and leaving as it lifts. That is not hover, so `hovered` stays false on a phone.\n */\n private hoverIfNeeded(): void {\n if (this.stopHover || !this.measures()) return;\n const enter = this.engine.setEventListener(this.node, 'topPointerEnter', (event) => {\n if (!isTouchPointer(event)) this.hovered.set(true);\n });\n const leave = this.engine.setEventListener(this.node, 'topPointerLeave', (event) => {\n if (!isTouchPointer(event)) this.hovered.set(false);\n });\n this.stopHover = () => {\n enter();\n leave();\n };\n }\n\n private measureIfNeeded(): void {\n if (this.stopLayout || !this.measures()) return;\n this.stopLayout = this.engine.setEventListener(this.node, 'topLayout', (event) => {\n const layout = (event as NativeSyntheticEvent<{ layout?: { width: number; height: number } }>)\n .nativeEvent?.layout;\n if (layout) this.size = { width: layout.width, height: layout.height };\n });\n }\n\n private onGrant(event: PressEvent): void {\n this.origin = touchPoint(event);\n this.cancelled = false;\n this.longPressed = false;\n // Decided as the press begins, as the host decides its own: a menu that arrives during a\n // delayed press-in then opens nothing, and this element keeps the long press.\n this.menuOwnsHold = this.menuTakesLongPress(event);\n this.clearTimers();\n if (this.androidRipple()) {\n const { x, y } = this.origin;\n this.engine.dispatchCommand(this.node, 'hotspotUpdate', [x, y]);\n this.engine.dispatchCommand(this.node, 'setPressed', [true]);\n }\n const delay = this.delayPressIn();\n if (delay > 0) this.pressInTimer = setTimeout(() => this.activate(event), delay);\n else this.activate(event);\n }\n\n /** `pressIn`, and the long-press clock starts from here. */\n private activate(event: PressEvent): void {\n this.pressInTimer = null;\n this.pressedAt = now();\n this.pressed.set(true);\n this.pressedChanged(true);\n this.pressIn.emit(event);\n if (!this.longPressListeners || this.contextMenu?.takesLongPress()) return;\n if (this.menuOwnsHold) return;\n this.longPressTimer = setTimeout(() => {\n this.longPressTimer = null;\n this.longPressed = true;\n this.emitReported(this.longPress, 'long-press', event, 'touch');\n }, this.delayLongPress());\n }\n\n /**\n * Whether the host opens a `[contextMenu]` inside this element on this long press, from the\n * pressed view out to this one, so `(longPress)` here does not also fire. The host decides at\n * its own long-press timeout, which can be later than `delayLongPress`.\n */\n private menuTakesLongPress(event: PressEvent): boolean {\n const menus = this.injector.get(Menus);\n if (!menus.contextMenuByNativeId) return false;\n const chain: (string | null)[] = [];\n for (let node = event.target as HostNode | null | undefined; node; node = node.parent) {\n const id = node.props['nativeID'];\n chain.push(typeof id === 'string' && id ? id : null);\n if (node === this.node) return menus.opensContextMenu(chain);\n }\n return false;\n }\n\n private onMove(event: PressEvent): void {\n if (this.cancelled || !this.origin) return;\n const point = touchPoint(event);\n if (this.stillOnControl(point.x - this.origin.x, point.y - this.origin.y)) return;\n // The finger has wandered: this is a drag, not a tap. Give up the press but stay the\n // responder, so a scroll view underneath still gets its gesture.\n this.cancelled = true;\n this.deactivate(event);\n }\n\n private onRelease(event: PressEvent): void {\n if (this.androidRipple()) this.engine.dispatchCommand(this.node, 'setPressed', [false]);\n if (this.cancelled) return;\n // Lifted before the press-in delay ran out: RN still reports a full press.\n if (this.pressInTimer) {\n clearTimeout(this.pressInTimer);\n this.activate(event);\n }\n const longPressed = this.longPressed;\n this.deactivate(event);\n if (longPressed) return;\n this.emitReported(this.press, 'click', event, 'touch');\n }\n\n /**\n * Fire a press output, and tell the app's interaction observers, if it has any, about it.\n *\n * The event is described before the output runs and handed over after it: the app's own handler\n * goes first, and one that removes the control still has it reported as it was when pressed.\n * Observers are looked up here rather than injected, because a press is rare and a lookup for\n * every `<text>` on screen is not. A press is reported whether or not anything listens to it: a\n * control that does nothing when tapped is what an observer looking for dead taps wants to hear.\n * A press on an element whose `[menu]` opens is reported, and `(press)` does not fire.\n */\n protected emitReported(\n output: { emit(event: PressEvent): void },\n type: InteractionType,\n event: PressEvent,\n source: 'touch' | 'click',\n ): void {\n const observers = interactionObservers(this.injector);\n const interaction = observers && this.describeInteraction(type, event, source);\n if (output !== this.press || !this.pressMenu?.open()) output.emit(event);\n if (observers && interaction) notifyInteraction(observers, interaction);\n }\n\n private describeInteraction(\n type: InteractionType,\n event: PressEvent,\n source: 'touch' | 'click',\n ): InteractionEvent {\n const text = textWithin(this.node);\n return {\n type,\n ...describeElement(this.engine, this.node),\n ...(text !== undefined && { text }),\n ...touchPosition(event),\n ...(this.size && { width: this.size.width, height: this.size.height }),\n source,\n timestamp: Date.now(),\n };\n }\n\n private onTerminate(event: PressEvent): void {\n if (this.androidRipple()) this.engine.dispatchCommand(this.node, 'setPressed', [false]);\n if (this.cancelled) return;\n this.cancelled = true;\n this.deactivate(event);\n }\n\n /** `pressOut`, no sooner than `minPressDuration` after `pressIn` and after `delayPressOut`. */\n private deactivate(event: PressEvent): void {\n if (this.pressInTimer) {\n clearTimeout(this.pressInTimer);\n this.pressInTimer = null;\n return;\n }\n if (this.longPressTimer) {\n clearTimeout(this.longPressTimer);\n this.longPressTimer = null;\n }\n if (!this.pressed()) return;\n const held = now() - this.pressedAt;\n const delay = Math.max(this.delayPressOut(), this.minPressDuration() - held);\n const out = () => {\n this.pressOutTimer = null;\n this.pressed.set(false);\n this.pressedChanged(false);\n this.pressOut.emit(event);\n };\n if (delay > 0) this.pressOutTimer = setTimeout(out, delay);\n else out();\n }\n\n private clearTimers(): void {\n // Every touchable is destroyed through here, and nearly all of them were never pressed.\n if (!this.pressInTimer && !this.longPressTimer && !this.pressOutTimer) return;\n for (const timer of [this.pressInTimer, this.longPressTimer, this.pressOutTimer]) {\n if (timer) clearTimeout(timer);\n }\n this.pressInTimer = this.longPressTimer = this.pressOutTimer = null;\n }\n}\n\n/**\n * A touchable that is a control: `Pressable`, `TouchableOpacity` and `PressBehavior`.\n *\n * The host bindings every control needs live here rather than on `TouchableBase`, which `Text`\n * extends: the state that follows `disabled`, and the Android ripple. Controls are few enough on\n * a screen to pay for a binding on every pass; texts are not.\n */\n@Directive({\n host: {\n // `disabled` is an input of ours, so it cannot reach `ngOnChanges` on the base; this is\n // the one binding that keeps the announced state in step with it.\n '[accessibilityState]': 'accessibilityStateProp()',\n // Nor is it left on the node for `:disabled` to read, so this is what a stylesheet matches.\n '[attr.data-disabled]': \"pressDisabled() ? '' : null\",\n '[nativeBackgroundAndroid]': 'rippleBackground()',\n '[nativeForegroundAndroid]': 'rippleForeground()',\n },\n})\nexport abstract class ControlBase extends TouchableBase {}\n\n/**\n * The press machine on its own, for a component that wants to be pressable rather than to\n * contain something that is.\n *\n * No selector: this is only ever a `hostDirectives` entry. A component listing it gets the whole\n * of `TouchableBase` on its own host node - the responder negotiation, the press rectangle, the\n * delays and the long-press timer - instead of wrapping a `<pressable>` and paying for a second\n * native view.\n *\n * It provides `TouchableBase`, so a primitive on the same node can `inject(TouchableBase)` and\n * read `pressed` without caring whether it landed on this or on a real `<pressable>`.\n */\n@Directive({\n providers: [{ provide: TouchableBase, useExisting: forwardRef(() => PressBehavior) }],\n})\nexport class PressBehavior extends ControlBase {\n /** The conditions the composing component gave, any of which disables the control. */\n private readonly conditions = signal<readonly Signal<boolean>[]>([]);\n private readonly held = computed(() => this.conditions().some((condition) => condition()));\n\n /**\n * Disable the control while `condition` is true, from the component that composes this: a\n * button that is loading, which its caller's `disabled` knows nothing of. Either one disables\n * it, as `disabled={loading || disabled}` does on React Native's `Pressable`: presses are\n * refused, a stylesheet sees `[data-disabled]`, and a screen reader is told.\n *\n * constructor() {\n * inject(PressBehavior).disableWhile(this.loading);\n * }\n */\n disableWhile(condition: Signal<boolean>): void {\n this.conditions.update((conditions) => [...conditions, condition]);\n }\n\n protected override accessibleByDefault(): boolean {\n return true;\n }\n\n protected override focusableByDefault(): boolean {\n return true;\n }\n\n protected override pressDisabled(): boolean {\n return this.held() || super.pressDisabled();\n }\n\n protected override disabledForAccessibility(): boolean | undefined {\n return this.held() ? true : this.disabled();\n }\n}\n\n/**\n * A view that responds to presses. RN's `Pressable`, with the same configuration: hit slop,\n * retention offset, press-in and press-out delays, long press, and an Android ripple.\n *\n * `pressed` is a public signal, so a template can style from it through a template reference:\n * `<pressable #p [style.opacity]=\"p.pressed() ? 0.5 : 1\">`.\n */\n@Directive({\n selector: 'pressable',\n exportAs: 'pressable',\n providers: [{ provide: TouchableBase, useExisting: forwardRef(() => Pressable) }],\n})\nexport class Pressable extends ControlBase {\n /** `Pressable.js`: a control is an accessibility element, and focusable, unless refused. */\n protected override accessibleByDefault(): boolean {\n return true;\n }\n\n protected override focusableByDefault(): boolean {\n return true;\n }\n\n protected override disabledForAccessibility(): boolean | undefined {\n return this.disabled();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pressable.js","sourceRoot":"","sources":["../src/pressable.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,MAAM,GAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,cAAc,GAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,GAGX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAe1C;;;GAGG;AACH,MAAM,uBAAuB,GAAqB,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAC/F,0CAA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AAU,SAAQ,WAAW;IACxC,4FAA4F;IACzE,mBAAmB;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAEkB,kBAAkB;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEkB,wBAAwB;QACzC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;uGAZU,SAAS;2FAAT,SAAS,wDAFT,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;;2FAEtE,SAAS;kBALrB,SAAS;mBAAC;oBACT,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC;iBAClF","sourcesContent":["/**\n * Press handling, built on the engine's responder system as RN's `Pressability` is.\n *\n * `onPress` is not a native event: RN synthesises it in JS from the touch primitives, with a\n * press rectangle, delays and a long-press timer around them. This is that machine, on the same\n * responder negotiation, so a button and an enclosing scroll view agree on who owns a drag.\n */\nimport {\n Directive,\n Injector,\n computed,\n forwardRef,\n inject,\n input,\n output,\n runInInjectionContext,\n signal,\n type Signal,\n} from '@angular/core';\nimport { Menus } from '@ng-native/device';\nimport {\n isTouchPointer,\n nativePlatform,\n type HostNode,\n type NativeSyntheticEvent,\n} from '@ng-native/fabric';\nimport { CONTEXT_MENU } from './context-menu.ts';\nimport { PRESS_MENU } from './press-menu.ts';\nimport type { Insets, TouchEvent } from './events.ts';\nimport {\n describeElement,\n interactionObservers,\n notifyInteraction,\n textWithin,\n type InteractionEvent,\n type InteractionType,\n} from './interaction-observer.ts';\nimport { byNativeId } from './native-id.ts';\nimport { booleanOr, numberOr, optionalBoolean } from './transforms.ts';\nimport { ViewBase } from './view-base.ts';\n\n/** What a press handler receives: RN's `{nativeEvent}` shape, passed straight through. */\nexport type PressEvent = TouchEvent;\n\n/**\n * Android's ripple, drawn natively. `foreground` paints it over the content rather than behind.\n */\nexport interface AndroidRipple {\n readonly color?: string | number;\n readonly borderless?: boolean;\n readonly radius?: number;\n readonly foreground?: boolean;\n}\n\n/**\n * How far outside its own bounds a control keeps a press: RN's `DEFAULT_PRESS_RECT_OFFSETS`.\n * More room below, because a thumb rolls downwards as it lifts.\n */\nconst DEFAULT_PRESS_RETENTION: Required<Insets> = { top: 20, left: 20, right: 20, bottom: 30 };\n/** RN's `DEFAULT_LONG_PRESS_DELAY_MS`. */\nconst DEFAULT_LONG_PRESS_DELAY = 500;\n/** RN's `DEFAULT_MIN_PRESS_DURATION`: the pressed look stays at least this long on a quick tap. */\nconst DEFAULT_MIN_PRESS_DURATION = 130;\n\n/**\n * Used only until a control has been measured. RN measures the view and cancels when the touch\n * leaves its bounds plus the retention offset; before the first layout arrives there are no\n * bounds to compare against, so fall back to a small movement threshold rather than treating a\n * drag of any length as a tap.\n */\nconst PRESS_CANCEL_DISTANCE = 15;\n\nconst insets = (value: Insets | number | undefined, fallback: Required<Insets>) => {\n if (value === undefined) return fallback;\n if (typeof value === 'number') return { top: value, left: value, right: value, bottom: value };\n return {\n top: value.top ?? 0,\n left: value.left ?? 0,\n right: value.right ?? 0,\n bottom: value.bottom ?? 0,\n };\n};\n\n/** Page-space touch point, tolerating the several shapes a Fabric touch payload can take. */\nfunction touchPoint(event: NativeSyntheticEvent): { x: number; y: number } {\n const native = (event.nativeEvent ?? {}) as {\n pageX?: number;\n pageY?: number;\n touches?: { pageX?: number; pageY?: number }[];\n };\n const touch = native.touches?.[0];\n return {\n x: native.pageX ?? touch?.pageX ?? 0,\n y: native.pageY ?? touch?.pageY ?? 0,\n };\n}\n\ntype TouchPosition = { pageX?: number; pageY?: number; locationX?: number; locationY?: number };\n\n/**\n * Where the touch was, in the window and in the view it landed on, or nothing for a press that\n * had no touch. A release carries the point on the event itself or in `changedTouches`, since the\n * lifted touch is no longer in `touches`.\n */\nfunction touchPosition(event: NativeSyntheticEvent): TouchPosition {\n const native = (event.nativeEvent ?? {}) as TouchPosition & {\n touches?: TouchPosition[];\n changedTouches?: TouchPosition[];\n };\n const touch = native.changedTouches?.[0] ?? native.touches?.[0];\n const position: TouchPosition = {};\n for (const key of ['pageX', 'pageY', 'locationX', 'locationY'] as const) {\n const value = native[key] ?? touch?.[key];\n if (typeof value === 'number') position[key] = value;\n }\n return position;\n}\n\n/** What `rippleDrawable` builds: Android's `RippleAndroid` drawable description. */\ninterface RippleDrawable {\n readonly type: 'RippleAndroid';\n readonly color: unknown;\n readonly borderless: boolean;\n readonly rippleRadius: number | undefined;\n}\n\nconst now = (): number => globalThis.performance?.now?.() ?? Date.now();\n\n/**\n * The press machine, and the base of every primitive that takes a touch.\n *\n * It declares no host bindings of its own, because `Text` extends it and a host binding runs on\n * every element that carries it, on every pass. The controls bind theirs through `ControlBase`.\n */\n@Directive()\nexport abstract class TouchableBase extends ViewBase {\n /**\n * Ignore touches entirely. Undefined until set, because React Native tells \"not passed\" from\n * \"passed false\": only a passed `disabled` wins over `aria-disabled` in what is announced.\n */\n readonly disabled = input(undefined, { transform: optionalBoolean });\n\n /**\n * How far outside the hit area a touch may wander before the press is cancelled. Native's\n * `hitSlop` grows the area a touch can start in; this grows the area it may move within.\n */\n readonly pressRetentionOffset = input<Insets | number>();\n /** Milliseconds a touch must be held before `(longPress)` fires. */\n readonly delayLongPress = input(DEFAULT_LONG_PRESS_DELAY, {\n transform: numberOr(DEFAULT_LONG_PRESS_DELAY),\n });\n /** Milliseconds between the touch landing and `(pressIn)`, so a scroll can start first. */\n readonly delayPressIn = input(0, { transform: numberOr(0) });\n /** Milliseconds between the touch lifting and `(pressOut)`. */\n readonly delayPressOut = input(0, { transform: numberOr(0) });\n /** The pressed state lasts at least this long, so a quick tap still shows it. */\n readonly minPressDuration = input(DEFAULT_MIN_PRESS_DURATION, {\n transform: numberOr(DEFAULT_MIN_PRESS_DURATION),\n });\n /** Whether a scrolling ancestor may take the gesture away mid-press. */\n readonly cancelable = input(true, { transform: booleanOr(true) });\n /** Android: a native ripple on press. */\n readonly androidRipple = input<AndroidRipple>(undefined, { alias: 'android_ripple' });\n\n /** The touch lifted inside the press area. Not fired after a `(longPress)` that has a listener. */\n readonly press = output<PressEvent>();\n readonly pressIn = output<PressEvent>();\n readonly pressOut = output<PressEvent>();\n /**\n * The touch has been held for `delayLongPress`. With no listener there is no long press, as in\n * React Native, so a slow tap is still a `press`.\n */\n readonly longPress = output<PressEvent>();\n\n /** Whether a press is in progress, for the pressed look. */\n readonly pressed = signal(false);\n\n /**\n * Whether a pointer is over the control, which on this platform means an iPad with a trackpad\n * or a mouse. Always false on a phone, because a phone never sends a pointer event.\n *\n * Opted into by exactly the elements that opt into being measured, which is the same question\n * asked twice: is this a control, or is it a piece of text that merely inherits the machinery.\n * Registering on everything was the first attempt and put two props on every paragraph on\n * screen, which is the most numerous node in an app paying for a state a label cannot use.\n */\n readonly hovered = signal(false);\n\n /*\n * Methods rather than `computed()`s, because nearly every instance has no ripple and a computed\n * is an allocation per element whether or not it ever holds anything. The drawable is kept for as\n * long as the ripple it came from, which is the memo the computed was there to provide: a fresh\n * object on every pass would re-send the prop on every pass.\n */\n protected rippleBackground(): RippleDrawable | undefined {\n const ripple = this.androidRipple();\n return ripple && !ripple.foreground ? this.drawable(ripple) : undefined;\n }\n\n protected rippleForeground(): RippleDrawable | undefined {\n const ripple = this.androidRipple();\n return ripple?.foreground ? this.drawable(ripple) : undefined;\n }\n\n private drawn: { ripple: AndroidRipple; drawable: RippleDrawable } | null = null;\n\n private drawable(ripple: AndroidRipple): RippleDrawable {\n if (this.drawn?.ripple !== ripple)\n this.drawn = { ripple, drawable: this.rippleDrawable(ripple) };\n return this.drawn.drawable;\n }\n\n /**\n * The drawable description Android's `ReactDrawableHelper` reads.\n *\n * `color` goes through the engine the way every other colour prop does, and has to: the helper\n * switches on the value's runtime type and takes a number or a platform-colour map, and anything\n * else - a `'#ff0000'` written at the call site, say - falls through to `null` and the ripple\n * draws in the theme's own `colorControlHighlight` instead. Nothing is logged and nothing throws,\n * so the ripple appears and is simply the wrong colour. RN's own `TouchableNativeFeedback.Ripple`\n * calls `processColor` here for the same reason.\n */\n private rippleDrawable(ripple: AndroidRipple): RippleDrawable {\n return {\n type: 'RippleAndroid' as const,\n color: this.engine.color(ripple.color),\n borderless: ripple.borderless ?? false,\n rippleRadius: ripple.radius,\n };\n }\n\n /** Where the touch started, so a drag can be told apart from a tap. */\n private origin: { x: number; y: number } | null = null;\n /** The control's own size, from its last layout. Null until it has been measured once. */\n private size: { width: number; height: number } | null = null;\n private cancelled = false;\n private longPressed = false;\n /** How many `(longPress)` listeners there are; the long-press clock only runs with one. */\n private longPressListeners = 0;\n /** A `[contextMenu]` on the same element, whose menu a long press may open instead. */\n private readonly contextMenu = inject(CONTEXT_MENU, { self: true, optional: true });\n /** A `[menu]` on the same element, which a press opens instead of firing `(press)`. */\n private readonly pressMenu = inject(PRESS_MENU, { self: true, optional: true });\n /**\n * For `Menus`, read only where there is a `(longPress)` (see `takeLongPressFromMenus`), and for\n * the interaction observers, read only once something is pressed.\n */\n private readonly injector = inject(Injector);\n private pressedAt = 0;\n private pressInTimer: ReturnType<typeof setTimeout> | null = null;\n private longPressTimer: ReturnType<typeof setTimeout> | null = null;\n /** Whether a `[contextMenu]` inside this element took this press's hold, as the press began. */\n private menuOwnsHold = false;\n private pressOutTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n super();\n // output() has to be a member's own initializer for the compiler to see it, so its listeners\n // are counted here, through its public subscribe.\n const subscribe = this.longPress.subscribe.bind(this.longPress);\n this.longPress.subscribe = (callback) => {\n this.longPressListeners++;\n const subscription = subscribe(callback);\n let open = true;\n return {\n unsubscribe: () => {\n if (open) this.longPressListeners--;\n open = false;\n subscription.unsubscribe();\n },\n };\n };\n this.pressMenu?.disableWhile(() => this.pressDisabled());\n }\n\n /** Called as a press starts and ends, for a subclass that shows it natively. `Text` does. */\n protected pressedChanged(_pressed: boolean): void {}\n\n /** Whether a touch starting on this node should be claimed. `Text` narrows it. */\n protected claims(): boolean {\n return !this.pressDisabled();\n }\n\n /**\n * Whether presses are refused. `Pressable.js` gives Pressability `disabled` alone, so here\n * `aria-disabled` and `accessibilityState.disabled` change what is announced and nothing else.\n * `TouchableOpacity` and `Text` widen it.\n */\n protected pressDisabled(): boolean {\n return !!this.disabled();\n }\n\n /**\n * `TouchableOpacity.js` and `Text.js`: `disabled ?? aria-disabled ?? accessibilityState.disabled`,\n * which is the merged announced state whenever `disabled` is unset.\n */\n protected disabledByAnyState(): boolean {\n return (this.disabled() ?? this.accessibilityStateProp()?.disabled) === true;\n }\n\n /**\n * Whether the control's size should be tracked. Native only measures a view that asks, so\n * this must not be true for every `<text>`: a pressable text opts in, a label never does.\n */\n protected measures(): boolean {\n return true;\n }\n\n /**\n * Whether a touch this far from where it started is still on the control.\n *\n * Distance from the origin is the wrong question on anything large: a thumb tap on a full-width\n * button easily travels twenty points without ever leaving it, and cancelling there reads as\n * \"the button doesn't work\", intermittently and only for some people. What matters is whether\n * the finger is still within the control plus its hit slop, plus the slop RN allows.\n *\n * The touch began somewhere inside the control but we do not know where, so the bound is the\n * full extent rather than half of it. That errs towards keeping the press, which is the right\n * way to be wrong: a press that survives a drag the user meant as a scroll is a smaller sin\n * than a tap that does nothing.\n */\n private stillOnControl(dx: number, dy: number): boolean {\n if (!this.size) return Math.hypot(dx, dy) <= PRESS_CANCEL_DISTANCE;\n const slop = insets(this.hitSlop(), { top: 0, left: 0, right: 0, bottom: 0 });\n const keep = insets(this.pressRetentionOffset(), DEFAULT_PRESS_RETENTION);\n const horizontal = dx < 0 ? slop.left + keep.left : slop.right + keep.right;\n const vertical = dy < 0 ? slop.top + keep.top : slop.bottom + keep.bottom;\n return (\n Math.abs(dx) <= this.size.width + horizontal && Math.abs(dy) <= this.size.height + vertical\n );\n }\n\n /**\n * A lifecycle hook rather than `inject(DestroyRef).onDestroy`: Angular registers a hook once per\n * directive type, where the callback was a closure and a lookup for every instance - and every\n * `<text>` on screen is one.\n */\n ngOnDestroy(): void {\n this.clearTimers();\n this.stopResponding?.();\n this.stopLayout?.();\n this.stopHover?.();\n this.stopClick?.();\n }\n\n private stopResponding: (() => void) | null = null;\n private stopLayout: (() => void) | null = null;\n private stopHover: (() => void) | null = null;\n private stopClick: (() => void) | null = null;\n\n override ngOnInit(): void {\n super.ngOnInit();\n this.respondIfNeeded();\n this.measureIfNeeded();\n this.hoverIfNeeded();\n this.clickIfNeeded();\n if (this.longPressListeners) this.takeLongPressFromMenus();\n }\n\n /**\n * Tell a host that opens a `[contextMenu]` on a long press (Android, iOS) that this view takes\n * its own, so one on it opens no menu around it: the innermost handler wins, as in a native\n * app. Every such view, not only one inside a menu, since a menu can be around it from another\n * template. A view with its own menu still opens that.\n */\n private takeLongPressFromMenus(): void {\n const menus = this.injector.get(Menus);\n if (!menus.longPressByNativeId) return;\n runInInjectionContext(this.injector, () =>\n byNativeId(\n this.engine,\n this.node,\n (nativeID) => menus.setTakesLongPress(nativeID, true),\n (nativeID) => menus.setTakesLongPress(nativeID, false),\n ),\n )();\n }\n\n override ngOnChanges(): void {\n super.ngOnChanges();\n this.respondIfNeeded();\n this.measureIfNeeded();\n this.hoverIfNeeded();\n this.clickIfNeeded();\n }\n\n /**\n * A press with no touch: Android's `performClick()`, which is what Enter, the D-pad centre and\n * TalkBack's double-tap do to a focused view, and which reaches us as `topClick` alone.\n *\n * `Pressability.js` answers it in `onClick`: `onPress` and nothing around it, not while disabled,\n * and not for a click carrying a `pointerType`, which is the pointer event a touch already\n * pressed through. It presses only the view that was clicked: a touchable the click only bubbled\n * through stops it there, so neither it nor anything above it acts on a click meant for a\n * focusable view inside it.\n *\n * Android only. iOS sends a click only as a pointer event, and the web host binds `topClick` to\n * the DOM's own click, which a mouse press already reached through the responder.\n */\n private clickIfNeeded(): void {\n if (this.stopClick || !this.measures() || nativePlatform() !== 'android') return;\n this.stopClick = this.engine.setEventListener(this.node, 'topClick', (event) => {\n const click = event as PressEvent;\n if (!this.measures() || Object.hasOwn(click.nativeEvent ?? {}, 'pointerType')) return;\n if (click.target !== this.node) {\n click.stopPropagation();\n return;\n }\n if (!this.claims()) return;\n this.emitReported(this.press, 'click', click, 'click');\n });\n }\n\n /**\n * Join the responder negotiation, once this is something a touch can press.\n *\n * Behind `measures()` for the same reason as layout and hover: a `<text>` is the commonest node\n * on screen and almost never a control, and registering every one cost a handler object, six\n * closures and a responder entry apiece for a touch it would have refused anyway.\n */\n private respondIfNeeded(): void {\n if (this.stopResponding || !this.measures()) return;\n this.stopResponding = this.engine.setResponder(this.node, {\n // Claim the gesture on touch down unless disabled. Because this goes through the\n // negotiation, an ancestor can pre-empt us in the capture pass and a nested pressable\n // wins over us in the bubble pass, neither of which raw touch listeners could express.\n onStartShouldSetResponder: () => this.claims(),\n onResponderGrant: (event) => this.onGrant(event),\n onResponderMove: (event) => this.onMove(event),\n onResponderRelease: (event) => this.onRelease(event),\n onResponderTerminate: (event) => this.onTerminate(event),\n // Yield to an enclosing scroll view when it takes over the drag, unless told not to.\n onResponderTerminationRequest: () => this.cancelable(),\n });\n }\n\n /**\n * `onLayout` is opted into by the engine as soon as something listens for it, which is the only\n * way the native side reports a view's size at all, and the reason it is only asked for once\n * `measures()` says so - a `<text>` answers that from an input, and most of them say no.\n *\n * Called from the lifecycle rather than watched by an effect. An effect per element is an\n * allocation and a scheduler entry for every pressable and every piece of text on screen, to\n * notice a change these two hooks already see.\n */\n /**\n * Hover, on the same terms and behind the same question.\n *\n * Fabric will not dispatch a pointer event to a view whose props have not asked for one, and\n * the engine writes those props when something listens - so listening is the whole opt-in. The\n * gate is `measures()`, which is not what its name is about but is the right question underneath\n * it: is this an actual control, or a piece of text that merely inherits the machinery. A label\n * says no, and two props on every paragraph on screen is not a cost worth paying for a hover\n * state a label has no use for.\n *\n * Native sends pointer events only in an app that turned them on (the `pointerEvents` option\n * of `@ng-native/expo`'s config plugin), and then for a finger as well, entering what it lands\n * on and leaving as it lifts. That is not hover, so `hovered` stays false on a phone.\n */\n private hoverIfNeeded(): void {\n if (this.stopHover || !this.measures()) return;\n const enter = this.engine.setEventListener(this.node, 'topPointerEnter', (event) => {\n if (!isTouchPointer(event)) this.hovered.set(true);\n });\n const leave = this.engine.setEventListener(this.node, 'topPointerLeave', (event) => {\n if (!isTouchPointer(event)) this.hovered.set(false);\n });\n this.stopHover = () => {\n enter();\n leave();\n };\n }\n\n private measureIfNeeded(): void {\n if (this.stopLayout || !this.measures()) return;\n this.stopLayout = this.engine.setEventListener(this.node, 'topLayout', (event) => {\n const layout = (event as NativeSyntheticEvent<{ layout?: { width: number; height: number } }>)\n .nativeEvent?.layout;\n if (layout) this.size = { width: layout.width, height: layout.height };\n });\n }\n\n private onGrant(event: PressEvent): void {\n this.origin = touchPoint(event);\n this.cancelled = false;\n this.longPressed = false;\n // Decided as the press begins, as the host decides its own: a menu that arrives during a\n // delayed press-in then opens nothing, and this element keeps the long press.\n this.menuOwnsHold = this.menuTakesLongPress(event);\n this.clearTimers();\n if (this.androidRipple()) {\n const { x, y } = this.origin;\n this.engine.dispatchCommand(this.node, 'hotspotUpdate', [x, y]);\n this.engine.dispatchCommand(this.node, 'setPressed', [true]);\n }\n const delay = this.delayPressIn();\n if (delay > 0) this.pressInTimer = setTimeout(() => this.activate(event), delay);\n else this.activate(event);\n }\n\n /** `pressIn`, and the long-press clock starts from here. */\n private activate(event: PressEvent): void {\n this.pressInTimer = null;\n this.pressedAt = now();\n this.pressed.set(true);\n this.pressedChanged(true);\n this.pressIn.emit(event);\n if (!this.longPressListeners || this.contextMenu?.takesLongPress()) return;\n if (this.menuOwnsHold) return;\n this.longPressTimer = setTimeout(() => {\n this.longPressTimer = null;\n this.longPressed = true;\n this.emitReported(this.longPress, 'long-press', event, 'touch');\n }, this.delayLongPress());\n }\n\n /**\n * Whether the host opens a `[contextMenu]` inside this element on this long press, from the\n * pressed view out to this one, so `(longPress)` here does not also fire. The host decides at\n * its own long-press timeout, which can be later than `delayLongPress`.\n */\n private menuTakesLongPress(event: PressEvent): boolean {\n const menus = this.injector.get(Menus);\n if (!menus.contextMenuByNativeId) return false;\n const chain: (string | null)[] = [];\n for (let node = event.target as HostNode | null | undefined; node; node = node.parent) {\n const id = node.props['nativeID'];\n chain.push(typeof id === 'string' && id ? id : null);\n if (node === this.node) return menus.opensContextMenu(chain);\n }\n return false;\n }\n\n private onMove(event: PressEvent): void {\n if (this.cancelled || !this.origin) return;\n const point = touchPoint(event);\n if (this.stillOnControl(point.x - this.origin.x, point.y - this.origin.y)) return;\n // The finger has wandered: this is a drag, not a tap. Give up the press but stay the\n // responder, so a scroll view underneath still gets its gesture.\n this.cancelled = true;\n this.deactivate(event);\n }\n\n private onRelease(event: PressEvent): void {\n if (this.androidRipple()) this.engine.dispatchCommand(this.node, 'setPressed', [false]);\n if (this.cancelled) return;\n // Lifted before the press-in delay ran out: RN still reports a full press.\n if (this.pressInTimer) {\n clearTimeout(this.pressInTimer);\n this.activate(event);\n }\n const longPressed = this.longPressed;\n this.deactivate(event);\n if (longPressed) return;\n this.emitReported(this.press, 'click', event, 'touch');\n }\n\n /**\n * Fire a press output, and tell the app's interaction observers, if it has any, about it.\n *\n * The event is described before the output runs and handed over after it: the app's own handler\n * goes first, and one that removes the control still has it reported as it was when pressed.\n * Observers are looked up here rather than injected, because a press is rare and a lookup for\n * every `<text>` on screen is not. A press is reported whether or not anything listens to it: a\n * control that does nothing when tapped is what an observer looking for dead taps wants to hear.\n * A press on an element whose `[menu]` opens is reported, and `(press)` does not fire.\n */\n protected emitReported(\n output: { emit(event: PressEvent): void },\n type: InteractionType,\n event: PressEvent,\n source: 'touch' | 'click',\n ): void {\n const observers = interactionObservers(this.injector);\n const interaction = observers && this.describeInteraction(type, event, source);\n if (output !== this.press || !this.pressMenu?.takePress()) output.emit(event);\n if (observers && interaction) notifyInteraction(observers, interaction);\n }\n\n private describeInteraction(\n type: InteractionType,\n event: PressEvent,\n source: 'touch' | 'click',\n ): InteractionEvent {\n const text = textWithin(this.node);\n return {\n type,\n ...describeElement(this.engine, this.node),\n ...(text !== undefined && { text }),\n ...touchPosition(event),\n ...(this.size && { width: this.size.width, height: this.size.height }),\n source,\n timestamp: Date.now(),\n };\n }\n\n private onTerminate(event: PressEvent): void {\n if (this.androidRipple()) this.engine.dispatchCommand(this.node, 'setPressed', [false]);\n if (this.cancelled) return;\n this.cancelled = true;\n this.deactivate(event);\n }\n\n /** `pressOut`, no sooner than `minPressDuration` after `pressIn` and after `delayPressOut`. */\n private deactivate(event: PressEvent): void {\n if (this.pressInTimer) {\n clearTimeout(this.pressInTimer);\n this.pressInTimer = null;\n return;\n }\n if (this.longPressTimer) {\n clearTimeout(this.longPressTimer);\n this.longPressTimer = null;\n }\n if (!this.pressed()) return;\n const held = now() - this.pressedAt;\n const delay = Math.max(this.delayPressOut(), this.minPressDuration() - held);\n const out = () => {\n this.pressOutTimer = null;\n this.pressed.set(false);\n this.pressedChanged(false);\n this.pressOut.emit(event);\n };\n if (delay > 0) this.pressOutTimer = setTimeout(out, delay);\n else out();\n }\n\n private clearTimers(): void {\n // Every touchable is destroyed through here, and nearly all of them were never pressed.\n if (!this.pressInTimer && !this.longPressTimer && !this.pressOutTimer) return;\n for (const timer of [this.pressInTimer, this.longPressTimer, this.pressOutTimer]) {\n if (timer) clearTimeout(timer);\n }\n this.pressInTimer = this.longPressTimer = this.pressOutTimer = null;\n }\n}\n\n/**\n * A touchable that is a control: `Pressable`, `TouchableOpacity` and `PressBehavior`.\n *\n * The host bindings every control needs live here rather than on `TouchableBase`, which `Text`\n * extends: the state that follows `disabled`, and the Android ripple. Controls are few enough on\n * a screen to pay for a binding on every pass; texts are not.\n */\n@Directive({\n host: {\n // `disabled` is an input of ours, so it cannot reach `ngOnChanges` on the base; this is\n // the one binding that keeps the announced state in step with it.\n '[accessibilityState]': 'accessibilityStateProp()',\n // Nor is it left on the node for `:disabled` to read, so this is what a stylesheet matches.\n '[attr.data-disabled]': \"pressDisabled() ? '' : null\",\n '[nativeBackgroundAndroid]': 'rippleBackground()',\n '[nativeForegroundAndroid]': 'rippleForeground()',\n },\n})\nexport abstract class ControlBase extends TouchableBase {}\n\n/**\n * The press machine on its own, for a component that wants to be pressable rather than to\n * contain something that is.\n *\n * No selector: this is only ever a `hostDirectives` entry. A component listing it gets the whole\n * of `TouchableBase` on its own host node - the responder negotiation, the press rectangle, the\n * delays and the long-press timer - instead of wrapping a `<pressable>` and paying for a second\n * native view.\n *\n * It provides `TouchableBase`, so a primitive on the same node can `inject(TouchableBase)` and\n * read `pressed` without caring whether it landed on this or on a real `<pressable>`.\n */\n@Directive({\n providers: [{ provide: TouchableBase, useExisting: forwardRef(() => PressBehavior) }],\n})\nexport class PressBehavior extends ControlBase {\n /** The conditions the composing component gave, any of which disables the control. */\n private readonly conditions = signal<readonly Signal<boolean>[]>([]);\n private readonly held = computed(() => this.conditions().some((condition) => condition()));\n\n /**\n * Disable the control while `condition` is true, from the component that composes this: a\n * button that is loading, which its caller's `disabled` knows nothing of. Either one disables\n * it, as `disabled={loading || disabled}` does on React Native's `Pressable`: presses are\n * refused, a stylesheet sees `[data-disabled]`, and a screen reader is told.\n *\n * constructor() {\n * inject(PressBehavior).disableWhile(this.loading);\n * }\n */\n disableWhile(condition: Signal<boolean>): void {\n this.conditions.update((conditions) => [...conditions, condition]);\n }\n\n protected override accessibleByDefault(): boolean {\n return true;\n }\n\n protected override focusableByDefault(): boolean {\n return true;\n }\n\n protected override pressDisabled(): boolean {\n return this.held() || super.pressDisabled();\n }\n\n protected override disabledForAccessibility(): boolean | undefined {\n return this.held() ? true : this.disabled();\n }\n}\n\n/**\n * A view that responds to presses. RN's `Pressable`, with the same configuration: hit slop,\n * retention offset, press-in and press-out delays, long press, and an Android ripple.\n *\n * `pressed` is a public signal, so a template can style from it through a template reference:\n * `<pressable #p [style.opacity]=\"p.pressed() ? 0.5 : 1\">`.\n */\n@Directive({\n selector: 'pressable',\n exportAs: 'pressable',\n providers: [{ provide: TouchableBase, useExisting: forwardRef(() => Pressable) }],\n})\nexport class Pressable extends ControlBase {\n /** `Pressable.js`: a control is an accessibility element, and focusable, unless refused. */\n protected override accessibleByDefault(): boolean {\n return true;\n }\n\n protected override focusableByDefault(): boolean {\n return true;\n }\n\n protected override disabledForAccessibility(): boolean | undefined {\n return this.disabled();\n }\n}\n"]}
|
package/dist/scroll-view.d.ts
CHANGED
|
@@ -65,13 +65,15 @@ export declare class ScrollView extends ScrollViewProps {
|
|
|
65
65
|
/** The content view's size changed; the value is its new width and height. */
|
|
66
66
|
readonly contentSizeChange: import("@angular/core").OutputEmitterRef<Size>;
|
|
67
67
|
private readonly refreshControl;
|
|
68
|
+
private readonly inSheet;
|
|
68
69
|
private readonly content;
|
|
69
70
|
private readonly sticky;
|
|
70
71
|
/** RN asks for every scroll event while anything is sticky, which is what keeps it pinned. */
|
|
71
72
|
protected readonly resolvedThrottle: import("@angular/core").Signal<number | undefined>;
|
|
72
73
|
/**
|
|
73
74
|
* RN's `nestedScrollEnabled ?? true` for a scroll view inside Android's swipe layout: the scroll
|
|
74
|
-
* view has to see a drag before the layout wrapped around it does, or every drag is a pull.
|
|
75
|
+
* view has to see a drag before the layout wrapped around it does, or every drag is a pull. A
|
|
76
|
+
* form sheet's drag gives way the same way, or a drag down on scrolled content moves the sheet.
|
|
75
77
|
*/
|
|
76
78
|
protected readonly resolvedNestedScroll: import("@angular/core").Signal<boolean | undefined>;
|
|
77
79
|
constructor();
|
package/dist/scroll-view.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component, DestroyRef, ElementRef, afterEveryRender, computed, contentChild, inject, input, output, viewChild, } from '@angular/core';
|
|
2
|
+
import { IN_FORM_SHEET } from '@ng-native/device';
|
|
2
3
|
import { nativePlatform } from '@ng-native/fabric';
|
|
3
4
|
import { dismissKeyboardOnTap } from "./keyboard-taps.js";
|
|
4
5
|
import { ContentContainer } from "./content-container.js";
|
|
@@ -78,6 +79,7 @@ export class ScrollView extends ScrollViewProps {
|
|
|
78
79
|
contentSizeChange = output();
|
|
79
80
|
refreshControl = contentChild(RefreshControl, /* @ts-ignore */
|
|
80
81
|
...(ngDevMode ? [{ debugName: "refreshControl" }] : /* istanbul ignore next */ []));
|
|
82
|
+
inSheet = inject(IN_FORM_SHEET);
|
|
81
83
|
content = viewChild.required('content', { ...(ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
82
84
|
sticky = new StickyHeaders(this.engine, this.node, () => !!this.horizontal());
|
|
83
85
|
/** RN asks for every scroll event while anything is sticky, which is what keeps it pinned. */
|
|
@@ -85,10 +87,13 @@ export class ScrollView extends ScrollViewProps {
|
|
|
85
87
|
...(ngDevMode ? [{ debugName: "resolvedThrottle" }] : /* istanbul ignore next */ []));
|
|
86
88
|
/**
|
|
87
89
|
* RN's `nestedScrollEnabled ?? true` for a scroll view inside Android's swipe layout: the scroll
|
|
88
|
-
* view has to see a drag before the layout wrapped around it does, or every drag is a pull.
|
|
90
|
+
* view has to see a drag before the layout wrapped around it does, or every drag is a pull. A
|
|
91
|
+
* form sheet's drag gives way the same way, or a drag down on scrolled content moves the sheet.
|
|
89
92
|
*/
|
|
90
93
|
resolvedNestedScroll = computed(() => this.nestedScrollEnabled() ??
|
|
91
|
-
(nativePlatform() === 'android' && this.refreshControl()
|
|
94
|
+
(nativePlatform() === 'android' && (this.inSheet || this.refreshControl())
|
|
95
|
+
? true
|
|
96
|
+
: undefined), /* @ts-ignore */
|
|
92
97
|
...(ngDevMode ? [{ debugName: "resolvedNestedScroll" }] : /* istanbul ignore next */ []));
|
|
93
98
|
constructor() {
|
|
94
99
|
super();
|