@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
@@ -0,0 +1,76 @@
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
+ }
69
+ }
70
+ }).catch((error) => {
71
+ console.error("[openSheet] open failed", error);
72
+ finish();
73
+ });
74
+ });
75
+ //#endregion
76
+ export { closeSheet, openSheet, sheetHost };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "buildId": "09d40cb6-77c8-4f47-9fd0-53989e8bea06",
3
+ "buildId": "bc136ba4-ca23-4dbc-99a2-c7175a4714db",
4
4
  "mode": "production",
5
5
  "capabilities": {
6
6
  "independentHydration": false
package/dist/web/ui.js CHANGED
@@ -25,27 +25,29 @@ import { applyThemeClasses, getThemePreference, getThemeScheme, onThemeSchemeCha
25
25
  import { openModal } from "./ui30.js";
26
26
  import { Overlay } from "./ui31.js";
27
27
  import { Popover } from "./ui33.js";
28
- import { showToast } from "./ui34.js";
29
- import { useAnimation } from "./ui35.js";
30
- import { styled } from "./ui36.js";
31
- import { openWindow } from "./ui37.js";
32
- import { Screen } from "./ui38.js";
33
- import { Tabs } from "./ui39.js";
34
- import { Switch } from "./ui40.js";
35
- import { useSafeAreaInsets } from "./ui41.js";
36
- import { SafeArea } from "./ui42.js";
37
- import { KeyboardAvoiding } from "./ui43.js";
38
- import { Drawer } from "./ui44.js";
39
- import { ActivityIndicator } from "./ui46.js";
40
- import { Meter } from "./ui48.js";
41
- import { Slider } from "./ui49.js";
42
- import { registerIcon, registerIcons } from "./ui50.js";
43
- import { Icon } from "./ui51.js";
44
- import { Heading } from "./ui52.js";
45
- import { PlatformBadge } from "./ui53.js";
46
- import { getStack, registerStack, stackEntries } from "./ui54.js";
47
- import { createStore } from "./ui55.js";
48
- import { useStore } from "./ui56.js";
49
- import { Sheet } from "./ui57.js";
50
- import { closeSheet, openSheet } from "./ui58.js";
51
- export { Absolute, ActivityIndicator, View as Column, Drawer, Grid, Heading, Icon, Image, KeyboardAvoiding, Link, LiquidGlass, LiquidGlassContainer, List, Meter, Modal, NavLink, Overlay, PlatformBadge, Popover, Pressable, RichText, RichTextSpan, Row, SafeArea, Screen, ScrollBox, ScrollView, Sheet, Slider, Spacer, Stack, Switch, Tabs, Text, TextArea, TextInput, View, applyThemeClasses, canGoBack, closeSheet, createStore, currentModalRoute, currentRoute, deriveRouteManifest, getColorScheme, getStack, getThemePreference, getThemeScheme, hrefFor, onThemeSchemeChange, openModal, openSheet, openWindow, popRoute, pushDeepLink, pushRoute, redirect, registerIcon, registerIcons, registerRoutes, registerScreens, registerStack, routeFor, routeStacks, screenFor, setThemePreference, showToast, stackEntries, styled, themeSchemeClasses, useAnimation, useCanGoBack, useColorScheme, useModalRoute, useRoute, useSafeAreaInsets, useStore, useThemeScheme };
28
+ import { Hoverable } from "./ui34.js";
29
+ import { showToast } from "./ui35.js";
30
+ import { useAnimation } from "./ui36.js";
31
+ import { styled } from "./ui37.js";
32
+ import { openWindow } from "./ui38.js";
33
+ import { Screen } from "./ui39.js";
34
+ import { Tabs } from "./ui40.js";
35
+ import { Switch } from "./ui41.js";
36
+ import { useSafeAreaInsets } from "./ui42.js";
37
+ import { SafeArea } from "./ui43.js";
38
+ import { KeyboardAvoiding } from "./ui44.js";
39
+ import { Drawer } from "./ui45.js";
40
+ import { useMeasure } from "./ui46.js";
41
+ import { ActivityIndicator } from "./ui48.js";
42
+ import { Meter } from "./ui50.js";
43
+ import { Slider } from "./ui51.js";
44
+ import { registerIcon, registerIcons } from "./ui52.js";
45
+ import { Icon } from "./ui53.js";
46
+ import { Heading } from "./ui54.js";
47
+ import { PlatformBadge } from "./ui55.js";
48
+ import { getStack, registerStack, stackEntries } from "./ui56.js";
49
+ import { createStore } from "./ui57.js";
50
+ import { useStore } from "./ui58.js";
51
+ import { Sheet } from "./ui59.js";
52
+ import { closeSheet, openSheet } from "./ui60.js";
53
+ export { Absolute, ActivityIndicator, View as Column, Drawer, Grid, Heading, Hoverable, Icon, Image, KeyboardAvoiding, Link, LiquidGlass, LiquidGlassContainer, List, Meter, Modal, NavLink, Overlay, PlatformBadge, Popover, Pressable, RichText, RichTextSpan, Row, SafeArea, Screen, ScrollBox, ScrollView, Sheet, Slider, Spacer, Stack, Switch, Tabs, Text, TextArea, TextInput, View, applyThemeClasses, canGoBack, closeSheet, createStore, currentModalRoute, currentRoute, deriveRouteManifest, getColorScheme, getStack, getThemePreference, getThemeScheme, hrefFor, onThemeSchemeChange, openModal, openSheet, openWindow, popRoute, pushDeepLink, pushRoute, redirect, registerIcon, registerIcons, registerRoutes, registerScreens, registerStack, routeFor, routeStacks, screenFor, setThemePreference, showToast, stackEntries, styled, themeSchemeClasses, useAnimation, useCanGoBack, useColorScheme, useMeasure, useModalRoute, useRoute, useSafeAreaInsets, useStore, useThemeScheme };
package/dist/web/ui13.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { applyEscapeProps } from "./ui2.js";
2
2
  import { layoutChildProps } from "./ui4.js";
3
- import { __s, bag16, clone, snapshotSpread, template } from "octane";
3
+ import { __s, bagOf, clone, snapshotSpread, template } from "octane";
4
4
  import { bindSignalChild, bindSignalHostPropSources, enableSignalBindings } from "octane/internal/client";
5
5
  //#region src/Text.web.tsrx
6
6
  enableSignalBindings(1, true);
7
7
  var _t$0 = /* @__PURE__ */ template("<span></span>");
8
8
  var _rm$1 = [
9
9
  "s",
10
- "n",
11
- "m"
10
+ "q",
11
+ "p"
12
12
  ];
13
13
  var Text = /* @__PURE__ */ __s(function Text(props, __s, __extra) {
14
14
  const textStyle = {
@@ -28,22 +28,25 @@ var Text = /* @__PURE__ */ __s(function Text(props, __s, __extra) {
28
28
  };
29
29
  let _b = __s.slots[0];
30
30
  if (_b === void 0) {
31
- let _m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7, _m8, _m9, _m10, _m11, _m12, _m13;
31
+ let _m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7, _m8, _m9, _m10, _m11, _m12, _m13, _m14, _m15, _m16;
32
32
  const _root = clone(_t$0);
33
33
  _m0 = props.id;
34
34
  _m1 = (el) => applyEscapeProps(el, props);
35
35
  _m2 = props.className;
36
36
  _m3 = snapshotSpread(layoutChildProps(props, textStyle));
37
- _m4 = props.accessibilityHint;
38
- _m5 = props.accessibilityValue;
39
- _m6 = props.accessibilityState?.disabled;
40
- _m7 = props.accessibilityState?.selected;
41
- _m8 = props.accessibilityState?.checked;
42
- _m9 = props.accessibilityState?.busy;
43
- _m10 = props.accessibilityState?.expanded;
44
- _m11 = props.accessibilityLiveRegion === "none" ? "off" : props.accessibilityLiveRegion;
45
- _m12 = _root;
46
- _m13 = bindSignalHostPropSources(__s, void 0, _root, [
37
+ _m4 = props.accessibilityRole;
38
+ _m5 = props.accessibilityLabel;
39
+ _m6 = props.accessible === false ? true : void 0;
40
+ _m7 = props.accessibilityHint;
41
+ _m8 = props.accessibilityValue;
42
+ _m9 = props.accessibilityState?.disabled;
43
+ _m10 = props.accessibilityState?.selected;
44
+ _m11 = props.accessibilityState?.checked;
45
+ _m12 = props.accessibilityState?.busy;
46
+ _m13 = props.accessibilityState?.expanded;
47
+ _m14 = props.accessibilityLiveRegion === "none" ? "off" : props.accessibilityLiveRegion;
48
+ _m15 = _root;
49
+ _m16 = bindSignalHostPropSources(__s, void 0, _root, [
47
50
  [
48
51
  false,
49
52
  "id",
@@ -62,46 +65,81 @@ var Text = /* @__PURE__ */ __s(function Text(props, __s, __extra) {
62
65
  [true, _m3],
63
66
  [
64
67
  false,
65
- "aria-description",
68
+ "role",
66
69
  _m4
67
70
  ],
68
71
  [
69
72
  false,
70
- "aria-valuetext",
73
+ "aria-label",
71
74
  _m5
72
75
  ],
73
76
  [
74
77
  false,
75
- "aria-disabled",
78
+ "aria-hidden",
76
79
  _m6
77
80
  ],
78
81
  [
79
82
  false,
80
- "aria-selected",
83
+ "aria-description",
81
84
  _m7
82
85
  ],
83
86
  [
84
87
  false,
85
- "aria-checked",
88
+ "aria-valuetext",
86
89
  _m8
87
90
  ],
88
91
  [
89
92
  false,
90
- "aria-busy",
93
+ "aria-disabled",
91
94
  _m9
92
95
  ],
93
96
  [
94
97
  false,
95
- "aria-expanded",
98
+ "aria-selected",
96
99
  _m10
97
100
  ],
98
101
  [
99
102
  false,
100
- "aria-live",
103
+ "aria-checked",
101
104
  _m11
105
+ ],
106
+ [
107
+ false,
108
+ "aria-busy",
109
+ _m12
110
+ ],
111
+ [
112
+ false,
113
+ "aria-expanded",
114
+ _m13
115
+ ],
116
+ [
117
+ false,
118
+ "aria-live",
119
+ _m14
102
120
  ]
103
121
  ], "b:3b621770", true);
104
- _b = bag16(__s, _root, _m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7, _m8, _m9, _m10, _m11, _m12, _m13, null, void 0);
122
+ _b = bagOf(__s, _root, {
123
+ a: _m0,
124
+ b: _m1,
125
+ c: _m2,
126
+ d: _m3,
127
+ e: _m4,
128
+ f: _m5,
129
+ g: _m6,
130
+ h: _m7,
131
+ i: _m8,
132
+ j: _m9,
133
+ k: _m10,
134
+ l: _m11,
135
+ m: _m12,
136
+ n: _m13,
137
+ o: _m14,
138
+ p: _m15,
139
+ q: _m16,
140
+ r: null,
141
+ s: void 0
142
+ });
105
143
  __s.refFields = _rm$1;
106
144
  } else {
107
145
  {
@@ -118,38 +156,50 @@ var Text = /* @__PURE__ */ __s(function Text(props, __s, __extra) {
118
156
  }
119
157
  _b.d = snapshotSpread(layoutChildProps(props, textStyle));
120
158
  {
121
- const _v = props.accessibilityHint;
159
+ const _v = props.accessibilityRole;
122
160
  if (_b.e !== _v) _b.e = _v;
123
161
  }
124
162
  {
125
- const _v = props.accessibilityValue;
163
+ const _v = props.accessibilityLabel;
126
164
  if (_b.f !== _v) _b.f = _v;
127
165
  }
128
166
  {
129
- const _v = props.accessibilityState?.disabled;
167
+ const _v = props.accessible === false ? true : void 0;
130
168
  if (_b.g !== _v) _b.g = _v;
131
169
  }
132
170
  {
133
- const _v = props.accessibilityState?.selected;
171
+ const _v = props.accessibilityHint;
134
172
  if (_b.h !== _v) _b.h = _v;
135
173
  }
136
174
  {
137
- const _v = props.accessibilityState?.checked;
175
+ const _v = props.accessibilityValue;
138
176
  if (_b.i !== _v) _b.i = _v;
139
177
  }
140
178
  {
141
- const _v = props.accessibilityState?.busy;
179
+ const _v = props.accessibilityState?.disabled;
142
180
  if (_b.j !== _v) _b.j = _v;
143
181
  }
144
182
  {
145
- const _v = props.accessibilityState?.expanded;
183
+ const _v = props.accessibilityState?.selected;
146
184
  if (_b.k !== _v) _b.k = _v;
147
185
  }
148
186
  {
149
- const _v = props.accessibilityLiveRegion === "none" ? "off" : props.accessibilityLiveRegion;
187
+ const _v = props.accessibilityState?.checked;
150
188
  if (_b.l !== _v) _b.l = _v;
151
189
  }
152
- _b.n = bindSignalHostPropSources(__s, _b.n, _b.m, [
190
+ {
191
+ const _v = props.accessibilityState?.busy;
192
+ if (_b.m !== _v) _b.m = _v;
193
+ }
194
+ {
195
+ const _v = props.accessibilityState?.expanded;
196
+ if (_b.n !== _v) _b.n = _v;
197
+ }
198
+ {
199
+ const _v = props.accessibilityLiveRegion === "none" ? "off" : props.accessibilityLiveRegion;
200
+ if (_b.o !== _v) _b.o = _v;
201
+ }
202
+ _b.q = bindSignalHostPropSources(__s, _b.q, _b.p, [
153
203
  [
154
204
  false,
155
205
  "id",
@@ -168,47 +218,62 @@ var Text = /* @__PURE__ */ __s(function Text(props, __s, __extra) {
168
218
  [true, _b.d],
169
219
  [
170
220
  false,
171
- "aria-description",
221
+ "role",
172
222
  _b.e
173
223
  ],
174
224
  [
175
225
  false,
176
- "aria-valuetext",
226
+ "aria-label",
177
227
  _b.f
178
228
  ],
179
229
  [
180
230
  false,
181
- "aria-disabled",
231
+ "aria-hidden",
182
232
  _b.g
183
233
  ],
184
234
  [
185
235
  false,
186
- "aria-selected",
236
+ "aria-description",
187
237
  _b.h
188
238
  ],
189
239
  [
190
240
  false,
191
- "aria-checked",
241
+ "aria-valuetext",
192
242
  _b.i
193
243
  ],
194
244
  [
195
245
  false,
196
- "aria-busy",
246
+ "aria-disabled",
197
247
  _b.j
198
248
  ],
199
249
  [
200
250
  false,
201
- "aria-expanded",
251
+ "aria-selected",
202
252
  _b.k
203
253
  ],
204
254
  [
205
255
  false,
206
- "aria-live",
256
+ "aria-checked",
207
257
  _b.l
258
+ ],
259
+ [
260
+ false,
261
+ "aria-busy",
262
+ _b.m
263
+ ],
264
+ [
265
+ false,
266
+ "aria-expanded",
267
+ _b.n
268
+ ],
269
+ [
270
+ false,
271
+ "aria-live",
272
+ _b.o
208
273
  ]
209
274
  ], "b:3b621770", true);
210
275
  }
211
- _b.q = bindSignalChild(__s, _b.q, 1, _b.m, props.children, "b:5ab934f0", null, void 0, void 0, void 0, true);
276
+ _b.t = bindSignalChild(__s, _b.t, 1, _b.p, props.children, "b:152a7b75", null, void 0, void 0, void 0, true);
212
277
  });
213
278
  //#endregion
214
279
  export { Text };
package/dist/web/ui34.js CHANGED
@@ -1,70 +1,150 @@
1
- import { cx } from "./ui28.js";
2
- import { applyThemeClasses } from "./ui29.js";
3
- import { __s, bag1, bag3, clone, componentSlot, createRoot, ifBlock, template } from "octane";
4
- import { childTextHoleUpdate } from "octane/internal/client";
5
- //#region src/toast.web.tsrx
6
- var _t$0 = /* @__PURE__ */ template("<div class=\"vx-toast\"></div>");
7
- function __then$0(__props, __s, __extra) {
8
- const props = __extra[0];
9
- let _b = __s.slots[0];
10
- if (_b === void 0) {
11
- let _m0;
12
- const _root = clone(_t$0);
13
- _m0 = _root;
14
- _b = bag3(__s, _root, _m0, null, void 0);
15
- }
16
- {
17
- const _v = props.content;
18
- _b.b = childTextHoleUpdate(__s, 1, _b.a, _v, _b.b, _b.c);
19
- _b.c = _v;
20
- }
21
- }
22
- function __else$2(__props, __s, __extra) {
23
- const Component = __extra[0].content;
24
- let _b = __s.slots[0];
25
- if (_b === void 0) {
26
- let _m0;
27
- const _root = clone(_t$0);
28
- _m0 = _root;
29
- _b = bag1(__s, _root, _m0);
30
- }
31
- componentSlot(__s, 1, _b.a, Component, {}, void 0, void 0, void 0, void 0, void 0, "c:1641d101");
32
- }
33
- var queue = [];
34
- var active = false;
35
- var ToastBody = /* @__PURE__ */ __s(function ToastBody(props, __s, __extra) {
1
+ import { View } from "./ui5.js";
2
+ import { Popover } from "./ui33.js";
3
+ import { bag4, bag5, child, clone, componentSlotVoid, drainFrag, hookSlots, markChildrenBlock, sibling, template, useEffect, useRef, useState } from "octane";
4
+ import { compilerMemoRegion, hookMemoCreate, hookMemoPublishInvariant, textHoleUpdate } from "octane/internal/client";
5
+ //#region src/Hoverable.web.tsrx
6
+ var _t$0 = /* @__PURE__ */ template("<!>", 0, 1);
7
+ var _t$1 = /* @__PURE__ */ template("<!><!>", 3, 1);
8
+ var _hs$ = /* @__PURE__ */ hookSlots(7);
9
+ var __childrenBody = {};
10
+ var __childrenBody$ = {};
11
+ var __childrenBody$2 = {};
12
+ var Hoverable = function Hoverable(props, __s, __extra) {
36
13
  const __block = __s.block;
37
- ifBlock(__s, 0, __block.parentNode, typeof props.content === "string", __then$0, __else$2, __block.endMarker, [props]);
38
- });
39
- function applyWebProps(host, props) {
40
- if (!props) return;
41
- for (const [key, value] of Object.entries(props)) if (key.includes("-")) host.setAttribute(key, String(value));
42
- else host[key] = value;
43
- }
44
- function showNext() {
45
- if (active || queue.length === 0) return;
46
- active = true;
47
- const entry = queue.shift();
48
- const host = document.createElement("div");
49
- const unbindTheme = applyThemeClasses(host, cx("vx-toast-host", entry.options.position === "top" ? "vx-toast-top" : "vx-toast-bottom"));
50
- applyWebProps(host, entry.options.web);
51
- document.body.appendChild(host);
52
- const root = createRoot(host);
53
- root.render(ToastBody, { content: entry.content });
54
- setTimeout(() => {
55
- unbindTheme();
56
- root.unmount();
57
- host.remove();
58
- active = false;
59
- showNext();
60
- }, Math.max(0, entry.options.duration ?? 3e3));
61
- }
62
- function showToast(content, options = {}) {
63
- queue.push({
64
- content,
65
- options
14
+ const __memoRegion = compilerMemoRegion(__s, _hs$ + 0);
15
+ let __hk = __memoRegion.hooks;
16
+ if (__hk === void 0) __memoRegion.hooks = __hk = hookMemoCreate(3);
17
+ const [open, setOpen] = useState(false, _hs$ + 0);
18
+ const anchor = useRef(null, _hs$ + 1);
19
+ const anchorBinding = useRef(null, _hs$ + 2);
20
+ const cardBinding = useRef(null, _hs$ + 3);
21
+ const openTimer = useRef(null, _hs$ + 4);
22
+ const closeTimer = useRef(null, _hs$ + 5);
23
+ const clearOpen = __hk[0] ?? hookMemoPublishInvariant(__hk, 0, () => {
24
+ if (openTimer.current !== null) clearTimeout(openTimer.current);
25
+ openTimer.current = null;
66
26
  });
67
- showNext();
68
- }
27
+ const clearClose = __hk[1] ?? hookMemoPublishInvariant(__hk, 1, () => {
28
+ if (closeTimer.current !== null) clearTimeout(closeTimer.current);
29
+ closeTimer.current = null;
30
+ });
31
+ const scheduleClose = () => {
32
+ clearClose();
33
+ closeTimer.current = setTimeout(() => {
34
+ closeTimer.current = null;
35
+ setOpen(false);
36
+ }, Math.max(0, props.closeDelay ?? 120));
37
+ };
38
+ const startOpen = () => {
39
+ clearClose();
40
+ clearOpen();
41
+ openTimer.current = setTimeout(() => {
42
+ openTimer.current = null;
43
+ setOpen(true);
44
+ }, Math.max(0, props.openDelay ?? 500));
45
+ };
46
+ const unbind = __hk[2] ?? hookMemoPublishInvariant(__hk, 2, (binding) => {
47
+ if (!binding) return;
48
+ binding.node.removeEventListener("mouseenter", binding.enter);
49
+ binding.node.removeEventListener("mouseleave", binding.leave);
50
+ });
51
+ const bindAnchor = (node) => {
52
+ anchor.current = node;
53
+ if (anchorBinding.current?.node === node) return;
54
+ unbind(anchorBinding.current);
55
+ anchorBinding.current = null;
56
+ if (!node) return;
57
+ const binding = {
58
+ node,
59
+ enter: startOpen,
60
+ leave: () => {
61
+ clearOpen();
62
+ scheduleClose();
63
+ }
64
+ };
65
+ node.addEventListener("mouseenter", binding.enter);
66
+ node.addEventListener("mouseleave", binding.leave);
67
+ anchorBinding.current = binding;
68
+ };
69
+ const bindCard = (node) => {
70
+ if (cardBinding.current?.node === node) return;
71
+ unbind(cardBinding.current);
72
+ cardBinding.current = null;
73
+ if (!node) return;
74
+ const binding = {
75
+ node,
76
+ enter: clearClose,
77
+ leave: scheduleClose
78
+ };
79
+ node.addEventListener("mouseenter", binding.enter);
80
+ node.addEventListener("mouseleave", binding.leave);
81
+ cardBinding.current = binding;
82
+ };
83
+ useEffect(() => () => {
84
+ clearOpen();
85
+ clearClose();
86
+ unbind(anchorBinding.current);
87
+ unbind(cardBinding.current);
88
+ }, [], _hs$ + 6);
89
+ function __children$1(__props, __s, __extra) {
90
+ const __block = __s.block;
91
+ function __children$4(__props, __s, __extra) {
92
+ const __block = __s.block;
93
+ function __children$6(__props, __s, __extra) {
94
+ const __block = __s.block;
95
+ let _b = __s.slots[0];
96
+ if (_b === void 0) {
97
+ let _m0, _m1;
98
+ const _root = clone(_t$0);
99
+ _m0 = __block.parentNode;
100
+ _m1 = child(_root);
101
+ drainFrag(_root, __block.parentNode, __block.endMarker);
102
+ _b = bag4(__s, null, _m0, _m1, null, void 0);
103
+ }
104
+ {
105
+ const _v = props.card;
106
+ _b.c = textHoleUpdate(__s, 1, _b.a, _v, _b.c, _b.d, _b.b, true, true);
107
+ _b.d = _v;
108
+ }
109
+ }
110
+ componentSlotVoid(__s, 0, __block.parentNode, View, {
111
+ "bind": bindCard,
112
+ "className": props.cardClassName,
113
+ "style": props.cardStyle,
114
+ "children": markChildrenBlock(__children$6, __childrenBody)
115
+ }, __block.endMarker, void 0, void 0, void 0, void 0, "c:efc5cf17");
116
+ }
117
+ let _b = __s.slots[0];
118
+ if (_b === void 0) {
119
+ let _m0, _m1, _m4;
120
+ const _root = clone(_t$1);
121
+ _m0 = __block.parentNode;
122
+ const _el0 = child(_root);
123
+ _m1 = _el0;
124
+ _m4 = sibling(_el0, 1);
125
+ drainFrag(_root, __block.parentNode, __block.endMarker);
126
+ _b = bag5(__s, null, _m0, _m1, null, void 0, _m4);
127
+ }
128
+ {
129
+ const _v = props.children;
130
+ _b.c = textHoleUpdate(__s, 1, _b.a, _v, _b.c, _b.d, _b.b, true);
131
+ _b.d = _v;
132
+ }
133
+ componentSlotVoid(__s, 2, _b.a, Popover, {
134
+ "open": open,
135
+ "anchor": anchor,
136
+ "placement": props.placement ?? "bottom",
137
+ "dismissOnOutsideTap": false,
138
+ "children": markChildrenBlock(__children$4, __childrenBody$)
139
+ }, _b.e, void 0, void 0, void 0, void 0, "c:258d2497");
140
+ }
141
+ componentSlotVoid(__s, 0, __block.parentNode, View, {
142
+ "className": props.className,
143
+ "style": props.style,
144
+ "bind": bindAnchor,
145
+ "web": props.web,
146
+ "children": markChildrenBlock(__children$1, __childrenBody$2)
147
+ }, __block.endMarker, void 0, void 0, true, void 0, "c:df012d7f");
148
+ };
69
149
  //#endregion
70
- export { showToast };
150
+ export { Hoverable };