@octane-xplat/ui 0.3.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 (129) hide show
  1. package/README.md +46 -0
  2. package/dist/native/octane-client-build.json +1 -1
  3. package/dist/native/ui.js +55 -40
  4. package/dist/native/ui10.js +20 -11
  5. package/dist/native/ui11.js +42 -109
  6. package/dist/native/ui12.js +17 -84
  7. package/dist/native/ui13.js +11 -41
  8. package/dist/native/ui14.js +133 -76
  9. package/dist/native/ui15.js +43 -92
  10. package/dist/native/ui16.js +106 -45
  11. package/dist/native/ui17.js +29 -42
  12. package/dist/native/ui18.js +34 -53
  13. package/dist/native/ui19.js +246 -32
  14. package/dist/native/ui20.js +27 -16
  15. package/dist/native/ui21.js +376 -86
  16. package/dist/native/ui22.js +26 -114
  17. package/dist/native/ui23.js +49 -97
  18. package/dist/native/ui24.js +79 -53
  19. package/dist/native/ui25.js +138 -16
  20. package/dist/native/ui26.js +8 -23
  21. package/dist/native/ui27.js +60 -34
  22. package/dist/native/ui28.js +36 -142
  23. package/dist/native/ui29.js +101 -21
  24. package/dist/native/ui3.js +22 -1
  25. package/dist/native/ui30.js +14 -31
  26. package/dist/native/ui31.js +55 -36
  27. package/dist/native/ui32.js +49 -61
  28. package/dist/native/ui33.js +36 -28
  29. package/dist/native/ui34.js +51 -8
  30. package/dist/native/ui35.js +98 -20
  31. package/dist/native/ui36.js +9 -33
  32. package/dist/native/ui37.js +42 -15
  33. package/dist/native/ui38.js +186 -57
  34. package/dist/native/ui39.js +96 -26
  35. package/dist/native/ui4.js +22 -20
  36. package/dist/native/ui40.js +179 -8
  37. package/dist/native/ui41.js +52 -98
  38. package/dist/native/ui42.js +14 -145
  39. package/dist/native/ui43.js +16 -19
  40. package/dist/native/ui44.js +6 -6
  41. package/dist/native/ui45.js +38 -0
  42. package/dist/native/ui46.js +267 -0
  43. package/dist/native/ui47.js +28 -0
  44. package/dist/native/ui48.js +35 -0
  45. package/dist/native/ui49.js +41 -0
  46. package/dist/native/ui5.js +37 -77
  47. package/dist/native/ui50.js +72 -0
  48. package/dist/native/ui51.js +66 -0
  49. package/dist/native/ui52.js +64 -0
  50. package/dist/native/ui53.js +27 -0
  51. package/dist/native/ui54.js +13 -0
  52. package/dist/native/ui55.js +92 -0
  53. package/dist/native/ui56.js +34 -0
  54. package/dist/native/ui57.js +19 -0
  55. package/dist/native/ui58.js +156 -0
  56. package/dist/native/ui59.js +33 -0
  57. package/dist/native/ui6.js +94 -9
  58. package/dist/native/ui60.js +14 -0
  59. package/dist/native/ui61.js +22 -0
  60. package/dist/native/ui62.js +8 -0
  61. package/dist/native/ui63.js +108 -0
  62. package/dist/native/ui64.js +76 -0
  63. package/dist/native/ui7.js +42 -26
  64. package/dist/native/ui8.js +22 -12
  65. package/dist/native/ui9.js +18 -9
  66. package/dist/web/octane-client-build.json +1 -1
  67. package/dist/web/ui.js +53 -40
  68. package/dist/web/ui10.js +33 -186
  69. package/dist/web/ui11.js +28 -409
  70. package/dist/web/ui12.js +21 -68
  71. package/dist/web/ui13.js +265 -96
  72. package/dist/web/ui14.js +85 -95
  73. package/dist/web/ui15.js +368 -25
  74. package/dist/web/ui16.js +13 -101
  75. package/dist/web/ui17.js +246 -42
  76. package/dist/web/ui18.js +237 -28
  77. package/dist/web/ui19.js +36 -10
  78. package/dist/web/ui20.js +73 -102
  79. package/dist/web/ui21.js +102 -73
  80. package/dist/web/ui22.js +95 -55
  81. package/dist/web/ui23.js +94 -55
  82. package/dist/web/ui24.js +31 -15
  83. package/dist/web/ui25.js +105 -19
  84. package/dist/web/ui26.js +29 -23
  85. package/dist/web/ui27.js +12 -123
  86. package/dist/web/ui28.js +9 -110
  87. package/dist/web/ui29.js +52 -102
  88. package/dist/web/ui3.js +29 -18
  89. package/dist/web/ui30.js +32 -41
  90. package/dist/web/ui31.js +120 -39
  91. package/dist/web/ui32.js +41 -74
  92. package/dist/web/ui33.js +148 -32
  93. package/dist/web/ui34.js +145 -62
  94. package/dist/web/ui35.js +140 -7
  95. package/dist/web/ui36.js +86 -41
  96. package/dist/web/ui37.js +19 -44
  97. package/dist/web/ui38.js +5 -15
  98. package/dist/web/ui39.js +24 -86
  99. package/dist/web/ui4.js +46 -152
  100. package/dist/web/ui40.js +150 -37
  101. package/dist/web/ui41.js +36 -10
  102. package/dist/web/ui42.js +40 -7
  103. package/dist/web/ui43.js +73 -19
  104. package/dist/web/ui44.js +40 -6
  105. package/dist/web/ui45.js +62 -0
  106. package/dist/web/ui46.js +50 -0
  107. package/dist/web/ui47.js +9 -0
  108. package/dist/web/ui48.js +45 -0
  109. package/dist/web/ui49.js +13 -0
  110. package/dist/web/ui5.js +131 -27
  111. package/dist/web/ui50.js +63 -0
  112. package/dist/web/ui51.js +47 -0
  113. package/dist/web/ui52.js +19 -0
  114. package/dist/web/ui53.js +273 -0
  115. package/dist/web/ui54.js +42 -0
  116. package/dist/web/ui55.js +17 -0
  117. package/dist/web/ui56.js +9 -0
  118. package/dist/web/ui57.js +22 -0
  119. package/dist/web/ui58.js +8 -0
  120. package/dist/web/ui59.js +44 -0
  121. package/dist/web/ui6.js +81 -45
  122. package/dist/web/ui60.js +46 -0
  123. package/dist/web/ui7.js +43 -21
  124. package/dist/web/ui8.js +27 -21
  125. package/dist/web/ui9.js +29 -18
  126. package/package.json +17 -4
  127. package/src/theme/tokens.css +597 -141
  128. package/types/index.d.ts +112 -58
  129. package/types/props.d.ts +291 -16
