@octane-xplat/ui 0.4.0 → 0.5.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.
Files changed (67) hide show
  1. package/dist/native/octane-client-build.json +1 -1
  2. package/dist/native/ui.js +26 -23
  3. package/dist/native/ui14.js +16 -1
  4. package/dist/native/ui16.js +2 -2
  5. package/dist/native/ui24.js +2 -1
  6. package/dist/native/ui3.js +22 -1
  7. package/dist/native/ui39.js +89 -91
  8. package/dist/native/ui40.js +180 -53
  9. package/dist/native/ui41.js +55 -16
  10. package/dist/native/ui42.js +15 -6
  11. package/dist/native/ui43.js +18 -37
  12. package/dist/native/ui44.js +6 -265
  13. package/dist/native/ui45.js +24 -14
  14. package/dist/native/ui46.js +261 -29
  15. package/dist/native/ui47.js +17 -30
  16. package/dist/native/ui48.js +28 -65
  17. package/dist/native/ui49.js +21 -46
  18. package/dist/native/ui50.js +58 -13
  19. package/dist/native/ui51.js +65 -12
  20. package/dist/native/ui52.js +58 -86
  21. package/dist/native/ui53.js +8 -15
  22. package/dist/native/ui54.js +11 -15
  23. package/dist/native/ui55.js +82 -146
  24. package/dist/native/ui56.js +18 -17
  25. package/dist/native/ui57.js +18 -13
  26. package/dist/native/ui58.js +155 -21
  27. package/dist/native/ui59.js +32 -7
  28. package/dist/native/ui6.js +54 -12
  29. package/dist/native/ui60.js +8 -102
  30. package/dist/native/ui61.js +20 -74
  31. package/dist/native/ui62.js +8 -0
  32. package/dist/native/ui63.js +108 -0
  33. package/dist/native/ui64.js +76 -0
  34. package/dist/web/octane-client-build.json +1 -1
  35. package/dist/web/ui.js +26 -24
  36. package/dist/web/ui13.js +106 -41
  37. package/dist/web/ui34.js +147 -67
  38. package/dist/web/ui35.js +136 -51
  39. package/dist/web/ui36.js +86 -18
  40. package/dist/web/ui37.js +20 -5
  41. package/dist/web/ui38.js +6 -37
  42. package/dist/web/ui39.js +26 -142
  43. package/dist/web/ui40.js +143 -32
  44. package/dist/web/ui41.js +42 -41
  45. package/dist/web/ui42.js +40 -74
  46. package/dist/web/ui43.js +47 -13
  47. package/dist/web/ui44.js +13 -33
  48. package/dist/web/ui45.js +60 -7
  49. package/dist/web/ui46.js +47 -42
  50. package/dist/web/ui47.js +7 -11
  51. package/dist/web/ui48.js +30 -48
  52. package/dist/web/ui49.js +12 -46
  53. package/dist/web/ui50.js +62 -16
  54. package/dist/web/ui51.js +33 -135
  55. package/dist/web/ui52.js +18 -41
  56. package/dist/web/ui53.js +266 -10
  57. package/dist/web/ui54.js +41 -8
  58. package/dist/web/ui55.js +16 -21
  59. package/dist/web/ui56.js +7 -6
  60. package/dist/web/ui57.js +20 -42
  61. package/dist/web/ui58.js +6 -44
  62. package/dist/web/ui59.js +44 -0
  63. package/dist/web/ui60.js +46 -0
  64. package/package.json +5 -1
  65. package/src/theme/tokens.css +255 -30
  66. package/types/index.d.ts +10 -0
  67. package/types/props.d.ts +59 -4
