@octane-xplat/ui 0.2.0 → 0.3.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 (94) hide show
  1. package/dist/native/octane-client-build.json +1 -1
  2. package/dist/native/ui.js +40 -19
  3. package/dist/native/ui10.js +19 -48
  4. package/dist/native/ui11.js +118 -56
  5. package/dist/native/ui12.js +114 -16
  6. package/dist/native/ui13.js +54 -18
  7. package/dist/native/ui14.js +76 -13
  8. package/dist/native/ui15.js +128 -18
  9. package/dist/native/ui16.js +48 -136
  10. package/dist/native/ui17.js +42 -19
  11. package/dist/native/ui18.js +50 -9
  12. package/dist/native/ui19.js +34 -12
  13. package/dist/native/ui2.js +10 -48
  14. package/dist/native/ui20.js +17 -0
  15. package/dist/native/ui21.js +93 -0
  16. package/dist/native/ui22.js +124 -0
  17. package/dist/native/ui23.js +103 -0
  18. package/dist/native/ui24.js +58 -0
  19. package/dist/native/ui25.js +19 -0
  20. package/dist/native/ui26.js +27 -0
  21. package/dist/native/ui27.js +35 -0
  22. package/dist/native/ui28.js +146 -0
  23. package/dist/native/ui29.js +28 -0
  24. package/dist/native/ui3.js +17 -20
  25. package/dist/native/ui30.js +35 -0
  26. package/dist/native/ui31.js +39 -0
  27. package/dist/native/ui32.js +70 -0
  28. package/dist/native/ui33.js +30 -0
  29. package/dist/native/ui34.js +10 -0
  30. package/dist/native/ui35.js +27 -0
  31. package/dist/native/ui36.js +34 -0
  32. package/dist/native/ui37.js +17 -0
  33. package/dist/native/ui38.js +68 -0
  34. package/dist/native/ui39.js +33 -0
  35. package/dist/native/ui4.js +21 -48
  36. package/dist/native/ui40.js +14 -0
  37. package/dist/native/ui41.js +104 -0
  38. package/dist/native/ui42.js +148 -0
  39. package/dist/native/ui43.js +22 -0
  40. package/dist/native/ui44.js +8 -0
  41. package/dist/native/ui5.js +70 -27
  42. package/dist/native/ui6.js +36 -20
  43. package/dist/native/ui7.js +24 -61
  44. package/dist/native/ui8.js +16 -18
  45. package/dist/native/ui9.js +16 -13
  46. package/dist/web/octane-client-build.json +1 -1
  47. package/dist/web/ui.js +40 -19
  48. package/dist/web/ui10.js +187 -31
  49. package/dist/web/ui11.js +419 -53
  50. package/dist/web/ui12.js +83 -15
  51. package/dist/web/ui13.js +107 -19
  52. package/dist/web/ui14.js +98 -18
  53. package/dist/web/ui15.js +83 -47
  54. package/dist/web/ui16.js +100 -93
  55. package/dist/web/ui17.js +36 -22
  56. package/dist/web/ui18.js +29 -15
  57. package/dist/web/ui19.js +9 -7
  58. package/dist/web/ui2.js +15 -103
  59. package/dist/web/ui20.js +114 -0
  60. package/dist/web/ui21.js +82 -0
  61. package/dist/web/ui22.js +68 -0
  62. package/dist/web/ui23.js +57 -0
  63. package/dist/web/ui24.js +16 -0
  64. package/dist/web/ui25.js +22 -0
  65. package/dist/web/ui26.js +39 -0
  66. package/dist/web/ui27.js +127 -0
  67. package/dist/web/ui28.js +112 -0
  68. package/dist/web/ui29.js +108 -0
  69. package/dist/web/ui3.js +19 -27
  70. package/dist/web/ui30.js +43 -0
  71. package/dist/web/ui31.js +42 -0
  72. package/dist/web/ui32.js +77 -0
  73. package/dist/web/ui33.js +43 -0
  74. package/dist/web/ui34.js +67 -0
  75. package/dist/web/ui35.js +9 -0
  76. package/dist/web/ui36.js +45 -0
  77. package/dist/web/ui37.js +47 -0
  78. package/dist/web/ui38.js +17 -0
  79. package/dist/web/ui39.js +100 -0
  80. package/dist/web/ui4.js +145 -17
  81. package/dist/web/ui40.js +41 -0
  82. package/dist/web/ui41.js +17 -0
  83. package/dist/web/ui42.js +9 -0
  84. package/dist/web/ui43.js +22 -0
  85. package/dist/web/ui44.js +8 -0
  86. package/dist/web/ui5.js +54 -52
  87. package/dist/web/ui6.js +43 -16
  88. package/dist/web/ui7.js +29 -36
  89. package/dist/web/ui8.js +29 -18
  90. package/dist/web/ui9.js +24 -16
  91. package/package.json +14 -3
  92. package/src/theme/tokens.css +166 -0
  93. package/types/index.d.ts +108 -1
  94. package/types/props.d.ts +333 -8
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "buildId": "599f4013-2457-4fe9-8bfc-27a249e67126",
3
+ "buildId": "0f82ad97-944d-4397-a64d-c6ebca7ba253",
4
4
  "mode": "production",
