@ng-native/components 0.29.0 → 0.30.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/README.md +2 -2
- package/dist/activity-indicator.js +3 -3
- package/dist/animated-style.js +3 -3
- package/dist/animations-web.js +3 -3
- package/dist/animations.js +3 -3
- package/dist/content-container.js +3 -3
- package/dist/context-menu.js +3 -3
- package/dist/drag-and-drop.js +6 -6
- package/dist/gestures-web.js +6 -6
- package/dist/gestures.js +6 -6
- package/dist/gradient-text.d.ts +1 -1
- package/dist/gradient-text.js +4 -4
- package/dist/gradient-text.js.map +1 -1
- package/dist/image-background.js +3 -3
- package/dist/image.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/input-accessory-view.js +3 -3
- package/dist/keyboard-avoiding-view.js +3 -3
- package/dist/keyboard-dock.js +15 -15
- package/dist/markdown-blocks.d.ts +2 -1
- package/dist/markdown-blocks.js +22 -18
- package/dist/markdown-blocks.js.map +1 -1
- package/dist/markdown-columns.js +3 -3
- package/dist/markdown-stream.js +8 -5
- package/dist/markdown-stream.js.map +1 -1
- package/dist/markdown.js +5 -5
- package/dist/markdown.js.map +1 -1
- package/dist/menu.js +12 -12
- package/dist/modal.js +8 -3
- package/dist/modal.js.map +1 -1
- package/dist/native-button.js +3 -3
- package/dist/native-gesture.js +3 -3
- package/dist/native-ref.js +3 -3
- package/dist/press-menu.d.ts +17 -8
- package/dist/press-menu.js +39 -18
- package/dist/press-menu.js.map +1 -1
- package/dist/pressable.js +12 -12
- package/dist/reanimated-web.js +6 -6
- package/dist/reanimated.js +6 -6
- package/dist/refresh-control.js +3 -3
- package/dist/safe-area-provider.js +3 -3
- package/dist/safe-area-view.js +3 -3
- package/dist/scroll-view-props.js +3 -3
- package/dist/scroll-view.js +3 -3
- package/dist/section-list.d.ts +4 -4
- package/dist/section-list.js +37 -34
- package/dist/section-list.js.map +1 -1
- package/dist/shortcut.js +3 -3
- package/dist/sidebar-item.js +3 -3
- package/dist/sidebar-section.d.ts +12 -5
- package/dist/sidebar-section.js +32 -12
- package/dist/sidebar-section.js.map +1 -1
- package/dist/sidebar.d.ts +11 -3
- package/dist/sidebar.js +16 -7
- package/dist/sidebar.js.map +1 -1
- package/dist/split-view.js +6 -6
- package/dist/stand-ins/animations.js +3 -3
- package/dist/switch.js +3 -3
- package/dist/template-slot.js +3 -3
- package/dist/text-input.js +3 -3
- package/dist/text.js +3 -3
- package/dist/touchable-opacity.js +3 -3
- package/dist/tray-icon.js +3 -3
- package/dist/view-base.d.ts +18 -2
- package/dist/view-base.js +42 -10
- package/dist/view-base.js.map +1 -1
- package/dist/view.js +3 -3
- package/dist/virtual-list-layout.d.ts +5 -0
- package/dist/virtual-list-layout.js.map +1 -1
- package/dist/virtual-list-num-columns.d.ts +8 -4
- package/dist/virtual-list-num-columns.js +13 -5
- package/dist/virtual-list-num-columns.js.map +1 -1
- package/dist/virtual-list-sticky-level.js +3 -3
- package/dist/virtual-list.d.ts +48 -5
- package/dist/virtual-list.js +206 -46
- package/dist/virtual-list.js.map +1 -1
- package/dist/visual-effect.d.ts +37 -0
- package/dist/visual-effect.js +60 -0
- package/dist/visual-effect.js.map +1 -0
- package/dist/worklet-scroll.js +3 -3
- package/dist/worklet-style.js +3 -3
- package/dist/written-props.js +7 -0
- package/dist/written-props.js.map +1 -1
- package/ios/NgNativeComponents.podspec +2 -2
- package/ios/NgNativeKeyboardFocus.h +21 -0
- package/ios/NgNativeKeyboardFocus.mm +28 -0
- package/ios/NgNativeKeyboardFocusModule.mm +203 -0
- package/ios/NgNativeMenus.mm +20 -0
- package/ios/NgNativePressMenu.h +13 -5
- package/ios/NgNativePressMenu.mm +36 -2
- package/ios/NgNativeViewBinder.h +5 -0
- package/ios/NgNativeViewBinder.mm +31 -4
- package/package.json +6 -6
package/dist/menu.js
CHANGED
|
@@ -86,10 +86,10 @@ export class MenuItem {
|
|
|
86
86
|
this.checkedModel.propose(!checked);
|
|
87
87
|
this.select.emit();
|
|
88
88
|
};
|
|
89
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
90
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.
|
|
89
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MenuItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
90
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.3.0", type: MenuItem, isStandalone: true, selector: "menu-item", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, menuRole: { classPropertyName: "menuRole", publicName: "menuRole", isSignal: true, isRequired: false, transformFunction: null }, shortcut: { classPropertyName: "shortcut", publicName: "shortcut", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, destructive: { classPropertyName: "destructive", publicName: "destructive", isSignal: true, isRequired: false, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null }, sfSymbol: { classPropertyName: "sfSymbol", publicName: "sfSymbol", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", select: "select" }, host: { properties: { "style.display": "\"none\"" } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
|
|
91
91
|
}
|
|
92
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MenuItem, decorators: [{
|
|
93
93
|
type: Component,
|
|
94
94
|
args: [{
|
|
95
95
|
selector: 'menu-item',
|
|
@@ -102,10 +102,10 @@ export class MenuSeparator {
|
|
|
102
102
|
constructor() {
|
|
103
103
|
registerIn(computed(() => ({ separator: true })), 'menu-separator');
|
|
104
104
|
}
|
|
105
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
106
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.
|
|
105
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MenuSeparator, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
106
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.3.0", type: MenuSeparator, isStandalone: true, selector: "menu-separator", host: { properties: { "style.display": "\"none\"" } }, ngImport: i0, template: '', isInline: true });
|
|
107
107
|
}
|
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MenuSeparator, decorators: [{
|
|
109
109
|
type: Component,
|
|
110
110
|
args: [{
|
|
111
111
|
selector: 'menu-separator',
|
|
@@ -141,10 +141,10 @@ export class MenuGroup {
|
|
|
141
141
|
...(this.destructive() && { destructive: true }),
|
|
142
142
|
})), 'menu-group');
|
|
143
143
|
}
|
|
144
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
145
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.
|
|
144
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MenuGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
145
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.3.0", type: MenuGroup, isStandalone: true, selector: "menu-group", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, menuRole: { classPropertyName: "menuRole", publicName: "menuRole", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, sfSymbol: { classPropertyName: "sfSymbol", publicName: "sfSymbol", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, destructive: { classPropertyName: "destructive", publicName: "destructive", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "\"none\"" } }, providers: [{ provide: MENU_MODEL, useFactory: menuModelInTreeOrder }], ngImport: i0, template: '<ng-content />', isInline: true });
|
|
146
146
|
}
|
|
147
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MenuGroup, decorators: [{
|
|
148
148
|
type: Component,
|
|
149
149
|
args: [{
|
|
150
150
|
selector: 'menu-group',
|
|
@@ -164,10 +164,10 @@ export class MenuBar {
|
|
|
164
164
|
const own = inject(MENU_MODEL, { self: true });
|
|
165
165
|
inject(DestroyRef).onDestroy(inject(Menus).addMenuBar(own.entries));
|
|
166
166
|
}
|
|
167
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
168
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.
|
|
167
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MenuBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
168
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.3.0", type: MenuBar, isStandalone: true, selector: "menu-bar", host: { properties: { "style.display": "\"none\"" } }, providers: [{ provide: MENU_MODEL, useFactory: menuModelInTreeOrder }], ngImport: i0, template: '<ng-content />', isInline: true });
|
|
169
169
|
}
|
|
170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MenuBar, decorators: [{
|
|
171
171
|
type: Component,
|
|
172
172
|
args: [{
|
|
173
173
|
selector: 'menu-bar',
|
package/dist/modal.js
CHANGED
|
@@ -98,6 +98,11 @@ export class Modal extends ViewBase {
|
|
|
98
98
|
...(ngDevMode ? [{ debugName: "containerStyle" }] : /* istanbul ignore next */ []));
|
|
99
99
|
constructor() {
|
|
100
100
|
super();
|
|
101
|
+
// A modal made outside a change detection (with a routed page, by `createComponent`) is in the
|
|
102
|
+
// tree before its `visible` binding has run, and a commit in between would read it as showing:
|
|
103
|
+
// the host presents it, empty, for that one commit. It starts hidden, and the binding's first
|
|
104
|
+
// value says whether it shows.
|
|
105
|
+
this.engine.setProp(this.node, 'visible', false);
|
|
101
106
|
// RN's host claims any touch that reaches it, so nothing inside the modal can hand a
|
|
102
107
|
// gesture to the screen underneath.
|
|
103
108
|
const stop = inject(HostEngine).setResponder(this.node, {
|
|
@@ -140,10 +145,10 @@ export class Modal extends ViewBase {
|
|
|
140
145
|
this.awaitingAnchor.set(false);
|
|
141
146
|
}, { injector: this.injector });
|
|
142
147
|
}
|
|
143
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
144
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.
|
|
148
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: Modal, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
149
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.3.0", type: Modal, isStandalone: true, selector: "modal", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, transparent: { classPropertyName: "transparent", publicName: "transparent", isSignal: true, isRequired: false, transformFunction: null }, backdropColor: { classPropertyName: "backdropColor", publicName: "backdropColor", isSignal: true, isRequired: false, transformFunction: null }, animationType: { classPropertyName: "animationType", publicName: "animationType", isSignal: true, isRequired: false, transformFunction: null }, presentationStyle: { classPropertyName: "presentationStyle", publicName: "presentationStyle", isSignal: true, isRequired: false, transformFunction: null }, supportedOrientations: { classPropertyName: "supportedOrientations", publicName: "supportedOrientations", isSignal: true, isRequired: false, transformFunction: null }, allowSwipeDismissal: { classPropertyName: "allowSwipeDismissal", publicName: "allowSwipeDismissal", isSignal: true, isRequired: false, transformFunction: null }, statusBarTranslucent: { classPropertyName: "statusBarTranslucent", publicName: "statusBarTranslucent", isSignal: true, isRequired: false, transformFunction: null }, navigationBarTranslucent: { classPropertyName: "navigationBarTranslucent", publicName: "navigationBarTranslucent", isSignal: true, isRequired: false, transformFunction: null }, hardwareAccelerated: { classPropertyName: "hardwareAccelerated", publicName: "hardwareAccelerated", isSignal: true, isRequired: false, transformFunction: null }, anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "visible": "visible() && !awaitingAnchor()", "transparent": "transparent()", "animationType": "animationType()", "presentationStyle": "resolvedPresentationStyle()", "supportedOrientations": "supportedOrientations()", "allowSwipeDismissal": "allowSwipeDismissal()", "statusBarTranslucent": "statusBarTranslucent()", "navigationBarTranslucent": "navigationBarTranslucent()", "hardwareAccelerated": "hardwareAccelerated()", "anchor": "anchorTag()" } }, usesInheritance: true, ngImport: i0, template: `<view [style]="containerStyle()" collapsable="false"><ng-content /></view>`, isInline: true, dependencies: [{ kind: "directive", type: View, selector: "view" }] });
|
|
145
150
|
}
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: Modal, decorators: [{
|
|
147
152
|
type: Component,
|
|
148
153
|
args: [{
|
|
149
154
|
selector: 'modal',
|
package/dist/modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../src/modal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAmB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAW1C,4CAA4C;AAC5C,SAAS,UAAU,CAAC,MAAmB;IACrC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,MAAM,YAAY,UAAU;QAAE,OAAO,MAAM,CAAC,aAA2B,CAAC;IAC5E,IAAI,UAAU,IAAI,MAAM;QAAE,OAAO,MAAoB,CAAC;IACtD,OAAS,MAA6B,CAAC,IAA+B,IAAI,IAAI,CAAC;AACjF,CAAC;AAKD;;;;;;;;;;;;;GAaG;AAkBH,MAAM,OAAO,KAAM,SAAQ,QAAQ;IACjC;;;;;OAKG;IACM,OAAO,GAAG,KAAK,CAAC,IAAI,+EAAI,SAAS,EAAE,gBAAgB,GAAG,CAAC;IAChE,wEAAwE;IAC/D,WAAW,GAAG,KAAK,CAAC,KAAK,mFAAI,SAAS,EAAE,gBAAgB,GAAG,CAAC;IACrE,0EAA0E;IACjE,aAAa,GAAG,KAAK;iGAAU,CAAC;IACz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;qBAC1B;iBACF","sourcesContent":["import {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { DESKTOP, Direction } from '@ng-native/device';\nimport { Engine, HostEngine, type EngineNode } from '@ng-native/fabric';\nimport { optionalBoolean } from './transforms.ts';\nimport { View } from './view.ts';\nimport { ViewBase } from './view-base.ts';\n\nexport type ModalPresentationStyle = 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen';\n/**\n * What `anchor` takes: an element, its `ElementRef`, or a component such as a `<pressable>`. A\n * template reference types as `HTMLElement` for an element and as its class for a component, so\n * both are named; at run time an element is its engine node, and a component's is its `node`.\n */\nexport type ModalAnchor =\n ElementRef | EngineNode | HTMLElement | ViewBase | { readonly node: unknown } | null | undefined;\n\n/** The engine node an anchor stands for. */\nfunction anchorNode(anchor: ModalAnchor): EngineNode | null {\n if (!anchor) return null;\n if (anchor instanceof ElementRef) return anchor.nativeElement as EngineNode;\n if ('nodeKind' in anchor) return anchor as EngineNode;\n return ((anchor as { node?: unknown }).node as EngineNode | undefined) ?? null;\n}\n\nexport type ModalOrientation =\n 'portrait' | 'portrait-upside-down' | 'landscape' | 'landscape-left' | 'landscape-right';\n\n/**\n * Content presented over everything else. Commits as `ModalHostView`.\n *\n * RN's `Modal.js` gives the native host `{position: 'absolute'}` (the engine's default for it)\n * and puts the children inside a full-bleed view carrying the backdrop colour. Without the\n * container the content has no backdrop and no layout box, so a modal renders as nothing.\n *\n * Events are element events: `(requestClose)` for the Android back button and an iOS swipe,\n * `(show)`, `(dismiss)`, and `(orientationChange)`.\n *\n * The container is pinned to the leading edge with `[side]: 0`, the same as RN's own Modal.js -\n * `left` in a left-to-right layout, `right` in a right-to-left one - so the backdrop starts from\n * the edge content actually begins at rather than always the physical left.\n */\n@Component({\n selector: 'modal',\n imports: [View],\n template: `<view [style]=\"containerStyle()\" collapsable=\"false\"><ng-content /></view>`,\n host: {\n '[visible]': 'visible() && !awaitingAnchor()',\n '[transparent]': 'transparent()',\n '[animationType]': 'animationType()',\n '[presentationStyle]': 'resolvedPresentationStyle()',\n '[supportedOrientations]': 'supportedOrientations()',\n '[allowSwipeDismissal]': 'allowSwipeDismissal()',\n '[statusBarTranslucent]': 'statusBarTranslucent()',\n '[navigationBarTranslucent]': 'navigationBarTranslucent()',\n '[hardwareAccelerated]': 'hardwareAccelerated()',\n '[anchor]': 'anchorTag()',\n },\n})\nexport class Modal extends ViewBase {\n /**\n * Whether the modal is showing. Defaults to true, as in RN. While false the engine leaves the\n * native host out of the commit, as RN's Modal returns null when hidden, because the host\n * covers the screen and takes every touch whether or not it presents; on iOS a modal that was\n * showing stays until native reports its dismissal.\n */\n readonly visible = input(true, { transform: booleanAttribute });\n /** See through to the screen behind; the container gets no backdrop. */\n readonly transparent = input(false, { transform: booleanAttribute });\n /** The container's background when not transparent. Defaults to white. */\n readonly backdropColor = input<string>();\n /** How the modal appears and leaves. Defaults to `none`. */\n readonly animationType = input<'none' | 'slide' | 'fade'>();\n /** iOS: full screen, a sheet, or over the current content. `overFullScreen` if transparent. */\n readonly presentationStyle = input<ModalPresentationStyle>();\n /** iOS: which orientations the modal may rotate to. Defaults to portrait. */\n readonly supportedOrientations = input<readonly ModalOrientation[]>();\n /** iOS: let a downward swipe dismiss the modal, reported through `(requestClose)`. */\n readonly allowSwipeDismissal = input(undefined, { transform: optionalBoolean });\n /**\n * Android: draw under the status bar. Always on under Android edge-to-edge (Expo SDK 57), where\n * React Native ignores `false`.\n */\n readonly statusBarTranslucent = input(undefined, { transform: optionalBoolean });\n /**\n * Android: draw under the navigation bar. Always on under Android edge-to-edge (Expo SDK 57),\n * where React Native ignores `false`. In an app that opts out, it needs `statusBarTranslucent`.\n */\n readonly navigationBarTranslucent = input(undefined, { transform: optionalBoolean });\n /** Android: give the modal's window a hardware-accelerated surface. */\n readonly hardwareAccelerated = input(undefined, { transform: optionalBoolean });\n\n /**\n * The element the modal points at. With one, it shows as a popover at the element on macOS and\n * Linux; on every other OS, iPadOS included, it shows as it would without one. Committed as the\n * react tag of the element's view.\n */\n readonly anchor = input<ModalAnchor>();\n\n private readonly direction = inject(Direction);\n /** Only the desktop host reads the anchor, so only there does the modal wait for it. */\n private readonly readsAnchor = inject(DESKTOP);\n /** For the anchor view tag, which only the engine itself hands out. */\n private readonly views = inject(Engine, { optional: true });\n private readonly injector = inject(Injector);\n\n /** The anchor's view tag, committed as `anchor`, or undefined with none. */\n protected readonly anchorTag = signal<number | undefined>(undefined);\n /**\n * Whether the anchor's view has still to commit, which gives it its tag. On a desktop OS the modal\n * waits: the host reads the anchor as it presents, and one presented without it stays a sheet.\n */\n protected readonly awaitingAnchor = signal(false);\n\n protected readonly resolvedPresentationStyle = computed(\n () => this.presentationStyle() ?? (this.transparent() ? 'overFullScreen' : undefined),\n );\n\n protected readonly containerStyle = computed(() => ({\n [this.direction.rtl() ? 'right' : 'left']: 0,\n top: 0,\n flex: 1,\n backgroundColor: this.transparent() ? 'transparent' : (this.backdropColor() ?? 'white'),\n }));\n\n constructor() {\n super();\n // RN's host claims any touch that reaches it, so nothing inside the modal can hand a\n // gesture to the screen underneath.\n const stop = inject(HostEngine).setResponder(this.node, {\n onStartShouldSetResponder: () => true,\n });\n inject(DestroyRef).onDestroy(stop);\n\n effect(() => this.followAnchor(anchorNode(this.anchor())));\n\n effect(() => {\n const style = this.presentationStyle();\n if (this.transparent() && style && style !== 'overFullScreen') {\n console.warn(\n `[angular-native] <modal> is transparent, which needs presentationStyle=\"overFullScreen\" on iOS; '${style}' will not be see-through.`,\n );\n }\n });\n }\n\n /**\n * Commit the anchor's tag. A view not yet committed has none, so it is read again once the\n * commit that makes it has happened.\n */\n private followAnchor(node: EngineNode | null): void {\n if (!node) {\n // The engine commits a prop that goes as null, which takes it off the native view.\n this.anchorTag.set(undefined);\n this.awaitingAnchor.set(false);\n return;\n }\n const tag = this.views?.tagOf(node);\n if (tag != null) {\n this.anchorTag.set(tag);\n this.awaitingAnchor.set(false);\n return;\n }\n // Elsewhere nothing reads the anchor, and a modal hidden to wait for it would be dismissed.\n if (this.readsAnchor) this.awaitingAnchor.set(true);\n afterNextRender(\n () => {\n if (anchorNode(this.anchor()) !== node) return;\n this.anchorTag.set(this.views?.tagOf(node) ?? undefined);\n // Once: an anchor that has still not committed is left out, and the modal shows anyway.\n this.awaitingAnchor.set(false);\n },\n { injector: this.injector },\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../src/modal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAmB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAW1C,4CAA4C;AAC5C,SAAS,UAAU,CAAC,MAAmB;IACrC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,MAAM,YAAY,UAAU;QAAE,OAAO,MAAM,CAAC,aAA2B,CAAC;IAC5E,IAAI,UAAU,IAAI,MAAM;QAAE,OAAO,MAAoB,CAAC;IACtD,OAAS,MAA6B,CAAC,IAA+B,IAAI,IAAI,CAAC;AACjF,CAAC;AAKD;;;;;;;;;;;;;GAaG;AAkBH,MAAM,OAAO,KAAM,SAAQ,QAAQ;IACjC;;;;;OAKG;IACM,OAAO,GAAG,KAAK,CAAC,IAAI,+EAAI,SAAS,EAAE,gBAAgB,GAAG,CAAC;IACh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IAAI,EAAE;wBACJ,WAAW,EAAE,gCAAgC;wBAC7C,eAAe,EAAE,eAAe;wBAChC,iBAAiB,EAAE,iBAAiB;wBACpC,qBAAqB,EAAE,6BAA6B;wBACpD,yBAAyB,EAAE,yBAAyB;wBACpD,uBAAuB,EAAE,uBAAuB;wBAChD,wBAAwB,EAAE,wBAAwB;wBAClD,4BAA4B,EAAE,4BAA4B;wBAC1D,uBAAuB,EAAE,uBAAuB;wBAChD,UAAU,EAAE,aAAa;qBAC1B;iBACF","sourcesContent":["import {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { DESKTOP, Direction } from '@ng-native/device';\nimport { Engine, HostEngine, type EngineNode } from '@ng-native/fabric';\nimport { optionalBoolean } from './transforms.ts';\nimport { View } from './view.ts';\nimport { ViewBase } from './view-base.ts';\n\nexport type ModalPresentationStyle = 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen';\n/**\n * What `anchor` takes: an element, its `ElementRef`, or a component such as a `<pressable>`. A\n * template reference types as `HTMLElement` for an element and as its class for a component, so\n * both are named; at run time an element is its engine node, and a component's is its `node`.\n */\nexport type ModalAnchor =\n ElementRef | EngineNode | HTMLElement | ViewBase | { readonly node: unknown } | null | undefined;\n\n/** The engine node an anchor stands for. */\nfunction anchorNode(anchor: ModalAnchor): EngineNode | null {\n if (!anchor) return null;\n if (anchor instanceof ElementRef) return anchor.nativeElement as EngineNode;\n if ('nodeKind' in anchor) return anchor as EngineNode;\n return ((anchor as { node?: unknown }).node as EngineNode | undefined) ?? null;\n}\n\nexport type ModalOrientation =\n 'portrait' | 'portrait-upside-down' | 'landscape' | 'landscape-left' | 'landscape-right';\n\n/**\n * Content presented over everything else. Commits as `ModalHostView`.\n *\n * RN's `Modal.js` gives the native host `{position: 'absolute'}` (the engine's default for it)\n * and puts the children inside a full-bleed view carrying the backdrop colour. Without the\n * container the content has no backdrop and no layout box, so a modal renders as nothing.\n *\n * Events are element events: `(requestClose)` for the Android back button and an iOS swipe,\n * `(show)`, `(dismiss)`, and `(orientationChange)`.\n *\n * The container is pinned to the leading edge with `[side]: 0`, the same as RN's own Modal.js -\n * `left` in a left-to-right layout, `right` in a right-to-left one - so the backdrop starts from\n * the edge content actually begins at rather than always the physical left.\n */\n@Component({\n selector: 'modal',\n imports: [View],\n template: `<view [style]=\"containerStyle()\" collapsable=\"false\"><ng-content /></view>`,\n host: {\n '[visible]': 'visible() && !awaitingAnchor()',\n '[transparent]': 'transparent()',\n '[animationType]': 'animationType()',\n '[presentationStyle]': 'resolvedPresentationStyle()',\n '[supportedOrientations]': 'supportedOrientations()',\n '[allowSwipeDismissal]': 'allowSwipeDismissal()',\n '[statusBarTranslucent]': 'statusBarTranslucent()',\n '[navigationBarTranslucent]': 'navigationBarTranslucent()',\n '[hardwareAccelerated]': 'hardwareAccelerated()',\n '[anchor]': 'anchorTag()',\n },\n})\nexport class Modal extends ViewBase {\n /**\n * Whether the modal is showing. Defaults to true, as in RN. While false the engine leaves the\n * native host out of the commit, as RN's Modal returns null when hidden, because the host\n * covers the screen and takes every touch whether or not it presents; on iOS a modal that was\n * showing stays until native reports its dismissal.\n */\n readonly visible = input(true, { transform: booleanAttribute });\n /** See through to the screen behind; the container gets no backdrop. */\n readonly transparent = input(false, { transform: booleanAttribute });\n /** The container's background when not transparent. Defaults to white. */\n readonly backdropColor = input<string>();\n /** How the modal appears and leaves. Defaults to `none`. */\n readonly animationType = input<'none' | 'slide' | 'fade'>();\n /** iOS: full screen, a sheet, or over the current content. `overFullScreen` if transparent. */\n readonly presentationStyle = input<ModalPresentationStyle>();\n /** iOS: which orientations the modal may rotate to. Defaults to portrait. */\n readonly supportedOrientations = input<readonly ModalOrientation[]>();\n /** iOS: let a downward swipe dismiss the modal, reported through `(requestClose)`. */\n readonly allowSwipeDismissal = input(undefined, { transform: optionalBoolean });\n /**\n * Android: draw under the status bar. Always on under Android edge-to-edge (Expo SDK 57), where\n * React Native ignores `false`.\n */\n readonly statusBarTranslucent = input(undefined, { transform: optionalBoolean });\n /**\n * Android: draw under the navigation bar. Always on under Android edge-to-edge (Expo SDK 57),\n * where React Native ignores `false`. In an app that opts out, it needs `statusBarTranslucent`.\n */\n readonly navigationBarTranslucent = input(undefined, { transform: optionalBoolean });\n /** Android: give the modal's window a hardware-accelerated surface. */\n readonly hardwareAccelerated = input(undefined, { transform: optionalBoolean });\n\n /**\n * The element the modal points at. With one, it shows as a popover at the element on macOS and\n * Linux; on every other OS, iPadOS included, it shows as it would without one. Committed as the\n * react tag of the element's view.\n */\n readonly anchor = input<ModalAnchor>();\n\n private readonly direction = inject(Direction);\n /** Only the desktop host reads the anchor, so only there does the modal wait for it. */\n private readonly readsAnchor = inject(DESKTOP);\n /** For the anchor view tag, which only the engine itself hands out. */\n private readonly views = inject(Engine, { optional: true });\n private readonly injector = inject(Injector);\n\n /** The anchor's view tag, committed as `anchor`, or undefined with none. */\n protected readonly anchorTag = signal<number | undefined>(undefined);\n /**\n * Whether the anchor's view has still to commit, which gives it its tag. On a desktop OS the modal\n * waits: the host reads the anchor as it presents, and one presented without it stays a sheet.\n */\n protected readonly awaitingAnchor = signal(false);\n\n protected readonly resolvedPresentationStyle = computed(\n () => this.presentationStyle() ?? (this.transparent() ? 'overFullScreen' : undefined),\n );\n\n protected readonly containerStyle = computed(() => ({\n [this.direction.rtl() ? 'right' : 'left']: 0,\n top: 0,\n flex: 1,\n backgroundColor: this.transparent() ? 'transparent' : (this.backdropColor() ?? 'white'),\n }));\n\n constructor() {\n super();\n // A modal made outside a change detection (with a routed page, by `createComponent`) is in the\n // tree before its `visible` binding has run, and a commit in between would read it as showing:\n // the host presents it, empty, for that one commit. It starts hidden, and the binding's first\n // value says whether it shows.\n this.engine.setProp(this.node, 'visible', false);\n // RN's host claims any touch that reaches it, so nothing inside the modal can hand a\n // gesture to the screen underneath.\n const stop = inject(HostEngine).setResponder(this.node, {\n onStartShouldSetResponder: () => true,\n });\n inject(DestroyRef).onDestroy(stop);\n\n effect(() => this.followAnchor(anchorNode(this.anchor())));\n\n effect(() => {\n const style = this.presentationStyle();\n if (this.transparent() && style && style !== 'overFullScreen') {\n console.warn(\n `[angular-native] <modal> is transparent, which needs presentationStyle=\"overFullScreen\" on iOS; '${style}' will not be see-through.`,\n );\n }\n });\n }\n\n /**\n * Commit the anchor's tag. A view not yet committed has none, so it is read again once the\n * commit that makes it has happened.\n */\n private followAnchor(node: EngineNode | null): void {\n if (!node) {\n // The engine commits a prop that goes as null, which takes it off the native view.\n this.anchorTag.set(undefined);\n this.awaitingAnchor.set(false);\n return;\n }\n const tag = this.views?.tagOf(node);\n if (tag != null) {\n this.anchorTag.set(tag);\n this.awaitingAnchor.set(false);\n return;\n }\n // Elsewhere nothing reads the anchor, and a modal hidden to wait for it would be dismissed.\n if (this.readsAnchor) this.awaitingAnchor.set(true);\n afterNextRender(\n () => {\n if (anchorNode(this.anchor()) !== node) return;\n this.anchorTag.set(this.views?.tagOf(node) ?? undefined);\n // Once: an anchor that has still not committed is left out, and the modal shows anyway.\n this.awaitingAnchor.set(false);\n },\n { injector: this.injector },\n );\n }\n}\n"]}
|
package/dist/native-button.js
CHANGED
|
@@ -153,15 +153,15 @@ export class NativeButton extends ControlBase {
|
|
|
153
153
|
super.ngOnDestroy();
|
|
154
154
|
this.stopPress?.();
|
|
155
155
|
}
|
|
156
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
157
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
156
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
157
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.3.0", type: NativeButton, isStandalone: true, selector: "native-button", inputs: { kind: { classPropertyName: "kind", publicName: "kind", isSignal: true, isRequired: false, transformFunction: null }, controlSize: { classPropertyName: "controlSize", publicName: "controlSize", isSignal: true, isRequired: false, transformFunction: null }, sfSymbol: { classPropertyName: "sfSymbol", publicName: "sfSymbol", isSignal: true, isRequired: false, transformFunction: null }, drawableName: { classPropertyName: "drawableName", publicName: "drawable", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "kind": "kind()", "controlSize": "controlSize()", "sfSymbol": "symbol()", "drawable": "android ? undefined : drawableResource()", "svgIcon": "svgIcon()", "iconImage": "iosPicture()?.uri", "style.flexDirection": "androidPicture() ? \"row\" : undefined", "style.alignItems": "androidPicture() ? \"center\" : undefined", "style.gap": "androidPicture() ? \"8px\" : undefined", "enabled": "!pressDisabled()" } }, providers: [{ provide: TouchableBase, useExisting: forwardRef(() => NativeButton) }], usesInheritance: true, ngImport: i0, template: `
|
|
158
158
|
@if (androidPicture(); as source) {
|
|
159
159
|
<image [source]="source" [tintColor]="tint()" style="width: 18px; height: 18px" />
|
|
160
160
|
}
|
|
161
161
|
<ng-content />
|
|
162
162
|
`, isInline: true, dependencies: [{ kind: "directive", type: Image, selector: "image", inputs: ["source", "src", "srcSet", "defaultSource", "loadingIndicatorSource", "resizeMode", "resizeMethod", "resizeMultiplier", "blurRadius", "capInsets", "tintColor", "fadeDuration", "progressiveRenderingEnabled", "alt", "crossOrigin", "referrerPolicy"] }] });
|
|
163
163
|
}
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeButton, decorators: [{
|
|
165
165
|
type: Component,
|
|
166
166
|
args: [{
|
|
167
167
|
selector: 'native-button',
|
package/dist/native-gesture.js
CHANGED
|
@@ -75,10 +75,10 @@ export class NativeGestureBase {
|
|
|
75
75
|
timestamp: Date.now(),
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
79
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
78
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeGestureBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
79
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: NativeGestureBase, isStandalone: true, selector: "[gesture]", inputs: { gesture: { classPropertyName: "gesture", publicName: "gesture", isSignal: true, isRequired: true, transformFunction: null }, trackGesture: { classPropertyName: "trackGesture", publicName: "trackGesture", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "collapsable": "false" } }, ngImport: i0 });
|
|
80
80
|
}
|
|
81
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeGestureBase, decorators: [{
|
|
82
82
|
type: Directive,
|
|
83
83
|
args: [{ selector: '[gesture]', host: { '[collapsable]': 'false' } }]
|
|
84
84
|
}], ctorParameters: () => [], propDecorators: { gesture: [{ type: i0.Input, args: [{ isSignal: true, alias: "gesture", required: true }] }], trackGesture: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackGesture", required: false }] }] } });
|
package/dist/native-ref.js
CHANGED
|
@@ -3,10 +3,10 @@ import * as i0 from "@angular/core";
|
|
|
3
3
|
/** Escape hatch for reading a primitive's retained node, e.g. to issue a native command. */
|
|
4
4
|
export class NativeRef {
|
|
5
5
|
node = inject(ElementRef).nativeElement;
|
|
6
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
7
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
6
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeRef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
7
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: NativeRef, isStandalone: true, selector: "[nativeRef]", exportAs: ["nativeRef"], ngImport: i0 });
|
|
8
8
|
}
|
|
9
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
9
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: NativeRef, decorators: [{
|
|
10
10
|
type: Directive,
|
|
11
11
|
args: [{ selector: '[nativeRef]', exportAs: 'nativeRef' }]
|
|
12
12
|
}] });
|
package/dist/press-menu.d.ts
CHANGED
|
@@ -15,15 +15,19 @@ export declare const PRESS_MENU: InjectionToken<{
|
|
|
15
15
|
* the template.
|
|
16
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
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* PopupMenu below it, and iOS as a UIMenu from a clear button laid over the element, which opens it
|
|
19
|
+
* as a touch goes down, as SwiftUI's `Menu` does. From iOS 17.4 a press on the element opens it as
|
|
20
|
+
* `open()` does, for a tap made before the button is laid; the host ignores the request while the
|
|
21
|
+
* menu is showing, as it is after the button's own touch. Before 17.4 iOS had no way to open one
|
|
22
|
+
* from code, so `open()` there opens none. Android and iOS take the
|
|
23
|
+
* `NgNativeMenus` module that Expo Go lacks. Other hosts (Expo Go, the web) draw none yet:
|
|
24
|
+
* there a press fires `(press)`, with one warning in development.
|
|
22
25
|
*
|
|
23
26
|
* The host contract: `Menus.popUpMenu(view, entries)` with the view's tag and the menu as
|
|
24
27
|
* `serializeMenu` makes it, and the item chosen sent as the view's `topContextMenuSelect`, as a
|
|
25
28
|
* context menu's. On iOS, `Menus.setPressMenu(nativeID, entries)` instead, as the menu changes, and
|
|
26
|
-
* null while the pressable is disabled
|
|
29
|
+
* null while the pressable is disabled, with `Menus.openPressMenu(nativeID)` to open it from iOS
|
|
30
|
+
* 17.4; the choice comes back by the view's `nativeID`.
|
|
27
31
|
*/
|
|
28
32
|
export declare class PressMenu {
|
|
29
33
|
readonly menu: import("@angular/core").InputSignal<TemplateRef<unknown> | null | undefined>;
|
|
@@ -35,11 +39,16 @@ export declare class PressMenu {
|
|
|
35
39
|
/** iOS's host, which takes the menu by `nativeID` and opens it on a touch itself. */
|
|
36
40
|
private readonly byNativeId;
|
|
37
41
|
private readonly disabled;
|
|
42
|
+
/** The menu as iOS's host has it: none while the pressable is disabled. */
|
|
43
|
+
private readonly shown;
|
|
44
|
+
/** The `nativeID` the menu was last sent to iOS's host under. */
|
|
45
|
+
private sentAs;
|
|
38
46
|
constructor();
|
|
39
47
|
disableWhile(disabled: () => boolean): void;
|
|
40
48
|
/**
|
|
41
|
-
* Whether a press is the menu's:
|
|
42
|
-
* menu; elsewhere `open()` opens it now.
|
|
49
|
+
* Whether a press is the menu's: before iOS 17.4 the host's own touch opened it, wherever it has
|
|
50
|
+
* the menu; elsewhere `open()` opens it now. On iOS React Native's press follows the button's own
|
|
51
|
+
* touch, and a screen reader's, and the host ignores that request while the menu is showing.
|
|
43
52
|
*/
|
|
44
53
|
takePress(): boolean;
|
|
45
54
|
/**
|
|
@@ -47,7 +56,7 @@ export declare class PressMenu {
|
|
|
47
56
|
* does not mean the menu showed: the host draws none for a view it is not showing (no window on
|
|
48
57
|
* macOS, not mapped on Linux), and does not report that. False when no request is sent: the menu
|
|
49
58
|
* 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).
|
|
59
|
+
* on a touch (iOS before 17.4).
|
|
51
60
|
*/
|
|
52
61
|
open(): boolean;
|
|
53
62
|
/**
|
package/dist/press-menu.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DestroyRef, Directive, ElementRef, InjectionToken, Injector, effect, forwardRef, inject, input, signal, untracked, } from '@angular/core';
|
|
1
|
+
import { DestroyRef, Directive, ElementRef, InjectionToken, Injector, computed, 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";
|
|
@@ -8,8 +8,8 @@ import * as i0 from "@angular/core";
|
|
|
8
8
|
export const PRESS_MENU = new InjectionToken('angular-native.pressMenu');
|
|
9
9
|
const drawsNone = '[menu] on a <pressable>: this host draws no menu on a press yet (macOS, Linux, Android and ' +
|
|
10
10
|
'iOS do), so the press fires (press) instead.';
|
|
11
|
-
const opensNoneOnIos = "PressMenu.open(): iOS
|
|
12
|
-
'no way to open one from code, so this opens none.';
|
|
11
|
+
const opensNoneOnIos = "PressMenu.open(): before iOS 17.4 a press menu opens only on a touch or a screen reader's " +
|
|
12
|
+
'press, and there is no way to open one from code, so this opens none.';
|
|
13
13
|
/** The warnings given in development, each once. */
|
|
14
14
|
const warned = new Set();
|
|
15
15
|
function warnOnce(message) {
|
|
@@ -26,15 +26,19 @@ function warnOnce(message) {
|
|
|
26
26
|
* the template.
|
|
27
27
|
*
|
|
28
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
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* PopupMenu below it, and iOS as a UIMenu from a clear button laid over the element, which opens it
|
|
30
|
+
* as a touch goes down, as SwiftUI's `Menu` does. From iOS 17.4 a press on the element opens it as
|
|
31
|
+
* `open()` does, for a tap made before the button is laid; the host ignores the request while the
|
|
32
|
+
* menu is showing, as it is after the button's own touch. Before 17.4 iOS had no way to open one
|
|
33
|
+
* from code, so `open()` there opens none. Android and iOS take the
|
|
34
|
+
* `NgNativeMenus` module that Expo Go lacks. Other hosts (Expo Go, the web) draw none yet:
|
|
35
|
+
* there a press fires `(press)`, with one warning in development.
|
|
33
36
|
*
|
|
34
37
|
* The host contract: `Menus.popUpMenu(view, entries)` with the view's tag and the menu as
|
|
35
38
|
* `serializeMenu` makes it, and the item chosen sent as the view's `topContextMenuSelect`, as a
|
|
36
39
|
* context menu's. On iOS, `Menus.setPressMenu(nativeID, entries)` instead, as the menu changes, and
|
|
37
|
-
* null while the pressable is disabled
|
|
40
|
+
* null while the pressable is disabled, with `Menus.openPressMenu(nativeID)` to open it from iOS
|
|
41
|
+
* 17.4; the choice comes back by the view's `nativeID`.
|
|
38
42
|
*/
|
|
39
43
|
export class PressMenu {
|
|
40
44
|
menu = input(/* @ts-ignore */
|
|
@@ -48,6 +52,11 @@ export class PressMenu {
|
|
|
48
52
|
byNativeId = this.os === 'ios' && this.menus.pressMenuByNativeId;
|
|
49
53
|
disabled = signal(() => false, /* @ts-ignore */
|
|
50
54
|
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
55
|
+
/** The menu as iOS's host has it: none while the pressable is disabled. */
|
|
56
|
+
shown = computed(() => (this.disabled()() ? null : this.built.sent()), /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
|
|
58
|
+
/** The `nativeID` the menu was last sent to iOS's host under. */
|
|
59
|
+
sentAs = null;
|
|
51
60
|
constructor() {
|
|
52
61
|
const stop = this.engine.setEventListener(this.node, 'topContextMenuSelect', (event) => {
|
|
53
62
|
const id = event.nativeEvent?.id;
|
|
@@ -62,20 +71,30 @@ export class PressMenu {
|
|
|
62
71
|
this.disabled.set(disabled);
|
|
63
72
|
}
|
|
64
73
|
/**
|
|
65
|
-
* Whether a press is the menu's:
|
|
66
|
-
* menu; elsewhere `open()` opens it now.
|
|
74
|
+
* Whether a press is the menu's: before iOS 17.4 the host's own touch opened it, wherever it has
|
|
75
|
+
* the menu; elsewhere `open()` opens it now. On iOS React Native's press follows the button's own
|
|
76
|
+
* touch, and a screen reader's, and the host ignores that request while the menu is showing.
|
|
67
77
|
*/
|
|
68
78
|
takePress() {
|
|
69
|
-
return this.byNativeId
|
|
79
|
+
return this.byNativeId && !this.menus.opensPressMenus
|
|
80
|
+
? untracked(this.built.sent) !== null
|
|
81
|
+
: this.open();
|
|
70
82
|
}
|
|
71
83
|
/**
|
|
72
84
|
* Ask the host to open the menu under the element now. True once the request is sent, which
|
|
73
85
|
* does not mean the menu showed: the host draws none for a view it is not showing (no window on
|
|
74
86
|
* macOS, not mapped on Linux), and does not report that. False when no request is sent: the menu
|
|
75
87
|
* 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).
|
|
88
|
+
* on a touch (iOS before 17.4).
|
|
77
89
|
*/
|
|
78
90
|
open() {
|
|
91
|
+
if (this.byNativeId && this.menus.opensPressMenus) {
|
|
92
|
+
const nativeID = this.sentAs;
|
|
93
|
+
if (nativeID === null || untracked(this.shown) === null)
|
|
94
|
+
return false;
|
|
95
|
+
this.menus.openPressMenu(nativeID);
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
79
98
|
const entries = untracked(this.built.sent);
|
|
80
99
|
if (!entries)
|
|
81
100
|
return false;
|
|
@@ -95,17 +114,19 @@ export class PressMenu {
|
|
|
95
114
|
*/
|
|
96
115
|
sendByNativeId() {
|
|
97
116
|
const choose = (id) => this.built.choose(id);
|
|
98
|
-
const
|
|
99
|
-
|
|
117
|
+
const send = byNativeId(this.engine, this.node, (nativeID) => {
|
|
118
|
+
this.sentAs = nativeID;
|
|
119
|
+
this.menus.setPressMenu(nativeID, untracked(this.shown), choose);
|
|
120
|
+
}, (nativeID) => this.menus.setPressMenu(nativeID, null, choose));
|
|
100
121
|
effect(() => {
|
|
101
|
-
shown();
|
|
122
|
+
this.shown();
|
|
102
123
|
send();
|
|
103
124
|
});
|
|
104
125
|
}
|
|
105
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
106
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
126
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: PressMenu, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
127
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.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 });
|
|
107
128
|
}
|
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: PressMenu, decorators: [{
|
|
109
130
|
type: Directive,
|
|
110
131
|
args: [{
|
|
111
132
|
selector: 'pressable[menu]',
|
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,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,EAA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\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"]}
|
|
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,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,4FAA4F;IAC5F,uEAAuE,CAAC;AAE1E,oDAAoD;AACpD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjC,SAAS,QAAQ,CAAC,OAAe;IAC/B,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO;IAClF,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpB,OAAO,CA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directive,\n ElementRef,\n InjectionToken,\n Injector,\n computed,\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(): before iOS 17.4 a press menu opens only on a touch or a screen reader's \" +\n 'press, and there is 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 opens it\n * as a touch goes down, as SwiftUI's `Menu` does. From iOS 17.4 a press on the element opens it as\n * `open()` does, for a tap made before the button is laid; the host ignores the request while the\n * menu is showing, as it is after the button's own touch. Before 17.4 iOS had no way to open one\n * from code, so `open()` there opens none. Android and iOS take the\n * `NgNativeMenus` module that Expo Go lacks. Other hosts (Expo Go, the web) draw none yet:\n * 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, with `Menus.openPressMenu(nativeID)` to open it from iOS\n * 17.4; 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 /** The menu as iOS's host has it: none while the pressable is disabled. */\n private readonly shown = computed(() => (this.disabled()() ? null : this.built.sent()));\n /** The `nativeID` the menu was last sent to iOS's host under. */\n private sentAs: string | null = null;\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: before iOS 17.4 the host's own touch opened it, wherever it has\n * the menu; elsewhere `open()` opens it now. On iOS React Native's press follows the button's own\n * touch, and a screen reader's, and the host ignores that request while the menu is showing.\n */\n takePress(): boolean {\n return this.byNativeId && !this.menus.opensPressMenus\n ? untracked(this.built.sent) !== null\n : 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 before 17.4).\n */\n open(): boolean {\n if (this.byNativeId && this.menus.opensPressMenus) {\n const nativeID = this.sentAs;\n if (nativeID === null || untracked(this.shown) === null) return false;\n this.menus.openPressMenu(nativeID);\n return true;\n }\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 send = byNativeId(\n this.engine,\n this.node,\n (nativeID) => {\n this.sentAs = nativeID;\n this.menus.setPressMenu(nativeID, untracked(this.shown), choose);\n },\n (nativeID) => this.menus.setPressMenu(nativeID, null, choose),\n );\n effect(() => {\n this.shown();\n send();\n });\n }\n}\n"]}
|
package/dist/pressable.js
CHANGED
|
@@ -553,10 +553,10 @@ export class TouchableBase extends ViewBase {
|
|
|
553
553
|
}
|
|
554
554
|
this.pressInTimer = this.longPressTimer = this.pressOutTimer = null;
|
|
555
555
|
}
|
|
556
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
557
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
556
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: TouchableBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
557
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: TouchableBase, isStandalone: true, inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, pressRetentionOffset: { classPropertyName: "pressRetentionOffset", publicName: "pressRetentionOffset", isSignal: true, isRequired: false, transformFunction: null }, delayLongPress: { classPropertyName: "delayLongPress", publicName: "delayLongPress", isSignal: true, isRequired: false, transformFunction: null }, delayPressIn: { classPropertyName: "delayPressIn", publicName: "delayPressIn", isSignal: true, isRequired: false, transformFunction: null }, delayPressOut: { classPropertyName: "delayPressOut", publicName: "delayPressOut", isSignal: true, isRequired: false, transformFunction: null }, minPressDuration: { classPropertyName: "minPressDuration", publicName: "minPressDuration", isSignal: true, isRequired: false, transformFunction: null }, cancelable: { classPropertyName: "cancelable", publicName: "cancelable", isSignal: true, isRequired: false, transformFunction: null }, androidRipple: { classPropertyName: "androidRipple", publicName: "android_ripple", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { press: "press", pressIn: "pressIn", pressOut: "pressOut", longPress: "longPress" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
558
558
|
}
|
|
559
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
559
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: TouchableBase, decorators: [{
|
|
560
560
|
type: Directive
|
|
561
561
|
}], ctorParameters: () => [], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], pressRetentionOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "pressRetentionOffset", required: false }] }], delayLongPress: [{ type: i0.Input, args: [{ isSignal: true, alias: "delayLongPress", required: false }] }], delayPressIn: [{ type: i0.Input, args: [{ isSignal: true, alias: "delayPressIn", required: false }] }], delayPressOut: [{ type: i0.Input, args: [{ isSignal: true, alias: "delayPressOut", required: false }] }], minPressDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "minPressDuration", required: false }] }], cancelable: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancelable", required: false }] }], androidRipple: [{ type: i0.Input, args: [{ isSignal: true, alias: "android_ripple", required: false }] }], press: [{ type: i0.Output, args: ["press"] }], pressIn: [{ type: i0.Output, args: ["pressIn"] }], pressOut: [{ type: i0.Output, args: ["pressOut"] }], longPress: [{ type: i0.Output, args: ["longPress"] }] } });
|
|
562
562
|
/**
|
|
@@ -567,10 +567,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
|
|
|
567
567
|
* a screen to pay for a binding on every pass; texts are not.
|
|
568
568
|
*/
|
|
569
569
|
export class ControlBase extends TouchableBase {
|
|
570
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
571
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
570
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: ControlBase, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
571
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: ControlBase, isStandalone: true, host: { properties: { "accessibilityState": "accessibilityStateProp()", "attr.data-disabled": "pressDisabled() ? '' : null", "nativeBackgroundAndroid": "rippleBackground()", "nativeForegroundAndroid": "rippleForeground()" } }, usesInheritance: true, ngImport: i0 });
|
|
572
572
|
}
|
|
573
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: ControlBase, decorators: [{
|
|
574
574
|
type: Directive,
|
|
575
575
|
args: [{
|
|
576
576
|
host: {
|
|
@@ -627,10 +627,10 @@ export class PressBehavior extends ControlBase {
|
|
|
627
627
|
disabledForAccessibility() {
|
|
628
628
|
return this.held() ? true : this.disabled();
|
|
629
629
|
}
|
|
630
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
631
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
630
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: PressBehavior, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
631
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: PressBehavior, isStandalone: true, providers: [{ provide: TouchableBase, useExisting: forwardRef(() => PressBehavior) }], usesInheritance: true, ngImport: i0 });
|
|
632
632
|
}
|
|
633
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: PressBehavior, decorators: [{
|
|
634
634
|
type: Directive,
|
|
635
635
|
args: [{
|
|
636
636
|
providers: [{ provide: TouchableBase, useExisting: forwardRef(() => PressBehavior) }],
|
|
@@ -654,10 +654,10 @@ export class Pressable extends ControlBase {
|
|
|
654
654
|
disabledForAccessibility() {
|
|
655
655
|
return this.disabled();
|
|
656
656
|
}
|
|
657
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
658
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
657
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: Pressable, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
658
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: Pressable, isStandalone: true, selector: "pressable", providers: [{ provide: TouchableBase, useExisting: forwardRef(() => Pressable) }], exportAs: ["pressable"], usesInheritance: true, ngImport: i0 });
|
|
659
659
|
}
|
|
660
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
660
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: Pressable, decorators: [{
|
|
661
661
|
type: Directive,
|
|
662
662
|
args: [{
|
|
663
663
|
selector: 'pressable',
|
package/dist/reanimated-web.js
CHANGED
|
@@ -40,20 +40,20 @@ export function sharedValue(initial) {
|
|
|
40
40
|
export class WorkletStyle {
|
|
41
41
|
workletStyle = input.required(/* @ts-ignore */
|
|
42
42
|
...(ngDevMode ? [{ debugName: "workletStyle" }] : /* istanbul ignore next */ []));
|
|
43
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
44
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
43
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletStyle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
44
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: WorkletStyle, isStandalone: true, selector: "[workletStyle]", inputs: { workletStyle: { classPropertyName: "workletStyle", publicName: "workletStyle", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
45
45
|
}
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletStyle, decorators: [{
|
|
47
47
|
type: Directive,
|
|
48
48
|
args: [{ selector: '[workletStyle]' }]
|
|
49
49
|
}], propDecorators: { workletStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "workletStyle", required: true }] }] } });
|
|
50
50
|
export class WorkletScroll {
|
|
51
51
|
workletScroll = input.required(/* @ts-ignore */
|
|
52
52
|
...(ngDevMode ? [{ debugName: "workletScroll" }] : /* istanbul ignore next */ []));
|
|
53
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
54
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
53
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletScroll, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
54
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: WorkletScroll, isStandalone: true, selector: "[workletScroll]", inputs: { workletScroll: { classPropertyName: "workletScroll", publicName: "workletScroll", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
55
55
|
}
|
|
56
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletScroll, decorators: [{
|
|
57
57
|
type: Directive,
|
|
58
58
|
args: [{ selector: '[workletScroll]' }]
|
|
59
59
|
}], propDecorators: { workletScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "workletScroll", required: true }] }] } });
|
package/dist/reanimated.js
CHANGED
|
@@ -112,10 +112,10 @@ const backend = {
|
|
|
112
112
|
*/
|
|
113
113
|
const { registerEventHandler, unregisterEventHandler } = require('react-native-reanimated/src/core.ts');
|
|
114
114
|
export class WorkletStyle extends WorkletStyleBase {
|
|
115
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
116
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
115
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletStyle, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
116
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: WorkletStyle, isStandalone: true, selector: "[workletStyle]", providers: [{ provide: WORKLETS, useValue: backend }], usesInheritance: true, ngImport: i0 });
|
|
117
117
|
}
|
|
118
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletStyle, decorators: [{
|
|
119
119
|
type: Directive,
|
|
120
120
|
args: [{
|
|
121
121
|
selector: '[workletStyle]',
|
|
@@ -123,10 +123,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
|
|
|
123
123
|
}]
|
|
124
124
|
}] });
|
|
125
125
|
export class WorkletScroll extends WorkletScrollBase {
|
|
126
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
127
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
126
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletScroll, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
127
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: WorkletScroll, isStandalone: true, selector: "[workletScroll]", providers: [{ provide: WORKLETS, useValue: backend }], usesInheritance: true, ngImport: i0 });
|
|
128
128
|
}
|
|
129
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: WorkletScroll, decorators: [{
|
|
130
130
|
type: Directive,
|
|
131
131
|
args: [{
|
|
132
132
|
selector: '[workletScroll]',
|