package/dist/web/ui33.js CHANGED
@@ -1,43 +1,159 @@
1
- import { __s, bag6, clone, queueRefAttach, queueRefDetach, setStyle, template } from "octane";
2
- import { childTextHoleUpdate, replaceRef, updateFreshClassName } from "octane/internal/client";
3
- //#region src/KeyboardAvoiding.web.tsrx
4
- var _t$0 = /* @__PURE__ */ template("<div></div>");
5
- var _rm$1 = [
6
- "r",
7
- "b",
8
- "a"
9
- ];
10
- function applyWebProps(node, bag) {
11
- if (!node || !bag) return;
12
- for (const [key, value] of Object.entries(bag)) if (key.includes("-")) node.setAttribute(key, String(value));
13
- else node[key] = value;
14
- }
15
- var KeyboardAvoiding = /* @__PURE__ */ __s(function KeyboardAvoiding(props, __s, __extra) {
1
+ import { cx } from "./ui28.js";
2
+ import { useThemeScheme } from "./ui29.js";
3
+ import { positionPopover } from "./ui32.js";
4
+ import { bag4, child, clone, componentSlotVoid, createElement, createPortal, createScopedElement, createScopedValue, drainFrag, hookSlots, ifBlock, positionalChildren, template, useEffect, useRef, useState, withSlot } from "octane";
5
+ import { compilerMemoRegion, hookMemoCreate, hookMemoPublishInvariant, textHoleUpdate } from "octane/internal/client";
6
+ //#region src/Popover.web.tsrx
7
+ var _t$0 = /* @__PURE__ */ template("<!>", 0, 1);
8
+ var _hs$ = /* @__PURE__ */ hookSlots(6);
9
+ var _h$0 = /* @__PURE__ */ Symbol(_hs$);
10
+ function __then$0(__props, __s, __extra) {
11
+ const __block = __s.block;
12
+ const dark = __extra[0];
13
+ const dismiss = __extra[1];
14
+ const panelRef = __extra[2];
15
+ const position = __extra[3];
16
+ const props = __extra[4];
17
+ const stopPointer = __extra[5];
16
18
  let _b = __s.slots[0];
17
19
  if (_b === void 0) {
18
20
  let _m0, _m1;
19
21
  const _root = clone(_t$0);
20
- queueRefAttach(__s, _m1 = (node) => applyWebProps(node, props.web), _m0 = _root);
21
- (__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.b, _b.a));
22
- _b = bag6(__s, _root, _m0, _m1, void 0, void 0, null, void 0);
23
- __s.refFields = _rm$1;
24
- } else {
25
- const _r = (node) => applyWebProps(node, props.web);
26
- if (_r !== _b.b) _b.b = replaceRef(__s, _b.b, _r, _b.a);
22
+ _m0 = __block.parentNode;
23
+ _m1 = child(_root);
24
+ drainFrag(_root, __block.parentNode, __block.endMarker);
25
+ _b = bag4(__s, null, _m0, _m1, null, void 0);
27
26
  }
28
- _b.c = updateFreshClassName(["vx-keyboard-avoiding", props.className], _b.c, _b.a);
29
27
  {
30
- const _v = props.style;
31
- if (_b.d !== _v) {
32
- setStyle(_b.a, _v, _b.d);
33
- _b.d = _v;
28
+ const _v = /* @__PURE__ */ createPortal(createScopedValue(() => createScopedElement("div", {
29
+ className: cx("vx-popover-layer", dark && "dark"),
30
+ style: {
31
+ position: "fixed",
32
+ inset: 0,
33
+ zIndex: 1e3,
34
+ pointerEvents: "none"
35
+ }
36
+ }, () => positionalChildren([(props.dismissOnOutsideTap ?? true) && createScopedValue(() => createElement("div", {
37
+ className: "vx-popover-backdrop",
38
+ style: {
39
+ position: "fixed",
40
+ inset: 0,
41
+ zIndex: 0,
42
+ pointerEvents: "auto"
43
+ },
44
+ onPointerDown: stopPointer,
45
+ onClick: dismiss
46
+ })), createScopedValue(() => createScopedElement("div", {
47
+ ref: panelRef,
48
+ className: cx("vx-popover", props.className),
49
+ style: {
50
+ ...props.style,
51
+ position: "fixed",
52
+ top: position.top,
53
+ left: position.left,
54
+ zIndex: 1,
55
+ pointerEvents: "auto"
56
+ },
57
+ ...props.web
58
+ }, () => props.children))]))), document.body);
59
+ _b.c = textHoleUpdate(__s, 1, _b.a, _v, _b.c, _b.d, _b.b, true, true);
60
+ _b.d = _v;
61
+ }
62
+ }
63
+ function __then$3(__props, __s, __extra) {
64
+ const __block = __s.block;
65
+ const anchorElement = __extra[0];
66
+ const props = __extra[1];
67
+ componentSlotVoid(__s, 0, __block.parentNode, PopoverLayer, {
68
+ ...props,
69
+ "anchorElement": anchorElement
70
+ }, __block.endMarker, void 0, void 0, void 0, void 0, "c:541a23d1");
71
+ }
72
+ var PopoverLayer = function PopoverLayer(props, __s, __extra) {
73
+ const __block = __s.block;
74
+ const __memoRegion = compilerMemoRegion(__s, _hs$ + 0);
75
+ let __hk = __memoRegion.hooks;
76
+ if (__hk === void 0) __memoRegion.hooks = __hk = hookMemoCreate(1);
77
+ const dark = withSlot(_h$0, useThemeScheme) === "dark";
78
+ const panelRef = useRef(null, _hs$ + 1);
79
+ const [position, setPosition] = useState(null, _hs$ + 2);
80
+ const update = () => {
81
+ const anchor = props.anchorElement;
82
+ if (!anchor?.getBoundingClientRect) return;
83
+ const anchorRect = anchor.getBoundingClientRect();
84
+ const panelRect = panelRef.current?.getBoundingClientRect?.();
85
+ const placed = positionPopover({
86
+ left: anchorRect.left,
87
+ top: anchorRect.top,
88
+ width: anchorRect.width,
89
+ height: anchorRect.height
90
+ }, {
91
+ width: panelRect?.width ?? 0,
92
+ height: panelRect?.height ?? 0
93
+ }, {
94
+ left: 0,
95
+ top: 0,
96
+ width: window.innerWidth,
97
+ height: window.innerHeight
98
+ }, props.placement ?? "bottom");
99
+ setPosition((current) => current?.left === placed.left && current?.top === placed.top ? current : placed);
100
+ };
101
+ useEffect(() => {
102
+ if (!props.open || !props.anchorElement?.getBoundingClientRect) {
103
+ setPosition(null);
104
+ return;
34
105
  }
106
+ update();
107
+ window.addEventListener("resize", update);
108
+ window.addEventListener("scroll", update, true);
109
+ const observer = typeof ResizeObserver === "undefined" || !panelRef.current ? null : new ResizeObserver(update);
110
+ if (observer && panelRef.current) observer.observe(panelRef.current);
111
+ return () => {
112
+ window.removeEventListener("resize", update);
113
+ window.removeEventListener("scroll", update, true);
114
+ observer?.disconnect();
115
+ };
116
+ }, [
117
+ props.open,
118
+ props.anchorElement,
119
+ props.placement,
120
+ props.children,
121
+ position === null
122
+ ], _hs$ + 3);
123
+ const stopPointer = __hk[0] ?? hookMemoPublishInvariant(__hk, 0, (event) => event.stopPropagation());
124
+ const dismiss = (event) => {
125
+ event.preventDefault();
126
+ event.stopPropagation();
127
+ props.onDismiss?.();
128
+ };
129
+ if (__s.block.pending && !__s.block.crossRenderUpdate) return;
130
+ {
131
+ const __ifCondition = props.open && position;
132
+ ifBlock(__s, 0, __block.parentNode, __ifCondition, __then$0, null, __block.endMarker, __ifCondition ? [
133
+ dark,
134
+ dismiss,
135
+ panelRef,
136
+ position,
137
+ props,
138
+ stopPointer
139
+ ] : void 0);
35
140
  }
141
+ };
142
+ var Popover = function Popover(props, __s, __extra) {
143
+ const __block = __s.block;
144
+ const [anchorElement, setAnchorElement] = useState(null, _hs$ + 4);
145
+ useEffect(() => {
146
+ const next = props.anchor?.current ?? null;
147
+ if (next !== anchorElement) setAnchorElement(next);
148
+ }, [
149
+ props.anchor,
150
+ props.open,
151
+ anchorElement
152
+ ], _hs$ + 5);
36
153
  {
37
- const _v = props.children;
38
- _b.e = childTextHoleUpdate(__s, 1, _b.a, _v, _b.e, _b.f);
39
- _b.f = _v;
154
+ const __ifCondition$ = props.open && anchorElement;
155
+ ifBlock(__s, 0, __block.parentNode, __ifCondition$, __then$3, null, __block.endMarker, __ifCondition$ ? [anchorElement, props] : void 0);
40
156
  }
41
- });
157
+ };
42
158
  //#endregion
