@nativescript-community/ui-material-bottomsheet 7.2.0 → 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.
@@ -22,7 +22,7 @@ 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.2.0",
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.2.0"
49
+ "@nativescript-community/ui-material-core": "^7.2.1"
50
50
  },
51
- "gitHead": "6f0934230139071de6eb0579837644924313334d"
51
+ "gitHead": "75b7a4ee372bce6dacaa260d05a106179dfa2713"
52
52
  }
package/svelte/index.d.ts CHANGED
@@ -2,17 +2,23 @@ import { BottomSheetOptions } from '../bottomsheet';
2
2
  import { View } from '@nativescript/core';
3
3
  import { NativeViewElementNode } from 'svelte-native/dom';
4
4
  import { PageSpec } from 'svelte-native/dom/navigation';
5
- export interface ShowBottomSheetOptions extends Omit<BottomSheetOptions, 'view'> {
6
- view: PageSpec;
7
- parent: NativeViewElementNode<View> | View;
8
- 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;
9
15
  }
10
16
  interface ComponentInstanceInfo {
11
17
  element: NativeViewElementNode<View>;
12
18
  viewInstance: SvelteComponent;
13
19
  }
14
- export declare function resolveComponentElement(viewSpec: PageSpec, props?: any): ComponentInstanceInfo;
15
- 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>;
16
22
  export declare function closeBottomSheet(result?: any): void;
17
23
  export declare function isBottomSheetOpened(): boolean;
18
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,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAazE,MAAM,UAAU,GAA4B,EAAE,CAAC;AAE/C,MAAM,UAAU,uBAAuB,CAAC,QAAkB,EAAE,KAAW;IACnE,MAAM,KAAK,GAAG,aAAa,CAAC,UAAU,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M,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
  }