@@ -1,22 +1,156 @@
1
- //#region src/store.ts
2
- function createStore(initial) {
3
- let value = initial;
4
- const listeners = /* @__PURE__ */ new Set();
5
- return {
6
- get: () => value,
7
- set(next) {
8
- const v = typeof next === "function" ? next(value) : next;
9
- if (Object.is(v, value)) return;
10
- value = v;
11
- for (const l of [...listeners]) l();
12
- },
13
- subscribe(notify) {
14
- listeners.add(notify);
15
- return () => {
16
- listeners.delete(notify);
17
- };
18
- }
19
- };
20
- }
1
+ import { cx } from "./ui2.js";
2
+ import { glyphSvgMarkup, isSvgSrc, svgSource } from "./ui28.js";
3
+ import { applyNativeProps } from "./ui36.js";
4
+ import { getIcon } from "./ui57.js";
5
+ import { defineUniversalComponent, universalIf, universalPlan, universalValue } from "@nativescript-community/octane";
6
+ //#region src/Icon.native.tsrx
7
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
8
+ "kind": "host",
9
+ "type": "svgview",
10
+ "props": { "stretch": "aspectFit" },
11
+ "bindings": [
12
+ ["id", 0],
13
+ ["className", 1],
14
+ ["src", 2],
15
+ ["style", 3],
16
+ ["ref", 4]
17
+ ]
18
+ });
19
+ var __octaneUniversalPlan1 = universalPlan("nativescript", {
20
+ "kind": "host",
21
+ "type": "label",
22
+ "bindings": [
23
+ ["id", 0],
24
+ ["className", 1],
25
+ ["text", 2],
26
+ ["style", 3],
27
+ ["ref", 4]
28
+ ]
29
+ });
30
+ var __octaneUniversalPlan2 = universalPlan("nativescript", {
31
+ "kind": "host",
32
+ "type": "svgview",
33
+ "props": { "stretch": "aspectFit" },
34
+ "bindings": [
35
+ ["id", 0],
36
+ ["className", 1],
37
+ ["src", 2],
38
+ ["style", 3],
39
+ ["ref", 4]
40
+ ]
41
+ });
42
+ var __octaneUniversalPlan3 = universalPlan("nativescript", {
43
+ "kind": "host",
44
+ "type": "image",
45
+ "bindings": [
46
+ ["id", 0],
47
+ ["className", 1],
48
+ ["src", 2],
49
+ ["style", 3],
50
+ ["ref", 4]
51
+ ]
52
+ });
53
+ var __octaneUniversalPlan4 = universalPlan("nativescript", {
54
+ "kind": "slot",
55
+ "slot": 0
56
+ });
57
+ var __octaneUniversalPlan5 = universalPlan("nativescript", {
58
+ "kind": "host",
59
+ "type": "label",
60
+ "bindings": [
61
+ ["id", 0],
62
+ ["className", 1],
63
+ ["text", 2],
64
+ ["style", 3],
65
+ ["ref", 4]
66
+ ]
67
+ });
68
+ var __octaneUniversalPlan6 = universalPlan("nativescript", {
69
+ "kind": "slot",
70
+ "slot": 0
71
+ });
72
+ var __octaneUniversalPlan7 = universalPlan("nativescript", {
73
+ "kind": "slot",
74
+ "slot": 0
75
+ });
76
+ var __octaneUniversalPlan8 = universalPlan("nativescript", {
77
+ "kind": "slot",
78
+ "slot": 0
79
+ });
80
+ var __octaneUniversalPlan9 = universalPlan("nativescript", {
81
+ "kind": "slot",
82
+ "slot": 0
83
+ });
84
+ var Icon = defineUniversalComponent("nativescript", function Icon(props) {
85
+ const glyph = getIcon(props.name);
86
+ if (!glyph) return null;
87
+ const size = props.size ?? 24;
88
+ const markup = glyphSvgMarkup(glyph, props.color);
89
+ return universalValue(__octaneUniversalPlan9, [universalIf(markup, () => {
90
+ return universalValue(__octaneUniversalPlan0, [
91
+ props.id,
92
+ cx(props.className),
93
+ markup,
94
+ {
95
+ width: size,
96
+ height: size
97
+ },
98
+ (el) => applyNativeProps(el, props)
99
+ ]);
100
+ }, () => {
101
+ return universalValue(__octaneUniversalPlan8, [universalIf(glyph.font, () => {
102
+ return universalValue(__octaneUniversalPlan1, [
103
+ props.id,
104
+ cx(props.className),
105
+ glyph.font.glyph,
106
+ {
107
+ fontFamily: glyph.font.family,
108
+ fontSize: size,
109
+ color: props.color
110
+ },
111
+ (el) => applyNativeProps(el, props)
112
+ ]);
113
+ }, () => {
114
+ return universalValue(__octaneUniversalPlan7, [universalIf(glyph.src, () => {
115
+ return universalValue(__octaneUniversalPlan4, [universalIf(isSvgSrc(glyph.src), () => {
116
+ return universalValue(__octaneUniversalPlan2, [
117
+ props.id,
118
+ cx(props.className),
119
+ svgSource(glyph.src),
120
+ {
121
+ width: size,
122
+ height: size
123
+ },
124
+ (el) => applyNativeProps(el, props)
125
+ ]);
126
+ }, () => {
127
+ return universalValue(__octaneUniversalPlan3, [
128
+ props.id,
129
+ cx(props.className),
130
+ glyph.src,
131
+ {
132
+ width: size,
133
+ height: size
134
+ },
135
+ (el) => applyNativeProps(el, props)
136
+ ]);
137
+ })]);
138
+ }, () => {
139
+ return universalValue(__octaneUniversalPlan6, [universalIf(glyph.text, () => {
140
+ return universalValue(__octaneUniversalPlan5, [
141
+ props.id,
142
+ cx(props.className),
143
+ glyph.text,
144
+ {
145
+ fontSize: size,
146
+ color: props.color
147
+ },
148
+ (el) => applyNativeProps(el, props)
149
+ ]);
150
+ })]);
151
+ })]);
152
+ })]);
153
+ })]);
154
+ }, { "module": "@nativescript-community/octane" });
21
155
  //#endregion