43
- export { KeyboardAvoiding };
159
+ export { Popover };
package/dist/web/ui34.js CHANGED
@@ -1,67 +1,150 @@
1
- import { __s, bag3, bag8, child, clone, drainFrag, ifBlock, queueRefAttach, queueRefDetach, setStyle, sibling, template } from "octane";
2
- import { childTextHoleUpdate, replaceRef, updateFreshClassName } from "octane/internal/client";
3
- //#region src/Drawer.web.tsrx
4
- var _t$0 = /* @__PURE__ */ template("<div class=\"vx-drawer-backdrop\" aria-hidden=\"true\"></div><div class=\"vx-drawer-panel\"></div>", 0, 1);
5
- var _t$1 = /* @__PURE__ */ template("<div><div class=\"vx-drawer-main\"></div><!></div>");
6
- function __then$1(__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) {
7
13
  const __block = __s.block;
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 = sibling(child(_root), 1);
14
- drainFrag(_root, __block.parentNode, __block.endMarker);
15
- _b = bag3(__s, null, _m0, null, void 0);
16
- }
17
- {
18
- const _v = props.drawer;
19
- _b.b = childTextHoleUpdate(__s, 1, _b.a, _v, _b.b, _b.c);
20
- _b.c = _v;
21
- }
22
- }
23
- var _rm$4 = [
24
- "r",
25
- "b",
26
- "a"
27
- ];
28
- function applyWebProps(node, bag) {
29
- if (!node || !bag) return;
30
- for (const [key, value] of Object.entries(bag)) if (key.includes("-")) node.setAttribute(key, String(value));
31
- else node[key] = value;
32
- }
33
- var Drawer = /* @__PURE__ */ __s(function Drawer(props, __s, __extra) {
34
- let _b = __s.slots[0];
35
- if (_b === void 0) {
36
- let _m0, _m1, _m4, _m5;
37
- const _root = clone(_t$1);
38
- queueRefAttach(__s, _m1 = (node) => applyWebProps(node, props.web), _m0 = _root);
39
- (__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.b, _b.a));
40
- _m4 = sibling(child(_root), 1);
41
- _m5 = child(_root);
42
- _b = bag8(__s, _root, _m0, _m1, void 0, void 0, _m4, _m5, null, void 0);
43
- __s.refFields = _rm$4;
44
- } else {
45
- const _r = (node) => applyWebProps(node, props.web);
46
- if (_r !== _b.b) _b.b = replaceRef(__s, _b.b, _r, _b.a);
47
- }
48
- _b.c = updateFreshClassName(["vx-drawer", props.className], _b.c, _b.a);
49
- {
50
- const _v = props.style;
51
- if (_b.d !== _v) {
52
- setStyle(_b.a, _v, _b.d);
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;
26
+ });
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);
53
131
  _b.d = _v;