5
5
  "capabilities": {
6
6
  "independentHydration": false
package/dist/native/ui.js CHANGED
@@ -1,19 +1,40 @@
1
- import { View } from "./ui2.js";
2
- import { Row } from "./ui3.js";
3
- import { Text } from "./ui4.js";
4
- import { Pressable } from "./ui5.js";
5
- import { TextInput } from "./ui6.js";
6
- import { List } from "./ui7.js";
7
- import { ScrollView } from "./ui8.js";
8
- import { Image } from "./ui9.js";
9
- import { Modal } from "./ui10.js";
10
- import { useAnimation } from "./ui11.js";
11
- import { getColorScheme, useColorScheme } from "./ui12.js";
12
- import { styled } from "./ui13.js";
13
- import { Screen } from "./ui14.js";
14
- import { getStack, registerStack, stackEntries } from "./ui15.js";
15
- import { Tabs } from "./ui16.js";
16
- import { Switch } from "./ui17.js";
17
- import { PlatformBadge } from "./ui18.js";
18
- import { currentRoute, pushRoute, routeFor, useRoute } from "./ui19.js";
19
- export { View as Column, Image, List, Modal, PlatformBadge, Pressable, Row, Screen, ScrollView, Switch, Tabs, Text, TextInput, View, currentRoute, getColorScheme, getStack, pushRoute, registerStack, routeFor, stackEntries, styled, useAnimation, useColorScheme, useRoute };
1
+ import { View } from "./ui5.js";
2
+ import { Row } from "./ui6.js";
3
+ import { Grid } from "./ui7.js";
4
+ import { Stack } from "./ui8.js";
5
+ import { Absolute } from "./ui9.js";
6
+ import { Spacer } from "./ui10.js";
7
+ import { Text } from "./ui11.js";
8
+ import { Pressable } from "./ui12.js";
9
+ import { TextInput } from "./ui13.js";
10
+ import { TextArea } from "./ui14.js";
11
+ import { List } from "./ui15.js";
12
+ import { ScrollView } from "./ui16.js";
13
+ import { Image } from "./ui17.js";
14
+ import { Modal } from "./ui18.js";
15
+ import { openModal } from "./ui19.js";
16
+ import { getColorScheme, useColorScheme } from "./ui20.js";
17
+ import { Overlay } from "./ui21.js";
18
+ import { Popover } from "./ui22.js";
19
+ import { showToast } from "./ui23.js";
20
+ import { useAnimation } from "./ui24.js";
21
+ import { styled } from "./ui25.js";
22
+ import { Screen } from "./ui26.js";
23
+ import { getStack, registerStack, stackEntries } from "./ui27.js";
24
+ import { Tabs } from "./ui28.js";
25
+ import { Switch } from "./ui29.js";
26
+ import { useSafeAreaInsets } from "./ui30.js";
27
+ import { SafeArea } from "./ui31.js";
28
+ import { KeyboardAvoiding } from "./ui32.js";
29
+ import { Drawer } from "./ui33.js";
30
+ import { ActivityIndicator } from "./ui35.js";
31
+ import { Slider } from "./ui36.js";
32
+ import { registerIcon, registerIcons } from "./ui37.js";
33
+ import { Icon } from "./ui38.js";
34
+ import { Heading } from "./ui39.js";
35
+ import { PlatformBadge } from "./ui40.js";
36
+ import { deriveRouteManifest } from "./ui41.js";
37
+ import { currentRoute, hrefFor, popRoute, pushRoute, registerRoutes, registerScreens, routeFor, screenFor, useRoute } from "./ui42.js";
38
+ import { createStore } from "./ui43.js";
39
+ import { useStore } from "./ui44.js";
40
+ export { Absolute, ActivityIndicator, View as Column, Drawer, Grid, Heading, Icon, Image, KeyboardAvoiding, List, Modal, Overlay, PlatformBadge, Popover, Pressable, Row, SafeArea, Screen, ScrollView, Slider, Spacer, Stack, Switch, Tabs, Text, TextArea, TextInput, View, createStore, currentRoute, deriveRouteManifest, getColorScheme, getStack, hrefFor, openModal, popRoute, pushRoute, registerIcon, registerIcons, registerRoutes, registerScreens, registerStack, routeFor, screenFor, showToast, stackEntries, styled, useAnimation, useColorScheme, useRoute, useSafeAreaInsets, useStore };
@@ -1,52 +1,23 @@
1
- import { createNativeScriptRoot, defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
2
- import { ContentView, Frame } from "@nativescript/core";
3
- //#region src/Modal.native.tsrx
4
- var _hs$ = /* @__PURE__ */ hookSlots(2);
5
- var _h$0 = /* @__PURE__ */ Symbol(_hs$);
6
- var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
1
+ import { cx } from "./ui2.js";
2
+ import { applyEscapeProps } from "./ui3.js";
3
+ import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
4
+ //#region src/Spacer.native.tsrx
7
5
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
8
- "kind": "range",
9
- "children": [{
10
- "kind": "slot",
11
- "slot": 0
12
- }]
6
+ "kind": "host",
7
+ "type": "stacklayout",
8
+ "props": { "flexGrow": 1 },
9
+ "bindings": [
10
+ ["ref", 0],
11
+ ["className", 1],
12
+ ["style", 2]
13
+ ]
13
14
  });