22
- export { createStore };
156
+ export { Icon };
@@ -1,8 +1,33 @@
1
- import { hookSlots, useSyncExternalStore } from "@nativescript-community/octane";
2
- //#region src/use-store.native.tsrx
3
- var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
4
- function useStore(store, select) {
5
- return useSyncExternalStore(store.subscribe, select === void 0 ? store.get : () => select(store.get()), _h$0);
6
- }
1
+ import { cx } from "./ui2.js";
2
+ import { applyNativeProps } from "./ui36.js";
3
+ import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
4
+ import { AccessibilityRole } from "@nativescript/core";
5
+ //#region src/Heading.native.tsrx
6
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
7
+ "kind": "host",
8
+ "type": "label",
9
+ "bindings": [
10
+ ["id", 0],
11
+ ["className", 1],
12
+ ["style", 2],
13
+ ["accessibilityRole", 3],
14
+ ["ref", 4]
15
+ ],
16
+ "children": [{
17
+ "kind": "slot",
18
+ "slot": 5
19
+ }]
20
+ });
21
+ var Heading = defineUniversalComponent("nativescript", function Heading(props) {
22
+ const level = props.level ?? 2;
23
+ return universalValue(__octaneUniversalPlan0, [
24
+ props.id,
25
+ cx(`vx-h${level}`, props.className),
26
+ props.style,
27
+ AccessibilityRole.Header,
28
+ (el) => applyNativeProps(el, props),
29
+ props.children
30
+ ]);
31
+ }, { "module": "@nativescript-community/octane" });
7
32
  //#endregion
8
- export { useStore };
33
+ export { Heading };
@@ -2,9 +2,12 @@ import { cx } from "./ui2.js";
2
2
  import { applyEscapeProps } from "./ui3.js";
3
3
  import { glassClassOf, glassConfigOf } from "./ui4.js";
4
4
  import { layoutChildProps } from "./ui5.js";
