@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.
- package/README.md +46 -0
- package/dist/native/octane-client-build.json +1 -1
- package/dist/native/ui.js +55 -40
- package/dist/native/ui10.js +20 -11
- package/dist/native/ui11.js +42 -109
- package/dist/native/ui12.js +17 -84
- package/dist/native/ui13.js +11 -41
- package/dist/native/ui14.js +133 -76
- package/dist/native/ui15.js +43 -92
- package/dist/native/ui16.js +106 -45
- package/dist/native/ui17.js +29 -42
- package/dist/native/ui18.js +34 -53
- package/dist/native/ui19.js +246 -32
- package/dist/native/ui20.js +27 -16
- package/dist/native/ui21.js +376 -86
- package/dist/native/ui22.js +26 -114
- package/dist/native/ui23.js +49 -97
- package/dist/native/ui24.js +79 -53
- package/dist/native/ui25.js +138 -16
- package/dist/native/ui26.js +8 -23
- package/dist/native/ui27.js +60 -34
- package/dist/native/ui28.js +36 -142
- package/dist/native/ui29.js +101 -21
- package/dist/native/ui3.js +22 -1
- package/dist/native/ui30.js +14 -31
- package/dist/native/ui31.js +55 -36
- package/dist/native/ui32.js +49 -61
- package/dist/native/ui33.js +36 -28
- package/dist/native/ui34.js +51 -8
- package/dist/native/ui35.js +98 -20
- package/dist/native/ui36.js +9 -33
- package/dist/native/ui37.js +42 -15
- package/dist/native/ui38.js +186 -57
- package/dist/native/ui39.js +96 -26
- package/dist/native/ui4.js +22 -20
- package/dist/native/ui40.js +179 -8
- package/dist/native/ui41.js +52 -98
- package/dist/native/ui42.js +14 -145
- package/dist/native/ui43.js +16 -19
- package/dist/native/ui44.js +6 -6
- package/dist/native/ui45.js +38 -0
- package/dist/native/ui46.js +267 -0
- package/dist/native/ui47.js +28 -0
- package/dist/native/ui48.js +35 -0
- package/dist/native/ui49.js +41 -0
- package/dist/native/ui5.js +37 -77
- package/dist/native/ui50.js +72 -0
- package/dist/native/ui51.js +66 -0
- package/dist/native/ui52.js +64 -0
- package/dist/native/ui53.js +27 -0
- package/dist/native/ui54.js +13 -0
- package/dist/native/ui55.js +92 -0
- package/dist/native/ui56.js +34 -0
- package/dist/native/ui57.js +19 -0
- package/dist/native/ui58.js +156 -0
- package/dist/native/ui59.js +33 -0
- package/dist/native/ui6.js +94 -9
- package/dist/native/ui60.js +14 -0
- package/dist/native/ui61.js +22 -0
- package/dist/native/ui62.js +8 -0
- package/dist/native/ui63.js +108 -0
- package/dist/native/ui64.js +76 -0
- package/dist/native/ui7.js +42 -26
- package/dist/native/ui8.js +22 -12
- package/dist/native/ui9.js +18 -9
- package/dist/web/octane-client-build.json +1 -1
- package/dist/web/ui.js +53 -40
- package/dist/web/ui10.js +33 -186
- package/dist/web/ui11.js +28 -409
- package/dist/web/ui12.js +21 -68
- package/dist/web/ui13.js +265 -96
- package/dist/web/ui14.js +85 -95
- package/dist/web/ui15.js +368 -25
- package/dist/web/ui16.js +13 -101
- package/dist/web/ui17.js +246 -42
- package/dist/web/ui18.js +237 -28
- package/dist/web/ui19.js +36 -10
- package/dist/web/ui20.js +73 -102
- package/dist/web/ui21.js +102 -73
- package/dist/web/ui22.js +95 -55
- package/dist/web/ui23.js +94 -55
- package/dist/web/ui24.js +31 -15
- package/dist/web/ui25.js +105 -19
- package/dist/web/ui26.js +29 -23
- package/dist/web/ui27.js +12 -123
- package/dist/web/ui28.js +9 -110
- package/dist/web/ui29.js +52 -102
- package/dist/web/ui3.js +29 -18
- package/dist/web/ui30.js +32 -41
- package/dist/web/ui31.js +120 -39
- package/dist/web/ui32.js +41 -74
- package/dist/web/ui33.js +148 -32
- package/dist/web/ui34.js +145 -62
- package/dist/web/ui35.js +140 -7
- package/dist/web/ui36.js +86 -41
- package/dist/web/ui37.js +19 -44
- package/dist/web/ui38.js +5 -15
- package/dist/web/ui39.js +24 -86
- package/dist/web/ui4.js +46 -152
- package/dist/web/ui40.js +150 -37
- package/dist/web/ui41.js +36 -10
- package/dist/web/ui42.js +40 -7
- package/dist/web/ui43.js +73 -19
- package/dist/web/ui44.js +40 -6
- package/dist/web/ui45.js +62 -0
- package/dist/web/ui46.js +50 -0
- package/dist/web/ui47.js +9 -0
- package/dist/web/ui48.js +45 -0
- package/dist/web/ui49.js +13 -0
- package/dist/web/ui5.js +131 -27
- package/dist/web/ui50.js +63 -0
- package/dist/web/ui51.js +47 -0
- package/dist/web/ui52.js +19 -0
- package/dist/web/ui53.js +273 -0
- package/dist/web/ui54.js +42 -0
- package/dist/web/ui55.js +17 -0
- package/dist/web/ui56.js +9 -0
- package/dist/web/ui57.js +22 -0
- package/dist/web/ui58.js +8 -0
- package/dist/web/ui59.js +44 -0
- package/dist/web/ui6.js +81 -45
- package/dist/web/ui60.js +46 -0
- package/dist/web/ui7.js +43 -21
- package/dist/web/ui8.js +27 -21
- package/dist/web/ui9.js +29 -18
- package/package.json +17 -4
- package/src/theme/tokens.css +597 -141
- package/types/index.d.ts +112 -58
- package/types/props.d.ts +291 -16
package/dist/web/ui33.js
CHANGED
|
@@ -1,43 +1,159 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
38
|
-
|
|
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 {
|
|
159
|
+
export { Popover };
|
package/dist/web/ui34.js
CHANGED
|
@@ -1,67 +1,150 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
9
|
-
let
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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 {
|
|
150
|
+
export { Hoverable };
|
package/dist/web/ui35.js
CHANGED
|
@@ -1,9 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 {
|
|
142
|
+
export { showToast };
|