54
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");
55
140
  }
56
- {
57
- const _v = props.main;
58
- _b.g = childTextHoleUpdate(__s, 1, _b.f, _v, _b.g, _b.h);
59
- _b.h = _v;
60
- }
61
- {
62
- const __ifCondition = props.open;
63
- ifBlock(__s, 2, _b.a, __ifCondition, __then$1, null, _b.e, __ifCondition ? [props] : void 0);
64
- }
65
- });
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
+ };
66
149
  //#endregion
67
- export { Drawer };
150
+ export { Hoverable };
package/dist/web/ui35.js CHANGED
@@ -1,9 +1,142 @@
1
- //#region src/platformProps.web.ts
2
- /** Apply a web escape-hatch bag after the primitive's standard props. */
3
- function applyWebProps(el, props) {
4
- if (!el || !props) return;
5
- for (const [name, value] of Object.entries(props)) if (name.includes("-")) el.setAttribute(name, String(value));
6
- else el[name] = value;
1
+ import { cx } from "./ui28.js";
2
+ import { applyThemeClasses } from "./ui29.js";
3
+ import { Popover } from "./ui33.js";
4
+ import { bag1, bag3, clone, componentSlot, componentSlotVoid, createRoot, ifBlock, markChildrenBlock, template } from "octane";
5
+ import { childTextHoleUpdate } from "octane/internal/client";
6
+ //#region src/toast-anchor.web.tsrx
7
+ var _t$0 = /* @__PURE__ */ template("<div class=\"vx-toast\"></div>");
8
+ function __then$3(__props, __s, __extra) {
9
+ const props = __extra[0];
10
+ let _b = __s.slots[0];
11
+ if (_b === void 0) {
12
+ let _m0;
13
+ const _root = clone(_t$0);
14
+ _m0 = _root;
15
+ _b = bag3(__s, _root, _m0, null, void 0);
16
+ }
17
+ {
18
+ const _v = props.content;
19
+ _b.b = childTextHoleUpdate(__s, 1, _b.a, _v, _b.b, _b.c);
20
+ _b.c = _v;
21
+ }
22
+ }
23
+ function __else$5(__props, __s, __extra) {
24
+ const Component = __extra[0].content;
25
+ let _b = __s.slots[0];
26
+ if (_b === void 0) {
27
+ let _m0;
28
+ const _root = clone(_t$0);
29
+ _m0 = _root;
30
+ _b = bag1(__s, _root, _m0);
31
+ }
32
+ componentSlot(__s, 1, _b.a, Component, {}, void 0, void 0, void 0, void 0, void 0, "c:46bd91a2");
33
+ }
34
+ var __childrenBody = {};
35
+ function __then$0(__props, __s, __extra) {
36
+ const __block = __s.block;
37
+ const props = __extra[0];
38
+ function __children$2(__props, __s, __extra) {
39
+ const __block = __s.block;
40
+ ifBlock(__s, 0, __block.parentNode, typeof props.content === "string", __then$3, __else$5, __block.endMarker, [props]);
41
+ }
42
+ componentSlotVoid(__s, 0, __block.parentNode, Popover, {
43
+ "open": props.open,
44
+ "anchor": props.options.anchor,
45
+ "placement": props.options.placement ?? placementFor(props.options.position),
46
+ "dismissOnOutsideTap": false,
47
+ "children": markChildrenBlock(__children$2, __childrenBody)
48
+ }, __block.endMarker, void 0, void 0, void 0, void 0, "c:fb0a2e5d");
49
+ }
50
+ function __then$9(__props, __s, __extra) {
51
+ const props = __extra[0];
52
+ let _b = __s.slots[0];
53
+ if (_b === void 0) {
54
+ let _m0;
55
+ const _root = clone(_t$0);
56
+ _m0 = _root;
57
+ _b = bag3(__s, _root, _m0, null, void 0);
58
+ }
59
+ {
60
+ const _v = props.content;
61
+ _b.b = childTextHoleUpdate(__s, 1, _b.a, _v, _b.b, _b.c);
62
+ _b.c = _v;
63
+ }
64
+ }
65
+ function __else$11(__props, __s, __extra) {
66
+ const Component = __extra[0].content;
67
+ let _b = __s.slots[0];
68
+ if (_b === void 0) {
69
+ let _m0;
70
+ const _root = clone(_t$0);
71
+ _m0 = _root;
72
+ _b = bag1(__s, _root, _m0);
73
+ }
74
+ componentSlot(__s, 1, _b.a, Component, {}, void 0, void 0, void 0, void 0, void 0, "c:75cbf224");
75
+ }
76
+ function __else$8(__props, __s, __extra) {
77
+ const __block = __s.block;
78
+ const props = __extra[0];
79
+ ifBlock(__s, 0, __block.parentNode, typeof props.content === "string", __then$9, __else$11, __block.endMarker, __extra);
80
+ }
81
+ var queue = [];
82
+ var active = false;
83
+ var ToastBody = function ToastBody(props, __s, __extra) {
84
+ const __block = __s.block;
85
+ ifBlock(__s, 0, __block.parentNode, props.options.anchor, __then$0, __else$8, __block.endMarker, [props]);
86
+ };
87
+ function placementFor(position = "bottom") {
88
+ return position.startsWith("top") ? "top" : "bottom";
89
+ }
90
+ function applyWebProps(host, props) {
91
+ for (const [key, value] of Object.entries(props ?? {})) if (key.includes("-")) host.setAttribute(key, String(value));
92
+ else host[key] = value;
93
+ }
94
+ function alignmentFor(position = "bottom") {
95
+ if (position.endsWith("-start")) return "flex-start";
96
+ if (position.endsWith("-end")) return "flex-end";
97
+ return "center";
98
+ }
99
+ function showNext() {
100
+ if (active || queue.length === 0) return;
101
+ active = true;
102
+ const entry = queue.shift();
103
+ const anchored = Boolean(entry.options.anchor);
104
+ const host = document.createElement("div");
105
+ const position = entry.options.position ?? "bottom";
106
+ const unbindTheme = applyThemeClasses(host, cx("vx-toast-host", placementFor(position) === "top" ? "vx-toast-top" : "vx-toast-bottom"));
107
+ applyWebProps(host, entry.options.web);
108
+ if (anchored) host.style.display = "none";
109
+ else host.style.justifyContent = alignmentFor(position);
110
+ document.body.appendChild(host);
111
+ const root = createRoot(host);
112
+ root.render(ToastBody, {
113
+ ...entry,
114
+ open: true
115
+ });
116
+ const finish = () => {
117
+ const cleanup = () => {
118
+ unbindTheme();
119
+ root.unmount();
120
+ host.remove();
121
+ active = false;
122
+ showNext();
123
+ };
124
+ if (anchored) {
125
+ root.render(ToastBody, {
126
+ ...entry,
127
+ open: false
128
+ });
129
+ setTimeout(cleanup, 0);
130
+ } else cleanup();
131
+ };
132
+ setTimeout(finish, Math.max(0, entry.options.duration ?? 3e3));
133
+ }
134
+ function showToast(content, options = {}) {
135
+ queue.push({
136
+ content,
137
+ options
138
+ });
139
+ showNext();
7
140
  }
8
141
  //#endregion
9
- export { applyWebProps };
142
+ export { showToast };