@getcortexlabs/mavis 0.1.0-alpha.2 → 0.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +3 -3
  2. package/dist/native/box.ios.d.ts +4 -0
  3. package/dist/native/box.ios.d.ts.map +1 -1
  4. package/dist/native/box.ios.js +13 -0
  5. package/dist/native/box.ios.js.map +1 -1
  6. package/dist/native/button.ios.d.ts +4 -0
  7. package/dist/native/button.ios.d.ts.map +1 -1
  8. package/dist/native/button.ios.js +12 -0
  9. package/dist/native/button.ios.js.map +1 -1
  10. package/dist/native/flex-layout.ios.d.ts +5 -0
  11. package/dist/native/flex-layout.ios.d.ts.map +1 -1
  12. package/dist/native/flex-layout.ios.js +24 -0
  13. package/dist/native/flex-layout.ios.js.map +1 -1
  14. package/dist/native/keyboard-dismiss.android.d.ts +8 -0
  15. package/dist/native/keyboard-dismiss.android.d.ts.map +1 -0
  16. package/dist/native/keyboard-dismiss.android.js +9 -0
  17. package/dist/native/keyboard-dismiss.android.js.map +1 -0
  18. package/dist/native/keyboard-dismiss.d.ts +10 -0
  19. package/dist/native/keyboard-dismiss.d.ts.map +1 -0
  20. package/dist/native/keyboard-dismiss.ios.d.ts +8 -0
  21. package/dist/native/keyboard-dismiss.ios.d.ts.map +1 -0
  22. package/dist/native/keyboard-dismiss.ios.js +88 -0
  23. package/dist/native/keyboard-dismiss.ios.js.map +1 -0
  24. package/dist/native/keyboard-dismiss.js +6 -0
  25. package/dist/native/keyboard-dismiss.js.map +1 -0
  26. package/dist/native/label.ios.d.ts +4 -0
  27. package/dist/native/label.ios.d.ts.map +1 -1
  28. package/dist/native/label.ios.js +12 -0
  29. package/dist/native/label.ios.js.map +1 -1
  30. package/dist/native/measure-memo.d.ts +37 -0
  31. package/dist/native/measure-memo.d.ts.map +1 -0
  32. package/dist/native/measure-memo.js +82 -0
  33. package/dist/native/measure-memo.js.map +1 -0
  34. package/dist/native/screen.android.d.ts +6 -0
  35. package/dist/native/screen.android.d.ts.map +1 -0
  36. package/dist/native/screen.android.js +8 -0
  37. package/dist/native/screen.android.js.map +1 -0
  38. package/dist/native/screen.d.ts +2 -0
  39. package/dist/native/screen.d.ts.map +1 -0
  40. package/dist/native/screen.js +3 -0
  41. package/dist/native/screen.js.map +1 -0
  42. package/dist/native/sheet.android.d.ts +14 -0
  43. package/dist/native/sheet.android.d.ts.map +1 -0
  44. package/dist/native/sheet.android.js +16 -0
  45. package/dist/native/sheet.android.js.map +1 -0
  46. package/dist/native/sheet.d.ts +17 -0
  47. package/dist/native/sheet.d.ts.map +1 -0
  48. package/dist/native/sheet.ios.d.ts +15 -0
  49. package/dist/native/sheet.ios.d.ts.map +1 -0
  50. package/dist/native/sheet.ios.js +32 -0
  51. package/dist/native/sheet.ios.js.map +1 -0
  52. package/dist/native/sheet.js +17 -0
  53. package/dist/native/sheet.js.map +1 -0
  54. package/dist/vue/components/MButton.d.ts +2 -2
  55. package/dist/vue/components/MCard.d.ts +2 -2
  56. package/dist/vue/components/MInput.d.ts +3 -3
  57. package/dist/vue/components/MReveal.d.ts +2 -2
  58. package/dist/vue/components/MScreen.d.ts +9 -0
  59. package/dist/vue/components/MScreen.d.ts.map +1 -1
  60. package/dist/vue/components/MScreen.js +53 -5
  61. package/dist/vue/components/MScreen.js.map +1 -1
  62. package/dist/vue/components/MSheet.d.ts +95 -0
  63. package/dist/vue/components/MSheet.d.ts.map +1 -0
  64. package/dist/vue/components/MSheet.js +281 -0
  65. package/dist/vue/components/MSheet.js.map +1 -0
  66. package/dist/vue/components/MText.d.ts +1 -1
  67. package/dist/vue/components/layout.d.ts +6 -6
  68. package/dist/vue/index.d.ts +8 -2
  69. package/dist/vue/index.d.ts.map +1 -1
  70. package/dist/vue/index.js +7 -2
  71. package/dist/vue/index.js.map +1 -1
  72. package/dist/vue/layers.d.ts +17 -0
  73. package/dist/vue/layers.d.ts.map +1 -0
  74. package/dist/vue/layers.js +26 -0
  75. package/dist/vue/layers.js.map +1 -0
  76. package/dist/vue/native-view.d.ts +6 -0
  77. package/dist/vue/native-view.d.ts.map +1 -0
  78. package/dist/vue/native-view.js +5 -0
  79. package/dist/vue/native-view.js.map +1 -0
  80. package/dist/vue/props.d.ts +12 -11
  81. package/dist/vue/props.d.ts.map +1 -1
  82. package/dist/vue/props.js +25 -10
  83. package/dist/vue/props.js.map +1 -1
  84. package/dist/vue/system-back.d.ts +11 -0
  85. package/dist/vue/system-back.d.ts.map +1 -0
  86. package/dist/vue/system-back.js +2 -0
  87. package/dist/vue/system-back.js.map +1 -0
  88. package/package.json +2 -2
  89. package/platforms/android/java/com/mavis/ui/Box.java +36 -3
  90. package/platforms/android/java/com/mavis/ui/FlexLayout.java +76 -4
  91. package/platforms/android/java/com/mavis/ui/MeasureMemo.java +145 -0
  92. package/platforms/android/java/com/mavis/ui/Screen.java +108 -0
  93. package/src/native/box.ios.ts +27 -0
  94. package/src/native/button.ios.ts +14 -0
  95. package/src/native/flex-layout.ios.ts +41 -0
  96. package/src/native/keyboard-dismiss.android.ts +17 -0
  97. package/src/native/keyboard-dismiss.ios.ts +122 -0
  98. package/src/native/keyboard-dismiss.ts +14 -0
  99. package/src/native/label.ios.ts +14 -0
  100. package/src/native/measure-memo.ts +116 -0
  101. package/src/native/screen.android.ts +12 -0
  102. package/src/native/screen.ts +2 -0
  103. package/src/native/sheet.android.ts +24 -0
  104. package/src/native/sheet.ios.ts +43 -0
  105. package/src/native/sheet.ts +26 -0
  106. package/src/vue/components/MScreen.ts +78 -5
  107. package/src/vue/components/MSheet.ts +335 -0
  108. package/src/vue/index.ts +26 -3
  109. package/src/vue/layers.ts +46 -0
  110. package/src/vue/native-view.ts +6 -0
  111. package/src/vue/props.ts +37 -12
  112. package/src/vue/system-back.ts +12 -0
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Mavis UI for NativeScript
2
2
 