14
- var __octaneUniversalPlan1 = universalPlan("nativescript", {
15
- "kind": "range",
16
- "children": []
17
- });
18
- var Panel = defineUniversalComponent("nativescript", function Panel(props) {
19
- return universalValue(__octaneUniversalPlan0, [props.children]);
20
- }, { "module": "@nativescript-community/octane" });
21
- var Modal = defineUniversalComponent("nativescript", function Modal(props) {
22
- const shown = useRef(null, _h$0);
23
- useEffect(() => {
24
- if (props.open && !shown.current) {
25
- const presenter = Frame.topmost()?.currentPage ?? Frame.topmost();
26
- if (!presenter) return;
27
- const host = new ContentView();
28
- const root = createNativeScriptRoot(host);
29
- shown.current = {
30
- host,
31
- root
32
- };
33
- root.render(Panel, { children: props.children });
34
- presenter.showModal(host, {
35
- context: {},
36
- closeCallback: () => {
37
- shown.current = null;
38
- props.onClose?.();
39
- },
40
- fullscreen: props.fullscreen ?? true,
41
- animated: true
42
- });
43
- } else if (!props.open && shown.current) {
44
- const { host } = shown.current;
45
- shown.current = null;
46
- host.closeModal();
47
- }
48
- }, [props.open], _h$1);
49
- return universalValue(__octaneUniversalPlan1, []);
15
+ var Spacer = defineUniversalComponent("nativescript", function Spacer(props) {
16
+ return universalValue(__octaneUniversalPlan0, [
17
+ (view) => applyEscapeProps(view, props),
18
+ cx("vx-spacer", props.className),
19
+ props.style
20
+ ]);
50
21
  }, { "module": "@nativescript-community/octane" });
51
22
  //#endregion
52
- export { Modal };
23
+ export { Spacer };
@@ -1,58 +1,120 @@
1
- import { hookSlots, useRef } from "@nativescript-community/octane";
2
- import { cancelAnimationFrame, requestAnimationFrame } from "@nativescript/core/animation-frame";
3
- //#region src/anim.native.tsrx
4
- var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
5
- function createAnimated(initial, prop) {
6
- let view = null;
7
- let current = initial;
8
- let raf = 0;
9
- const apply = (v) => {
10
- current = v;
11
- if (view) view[prop] = v;
1
+ import { cx } from "./ui2.js";
2
+ import { applyEscapeProps, nativeAccessibilityState } from "./ui3.js";
3
+ import { layoutChildProps } from "./ui4.js";
4
+ import { createContext, defineUniversalComponent, universalComponent, universalIf, universalPlan, universalProps, universalValue, useContext } from "@nativescript-community/octane";
5
+ //#region src/Text.native.tsrx
6
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
7
+ "kind": "host",
8
+ "type": "span",
9
+ "propsSlot": 0,
10
+ "children": [{
11
+ "kind": "slot",
12
+ "slot": 1
13
+ }]
14
+ });
15
+ var __octaneUniversalPlan1 = universalPlan("nativescript", {
16
+ "kind": "host",
17
+ "type": "label",
18
+ "propsSlot": 0,
19
+ "children": [{
20
+ "kind": "slot",
21
+ "slot": 1
22
+ }]
23
+ });
24
+ var __octaneUniversalPlan2 = universalPlan("nativescript", {
25
+ "kind": "slot",
26
+ "slot": 0
27
+ });
28
+ var InText = createContext(false);
29
+ var TextScope = defineUniversalComponent("nativescript", function TextScope(props) {
30
+ return InText({
31
+ value: true,
32
+ children: props.children
33
+ });
34
+ }, { "module": "@nativescript-community/octane" });
35
+ var Text = defineUniversalComponent("nativescript", function Text(props) {
36
+ const inText = useContext(InText);
37
+ const textStyle = {
38
+ ...props.style,
39
+ ...props.ellipsize ? {
40
+ whiteSpace: "nowrap",
41
+ textOverflow: "ellipsis"
42
+ } : {}
12
43
  };
13
- const run = (step) => {
14
- cancelAnimationFrame(raf);
15
- const start = Date.now();
16
- const tick = () => {
17
- const v = step(Date.now() - start);
18
- if (v === null) return;
19
- apply(v);
20
- raf = requestAnimationFrame(tick);
21
- };
22
- raf = requestAnimationFrame(tick);
23
- };
24
- return {
25
- get value() {
26
- return current;
27
- },
28
- bind(v) {
29
- view = v;
30
- if (view) view[prop] = current;
31
- },
32
- to(target, opts) {
33
- const dur = opts?.duration ?? 300;
34
- const from = current;
35
- run((t) => t >= dur ? (apply(target), null) : from + (target - from) * (t / dur));
36
- },
37
- spring(target, opts) {
38
- const damping = opts?.damping ?? 14, stiffness = opts?.stiffness ?? 120;
39
- let v = 0, x = current;
40
- run(() => {
41
- const dt = 1 / 60;
42
- v += (-stiffness * (x - target) - damping * v) * dt;
43
- x += v * dt;
44
- return Math.abs(v) < .5 && Math.abs(x - target) < .5 ? (apply(target), null) : x;
45
- });
46
- },
47
- stop() {
48
- cancelAnimationFrame(raf);
49
- }
50
- };
51
- }
52
- function useAnimation(initial = 0, prop = "translateX") {
53
- const c = useRef(null, _h$0);
54
- if (!c.current) c.current = createAnimated(initial, prop);
55
- return c.current;
56
- }
44
+ return universalValue(__octaneUniversalPlan2, [universalIf(inText, () => {
45
+ return universalValue(__octaneUniversalPlan0, [universalProps([
46
+ [
47
+ "set",
48
+ "ref",
49
+ (v) => applyEscapeProps(v, props)
50
+ ],
51
+ [
52
+ "set",
53
+ "className",
54
+ cx(props.className)
55
+ ],
56
+ [
57
+ "set",
58
+ "style",
59
+ textStyle
60
+ ],
61
+ ["spread", layoutChildProps(props)]
62
+ ]), props.children]);
63
+ }, () => {
64
+ return universalValue(__octaneUniversalPlan1, [universalProps([
65
+ [
66
+ "set",
67
+ "ref",
68
+ (v) => applyEscapeProps(v, props)
69
+ ],
70
+ ["spread", layoutChildProps(props)],
71
+ [
72
+ "set",
73
+ "className",
74
+ cx(props.className)
75
+ ],
76
+ [
77
+ "set",
78
+ "style",
79
+ textStyle
80
+ ],
81
+ [
82
+ "set",
83
+ "maxLines",
84
+ props.numberOfLines
85
+ ],
86
+ [
87
+ "set",
88
+ "textOverflow",
89
+ props.ellipsize ? "ellipsis" : void 0
90
+ ],
91
+ [
92
+ "set",
93
+ "whiteSpace",
94
+ props.ellipsize ? "nowrap" : void 0
95
+ ],
96
+ [
97
+ "set",
98
+ "accessibilityHint",
99
+ props.accessibilityHint
100
+ ],
101
+ [
102
+ "set",
103
+ "accessibilityValue",
104
+ props.accessibilityValue
105
+ ],
106
+ [
107
+ "set",
108
+ "accessibilityState",
109
+ nativeAccessibilityState(props.accessibilityState)
110
+ ],
111
+ [
112
+ "set",
113
+ "accessibilityLiveRegion",
114
+ props.accessibilityLiveRegion
115
+ ]
116
+ ]), universalComponent("nativescript", TextScope, universalProps([], props.children))]);
117
+ })]);
118
+ }, { "module": "@nativescript-community/octane" });
57
119
  //#endregion
58
- export { useAnimation };
120
+ export { Text };
@@ -1,17 +1,115 @@
1
- import { hookSlots, useSyncExternalStore } from "@nativescript-community/octane";
2
- import { Application } from "@nativescript/core";
3
- //#region src/theme/colorScheme.native.tsrx
4
- var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
5
- function getColorScheme() {
6
- return Application.primaryWindow?.systemAppearance?.() ?? Application.systemAppearance?.() ?? "light";
7
- }
8
- function subscribe(cb) {
9
- const h = () => cb();
10
- Application.on("systemAppearanceChanged", h);
11
- return () => Application.off("systemAppearanceChanged", h);
12
- }
13
- function useColorScheme() {
14
- return useSyncExternalStore(subscribe, getColorScheme, _h$0);
15
- }
1
+ import { cx } from "./ui2.js";
2
+ import { applyEscapeProps, nativeAccessibilityState } from "./ui3.js";
3
+ import { layoutChildProps } from "./ui4.js";
4
+ import { defineUniversalComponent, universalPlan, universalProps, universalValue } from "@nativescript-community/octane";
5
+ //#region src/Pressable.native.tsrx
6
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
7
+ "kind": "host",
8
+ "type": "flexboxlayout",
9
+ "propsSlot": 0,
10
+ "children": [{
11
+ "kind": "slot",
12
+ "slot": 1
13
+ }]
14
+ });
15
+ var Pressable = defineUniversalComponent("nativescript", function Pressable(props) {
16
+ return universalValue(__octaneUniversalPlan0, [universalProps([
17
+ [
18
+ "set",
19
+ "ref",
20
+ (v) => applyEscapeProps(v, props)
21
+ ],
22
+ [
23
+ "set",
24
+ "id",
25
+ props.id
26
+ ],
27
+ ["spread", layoutChildProps(props)],
28
+ [
29
+ "set",
30
+ "flexDirection",
31
+ "column"
32
+ ],
33
+ [
34
+ "set",
35
+ "className",
36
+ cx("vx-pressable", props.className)
37
+ ],
38
+ [
39
+ "set",
40
+ "style",
41
+ {
42
+ ...props.style,
43
+ ...props.hitSlop ? {
44
+ margin: -props.hitSlop,
45
+ padding: props.hitSlop
46
+ } : {}
47
+ }
48
+ ],
49
+ [
50
+ "set",
51
+ "accessible",
52
+ props.accessible
53
+ ],
54
+ [
55
+ "set",
56
+ "accessibilityLabel",
57
+ props.accessibilityLabel
58
+ ],
59
+ [
60
+ "set",
61
+ "accessibilityRole",
62
+ props.accessibilityRole
63
+ ],
64
+ [
65
+ "set",
66
+ "accessibilityHint",
67
+ props.accessibilityHint
68
+ ],
69
+ [
70
+ "set",
71
+ "accessibilityValue",
72
+ props.accessibilityValue
73
+ ],
74
+ [
75
+ "set",
76
+ "accessibilityState",
77
+ nativeAccessibilityState(props.accessibilityState)
78
+ ],
79
+ [
80
+ "set",
81
+ "accessibilityLiveRegion",
82
+ props.accessibilityLiveRegion
83
+ ],
84
+ [
85
+ "set",
86
+ "ignoreTouchAnimation",
87
+ props.ignoreTouchAnimation
88
+ ],
89
+ [
90
+ "set",
91
+ "onTap",
92
+ props.disabled ? void 0 : props.onPress
93
+ ],
94
+ [
95
+ "set",
96
+ "onLongPress",
97
+ props.disabled ? void 0 : props.onLongPress
98
+ ],
99
+ [
100
+ "set",
101
+ "onDoubleTap",
102
+ props.disabled ? void 0 : props.onDoublePress
103
+ ],
104
+ [
105
+ "set",
106
+ "onTouch",
107
+ props.disabled ? void 0 : (e) => {
108
+ if (e.action === "down") props.onPressIn?.();
109
+ else if (e.action === "up" || e.action === "cancel") props.onPressOut?.();
110
+ }
111
+ ]
112
+ ]), props.children]);
113
+ }, { "module": "@nativescript-community/octane" });
16
114
  //#endregion
