@octane-xplat/ui 0.3.0 → 0.4.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 +52 -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 +118 -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 +78 -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/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 -24
- package/dist/native/ui4.js +22 -20
- package/dist/native/ui40.js +57 -13
- package/dist/native/ui41.js +15 -100
- package/dist/native/ui42.js +6 -146
- package/dist/native/ui43.js +37 -21
- package/dist/native/ui44.js +265 -6
- package/dist/native/ui45.js +28 -0
- package/dist/native/ui46.js +35 -0
- package/dist/native/ui47.js +41 -0
- package/dist/native/ui48.js +72 -0
- package/dist/native/ui49.js +66 -0
- package/dist/native/ui5.js +37 -77
- package/dist/native/ui50.js +27 -0
- package/dist/native/ui51.js +13 -0
- package/dist/native/ui52.js +92 -0
- package/dist/native/ui53.js +34 -0
- package/dist/native/ui54.js +17 -0
- package/dist/native/ui55.js +156 -0
- package/dist/native/ui56.js +33 -0
- package/dist/native/ui57.js +14 -0
- package/dist/native/ui58.js +22 -0
- package/dist/native/ui59.js +8 -0
- package/dist/native/ui6.js +52 -9
- package/dist/native/ui60.js +108 -0
- package/dist/native/ui61.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 +51 -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 +201 -97
- 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 +54 -51
- package/dist/web/ui35.js +55 -7
- package/dist/web/ui36.js +18 -41
- package/dist/web/ui37.js +6 -46
- package/dist/web/ui38.js +37 -16
- package/dist/web/ui39.js +135 -81
- package/dist/web/ui4.js +46 -152
- package/dist/web/ui40.js +39 -37
- package/dist/web/ui41.js +41 -16
- package/dist/web/ui42.js +74 -7
- package/dist/web/ui43.js +40 -20
- package/dist/web/ui44.js +60 -6
- package/dist/web/ui45.js +9 -0
- package/dist/web/ui46.js +45 -0
- package/dist/web/ui47.js +13 -0
- package/dist/web/ui48.js +63 -0
- package/dist/web/ui49.js +47 -0
- package/dist/web/ui5.js +131 -27
- package/dist/web/ui50.js +17 -0
- package/dist/web/ui51.js +149 -0
- package/dist/web/ui52.js +42 -0
- package/dist/web/ui53.js +17 -0
- package/dist/web/ui54.js +9 -0
- package/dist/web/ui55.js +22 -0
- package/dist/web/ui56.js +8 -0
- package/dist/web/ui57.js +44 -0
- package/dist/web/ui58.js +46 -0
- package/dist/web/ui6.js +81 -45
- package/dist/web/ui7.js +43 -21
- package/dist/web/ui8.js +27 -21
- package/dist/web/ui9.js +29 -18
- package/package.json +13 -4
- package/src/theme/tokens.css +369 -138
- package/types/index.d.ts +102 -58
- package/types/props.d.ts +233 -13
package/dist/web/ui20.js
CHANGED
|
@@ -1,114 +1,85 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { applyEscapeProps } from "./ui2.js";
|
|
2
|
+
import { normStyle } from "./ui4.js";
|
|
3
|
+
import { __s, bag11, clone, delegateEvents, queueRefAttach, queueRefDetach, setEventHandler, setStyle, template } from "octane";
|
|
4
|
+
import { bindSignalAttribute, bindSignalValue, enableSignalBindings, replaceRef, setBooleanAttributeIfChanged, setPlainAttribute } from "octane/internal/client";
|
|
5
|
+
//#region src/TextInput.web.tsrx
|
|
5
6
|
enableSignalBindings(1, true);
|
|
6
|
-
delegateEvents([
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
setEventHandler(_root, "$$click", props.onDismiss);
|
|
18
|
-
_b = bag1(__s, _root, _m0);
|
|
19
|
-
} else setEventHandler(_b.a, "$$click", props.onDismiss);
|
|
20
|
-
}
|
|
21
|
-
var _rm$5 = [
|
|
22
|
-
"s",
|
|
23
|
-
"e",
|
|
24
|
-
"d"
|
|
7
|
+
delegateEvents([
|
|
8
|
+
"focusin",
|
|
9
|
+
"focusout",
|
|
10
|
+
"input",
|
|
11
|
+
"keydown"
|
|
12
|
+
]);
|
|
13
|
+
var _t$0 = /* @__PURE__ */ template("<input data-octane-input=\"i:cd4865f9\"/>");
|
|
14
|
+
var _rm$0 = [
|
|
15
|
+
"r",
|
|
16
|
+
"b",
|
|
17
|
+
"a"
|
|
25
18
|
];
|
|
26
|
-
function
|
|
27
|
-
const
|
|
19
|
+
var TextInput = /* @__PURE__ */ __s(function TextInput(props, __s, __extra) {
|
|
20
|
+
const keyboardType = props.keyboardType === "phone" ? "tel" : props.keyboardType === "default" ? "text" : props.keyboardType;
|
|
21
|
+
const inputMode = props.keyboardType === "number" ? "numeric" : props.keyboardType === "phone" ? "tel" : props.keyboardType === "default" ? "text" : props.keyboardType;
|
|
28
22
|
let _b = __s.slots[0];
|
|
29
23
|
if (_b === void 0) {
|
|
30
|
-
let _m0, _m1,
|
|
31
|
-
const _root = clone(_t$
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
[true, _m2]
|
|
52
|
-
], "b:4cb93a35", true);
|
|
53
|
-
const _el0 = sibling(child(_root), 1);
|
|
54
|
-
_m5 = _el0;
|
|
55
|
-
setEventHandler(_el0, "$$click", (event) => event.stopPropagation());
|
|
56
|
-
markDangerouslySetInnerHTMLChildren(_root);
|
|
57
|
-
_m6 = child(_root);
|
|
58
|
-
_b = bag9(__s, _root, _m0, _m1, _m2, _m3, _m4, _m5, _m6, null, void 0);
|
|
59
|
-
__s.refFields = _rm$5;
|
|
24
|
+
let _m0, _m1, _m5;
|
|
25
|
+
const _root = clone(_t$0);
|
|
26
|
+
queueRefAttach(__s, _m1 = (el) => {
|
|
27
|
+
if (!el) return;
|
|
28
|
+
applyEscapeProps(el, props);
|
|
29
|
+
props.bind?.({
|
|
30
|
+
focus: () => el.focus(),
|
|
31
|
+
blur: () => el.blur(),
|
|
32
|
+
native: el
|
|
33
|
+
});
|
|
34
|
+
}, _m0 = _root);
|
|
35
|
+
(__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.b, _b.a));
|
|
36
|
+
_m5 = bindSignalValue(__s, void 0, _root, props.value, "i:cd4865f9");
|
|
37
|
+
setEventHandler(_root, "$$input", (e) => props.onChange?.(e.target.value));
|
|
38
|
+
setEventHandler(_root, "$$keydown", (e) => {
|
|
39
|
+
if (e.key === "Enter" && !e.shiftKey) props.onSubmit?.();
|
|
40
|
+
});
|
|
41
|
+
setEventHandler(_root, "$$focusin", props.onFocus);
|
|
42
|
+
setEventHandler(_root, "$$focusout", props.onBlur);
|
|
43
|
+
_b = bag11(__s, _root, _m0, _m1, void 0, void 0, void 0, _m5, void 0, void 0, void 0, void 0, void 0);
|
|
44
|
+
__s.refFields = _rm$0;
|
|
60
45
|
} else {
|
|
61
46
|
{
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
47
|
+
const _r = (el) => {
|
|
48
|
+
if (!el) return;
|
|
49
|
+
applyEscapeProps(el, props);
|
|
50
|
+
props.bind?.({
|
|
51
|
+
focus: () => el.focus(),
|
|
52
|
+
blur: () => el.blur(),
|
|
53
|
+
native: el
|
|
54
|
+
});
|
|
70
55
|
};
|
|
71
|
-
if (_b.b
|
|
56
|
+
if (_r !== _b.b) _b.b = replaceRef(__s, _b.b, _r, _b.a);
|
|
72
57
|
}
|
|
73
|
-
_b.
|
|
74
|
-
_b.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
[
|
|
81
|
-
false,
|
|
82
|
-
"style",
|
|
83
|
-
_b.b
|
|
84
|
-
],
|
|
85
|
-
[true, _b.c]
|
|
86
|
-
], "b:4cb93a35", true);
|
|
87
|
-
setEventHandler(_b.f, "$$click", (event) => event.stopPropagation());
|
|
88
|
-
}
|
|
89
|
-
ifBlock(__s, 1, _b.d, props.shadeCover, __then$2, null, _b.g, __extra);
|
|
90
|
-
_b.j = bindSignalChild(__s, _b.j, 2, _b.f, props.children, "b:69179142", null, void 0, void 0, void 0, true);
|
|
91
|
-
}
|
|
92
|
-
function __then$0(__props, __s, __extra) {
|
|
93
|
-
const __block = __s.block;
|
|
94
|
-
const props = __extra[0];
|
|
95
|
-
let _b = __s.slots[0];
|
|
96
|
-
if (_b === void 0) {
|
|
97
|
-
let _m0, _m1;
|
|
98
|
-
const _root = clone(_t$2);
|
|
99
|
-
_m0 = __block.parentNode;
|
|
100
|
-
_m1 = child(_root);
|
|
101
|
-
drainFrag(_root, __block.parentNode, __block.endMarker);
|
|
102
|
-
_b = bag2(__s, null, _m0, _m1);
|
|
58
|
+
_b.f = bindSignalValue(__s, _b.f, _b.a, props.value, "i:cd4865f9");
|
|
59
|
+
setEventHandler(_b.a, "$$input", (e) => props.onChange?.(e.target.value));
|
|
60
|
+
setEventHandler(_b.a, "$$keydown", (e) => {
|
|
61
|
+
if (e.key === "Enter" && !e.shiftKey) props.onSubmit?.();
|
|
62
|
+
});
|
|
63
|
+
setEventHandler(_b.a, "$$focusin", props.onFocus);
|
|
64
|
+
setEventHandler(_b.a, "$$focusout", props.onBlur);
|
|
103
65
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var Overlay = function Overlay(props, __s, __extra) {
|
|
107
|
-
const __block = __s.block;
|
|
66
|
+
_b.c = bindSignalAttribute(__s, _b.c, _b.a, "id", props.id, "b:b371d08c", setPlainAttribute);
|
|
67
|
+
_b.d = bindSignalAttribute(__s, _b.d, _b.a, "class", props.className, "b:2afd54b5", "class");
|
|
108
68
|
{
|
|
109
|
-
const
|
|
110
|
-
|
|
69
|
+
const _v = {
|
|
70
|
+
...normStyle(props.style),
|
|
71
|
+
...props.placeholderTextColor ? { "--placeholder-color": props.placeholderTextColor } : {}
|
|
72
|
+
};
|
|
73
|
+
if (_b.e !== _v) {
|
|
74
|
+
setStyle(_b.a, _v, _b.e);
|
|
75
|
+
_b.e = _v;
|
|
76
|
+
}
|
|
111
77
|
}
|
|
112
|
-
|
|
78
|
+
_b.g = bindSignalAttribute(__s, _b.g, _b.a, "type", props.secure ? "password" : props.keyboardType === "number" || props.keyboardType === "decimal" ? "number" : keyboardType, "b:b9f25817", setPlainAttribute);
|
|
79
|
+
_b.h = bindSignalAttribute(__s, _b.h, _b.a, "inputMode", inputMode, "b:b382c01e", setPlainAttribute);
|
|
80
|
+
_b.i = bindSignalAttribute(__s, _b.i, _b.a, "enterKeyHint", props.returnKeyType, "b:b9b532c0", setPlainAttribute);
|
|
81
|
+
_b.j = setBooleanAttributeIfChanged(props.editable === false, _b.j, _b.a, "readonly");
|
|
82
|
+
_b.k = bindSignalAttribute(__s, _b.k, _b.a, "placeholder", props.placeholder ?? props.hint, "b:e9b4ae0b", setPlainAttribute);
|
|
83
|
+
});
|
|
113
84
|
//#endregion
|
|
114
|
-
export {
|
|
85
|
+
export { TextInput };
|
package/dist/web/ui21.js
CHANGED
|
@@ -1,82 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { applyEscapeProps } from "./ui2.js";
|
|
2
|
+
import { normStyle } from "./ui4.js";
|
|
3
|
+
import { __s, bag11, clone, delegateEvents, hookSlots, queueRefAttach, queueRefDetach, setAttribute, setEventHandler, setStyle, template, useLayoutEffect, useRef } from "octane";
|
|
4
|
+
import { bindSignalAttribute, bindSignalValue, enableSignalBindings, replaceRef, setBooleanAttributeIfChanged, setPlainAttribute, updateFreshClassName } from "octane/internal/client";
|
|
5
|
+
//#region src/TextArea.web.tsrx
|
|
6
|
+
enableSignalBindings(1, true);
|
|
7
|
+
delegateEvents([
|
|
8
|
+
"focusin",
|
|
9
|
+
"focusout",
|
|
10
|
+
"input",
|
|
11
|
+
"keydown"
|
|
12
|
+
]);
|
|
13
|
+
var _t$0 = /* @__PURE__ */ template("<textarea data-octane-input=\"i:bf482a0b\"></textarea>");
|
|
6
14
|
var _hs$ = /* @__PURE__ */ hookSlots(2);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
var _rm$0 = [
|
|
16
|
+
"r",
|
|
17
|
+
"b",
|
|
18
|
+
"a"
|
|
19
|
+
];
|
|
20
|
+
var TextArea = /* @__PURE__ */ __s(function TextArea(props, __s, __extra) {
|
|
21
|
+
const el = useRef(null, _hs$ + 0);
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
const t = el.current;
|
|
24
|
+
if (!t) return;
|
|
25
|
+
const cs = getComputedStyle(t);
|
|
26
|
+
const pad = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
|
|
27
|
+
const bord = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);
|
|
28
|
+
const adj = cs.boxSizing === "border-box" ? bord : -pad;
|
|
29
|
+
const line = parseFloat(cs.lineHeight) || parseFloat(cs.fontSize) * 1.2;
|
|
30
|
+
const cap = props.maxRows ? props.maxRows * line + (cs.boxSizing === "border-box" ? pad + bord : 0) : parseFloat(cs.maxHeight) || Infinity;
|
|
31
|
+
if (props.maxRows) t.style.maxHeight = Math.ceil(cap) + "px";
|
|
32
|
+
if (props.autoGrow) {
|
|
33
|
+
t.style.height = "auto";
|
|
34
|
+
const need = t.scrollHeight + adj;
|
|
35
|
+
t.style.height = Math.min(need, cap) + "px";
|
|
36
|
+
t.style.overflowY = need > cap ? "auto" : "hidden";
|
|
37
|
+
}
|
|
38
|
+
}, [
|
|
39
|
+
props.value,
|
|
40
|
+
props.rows,
|
|
41
|
+
props.autoGrow,
|
|
42
|
+
props.maxRows,
|
|
43
|
+
props.className,
|
|
44
|
+
props.style
|
|
45
|
+
], _hs$ + 1);
|
|
11
46
|
let _b = __s.slots[0];
|
|
12
47
|
if (_b === void 0) {
|
|
13
|
-
let _m0, _m1;
|
|
48
|
+
let _m0, _m1, _m5;
|
|
14
49
|
const _root = clone(_t$0);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
50
|
+
queueRefAttach(__s, _m1 = (node) => {
|
|
51
|
+
el.current = node;
|
|
52
|
+
if (!node) return;
|
|
53
|
+
applyEscapeProps(node, props);
|
|
54
|
+
props.bind?.({
|
|
55
|
+
focus: () => node.focus(),
|
|
56
|
+
blur: () => node.blur(),
|
|
57
|
+
native: node
|
|
58
|
+
});
|
|
59
|
+
}, _m0 = _root);
|
|
60
|
+
(__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.b, _b.a));
|
|
61
|
+
_m5 = bindSignalValue(__s, void 0, _root, props.value, "i:bf482a0b");
|
|
62
|
+
setEventHandler(_root, "$$input", (e) => props.onChange?.(e.target.value));
|
|
63
|
+
setEventHandler(_root, "$$keydown", (e) => {
|
|
64
|
+
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) props.onSubmit?.();
|
|
65
|
+
});
|
|
66
|
+
setEventHandler(_root, "$$focusin", props.onFocus);
|
|
67
|
+
setEventHandler(_root, "$$focusout", props.onBlur);
|
|
68
|
+
_b = bag11(__s, _root, _m0, _m1, void 0, void 0, void 0, _m5, void 0, void 0, void 0, void 0, void 0);
|
|
69
|
+
__s.refFields = _rm$0;
|
|
70
|
+
} else {
|
|
71
|
+
{
|
|
72
|
+
const _r = (node) => {
|
|
73
|
+
el.current = node;
|
|
74
|
+
if (!node) return;
|
|
75
|
+
applyEscapeProps(node, props);
|
|
76
|
+
props.bind?.({
|
|
77
|
+
focus: () => node.focus(),
|
|
78
|
+
blur: () => node.blur(),
|
|
79
|
+
native: node
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
if (_r !== _b.b) _b.b = replaceRef(__s, _b.b, _r, _b.a);
|
|
83
|
+
}
|
|
84
|
+
_b.f = bindSignalValue(__s, _b.f, _b.a, props.value, "i:bf482a0b");
|
|
85
|
+
setEventHandler(_b.a, "$$input", (e) => props.onChange?.(e.target.value));
|
|
86
|
+
setEventHandler(_b.a, "$$keydown", (e) => {
|
|
87
|
+
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) props.onSubmit?.();
|
|
88
|
+
});
|
|
89
|
+
setEventHandler(_b.a, "$$focusin", props.onFocus);
|
|
90
|
+
setEventHandler(_b.a, "$$focusout", props.onBlur);
|
|
19
91
|
}
|
|
92
|
+
_b.c = bindSignalAttribute(__s, _b.c, _b.a, "id", props.id, "b:601d47ca", setPlainAttribute);
|
|
93
|
+
_b.d = updateFreshClassName(["vx-textarea", props.className], _b.d, _b.a);
|
|
20
94
|
{
|
|
21
|
-
const _v =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...props.style,
|
|
25
|
-
position: "fixed",
|
|
26
|
-
top: position.top,
|
|
27
|
-
left: position.left,
|
|
28
|
-
transform: props.placement === "top" ? "translateY(-100%)" : props.placement === "left" ? "translateX(-100%)" : void 0
|
|
29
|
-
},
|
|
30
|
-
...props.web
|
|
31
|
-
}, () => props.children)), document.body);
|
|
32
|
-
_b.c = textHoleUpdate(__s, 1, _b.a, _v, _b.c, _b.d, _b.b, true, true);
|
|
33
|
-
_b.d = _v;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
var Popover = function Popover(props, __s, __extra) {
|
|
37
|
-
const __block = __s.block;
|
|
38
|
-
const [position, setPosition] = useState(null, _hs$ + 0);
|
|
39
|
-
const anchor = props.anchor?.current ?? props.anchor;
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (!props.open || !anchor?.getBoundingClientRect) {
|
|
42
|
-
setPosition(null);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const update = () => {
|
|
46
|
-
const rect = anchor.getBoundingClientRect();
|
|
47
|
-
const gap = 8;
|
|
48
|
-
let top = rect.bottom + gap;
|
|
49
|
-
let left = rect.left;
|
|
50
|
-
if (props.placement === "top") top = rect.top - gap;
|
|
51
|
-
if (props.placement === "left") {
|
|
52
|
-
top = rect.top;
|
|
53
|
-
left = rect.left - gap;
|
|
54
|
-
}
|
|
55
|
-
if (props.placement === "right") {
|
|
56
|
-
top = rect.top;
|
|
57
|
-
left = rect.right + gap;
|
|
58
|
-
}
|
|
59
|
-
setPosition({
|
|
60
|
-
top,
|
|
61
|
-
left
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
update();
|
|
65
|
-
window.addEventListener("resize", update);
|
|
66
|
-
window.addEventListener("scroll", update, true);
|
|
67
|
-
return () => {
|
|
68
|
-
window.removeEventListener("resize", update);
|
|
69
|
-
window.removeEventListener("scroll", update, true);
|
|
95
|
+
const _v = {
|
|
96
|
+
...normStyle(props.style),
|
|
97
|
+
...props.placeholderTextColor ? { "--placeholder-color": props.placeholderTextColor } : {}
|
|
70
98
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
], _hs$ + 1);
|
|
76
|
-
{
|
|
77
|
-
const __ifCondition = props.open && position;
|
|
78
|
-
ifBlock(__s, 0, __block.parentNode, __ifCondition, __then$0, null, __block.endMarker, __ifCondition ? [position, props] : void 0);
|
|
99
|
+
if (_b.e !== _v) {
|
|
100
|
+
setStyle(_b.a, _v, _b.e);
|
|
101
|
+
_b.e = _v;
|
|
102
|
+
}
|
|
79
103
|
}
|
|
80
|
-
|
|
104
|
+
_b.g = bindSignalAttribute(__s, _b.g, _b.a, "inputMode", props.keyboardType === "number" ? "numeric" : props.keyboardType === "phone" ? "tel" : props.keyboardType === "default" ? "text" : props.keyboardType, "b:ef3d0153", setPlainAttribute);
|
|
105
|
+
_b.h = bindSignalAttribute(__s, _b.h, _b.a, "enterKeyHint", props.returnKeyType, "b:c58c3b7f", setPlainAttribute);
|
|
106
|
+
_b.i = setBooleanAttributeIfChanged(props.editable === false, _b.i, _b.a, "readonly");
|
|
107
|
+
_b.j = bindSignalAttribute(__s, _b.j, _b.a, "placeholder", props.placeholder ?? props.hint, "b:49264ef3", setPlainAttribute);
|
|
108
|
+
_b.k = bindSignalAttribute(__s, _b.k, _b.a, "rows", props.rows ?? (props.autoGrow ? 1 : 3), "b:3f250714", setAttribute);
|
|
109
|
+
});
|
|
81
110
|
//#endregion
|
|
82
|
-
export {
|
|
111
|
+
export { TextArea };
|
package/dist/web/ui22.js
CHANGED
|
@@ -1,68 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _t$0 = /* @__PURE__ */ template("
|
|
6
|
-
|
|
1
|
+
import { __s, bag4, bag6, child, clone, drainFrag, forBlock, hookSlots, queueRefAttach, queueRefDetach, setStyle, template, useLayoutEffect, useRef } from "octane";
|
|
2
|
+
import { bindSignalAttribute, bindSignalChild, enableSignalBindings, replaceRef, setPlainAttribute, updateFreshClassName } from "octane/internal/client";
|
|
3
|
+
//#region src/List.web.tsrx
|
|
4
|
+
enableSignalBindings(1, true);
|
|
5
|
+
var _t$0 = /* @__PURE__ */ template("<!>", 0, 1);
|
|
6
|
+
var _t$1 = /* @__PURE__ */ template("<div><!></div>");
|
|
7
|
+
var _hs$ = /* @__PURE__ */ hookSlots(3);
|
|
8
|
+
function __empty$1(__props, __s, __extra) {
|
|
9
|
+
const __block = __s.block;
|
|
7
10
|
const props = __extra[0];
|
|
8
11
|
let _b = __s.slots[0];
|
|
9
12
|
if (_b === void 0) {
|
|
10
|
-
let _m0;
|
|
13
|
+
let _m0, _m1;
|
|
11
14
|
const _root = clone(_t$0);
|
|
12
|
-
_m0 =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const _v = props.content;
|
|
17
|
-
_b.b = childTextHoleUpdate(__s, 1, _b.a, _v, _b.b, _b.c);
|
|
18
|
-
_b.c = _v;
|
|
15
|
+
_m0 = __block.parentNode;
|
|
16
|
+
_m1 = child(_root);
|
|
17
|
+
drainFrag(_root, __block.parentNode, __block.endMarker);
|
|
18
|
+
_b = bag4(__s, null, _m0, _m1, null, void 0);
|
|
19
19
|
}
|
|
20
|
+
_b.e = bindSignalChild(__s, _b.e, 1, _b.a, props.renderEmpty?.(), "b:0fabf1d6", _b.b, true, void 0, true, void 0);
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
22
|
+
function __item$3(item, __s, __extra) {
|
|
23
|
+
const __block = __s.block;
|
|
24
|
+
const props = __extra[0];
|
|
25
|
+
const i = __block.itemIndex;
|
|
23
26
|
let _b = __s.slots[0];
|
|
24
27
|
if (_b === void 0) {
|
|
25
|
-
let _m0;
|
|
28
|
+
let _m0, _m1;
|
|
26
29
|
const _root = clone(_t$0);
|
|
27
|
-
_m0 =
|
|
28
|
-
|
|
30
|
+
_m0 = __block.parentNode;
|
|
31
|
+
_m1 = child(_root);
|
|
32
|
+
drainFrag(_root, __block.parentNode, __block.endMarker);
|
|
33
|
+
_b = bag4(__s, null, _m0, _m1, null, void 0);
|
|
29
34
|
}
|
|
30
|
-
|
|
35
|
+
_b.e = bindSignalChild(__s, _b.e, 1, _b.a, props.renderItem(item, i), "b:0d1e153e", _b.b, true, void 0, true, void 0);
|
|
31
36
|
}
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
var _rm$6 = [
|
|
38
|
+
"r",
|
|
39
|
+
"c",
|
|
40
|
+
"b"
|
|
41
|
+
];
|
|
42
|
+
var List = /* @__PURE__ */ __s(function List(props, __s, __extra) {
|
|
43
|
+
const el = useRef(null, _hs$ + 0);
|
|
44
|
+
const reachedEnd = useRef(false, _hs$ + 1);
|
|
45
|
+
useLayoutEffect(() => {
|
|
46
|
+
const node = el.current;
|
|
47
|
+
if (!node) return;
|
|
48
|
+
for (const [name, value] of Object.entries(props.web ?? {})) if (name.includes("-")) {
|
|
49
|
+
if (value == null) node.removeAttribute(name);
|
|
50
|
+
else node.setAttribute(name, String(value));
|
|
51
|
+
} else node[name] = value;
|
|
52
|
+
let frame = 0;
|
|
53
|
+
const checkEnd = () => {
|
|
54
|
+
frame = 0;
|
|
55
|
+
if (node.scrollHeight - node.scrollTop - node.clientHeight > node.clientHeight) reachedEnd.current = false;
|
|
56
|
+
else if (!reachedEnd.current) {
|
|
57
|
+
reachedEnd.current = true;
|
|
58
|
+
props.onEndReached?.();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const onScroll = () => {
|
|
62
|
+
if (!frame) frame = requestAnimationFrame(checkEnd);
|
|
63
|
+
};
|
|
64
|
+
node.addEventListener("scroll", onScroll, { passive: true });
|
|
65
|
+
checkEnd();
|
|
66
|
+
return () => {
|
|
67
|
+
node.removeEventListener("scroll", onScroll);
|
|
68
|
+
if (frame) cancelAnimationFrame(frame);
|
|
69
|
+
};
|
|
70
|
+
}, [
|
|
71
|
+
props.onEndReached,
|
|
72
|
+
props.web,
|
|
73
|
+
props.items
|
|
74
|
+
], _hs$ + 2);
|
|
75
|
+
let _b = __s.slots[0];
|
|
76
|
+
if (_b === void 0) {
|
|
77
|
+
let _m1, _m2, _m5;
|
|
78
|
+
const _root = clone(_t$1);
|
|
79
|
+
_m1 = _root;
|
|
80
|
+
queueRefAttach(__s, _m2 = el, _m1);
|
|
81
|
+
(__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.c, _b.b));
|
|
82
|
+
_m5 = child(_root);
|
|
83
|
+
_b = bag6(__s, _root, void 0, _m1, _m2, void 0, void 0, _m5);
|
|
84
|
+
__s.refFields = _rm$6;
|
|
85
|
+
} else {
|
|
86
|
+
const _r = el;
|
|
87
|
+
if (_r !== _b.c) _b.c = replaceRef(__s, _b.c, _r, _b.b);
|
|
88
|
+
}
|
|
89
|
+
_b.a = bindSignalAttribute(__s, _b.a, _b.b, "id", props.id, "b:7d4c5670", setPlainAttribute);
|
|
90
|
+
_b.d = updateFreshClassName(["vx-list", props.className], _b.d, _b.b);
|
|
91
|
+
{
|
|
92
|
+
const _v = Object.assign({
|
|
93
|
+
display: "flex",
|
|
94
|
+
flexDirection: "column",
|
|
95
|
+
flexWrap: "nowrap",
|
|
96
|
+
alignItems: "stretch",
|
|
97
|
+
overflowY: "auto",
|
|
98
|
+
minHeight: 0
|
|
99
|
+
}, props.style);
|
|
100
|
+
if (_b.e !== _v) {
|
|
101
|
+
setStyle(_b.b, _v, _b.e);
|
|
102
|
+
_b.e = _v;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
forBlock(__s, 1, _b.b, props.items, (item, i) => props.keyFor?.(item) ?? item.id, __item$3, 32, [props], __empty$1, _b.f, true, "f3hh71u");
|
|
37
106
|
});
|
|
38
|
-
function applyWebProps(host, props) {
|
|
39
|
-
if (!props) return;
|
|
40
|
-
for (const [key, value] of Object.entries(props)) if (key.includes("-")) host.setAttribute(key, String(value));
|
|
41
|
-
else host[key] = value;
|
|
42
|
-
}
|
|
43
|
-
function showNext() {
|
|
44
|
-
if (active || queue.length === 0) return;
|
|
45
|
-
active = true;
|
|
46
|
-
const entry = queue.shift();
|
|
47
|
-
const host = document.createElement("div");
|
|
48
|
-
host.className = cx("vx-toast-host", entry.options.position === "top" ? "vx-toast-top" : "vx-toast-bottom");
|
|
49
|
-
applyWebProps(host, entry.options.web);
|
|
50
|
-
document.body.appendChild(host);
|
|
51
|
-
const root = createRoot(host);
|
|
52
|
-
root.render(ToastBody, { content: entry.content });
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
root.unmount();
|
|
55
|
-
host.remove();
|
|
56
|
-
active = false;
|
|
57
|
-
showNext();
|
|
58
|
-
}, Math.max(0, entry.options.duration ?? 3e3));
|
|
59
|
-
}
|
|
60
|
-
function showToast(content, options = {}) {
|
|
61
|
-
queue.push({
|
|
62
|
-
content,
|
|
63
|
-
options
|
|
64
|
-
});
|
|
65
|
-
showNext();
|
|
66
|
-
}
|
|
67
107
|
//#endregion
|
|
68
|
-
export {
|
|
108
|
+
export { List };
|