3
- NativeScript components and themes for Mavis UI `0.1.0-alpha.2`, starting with Vue. Experimental prerelease for testing in real apps; the API can change between alpha versions. Licensed under MIT.
3
+ NativeScript components and themes for Mavis UI `0.1.0-alpha.3`, starting with Vue. Experimental prerelease for testing in real apps; the API can change between alpha versions. Licensed under MIT.
4
4
 
5
5
  In an existing NativeScript-Vue application:
6
6
 
7
7
  ```sh
8
- npm install @getcortexlabs/mavis@0.1.0-alpha.2 @rafaelaugusto/jolt@0.1.0-rc.1
8
+ npm install @getcortexlabs/mavis@0.1.0-alpha.3 @rafaelaugusto/jolt@0.1.0-rc.1
9
9
  ```
10
10
 
11
11
  ```ts
@@ -21,7 +21,7 @@ createApp({ render: () => h('Frame', {}, [h(App)]) })
21
21
 
22
22
  Use the existing navigation host when your app already has one. MScreen represents a native Page; do not nest Screens. Android keyboard avoidance requires `adjustResize` on the Activity.
23
23
 
24
- The plugin registers Screen, Row, Column, Box, Card, Text, Icon, Button, Input, Slider and Reveal. Icons use the bundled Lucide font: copy `fonts/lucide.ttf` from this package into the app's `fonts` folder. Use `MButton` or `m-button` in Vue templates; with `@nativescript/vite`, use `MButton`, because that integration compiles hyphenated tags as native elements. Both `@nativescript/webpack` and `@nativescript/vite` pick up the Mavis iOS and Android files. Themes are exported from `@getcortexlabs/mavis`; components and theme context are available from `/vue`.
24
+ The plugin registers Screen, Row, Column, Box, Card, Text, Icon, Button, Input, Slider, Sheet and Reveal. Sheet uses Jolt's bottom sheet inside a Screen; with vue-router-ns, pass `claimSystemBack: (claimant) => router.claimSystemBack(claimant)` to `createMavis` so Android back reaches an open sheet first. Icons use the bundled Lucide font: copy `fonts/lucide.ttf` from this package into the app's `fonts` folder. Use `MButton` or `m-button` in Vue templates; with `@nativescript/vite`, use `MButton`, because that integration compiles hyphenated tags as native elements. Both `@nativescript/webpack` and `@nativescript/vite` pick up the Mavis iOS and Android files. Themes are exported from `@getcortexlabs/mavis`; components and theme context are available from `/vue`.
25
25
 
26
26
  - `@getcortexlabs/mavis-core`: shared themes, spacing, slider step conversion and Vue context.
27
27
  - `src/native/`: NativeScript behavior, including owned Jolt press effects.
@@ -1,6 +1,10 @@
1
1
  import { GridLayout } from '@nativescript/core';
2
+ import { type MeasureRecord } from './measure-memo';
2
3
  /** An auto-height Box takes its content height when the parent only limits the available space. */
3
4
  export declare class MavisBox extends GridLayout {
5
+ measureRecord?: MeasureRecord;
6
+ measure(widthSpec: number, heightSpec: number): void;
7
+ requestLayout(): void;
4
8
  onMeasure(widthSpec: number, heightSpec: number): void;
5
9
  }
6
10
  //# sourceMappingURL=box.ios.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"box.ios.d.ts","sourceRoot":"","sources":["../../src/native/box.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAS,MAAM,oBAAoB,CAAA;AAItD,mGAAmG;AACnG,qBAAa,QAAS,SAAQ,UAAU;IACtC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAOhD"}
1
+ {"version":3,"file":"box.ios.d.ts","sourceRoot":"","sources":["../../src/native/box.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAS,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAA;AAIvB,mGAAmG;AACnG,qBAAa,QAAS,SAAQ,UAAU;IACtC,aAAa,CAAC,EAAE,aAAa,CAAA;IAE7B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAa7C,aAAa;IAKb,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAOhD"}
@@ -1,7 +1,20 @@
1
1
  import { GridLayout, Utils } from '@nativescript/core';
2
+ import { filledLimit, layoutChildren, recordMeasurement, reuseMeasurement, } from './measure-memo';
2
3
  const { layout } = Utils;
3
4
  /** An auto-height Box takes its content height when the parent only limits the available space. */
4
5
  export class MavisBox extends GridLayout {
6
+ measureRecord;
7
+ measure(widthSpec, heightSpec) {
8
+ if (reuseMeasurement(this, widthSpec, heightSpec))
9
+ return;
10
+ super.measure(widthSpec, heightSpec);
11
+ const measured = this;
12
+ recordMeasurement(this, widthSpec, heightSpec, layoutChildren(this), filledLimit(widthSpec, heightSpec, measured._measuredWidth, measured._measuredHeight));
13
+ }
14
+ requestLayout() {
15
+ this.measureRecord = undefined;
16
+ super.requestLayout();
17
+ }
5
18
  onMeasure(widthSpec, heightSpec) {
6
19
  const relaxed = this.effectiveHeight < 0 && layout.getMeasureSpecMode(heightSpec) === layout.AT_MOST
7
20
  ? layout.makeMeasureSpec(0, layout.UNSPECIFIED)
@@ -1 +1 @@
1
- {"version":3,"file":"box.ios.js","sourceRoot":"","sources":["../../src/native/box.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;AAExB,mGAAmG;AACnG,MAAM,OAAO,QAAS,SAAQ,UAAU;IACtC,SAAS,CAAC,SAAiB,EAAE,UAAkB;QAC7C,MAAM,OAAO,GACX,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,KAAK,MAAM,CAAC,OAAO;YAClF,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;YAC/C,CAAC,CAAC,UAAU,CAAA;QAChB,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC;CACF"}
1
+ {"version":3,"file":"box.ios.js","sourceRoot":"","sources":["../../src/native/box.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EACL,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GAEjB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;AAExB,mGAAmG;AACnG,MAAM,OAAO,QAAS,SAAQ,UAAU;IACtC,aAAa,CAAgB;IAE7B,OAAO,CAAC,SAAiB,EAAE,UAAkB;QAC3C,IAAI,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC;YAAE,OAAM;QACzD,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;QACpC,MAAM,QAAQ,GAAG,IAAsE,CAAA;QACvF,iBAAiB,CACf,IAAI,EACJ,SAAS,EACT,UAAU,EACV,cAAc,CAAC,IAAI,CAAC,EACpB,WAAW,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,eAAe,CAAC,CACtF,CAAA;IACH,CAAC;IAED,aAAa;QACX,IAAI,CAAC,aAAa,GAAG,SAAS,CAAA;QAC9B,KAAK,CAAC,aAAa,EAAE,CAAA;IACvB,CAAC;IAED,SAAS,CAAC,SAAiB,EAAE,UAAkB;QAC7C,MAAM,OAAO,GACX,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,KAAK,MAAM,CAAC,OAAO;YAClF,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;YAC/C,CAAC,CAAC,UAAU,CAAA;QAChB,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC;CACF"}
@@ -1,5 +1,9 @@
1
1
  import { Button } from '@nativescript/core';
2
+ import { type MeasureRecord } from './measure-memo';
2
3
  export declare class MavisButton extends Button {
4
+ measureRecord?: MeasureRecord;
5
+ measure(widthSpec: number, heightSpec: number): void;
6
+ requestLayout(): void;
3
7
  onMeasure(widthSpec: number, heightSpec: number): void;
4
8
  }
5
9
  //# sourceMappingURL=button.ios.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.ios.d.ts","sourceRoot":"","sources":["../../src/native/button.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,qBAAa,WAAY,SAAQ,MAAM;IACrC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAWhD"}
1
+ {"version":3,"file":"button.ios.d.ts","sourceRoot":"","sources":["../../src/native/button.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAExF,qBAAa,WAAY,SAAQ,MAAM;IACrC,aAAa,CAAC,EAAE,aAAa,CAAA;IAE7B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAM7C,aAAa;IAKb,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAWhD"}
@@ -1,5 +1,17 @@
1
1
  import { Button } from '@nativescript/core';
2
+ import { recordMeasurement, reuseMeasurement } from './measure-memo';
2
3
  export class MavisButton extends Button {
4
+ measureRecord;
5
+ measure(widthSpec, heightSpec) {
6
+ if (reuseMeasurement(this, widthSpec, heightSpec))
7
+ return;
8
+ super.measure(widthSpec, heightSpec);
9
+ recordMeasurement(this, widthSpec, heightSpec);
10
+ }
11
+ requestLayout() {
12
+ this.measureRecord = undefined;
13
+ super.requestLayout();
14
+ }
3
15
  onMeasure(widthSpec, heightSpec) {
4
16
  const button = this.ios;
5
17
  // UIButton updates titleLabel during its layout pass. Wrapped measurement needs the
@@ -1 +1 @@
1
- {"version":3,"file":"button.ios.js","sourceRoot":"","sources":["../../src/native/button.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,MAAM,OAAO,WAAY,SAAQ,MAAM;IACrC,SAAS,CAAC,SAAiB,EAAE,UAAkB;QAC7C,MAAM,MAAM,GAAG,IAAI,CA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MAAM,CAAC,YAAY,CAAA;QAC9C,CAAC;QACD,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IACxC,CAAC;CACF"}
@@ -1,5 +1,10 @@
1
1
  import { FlexboxLayout, type View } from '@nativescript/core';
2
+ import { type MeasureRecord } from './measure-memo';
2
3
  export declare class MavisFlexLayout extends FlexboxLayout {
4
+ measureRecord?: MeasureRecord;
5
+ measure(widthSpec: number, heightSpec: number): void;
6
+ private contentExceeds;
7
+ requestLayout(): void;
3
8
  _registerLayoutChild(child: View): void;
4
9
  onLoaded(): void;
5
10
  _determineMainSize(direction: string, widthSpec: number, heightSpec: number): void;
@@ -1 +1 @@
1
- {"version":3,"file":"flex-layout.ios.d.ts","sourceRoot":"","sources":["../../src/native/flex-layout.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAoBpE,qBAAa,eAAgB,SAAQ,aAAa;IAChD,oBAAoB,CAAC,KAAK,EAAE,IAAI;IAKhC,QAAQ;IAKR,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IA+C3E,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,cAAc;CAoBvB"}
1
+ {"version":3,"file":"flex-layout.ios.d.ts","sourceRoot":"","sources":["../../src/native/flex-layout.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEpE,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAA;AAqBvB,qBAAa,eAAgB,SAAQ,aAAa;IAChD,aAAa,CAAC,EAAE,aAAa,CAAA;IAE7B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAc7C,OAAO,CAAC,cAAc;IAYtB,aAAa;IAKb,oBAAoB,CAAC,KAAK,EAAE,IAAI;IAKhC,QAAQ;IAKR,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IA+C3E,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,cAAc;CAoBvB"}
@@ -1,8 +1,32 @@
1
1
  import { FlexboxLayout, Utils } from '@nativescript/core';
2
2
  import { applyColumnShrink } from './flex-children';
3
+ import { layoutChildren, recordMeasurement, reuseMeasurement, } from './measure-memo';
3
4
  const { layout } = Utils;
4
5
  const base = FlexboxLayout.prototype;
5
6
  export class MavisFlexLayout extends FlexboxLayout {
7
+ measureRecord;
8
+ measure(widthSpec, heightSpec) {
9
+ if (reuseMeasurement(this, widthSpec, heightSpec))
10
+ return;
11
+ super.measure(widthSpec, heightSpec);
12
+ recordMeasurement(this, widthSpec, heightSpec, layoutChildren(this), this.contentExceeds(widthSpec, heightSpec));
13
+ }
14
+ // Core measures a looser request without shrinking, so its lines tell whether the content
15
+ // wanted more room than the request allowed.
16
+ contentExceeds(widthSpec, heightSpec) {
17
+ const measurement = this;
18
+ const column = this.flexDirection.startsWith('column');
19
+ const main = measurement._getLargestMainSize();
20
+ const cross = measurement._getSumOfCrossSize();
21
+ const maxHeight = column ? main : cross + this.effectivePaddingTop + this.effectivePaddingBottom;
22
+ const maxWidth = column ? cross + this.effectivePaddingLeft + this.effectivePaddingRight : main;
23
+ const exceeds = (spec, size) => layout.getMeasureSpecMode(spec) === layout.AT_MOST && layout.getMeasureSpecSize(spec) < size;
24
+ return exceeds(heightSpec, maxHeight) || exceeds(widthSpec, maxWidth);
25
+ }
26
+ requestLayout() {
27
+ this.measureRecord = undefined;
28
+ super.requestLayout();
29
+ }
6
30
  _registerLayoutChild(child) {
7
31
  super._registerLayoutChild(child);
8
32
  applyColumnShrink(this, child);
@@ -1 +1 @@
1
- {"version":3,"file":"flex-layout.ios.js","sourceRoot":"","sources":["../../src/native/flex-layout.ios.ts"],"names":[],"mappings":"AAAA,OAAO,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AAC,CAAC,MAAM,CAAC,OAAO,CAAA;QACpB,KAAK,CAAC,OAAO,CACX,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EAC7C,KAAK,CAAC,eAAe,IAAI,CAAC;YACxB,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC;YAC/D,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAC5C,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import type { View } from '@nativescript/core';
2
+ export interface KeyboardDismissal {
3
+ tap: boolean;
4
+ drag: boolean;
5
+ }
6
+ /** The container is a `com.mavis.ui.Screen`, which watches every touch of the page. */
7
+ export declare function dismissKeyboardOn(container: View, options: KeyboardDismissal): () => void;
8
+ //# sourceMappingURL=keyboard-dismiss.android.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-dismiss.android.d.ts","sourceRoot":"","sources":["../../src/native/keyboard-dismiss.android.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAE9C,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;CACd;AAKD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAKzF"}
@@ -0,0 +1,9 @@
1
+ /** The container is a `com.mavis.ui.Screen`, which watches every touch of the page. */
2
+ export function dismissKeyboardOn(container, options) {
3
+ const screen = container.android;
4
+ if (!screen?.setKeyboardDismissal)
5
+ return () => { };
6
+ screen.setKeyboardDismissal(options.tap, options.drag);
7
+ return () => screen.setKeyboardDismissal?.(false, false);
8
+ }
9
+ //# sourceMappingURL=keyboard-dismiss.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-dismiss.android.js","sourceRoot":"","sources":["../../src/native/keyboard-dismiss.android.ts"],"names":[],"mappings":"AAUA,uFAAuF;AACvF,MAAM,UAAU,iBAAiB,CAAC,SAAe,EAAE,OAA0B;IAC3E,MAAM,MAAM,GAAG,SAAS,CAAC,OAA0C,CAAA;IACnE,IAAI,CAAC,MAAM,EAAE,oBAAoB;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;IAClD,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACtD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { View } from '@nativescript/core';
2
+ export interface KeyboardDismissal {
3
+ /** A tap anywhere on the page that is not an editor. */
4
+ tap: boolean;
5
+ /** A drag of the scrolling content. */
6
+ drag: boolean;
7
+ }
8
+ /** Puts the software keyboard away for the given gestures until the returned function runs. */
9
+ export declare function dismissKeyboardOn(_container: View, _options: KeyboardDismissal): () => void;
10
+ //# sourceMappingURL=keyboard-dismiss.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-dismiss.d.ts","sourceRoot":"","sources":["../../src/native/keyboard-dismiss.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAE9C,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,GAAG,EAAE,OAAO,CAAA;IACZ,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;CACd;AAGD,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAE3F"}
@@ -0,0 +1,8 @@
1
+ import { type View } from '@nativescript/core';
2
+ export interface KeyboardDismissal {
3
+ tap: boolean;
4
+ drag: boolean;
5
+ }
6
+ /** A tap recognizer on the page container; the scroll view follows the drag with the keyboard. */
7
+ export declare function dismissKeyboardOn(container: View, options: KeyboardDismissal): () => void;
8
+ //# sourceMappingURL=keyboard-dismiss.ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-dismiss.ios.d.ts","sourceRoot":"","sources":["../../src/native/keyboard-dismiss.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAE1D,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;CACd;AAiFD,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAkCzF"}
@@ -0,0 +1,88 @@
1
+ import { ScrollView } from '@nativescript/core';
2
+ const editor = (view) => {
3
+ for (let current = view; current; current = current.superview) {
4
+ if (current instanceof UITextField || current instanceof UITextView)
5
+ return true;
6
+ }
7
+ return false;
8
+ };
9
+ const firstResponder = (view) => {
10
+ if (view.isFirstResponder)
11
+ return view;
12
+ const subviews = view.subviews;
13
+ for (let index = 0; index < subviews.count; index++) {
14
+ const found = firstResponder(subviews.objectAtIndex(index));
15
+ if (found)
16
+ return found;
17
+ }
18
+ return null;
19
+ };
20
+ // The recognizer only observes: it never cancels or delays the touches of the controls below
21
+ // it, and it recognizes together with the gesture recognizers of Core and Jolt. It takes a
22
+ // touch only while an editor is active and the touch is not on an editor. UIKit runs the tap
23
+ // action after the control's own action, so a control that focused another editor meanwhile
24
+ // keeps that focus.
25
+ let editing = null;
26
+ let Delegate;
27
+ let Target;
28
+ function classes() {
29
+ Delegate ??= NSObject.extend({
30
+ gestureRecognizerShouldReceiveTouch(recognizer, touch) {
31
+ editing = editor(touch.view) ? null : firstResponder(recognizer.view);
32
+ return editing !== null;
33
+ },
34
+ gestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer() {
35
+ return true;
36
+ },
37
+ }, { protocols: [UIGestureRecognizerDelegate] });
38
+ Target ??= NSObject.extend({
39
+ dismiss(recognizer) {
40
+ const current = firstResponder(recognizer.view);
41
+ if (editing && current?.isEqual(editing))
42
+ recognizer.view.endEditing(true);
43
+ editing = null;
44
+ },
45
+ }, { exposedMethods: { dismiss: { returns: interop.types.void, params: [UIGestureRecognizer] } } });
46
+ return { Delegate, Target };
47
+ }
48
+ /** A tap recognizer on the page container; the scroll view follows the drag with the keyboard. */
49
+ export function dismissKeyboardOn(container, options) {
50
+ const native = container.ios;
51
+ if (!native)
52
+ return () => { };
53
+ let recognizer;
54
+ // The recognizer keeps neither object alive for the runtime: hold both until release.
55
+ let delegate;
56
+ let target;
57
+ if (options.tap) {
58
+ const { Delegate, Target } = classes();
59
+ delegate = new Delegate();
60
+ target = new Target();
61
+ recognizer = UITapGestureRecognizer.alloc().initWithTargetAction(target, 'dismiss');
62
+ recognizer.cancelsTouchesInView = false;
63
+ recognizer.delaysTouchesEnded = false;
64
+ recognizer.delegate = delegate;
65
+ native.addGestureRecognizer(recognizer);
66
+ }
67
+ let scroll;
68
+ container.eachChildView((child) => {
69
+ if (child instanceof ScrollView)
70
+ scroll = child;
71
+ return !scroll;
72
+ });
73
+ // UIScrollViewKeyboardDismissMode: none (0) or interactive (2).
74
+ if (scroll?.ios)
75
+ scroll.ios.keyboardDismissMode = options.drag ? 2 : 0;
76
+ return () => {
77
+ if (recognizer) {
78
+ native.removeGestureRecognizer(recognizer);
79
+ recognizer.delegate = null;
80
+ }
81
+ recognizer = undefined;
82
+ delegate = undefined;
83
+ target = undefined;
84
+ if (scroll?.ios)
85
+ scroll.ios.keyboardDismissMode = 0;
86
+ };
87
+ }
88
+ //# sourceMappingURL=keyboard-dismiss.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-dismiss.ios.js","sourceRoot":"","sources":["../../src/native/keybo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ACnF,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAA;QACvC,UAAU,CAAC,kBAAkB,GAAG,KAAK,CAAA;QACrC,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAC9B,MAAM,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAA;IACzC,CAAC;IACD,IAAI,MAA8B,CAAA;IAClC,SAAS,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE;QAChC,IAAI,KAAK,YAAY,UAAU;YAAE,MAAM,GAAG,KAAK,CAAA;QAC/C,OAAO,CAAC,MAAM,CAAA;IAChB,CAAC,CAAC,CAAA;IACF,gEAAgE;IAChE,IAAI,MAAM,EAAE,GAAG;QAAE,MAAM,CAAC,GAAG,CAAC,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACtE,OAAO,GAAG,EAAE;QACV,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAA;YAC1C,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAA;QAC5B,CAAC;QACD,UAAU,GAAG,SAAS,CAAA;QACtB,QAAQ,GAAG,SAAS,CAAA;QACpB,MAAM,GAAG,SAAS,CAAA;QAClB,IAAI,MAAM,EAAE,GAAG;YAAE,MAAM,CAAC,GAAG,CAAC,mBAAmB,GAAG,CAAC,CAAA;IACrD,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ // NativeScript resolves the platform implementation before loading this module.
2
+ /** Puts the software keyboard away for the given gestures until the returned function runs. */
3
+ export function dismissKeyboardOn(_container, _options) {
4
+ return () => { };
5
+ }
6
+ //# sourceMappingURL=keyboard-dismiss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-dismiss.js","sourceRoot":"","sources":["../../src/native/keyboard-dismiss.ts"],"names":[],"mappings":"AASA,gFAAgF;AAChF,+FAA+F;AAC/F,MAAM,UAAU,iBAAiB,CAAC,UAAgB,EAAE,QAA2B;IAC7E,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;AACjB,CAAC"}
@@ -1,5 +1,9 @@
1
1
  import { Label } from '@nativescript/core';
2
+ import { type MeasureRecord } from './measure-memo';
2
3
  export declare class MavisLabel extends Label {
4
+ measureRecord?: MeasureRecord;
5
+ measure(widthSpec: number, heightSpec: number): void;
6
+ requestLayout(): void;
3
7
  disposeNativeView(): void;
4
8
  _requestLayoutOnTextChanged(): void;
5
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"label.ios.d.ts","sourceRoot":"","sources":["../../src/native/label.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAS,MAAM,oBAAoB,CAAA;AAEjD,qBAAa,UAAW,SAAQ,KAAK;IACnC,iBAAiB;IAQjB,2BAA2B;CAI5B"}
1
+ {"version":3,"file":"label.ios.d.ts","sourceRoot":"","sources":["../../src/native/label.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAS,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAExF,qBAAa,UAAW,SAAQ,KAAK;IACnC,aAAa,CAAC,EAAE,aAAa,CAAA;IAE7B,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAM7C,aAAa;IAKb,iBAAiB;IAQjB,2BAA2B;CAI5B"}
@@ -1,5 +1,17 @@
1
1
  import { Label, Utils } from '@nativescript/core';
2
+ import { recordMeasurement, reuseMeasurement } from './measure-memo';
2
3
  export class MavisLabel extends Label {
4
+ measureRecord;
5
+ measure(widthSpec, heightSpec) {
6
+ if (reuseMeasurement(this, widthSpec, heightSpec))
7
+ return;
8
+ super.measure(widthSpec, heightSpec);
9
+ recordMeasurement(this, widthSpec, heightSpec);
10
+ }
11
+ requestLayout() {
12
+ this.measureRecord = undefined;
13
+ super.requestLayout();
14
+ }
3
15
  disposeNativeView() {
4
16
  const native = this.nativeViewProtected;
5
17
  super.disposeNativeView();
@@ -1 +1 @@
1
- {"version":3,"file":"label.ios.js","sourceRoot":"","sources":["../../src/native/label.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,iBAAiB;QACf,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAA;QACvC,KAAK,CAAC,iBAAiB,EAAE,CAAA;QACzB,0EAA0E;QAC1E,4EAA4E;QAC5E,IAAI,MAAM;YAAE,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;IAED,2BAA2B;QACzB,+EAA+E;QAC/E,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;CACF"}
1
+ {"version":3,"file":"label.ios.js","sourceRoot":"","sources":["../../src/native/label.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAsB,MAAM,gBAAgB,CAAA;AAExF,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,aAAa,CAAgB;IAE7B,OAAO,CAAC,SAAiB,EAAE,UAAkB;QAC3C,IAAI,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC;YAAE,OAAM;QACzD,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;QACpC,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;IAChD,CAAC;IAED,aAAa;QACX,IAAI,CAAC,aAAa,GAAG,SAAS,CAAA;QAC9B,KAAK,CAAC,aAAa,EAAE,CAAA;IACvB,CAAC;IAED,iBAAiB;QACf,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAA;QACvC,KAAK,CAAC,iBAAiB,EAAE,CAAA;QACzB,0EAA0E;QAC1E,4EAA4E;QAC5E,IAAI,MAAM;YAAE,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;IAED,2BAA2B;QACzB,+EAA+E;QAC/E,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;CACF"}
@@ -0,0 +1,37 @@
1
+ import { type View } from '@nativescript/core';
2
+ interface ChildRecord {
3
+ view: View;
4
+ widthSpec: number;
5
+ heightSpec: number;
6
+ width: number;
7
+ height: number;
8
+ }
9
+ export interface MeasureRecord {
10
+ widthSpec: number;
11
+ heightSpec: number;
12
+ width: number;
13
+ height: number;
14
+ percent: boolean;
15
+ /** The looser request clamped content that wanted more room; an exact size would shrink it. */
16
+ clamped: boolean;
17
+ children: ChildRecord[];
18
+ }
19
+ export interface Memoized extends View {
20
+ measureRecord?: MeasureRecord;
21
+ }
22
+ /** Whether a looser request on either axis returned its whole limit; for layouts that cannot tell. */
23
+ export declare function filledLimit(widthSpec: number, heightSpec: number, width: number, height: number): boolean;
24
+ /**
25
+ * Core measures a view again whenever its parent asks while a layout request is pending, and
26
+ * flex containers ask several times per pass, so nested containers measure their leaves an
27
+ * exponential number of times. While nothing in the subtree asked for layout, the recorded
28
+ * measurement answers a repeated request and the children are measured again from their records.
29
+ */
30
+ export declare function reuseMeasurement(view: Memoized, widthSpec: number, heightSpec: number): boolean;
31
+ /** Stores the measurement that just completed with the specs every child last received. */
32
+ export declare function recordMeasurement(view: Memoized, widthSpec: number, heightSpec: number, children?: readonly View[], clamped?: boolean): void;
33
+ export declare function layoutChildren(view: {
34
+ eachLayoutChild(callback: (child: View) => void): void;
35
+ }): View[];
36
+ export {};
37
+ //# sourceMappingURL=measure-memo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure-memo.d.ts","sourceRoot":"","sources":["../../src/native/measure-memo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAIrD,UAAU,WAAW;IACnB,IAAI,EAAE,IAAI,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AACD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,+FAA+F;IAC/F,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,WAAW,EAAE,CAAA;CACxB;AASD,MAAM,WAAW,QAAS,SAAQ,IAAI;IACpC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAkBD,sGAAsG;AACtG,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAK/F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAerF;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,SAAS,IAAI,EAAO,EAC9B,OAAO,UAAQ,QAqBhB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,eAAe,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI,CAAA;CAAE,UAM9F"}
@@ -0,0 +1,82 @@
1
+ import { Utils } from '@nativescript/core';
2
+ const { layout } = Utils;
3
+ const isPercent = (value) => typeof value === 'object' && value !== null && value.unit === '%';
4
+ // An exact request for the size a looser request produced is the same measurement, unless a
5
+ // child resolves a percentage against the request itself or the looser request clamped content
6
+ // that wanted more room: an exact size would then shrink the children instead. Core keeps the
7
+ // too-small state only for widths, so layouts report clamping themselves.
8
+ function matches(spec, record, recordedSpec, sizeAndState) {
9
+ if (spec === recordedSpec)
10
+ return true;
11
+ if (record.percent || record.clamped)
12
+ return false;
13
+ if (layout.getMeasureSpecMode(spec) !== layout.EXACTLY)
14
+ return false;
15
+ if (layout.getMeasureSpecMode(recordedSpec) === layout.EXACTLY)
16
+ return false;
17
+ if (sizeAndState & layout.MEASURED_STATE_TOO_SMALL)
18
+ return false;
19
+ return layout.getMeasureSpecSize(spec) === (sizeAndState & layout.MEASURED_SIZE_MASK);
20
+ }
21
+ /** Whether a looser request on either axis returned its whole limit; for layouts that cannot tell. */
22
+ export function filledLimit(widthSpec, heightSpec, width, height) {
23
+ const filled = (spec, size) => layout.getMeasureSpecMode(spec) === layout.AT_MOST &&
24
+ (size & layout.MEASURED_SIZE_MASK) >= layout.getMeasureSpecSize(spec);
25
+ return filled(widthSpec, width) || filled(heightSpec, height);
26
+ }
27
+ /**
28
+ * Core measures a view again whenever its parent asks while a layout request is pending, and
29
+ * flex containers ask several times per pass, so nested containers measure their leaves an
30
+ * exponential number of times. While nothing in the subtree asked for layout, the recorded
31
+ * measurement answers a repeated request and the children are measured again from their records.
32
+ */
33
+ export function reuseMeasurement(view, widthSpec, heightSpec) {
34
+ const record = view.measureRecord;
35
+ const internals = view;
36
+ if (!record || !internals.isLayoutRequested)
37
+ return false;
38
+ if (!matches(widthSpec, record, record.widthSpec, record.width))
39
+ return false;
40
+ if (!matches(heightSpec, record, record.heightSpec, record.height))
41
+ return false;
42
+ internals._setCurrentMeasureSpecs(widthSpec, heightSpec);
43
+ for (const child of record.children) {
44
+ const current = child.view;
45
+ // A child still holding the recorded result was measured by this record's pass.
46
+ if (current._measuredWidth === child.width && current._measuredHeight === child.height)
47
+ continue;
48
+ child.view.measure(child.widthSpec, child.heightSpec);
49
+ }
50
+ view.setMeasuredDimension(record.width, record.height);
51
+ return true;
52
+ }
53
+ /** Stores the measurement that just completed with the specs every child last received. */
54
+ export function recordMeasurement(view, widthSpec, heightSpec, children = [], clamped = false) {
55
+ const internals = view;
56
+ view.measureRecord = {
57
+ widthSpec,
58
+ heightSpec,
59
+ width: internals._measuredWidth,
60
+ height: internals._measuredHeight,
61
+ percent: children.some((child) => isPercent(child.width) || isPercent(child.height)),
62
+ clamped,
63
+ children: children.map((child) => {
64
+ const specs = child;
65
+ return {
66
+ view: child,
67
+ widthSpec: specs._currentWidthMeasureSpec,
68
+ heightSpec: specs._currentHeightMeasureSpec,
69
+ width: specs._measuredWidth,
70
+ height: specs._measuredHeight,
71
+ };
72
+ }),
73
+ };
74
+ }
75
+ export function layoutChildren(view) {
76
+ const children = [];
77
+ view.eachLayoutChild((child) => {
78
+ children.push(child);
79
+ });
80
+ return children;
81
+ }
82
+ //# sourceMappingURL=measure-memo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure-memo.js","sourceRoot":"","sources":["../../src/native/measure-memo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAa,MAAM,oBAAoB,CAAA;AAErD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;AA+BxB,MAAM,SAAS,GAAG,CAAC,KAAc,EAAE,EAAE,CACnC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAA2B,CAAC,IAAI,KAAK,GAAG,CAAA;AAE1F,4FAA4F;AAC5F,+FAA+F;AAC/F,8FAA8F;AAC9F,0EAA0E;AAC1E,SAAS,OAAO,CAAC,IAAY,EAAE,MAAqB,EAAE,YAAoB,EAAE,YAAoB;IAC9F,IAAI,IAAI,KAAK,YAAY;QAAE,OAAO,IAAI,CAAA;IACtC,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAClD,IAAI,MAAM,CAAC,kBAAkB,CAAC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AAE,KAAK,CAAC,yBAAyB;gBAC3C,KAAK,EAAE,KAAK,CAAC,cAAc;gBAC3B,MAAM,EAAE,KAAK,CAAC,eAAe;aAC9B,CAAA;QACH,CAAC,CAAC;KACH,CAAA;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAgE;IAC7F,MAAM,QAAQ,GAAW,EAAE,CAAA;IAC3B,IAAI,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC,CAAC,CAAA;IACF,OAAO,QAAQ,CAAA;AACjB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { GridLayout } from '@nativescript/core';
2
+ /** The page container sees every touch of the page and can put the keyboard away. */
3
+ export declare class MavisScreen extends GridLayout {
4
+ createNativeView(): object;
5
+ }
6
+ //# sourceMappingURL=screen.android.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.android.d.ts","sourceRoot":"","sources":["../../src/native/screen.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAM/C,qFAAqF;AACrF,qBAAa,WAAY,SAAQ,UAAU;IACzC,gBAAgB;CAGjB"}
@@ -0,0 +1,8 @@
1
+ import { GridLayout } from '@nativescript/core';
2
+ /** The page container sees every touch of the page and can put the keyboard away. */
3
+ export class MavisScreen extends GridLayout {
4
+ createNativeView() {
5
+ return new com.mavis.ui.Screen(this._context);
6
+ }
7
+ }
8
+ //# sourceMappingURL=screen.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.android.js","sourceRoot":"","sources":["../../src/native/screen.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAM/C,qFAAqF;AACrF,MAAM,OAAO,WAAY,SAAQ,UAAU;IACzC,gBAAgB;QACd,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC/C,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export { GridLayout as MavisScreen } from '@nativescript/core';
2
+ //# sourceMappingURL=screen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/native/screen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,3 @@
1
+ // NativeScript resolves the platform implementation before loading this module.
2
+ export { GridLayout as MavisScreen } from '@nativescript/core';
3
+ //# sourceMappingURL=screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.js","sourceRoot":"","sources":["../../src/native/screen.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { type View } from '@nativescript/core';
2
+ export interface BackPress {
3
+ cancel: boolean;
4
+ }
5
+ export declare function watchBack(handler: (event: BackPress) => void): () => void;
6
+ export declare function setModal(_panel: View, _modal: boolean): void;
7
+ /** The Android window keeps the page inside the system bars, so the host needs no insets. */
8
+ export declare function safeAreaOf(_host: View): {
9
+ readonly top: number;
10
+ readonly bottom: number;
11
+ };
12
+ export declare function expandLayerHost(_host: View): void;
13
+ export declare function bottomInset(_host: View): number;
14
+ //# sourceMappingURL=sheet.android.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sheet.android.d.ts","sourceRoot":"","sources":["../../src/native/sheet.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAE3D,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAIzE;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,QAAI;AAE1D,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAEzF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,QAAI;AAE/C,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,16 @@
1
+ import { Application } from '@nativescript/core';
2
+ export function watchBack(handler) {
3
+ const event = Application.android.activityBackPressedEvent;
4
+ Application.android.on(event, handler);
5
+ return () => Application.android.off(event, handler);
6
+ }
7
+ export function setModal(_panel, _modal) { }
8
+ /** The Android window keeps the page inside the system bars, so the host needs no insets. */
9
+ export function safeAreaOf(_host) {
10
+ return { top: 0, bottom: 0 };
11
+ }
12
+ export function expandLayerHost(_host) { }
13
+ export function bottomInset(_host) {
14
+ return 0;
15
+ }
16
+ //# sourceMappingURL=sheet.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sheet.android.js","sourceRoot":"","sources":["../../src/native/sheet.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,oBAAoB,CAAA;AAM3D,MAAM,UAAU,SAAS,CAAC,OAAmC;IAC3D,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,wBAAwB,CAAA;IAC1D,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACtC,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACtD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,MAAY,EAAE,MAAe,IAAG,CAAC;AAE1D,6FAA6F;AAC7F,MAAM,UAAU,UAAU,CAAC,KAAW;IACpC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAA;AAC9B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAW,IAAG,CAAC;AAE/C,MAAM,UAAU,WAAW,CAAC,KAAW;IACrC,OAAO,CAAC,CAAA;AACV,CAAC"}