17
- export { getColorScheme, useColorScheme };
115
+ export { Pressable };
@@ -1,19 +1,55 @@
1
- import "@nativescript-community/octane";
2
- import { defineUniversalComponent as defineUniversalComponent$1, universalComponent as universalComponent$1 } from "octane/universal";
3
- //#region src/styled.native.tsrx
4
- function styled(Base, def) {
5
- function Styled(props) {
6
- const cls = [def.base];
7
- const rest = { ...props };
8
- for (const k of Object.keys(def.variants ?? {})) {
9
- if (props[k]) cls.push(def.variants[k]);
10
- delete rest[k];
11
- }
12
- if (props.className) cls.push(props.className);
13
- rest.className = cls;
14
- return universalComponent$1("nativescript", Base, rest);
15
- }
16
- return defineUniversalComponent$1("nativescript", Styled);
17
- }
1
+ import { cx } from "./ui2.js";
2
+ import { applyEscapeProps } from "./ui3.js";
3
+ import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
4
+ //#region src/TextInput.native.tsrx
5
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
6
+ "kind": "host",
7
+ "type": "textfield",
8
+ "bindings": [
9
+ ["ref", 0],
10
+ ["id", 1],
11
+ ["className", 2],
12
+ ["style", 3],
13
+ ["text", 4],
14
+ ["hint", 5],
15
+ ["secure", 6],
16
+ ["keyboardType", 7],
17
+ ["returnKeyType", 8],
18
+ ["editable", 9],
19
+ ["onTextChange", 10],
20
+ ["onReturnPress", 11],
21
+ ["onFocus", 12],
22
+ ["onBlur", 13]
23
+ ]
24
+ });
25
+ var TextInput = defineUniversalComponent("nativescript", function TextInput(props) {
26
+ return universalValue(__octaneUniversalPlan0, [
27
+ (v) => {
28
+ if (!v) return;
29
+ applyEscapeProps(v, props);
30
+ props.bind?.({
31
+ focus: () => v.focus(),
32
+ blur: () => v.dismissSoftInput?.() ?? v.blur(),
33
+ native: v
34
+ });
35
+ },
36
+ props.id,
37
+ cx(props.className),
38
+ {
39
+ ...props.style,
40
+ ...props.placeholderTextColor ? { placeholderColor: props.placeholderTextColor } : {}
41
+ },
42
+ props.value,
43
+ props.placeholder ?? props.hint,
44
+ props.secure,
45
+ props.keyboardType === "default" ? void 0 : props.keyboardType,
46
+ props.returnKeyType,
47
+ props.editable,
48
+ (e) => props.onChange?.(e.value),
49
+ props.onSubmit,
50
+ props.onFocus,
51
+ props.onBlur
52
+ ]);
53
+ }, { "module": "@nativescript-community/octane" });
18
54
  //#endregion