5
- import { defineUniversalComponent, hookSlots, universalPlan, universalProps, universalValue, useCallback } from "@nativescript-community/octane";
5
+ import { defineUniversalComponent, hookSlots, universalPlan, universalProps, universalValue, useCallback, useRef } from "@nativescript-community/octane";
6
+ import { Utils } from "@nativescript/core";
6
7
  //#region src/View.native.tsrx
7
- var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
8
+ var _hs$ = /* @__PURE__ */ hookSlots(2);
9
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
10
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
8
11
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
9
12
  "kind": "host",
10
13
  "type": "flexboxlayout",
@@ -20,17 +23,56 @@ var PAN_STATE = [
20
23
  "moved",
21
24
  "ended"
22
25
  ];
23
- var View = defineUniversalComponent("nativescript", function View(props) {
24
- const onPan = useCallback((e) => props.onPan?.({
25
- x: e.deltaX,
26
- y: e.deltaY,
27
- dx: e.deltaX,
28
- dy: e.deltaY,
26
+ function panVelocity(e, state, trackerRef) {
27
+ const recognizer = e.ios;
28
+ const nativeView = e.view?.nativeViewProtected;
29
+ if (recognizer?.velocityInView && nativeView) {
30
+ const velocity = recognizer.velocityInView(nativeView);
31
+ return {
32
+ vx: velocity.x,
33
+ vy: velocity.y
34
+ };
35
+ }
36
+ const motionEvent = e.android?.current;
37
+ const velocityTrackerClass = globalThis.android?.view?.VelocityTracker;
38
+ if (!motionEvent || !velocityTrackerClass) return {
29
39
  vx: 0,
30
- vy: 0,
31
- state: PAN_STATE[e.state] ?? "moved",
32
- target: e.view ?? e.object
33
- }), [props.onPan], _h$0);
40
+ vy: 0
41
+ };
42
+ if (state === 1 || !trackerRef.current) {
43
+ trackerRef.current?.recycle?.();
44
+ trackerRef.current = velocityTrackerClass.obtain();
45
+ }
46
+ const tracker = trackerRef.current;
47
+ tracker.addMovement(motionEvent);
48
+ tracker.computeCurrentVelocity(1e3);
49
+ const density = Utils.layout.getDisplayDensity();
50
+ const velocity = {
51
+ vx: tracker.getXVelocity() / density,
52
+ vy: tracker.getYVelocity() / density
53
+ };
54
+ if (state === 0 || state === 3) {
55
+ tracker.recycle?.();
56
+ trackerRef.current = null;
57
+ }
58
+ return velocity;
59
+ }
60
+ var View = defineUniversalComponent("nativescript", function View(props) {
61
+ const velocityTracker = useRef(null, _h$0);
62
+ const onPan = useCallback((e) => {
63
+ const state = PAN_STATE[e.state] ?? "moved";
64
+ const velocity = panVelocity(e, e.state, velocityTracker);
65
+ props.onPan?.({
66
+ x: e.deltaX,
67
+ y: e.deltaY,
68
+ dx: e.deltaX,
69
+ dy: e.deltaY,
70
+ vx: velocity.vx,
71
+ vy: velocity.vy,
72
+ state,
73
+ target: e.view ?? e.object
74
+ });
75
+ }, [props.onPan], _h$1);
34
76
  return universalValue(__octaneUniversalPlan0, [universalProps([
35
77
  [
36
78
  "set",
@@ -1,108 +1,14 @@
1
1
  import { cx } from "./ui2.js";
2
- import { applyThemeClasses } from "./ui31.js";
3
- import { rootLayoutFor } from "./ui34.js";
4
- import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
5
- import { GridLayout, isAndroid, isIOS } from "@nativescript/core";
6
- //#region src/Sheet.native.tsrx
7
- var _hs$ = /* @__PURE__ */ hookSlots(3);
8
- var _h$0 = /* @__PURE__ */ Symbol(_hs$);
9
- var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
10
- var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
2
+ import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
3
+ //#region src/PlatformBadge.native.tsrx
11
4
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
12
- "kind": "range",
13
- "children": [{
14
- "kind": "slot",
15
- "slot": 0
16
- }]
17
- });
18
- var __octaneUniversalPlan1 = universalPlan("nativescript", {
19
5
  "kind": "host",
20
- "type": "stacklayout",
21
- "bindings": [["ref", 0], ["style", 1]]
6
+ "type": "label",
7
+ "props": { "text": "ios|android" },
8
+ "bindings": [["className", 0]]
22
9
  });
23
- var SheetBody = defineUniversalComponent("nativescript", function SheetBody(props) {
24
- return universalValue(__octaneUniversalPlan0, [props.children]);
25
- }, { "module": "@nativescript-community/octane" });
26
- var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
27
- const sentinel = useRef(null, _h$0);
28
- const shown = useRef(null, _h$1);
29
- useEffect(() => {
30
- const cur = shown.current;
31
- if (!props.open) {
32
- if (!cur) return;
33
- shown.current = null;
34
- cur.programmatic = true;
35
- cur.unbindTheme?.();
36
- cur.root.unmount?.();
37
- const owner = cur.host.parent;
38
- if (owner?.hasChild?.(cur.host)) owner.close(cur.host).catch((error) => {
39
- console.error("[Sheet] close failed", error);
40
- });
41
- return;
42
- }
43
- const rl = rootLayoutFor(sentinel.current);
44
- if (!rl) return;
45
- if (cur) {
46
- cur.root.render(SheetBody, { children: props.children });
47
- return;
48
- }
49
- const host = new GridLayout();
50
- const unbindTheme = applyThemeClasses(host, cx("vx-sheet-host", props.className));
51
- host.horizontalAlignment = "stretch";
52
- host.verticalAlignment = "bottom";
53
- if (props.style) Object.assign(host.style, props.style);
54
- Object.assign(host, isIOS ? props.ios : isAndroid ? props.android : void 0);
55
- const root = createNativeScriptRoot(host);
56
- const opened = {
57
- host,
58
- root,
59
- unbindTheme,
60
- programmatic: false
61
- };
62
- shown.current = opened;
63
- root.render(SheetBody, { children: props.children });
64
- host.on("closed", () => {
65
- if (shown.current === opened) shown.current = null;
66
- opened.unbindTheme?.();
67
- opened.root.unmount?.();
68
- if (!opened.programmatic) props.onDismiss?.();
69
- });
70
- rl.open(host, {
71
- ...props.shadeCover ?? true ? { shadeCover: {
72
- opacity: .4,
73
- tapToClose: true
74
- } } : {},
75
- animation: {
76
- enterFrom: {
77
- translateY: 400,
78
- duration: 250
79
- },
80
- exitTo: {
81
- translateY: 400,
82
- duration: 200
83
- }
84
- }
85
- }).catch((error) => {
86
- if (shown.current === opened) shown.current = null;
87
- opened.unbindTheme?.();
88
- opened.root.unmount?.();
89
- console.error("[Sheet] open failed", error);
90
- });
91
- }, [
92
- props.open,
93
- props.children,
94
- props.className,
95
- props.style,
96
- props.shadeCover,
97
- props.ios,
98
- props.android
99
- ], _h$2);
100
- return universalValue(__octaneUniversalPlan1, [(v) => {
101
- sentinel.current = v;
102
- }, {
103
- width: 0,
104
- height: 0
105
- }]);
10
+ var PlatformBadge = defineUniversalComponent("nativescript", function PlatformBadge(props) {
11
+ return universalValue(__octaneUniversalPlan0, [cx(props.className)]);
106
12
  }, { "module": "@nativescript-community/octane" });
107
13
  //#endregion
108
- export { Sheet };
14
+ export { PlatformBadge };
@@ -1,76 +1,22 @@
1
- import { applyThemeClasses } from "./ui31.js";
2
- import { topRootLayout } from "./ui34.js";
3
- import { createNativeScriptRoot } from "@nativescript-community/octane";
4
- import { GridLayout } from "@nativescript/core";
5
- //#region src/sheet-service.native.ts
6
- var active = /* @__PURE__ */ new Set();
7
- /** The most recently opened sheet's host view — for harness asserts (view
8
- * identity beats tree search; the owning rootlayout may unload/reload). */
9
- function sheetHost() {
10
- return [...active].pop()?.host ?? null;
11
- }
12
- /** Close the most recently opened sheet (resolve with `result`). */
13
- function closeSheet(result) {
14
- [...active].pop()?.finish(result);
15
- }
16
- /** Imperative in-window sheet: a dedicated Octane root on a bottom-docked
17
- * GridLayout host opened on the CURRENT rootlayout (topRootLayout — the
18
- * service has no declaring view). Resolves when the sheet closes. */
19
- var openSheet = (Component, params, options = {}) => new Promise((resolve) => {
20
- const rl = topRootLayout();
21
- if (!rl) {
22
- console.warn("[openSheet] no RootLayout mounted — sheet skipped");
23
- resolve(void 0);
24
- return;
25
- }
26
- const host = new GridLayout();
27
- const unbindTheme = applyThemeClasses(host, "vx-sheet-host");
28
- host.horizontalAlignment = "stretch";
29
- host.verticalAlignment = "bottom";
30
- const root = createNativeScriptRoot(host);
31
- let finished = false;
32
- const finish = (result) => {
33
- if (finished) return;
34
- finished = true;
35
- active.delete(entry);
36
- unbindTheme();
37
- root.unmount?.();
38
- const owner = host.parent;
39
- if (owner?.hasChild?.(host)) owner.close(host).catch((error) => {
40
- console.error("[openSheet] close failed", error);
41
- });
42
- resolve(result);
43
- };
44
- const entry = {
45
- host,
46
- root,
47
- finish
48
- };
49
- host.on("closed", () => finish());
50
- root.render(Component, {
51
- params,
52
- close: finish
53
- });
54
- active.add(entry);
55
- rl.open(host, {
56
- ...options.shadeCover ?? true ? { shadeCover: {
57
- opacity: .4,
58
- tapToClose: true
59
- } } : {},
60
- animation: {
61
- enterFrom: {
62
- translateY: 400,
63
- duration: 250
64
- },
65
- exitTo: {
66
- translateY: 400,
67
- duration: 200
68
- }
1
+ //#region src/store.ts
2
+ function createStore(initial) {
3
+ let value = initial;
4
+ const listeners = /* @__PURE__ */ new Set();
5
+ return {
6
+ get: () => value,
7
+ set(next) {
8
+ const v = typeof next === "function" ? next(value) : next;
9
+ if (Object.is(v, value)) return;
10
+ value = v;
11
+ for (const l of [...listeners]) l();
12
+ },
13
+ subscribe(notify) {
14
+ listeners.add(notify);
15
+ return () => {
16
+ listeners.delete(notify);
17
+ };
69
18
  }
70
- }).catch((error) => {
71
- console.error("[openSheet] open failed", error);
72
- finish();
73
- });
74
- });
19
+ };
20
+ }
75
21
  //#endregion
76
- export { closeSheet, openSheet, sheetHost };
22
+ export { createStore };
@@ -0,0 +1,8 @@
1
+ import { hookSlots, useSyncExternalStore } from "@nativescript-community/octane";
2
+ //#region src/use-store.native.tsrx
3
+ var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
4
+ function useStore(store, select) {
5
+ return useSyncExternalStore(store.subscribe, select === void 0 ? store.get : () => select(store.get()), _h$0);
6
+ }
7
+ //#endregion
8
+ export { useStore };
@@ -0,0 +1,108 @@
1
+ import { cx } from "./ui2.js";
2
+ import { applyThemeClasses } from "./ui31.js";
3
+ import { rootLayoutFor } from "./ui34.js";
4
+ import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
5
+ import { GridLayout, isAndroid, isIOS } from "@nativescript/core";
6
+ //#region src/Sheet.native.tsrx
7
+ var _hs$ = /* @__PURE__ */ hookSlots(3);
8
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
9
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
10
+ var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
11
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
12
+ "kind": "range",
13
+ "children": [{
14
+ "kind": "slot",
15
+ "slot": 0
16
+ }]
17
+ });
18
+ var __octaneUniversalPlan1 = universalPlan("nativescript", {
19
+ "kind": "host",
20
+ "type": "stacklayout",
21
+ "bindings": [["ref", 0], ["style", 1]]
22
+ });
23
+ var SheetBody = defineUniversalComponent("nativescript", function SheetBody(props) {
24
+ return universalValue(__octaneUniversalPlan0, [props.children]);
25
+ }, { "module": "@nativescript-community/octane" });
26
+ var Sheet = defineUniversalComponent("nativescript", function Sheet(props) {
27
+ const sentinel = useRef(null, _h$0);
28
+ const shown = useRef(null, _h$1);
29
+ useEffect(() => {
30
+ const cur = shown.current;
31
+ if (!props.open) {
32
+ if (!cur) return;
33
+ shown.current = null;
34
+ cur.programmatic = true;
35
+ cur.unbindTheme?.();
36
+ cur.root.unmount?.();
37
+ const owner = cur.host.parent;
38
+ if (owner?.hasChild?.(cur.host)) owner.close(cur.host).catch((error) => {
39
+ console.error("[Sheet] close failed", error);
40
+ });
41
+ return;
42
+ }
43
+ const rl = rootLayoutFor(sentinel.current);
44
+ if (!rl) return;
45
+ if (cur) {
46
+ cur.root.render(SheetBody, { children: props.children });
47
+ return;
48
+ }
49
+ const host = new GridLayout();
50
+ const unbindTheme = applyThemeClasses(host, cx("vx-sheet-host", props.className));
51
+ host.horizontalAlignment = "stretch";
52
+ host.verticalAlignment = "bottom";
53
+ if (props.style) Object.assign(host.style, props.style);
54
+ Object.assign(host, isIOS ? props.ios : isAndroid ? props.android : void 0);
55
+ const root = createNativeScriptRoot(host);
56
+ const opened = {
57
+ host,
58
+ root,
59
+ unbindTheme,
60
+ programmatic: false
61
+ };
62
+ shown.current = opened;
63
+ root.render(SheetBody, { children: props.children });
64
+ host.on("closed", () => {
65
+ if (shown.current === opened) shown.current = null;
66
+ opened.unbindTheme?.();
67
+ opened.root.unmount?.();
68
+ if (!opened.programmatic) props.onDismiss?.();
69
+ });
70
+ rl.open(host, {
71
+ ...props.shadeCover ?? true ? { shadeCover: {
72
+ opacity: .4,
73
+ tapToClose: true
74
+ } } : {},
75
+ animation: {
76
+ enterFrom: {
77
+ translateY: 400,
78
+ duration: 250
79
+ },
80
+ exitTo: {
81
+ translateY: 400,
82
+ duration: 200
83
+ }
84
+ }
85
+ }).catch((error) => {
86
+ if (shown.current === opened) shown.current = null;
87
+ opened.unbindTheme?.();
88
+ opened.root.unmount?.();
89
+ console.error("[Sheet] open failed", error);
90
+ });
91
+ }, [
92
+ props.open,
93
+ props.children,
94
+ props.className,
95
+ props.style,
96
+ props.shadeCover,
97
+ props.ios,
98
+ props.android
99
+ ], _h$2);
100
+ return universalValue(__octaneUniversalPlan1, [(v) => {
101
+ sentinel.current = v;
102
+ }, {
103
+ width: 0,
104
+ height: 0
105
+ }]);
106
+ }, { "module": "@nativescript-community/octane" });
107
+ //#endregion
108
+ export { Sheet };