@nativescript-community/ui-material-bottomsheet 7.1.4 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { EventData, View, ViewBase } from '@nativescript/core';
1
+ import { EventData, View } from '@nativescript/core';
2
2
  export interface ShownBottomSheetData extends EventData {
3
3
  /**
4
4
  * The context (optional, may be undefined) passed to the view when shown modally.
@@ -17,12 +17,12 @@ export declare enum StateBottomSheet {
17
17
  EXPANDED = 1,
18
18
  DRAGGING = 2
19
19
  }
20
- export declare type onChangeStateBottomSheet = (stateBottomSheet: StateBottomSheet, slideOffset?: number) => void;
20
+ export type onChangeStateBottomSheet = (stateBottomSheet: StateBottomSheet, slideOffset?: number) => void;
21
21
  export declare const shownInBottomSheetEvent = "shownInBottomSheet";
22
22
  export declare const showingInBottomSheetEvent = "showingInBottomSheet";
23
23
  export declare const closedSheetEvent = "closedBottomSheet";
24
24
  export interface BottomSheetOptions {
25
- view: string | ViewBase;
25
+ view: string | View;
26
26
  context?: any;
27
27
  animated?: boolean;
28
28
  dismissOnBackgroundTap?: boolean;
@@ -54,5 +54,5 @@ export declare abstract class ViewWithBottomSheetBase extends View {
54
54
  protected _raiseShowingBottomSheetEvent(): void;
55
55
  _raiseClosedBottomSheetEvent(): void;
56
56
  closeBottomSheet(...args: any[]): void;
57
- showBottomSheet(options: BottomSheetOptions): ViewBase;
57
+ showBottomSheet(options: BottomSheetOptions): View;
58
58
  }
@@ -15,7 +15,7 @@ var MDCBottomSheetControllerDelegateImpl = /** @class */ (function (_super) {
15
15
  };
16
16
  MDCBottomSheetControllerDelegateImpl.prototype.bottomSheetControllerDidChangeYOffsetYOffset = function (controller, yOffset) {
17
17
  var owner = this._owner.get();
18
- if (owner && owner._onChangeStateBottomSheetCallback) {
18
+ if (owner === null || owner === void 0 ? void 0 : owner._onChangeStateBottomSheetCallback) {
19
19
  var presentationController = controller.presentationController;
20
20
  var heightScreen = Screen.mainScreen.heightDIPs;
21
21
  var heightCollapsedSheet = presentationController.preferredSheetHeight || controller.preferredContentSize.height;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-material-bottomsheet",
3
- "version": "7.1.4",
3
+ "version": "7.2.1",
4
4
  "description": "Material Design Bottom Sheets slide up from the bottom of the screen to reveal more content. Bottom sheets integrate with the app to display supporting content or present deep-linked content from other apps.",
5
5
  "main": "./bottomsheet",
6
6
  "sideEffects": false,
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "readmeFilename": "README.md",
48
48
  "dependencies": {
49
- "@nativescript-community/ui-material-core": "^7.1.4"
49
+ "@nativescript-community/ui-material-core": "^7.2.1"
50
50
  },
51
- "gitHead": "8052d595674b39c5d2369b44c29823ad09eb8a83"
51
+ "gitHead": "75b7a4ee372bce6dacaa260d05a106179dfa2713"
52
52
  }
package/svelte/index.d.ts CHANGED
@@ -1,19 +1,24 @@
1
- /// <reference types="svelte-native" />
2
1
  import { BottomSheetOptions } from '../bottomsheet';
3
2
  import { View } from '@nativescript/core';
4
3
  import { NativeViewElementNode } from 'svelte-native/dom';
5
4
  import { PageSpec } from 'svelte-native/dom/navigation';
6
- export interface ShowBottomSheetOptions extends Omit<BottomSheetOptions, 'view'> {
7
- view: PageSpec;
8
- parent: NativeViewElementNode<View> | View;
9
- props?: any;
5
+ declare module '@nativescript/core/ui/core/view' {
6
+ interface View {
7
+ closeBottomSheet(...args: any): void;
8
+ showBottomSheet(options: BottomSheetOptions): View;
9
+ }
10
+ }
11
+ export interface SvelteShowBottomSheetOptions<U> extends Omit<BottomSheetOptions, 'view'> {
12
+ view: PageSpec<U>;
13
+ parent?: NativeViewElementNode<View> | View;
14
+ props?: U;
10
15
  }
11
16
  interface ComponentInstanceInfo {
12
17
  element: NativeViewElementNode<View>;
13
18
  viewInstance: SvelteComponent;
14
19
  }
15
- export declare function resolveComponentElement(viewSpec: PageSpec, props?: any): ComponentInstanceInfo;
16
- export declare function showBottomSheet<T>(modalOptions: ShowBottomSheetOptions): Promise<T>;
20
+ export declare function resolveComponentElement<T>(viewSpec: typeof SvelteComponent<T>, props?: any): ComponentInstanceInfo;
21
+ export declare function showBottomSheet<T, U = any>(modalOptions: SvelteShowBottomSheetOptions<U>): Promise<T>;
17
22
  export declare function closeBottomSheet(result?: any): void;
18
23
  export declare function isBottomSheetOpened(): boolean;
19
24
  export {};
package/svelte/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { Frame, View, ViewBase } from '@nativescript/core';
1
+ import { Frame, View } from '@nativescript/core';
2
2
  import { NativeViewElementNode, createElement } from 'svelte-native/dom';
3
3
  const modalStack = [];
4
4
  export function resolveComponentElement(viewSpec, props) {
5
- const dummy = createElement('fragment');
5
+ const dummy = createElement('fragment', window.document);
6
6
  const viewInstance = new viewSpec({ target: dummy, props });
7
7
  const element = dummy.firstElement();
8
8
  return { element, viewInstance };
@@ -12,18 +12,16 @@ export function showBottomSheet(modalOptions) {
12
12
  // Get this before any potential new frames are created by component below
13
13
  const modalLauncher = (parent && (parent instanceof View ? parent : parent.nativeView)) || Frame.topmost().currentPage;
14
14
  const componentInstanceInfo = resolveComponentElement(view, props);
15
- const modalView = componentInstanceInfo.element.nativeView;
15
+ let modalView = componentInstanceInfo.element.nativeView;
16
16
  return new Promise(async (resolve, reject) => {
17
17
  let resolved = false;
18
18
  const closeCallback = (result) => {
19
19
  if (resolved)
20
20
  return;
21
- const index = modalStack.indexOf(componentInstanceInfo);
22
- if (index !== -1) {
23
- modalStack.splice(index, 1);
24
- }
21
+ modalStack.pop();
25
22
  resolved = true;
26
23
  resolve(result);
24
+ modalView._tearDownUI();
27
25
  componentInstanceInfo.viewInstance.$destroy(); // don't let an exception in destroy kill the promise callback
28
26
  };
29
27
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["svelte/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAA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IAAI,CAAC,qBAAqB,CAAC,CAAC;SAC1C;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,GAAG,CAAC,CAAC;SACf;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAY;IACzC,MAAM,qBAAqB,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAChE,IAAI,qBAAqB,EAAE;QACtB,qBAAqB,CAAC,OAAO,CAAC,UAAkB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;KAC9E;AACL,CAAC;AACD,MAAM,UAAU,mBAAmB;IAC/B,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;AACjC,CAAC"}
package/vue3/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ViewBase } from '@nativescript/core';
1
+ import { View } from '@nativescript/core';
2
2
  import { BottomSheetOptions } from '../bottomsheet';
3
3
  declare module '@vue/runtime-core' {
4
4
  interface ComponentCustomProperties {
@@ -14,7 +14,7 @@ declare const BottomSheetPlugin: {
14
14
  install(app: any): void;
15
15
  };
16
16
  interface VueBottomSheetOptions extends Partial<BottomSheetOptions> {
17
- view?: string | ViewBase;
17
+ view?: string | View;
18
18
  props?: any;
19
19
  on?: Record<string, (...args: any[]) => any>;
20
20
  }
@@ -1,10 +0,0 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- export declare class NativeScriptMaterialBottomSheetModule {
4
- private static initialized;
5
- static forRoot(): ModuleWithProviders<NativeScriptMaterialBottomSheetModule>;
6
- constructor();
7
- static ɵfac: i0.ɵɵFactoryDeclaration<NativeScriptMaterialBottomSheetModule, never>;
8
- static ɵmod: i0.ɵɵNgModuleDeclaration<NativeScriptMaterialBottomSheetModule, never, never, never>;
9
- static ɵinj: i0.ɵɵInjectorDeclaration<NativeScriptMaterialBottomSheetModule>;
10
- }
@@ -1,28 +0,0 @@
1
- import { Type, ViewContainerRef } from '@angular/core';
2
- import type { BottomSheetOptions as MaterialBottomSheetOptions } from '@nativescript-community/ui-material-bottomsheet';
3
- import { Observable } from 'rxjs';
4
- import * as i0 from "@angular/core";
5
- export declare type BaseShowBottomSheetOptions = Omit<MaterialBottomSheetOptions, 'closeCallback' | 'view'>;
6
- export interface BottomSheetOptions extends BaseShowBottomSheetOptions {
7
- viewContainerRef?: ViewContainerRef;
8
- }
9
- export declare class BottomSheetParams {
10
- readonly context: any;
11
- readonly closeCallback: (...args: any[]) => void;
12
- constructor(context: any, closeCallback: (...args: any[]) => void);
13
- }
14
- export declare class BottomSheetService {
15
- show<TResult = any>(type: Type<any>, options: BottomSheetOptions): Observable<TResult>;
16
- showWithCloseCallback<TResult = any>(type: Type<any>, options: BottomSheetOptions): {
17
- observable: Observable<TResult>;
18
- closeCallback: () => void;
19
- };
20
- private getParentView;
21
- private getFactoryResolver;
22
- private createChildInjector;
23
- private getBottomSheetParams;
24
- private createDetachedLoader;
25
- private loadComponent;
26
- static ɵfac: i0.ɵɵFactoryDeclaration<BottomSheetService, never>;
27
- static ɵprov: i0.ɵɵInjectableDeclaration<BottomSheetService>;
28
- }
@@ -1,2 +0,0 @@
1
- export * from './bottomsheet.module';
2
- export * from './bottomsheet.service';