19
- export { styled };
55
+ export { TextInput };
@@ -1,20 +1,83 @@
1
- import { defineUniversalComponent, universalPlan, universalValue } from "@nativescript-community/octane";
2
- //#region src/Screen.native.tsrx
1
+ import { cx } from "./ui2.js";
2
+ import { applyEscapeProps } from "./ui3.js";
3
+ import { defineUniversalComponent, hookSlots, universalPlan, universalValue, useEffect, useRef } from "@nativescript-community/octane";
4
+ import { Utils } from "@nativescript/core";
5
+ //#region src/TextArea.native.tsrx
6
+ var _hs$ = /* @__PURE__ */ hookSlots(2);
7
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
8
+ var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
3
9
  var __octaneUniversalPlan0 = universalPlan("nativescript", {
4
10
  "kind": "host",
5
- "type": "rootlayout",
6
- "bindings": [["className", 0], ["style", 1]],
7
- "children": [{
8
- "kind": "slot",
9
- "slot": 2
10
- }]
11
+ "type": "textview",
12
+ "bindings": [
13
+ ["id", 0],
14
+ ["ref", 1],
15
+ ["className", 2],
16
+ ["style", 3],
17
+ ["text", 4],
18
+ ["hint", 5],
19
+ ["keyboardType", 6],
20
+ ["returnKeyType", 7],
21
+ ["editable", 8],
22
+ ["onLoaded", 9],
23
+ ["onTextChange", 10],
24
+ ["onReturnPress", 11],
25
+ ["onFocus", 12],
26
+ ["onBlur", 13]
27
+ ]
11
28
  });
12
- var Screen = defineUniversalComponent("nativescript", function Screen(props) {
29
+ var TextArea = defineUniversalComponent("nativescript", function TextArea(props) {
30
+ const el = useRef(null, _h$0);
31
+ const lineDip = (v) => {
32
+ const ios = v?.ios?.font?.lineHeight;
33
+ if (ios > 0) return ios;
34
+ const px = v?.android?.getLineHeight?.();
35
+ if (px > 0) return Utils.layout.toDeviceIndependentPixels(px);
36
+ return 24;
37
+ };
38
+ const fit = (v) => {
39
+ if (!v) return;
40
+ if (props.style?.height != null) return;
41
+ const line = lineDip(v);
42
+ const rows = props.rows ?? (props.autoGrow ? 1 : 3);
43
+ v.style.minHeight = rows * line;
44
+ if (props.maxRows) v.style.maxHeight = props.maxRows * line;
45
+ else if (!props.autoGrow) v.style.maxHeight = rows * line;
46
+ };
47
+ useEffect(() => fit(el.current), [
48
+ props.rows,
49
+ props.autoGrow,
50
+ props.maxRows,
51
+ props.style
52
+ ], _h$1);
13
53
  return universalValue(__octaneUniversalPlan0, [
14
- props.className,
15
- props.style,
16
- props.children
54
+ props.id,
55
+ (v) => {
56
+ el.current = v;
57
+ if (!v) return;
58
+ applyEscapeProps(v, props);
59
+ props.bind?.({
60
+ focus: () => v.focus(),
61
+ blur: () => v.dismissSoftInput?.() ?? v.blur(),
62
+ native: v
63
+ });
64
+ },
65
+ cx(props.className),
66
+ {
67
+ ...props.style,
68
+ ...props.placeholderTextColor ? { placeholderColor: props.placeholderTextColor } : {}
69
+ },
70
+ props.value,
71
+ props.placeholder ?? props.hint,
72
+ props.keyboardType === "default" ? void 0 : props.keyboardType,
73
+ props.returnKeyType,
74
+ props.editable,
75
+ (e) => fit(e.object),
76
+ (e) => props.onChange?.(e.value),
77
+ props.onSubmit,
78
+ props.onFocus,
79
+ props.onBlur
17
80
  ]);
18
81
  }, { "module": "@nativescript-community/octane" });
19
82
  //#endregion
20
- export { Screen };
83
+ export { TextArea };