@xaui/native 0.9.1-alpha.2 → 0.9.1-alpha.20
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/dist/chunk-2WMVDMFV.cjs +62 -0
- package/dist/chunk-33QILJJH.cjs +143 -0
- package/dist/chunk-4EPS7UBO.js +496 -0
- package/dist/{chunk-M7P46XKI.cjs → chunk-57SJ4LJF.cjs} +33 -3
- package/dist/chunk-6ARON3XT.cjs +534 -0
- package/dist/{chunk-RBNCR5KB.js → chunk-A3EGFI6T.js} +31 -1
- package/dist/chunk-A4VD4MHK.cjs +757 -0
- package/dist/{chunk-NHPQQQ7P.cjs → chunk-BHTFIZTQ.cjs} +55 -88
- package/dist/chunk-EVXZGNPA.cjs +303 -0
- package/dist/chunk-EXX6ATAS.js +303 -0
- package/dist/chunk-GGW42MY4.js +20 -0
- package/dist/chunk-JXLRHKCQ.js +143 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/{chunk-PBVPOX7D.js → chunk-MWXE7D4L.js} +29 -62
- package/dist/{chunk-RCP3SD26.js → chunk-N7C4UNUL.js} +2 -126
- package/dist/chunk-RMLFMRWL.js +102 -0
- package/dist/chunk-UBA6AEY6.cjs +102 -0
- package/dist/{chunk-B755PRVJ.cjs → chunk-UVO4GFSW.cjs} +3 -127
- package/dist/chunk-WXAME7KB.js +728 -0
- package/dist/chunk-XHZBXYVU.js +62 -0
- package/dist/components/button/index.cjs +15 -0
- package/dist/components/button/index.d.cts +658 -0
- package/dist/components/button/index.d.ts +658 -0
- package/dist/components/button/index.js +15 -0
- package/dist/components/typography/index.cjs +14 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +14 -0
- package/dist/components/view/index.cjs +16 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +16 -0
- package/dist/create-recipe-C0XXjuow.d.cts +89 -0
- package/dist/create-recipe-CPXFo2rk.d.ts +89 -0
- package/dist/index.cjs +151 -5
- package/dist/index.d.cts +77 -4
- package/dist/index.d.ts +77 -4
- package/dist/index.js +155 -9
- package/dist/pressable-feedback.type-1K8YEOb8.d.cts +195 -0
- package/dist/pressable-feedback.type-BwkKLQlX.d.ts +195 -0
- package/dist/style-props.type-B1BG5TCm.d.cts +31 -0
- package/dist/style-props.type-B1BG5TCm.d.ts +31 -0
- package/dist/system/index.cjs +64 -3
- package/dist/system/index.d.cts +299 -75
- package/dist/system/index.d.ts +299 -75
- package/dist/system/index.js +66 -5
- package/dist/theme/index.cjs +4 -3
- package/dist/theme/index.d.cts +26 -14
- package/dist/theme/index.d.ts +26 -14
- package/dist/theme/index.js +7 -6
- package/dist/{theme.type-B3ODSLbB.d.cts → theme.type-C2gNHpEx.d.cts} +8 -2
- package/dist/{theme.type-B3ODSLbB.d.ts → theme.type-C2gNHpEx.d.ts} +8 -2
- package/package.json +64 -18
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useStyleProps
|
|
3
|
+
} from "./chunk-EXX6ATAS.js";
|
|
4
|
+
|
|
5
|
+
// src/system/portal/portal.tsx
|
|
6
|
+
import { useContext, useId, useLayoutEffect } from "react";
|
|
7
|
+
|
|
8
|
+
// src/system/portal/portal-context.ts
|
|
9
|
+
import { createContext } from "react";
|
|
10
|
+
var PortalContext = createContext(null);
|
|
11
|
+
|
|
12
|
+
// src/system/portal/portal.tsx
|
|
13
|
+
function Portal({ children }) {
|
|
14
|
+
const context = useContext(PortalContext);
|
|
15
|
+
const key = useId();
|
|
16
|
+
useLayoutEffect(() => {
|
|
17
|
+
context?.addPortal(key, children);
|
|
18
|
+
}, [children, context, key]);
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
return () => context?.removePortal(key);
|
|
21
|
+
}, [context, key]);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
Portal.displayName = "XAUI.Portal";
|
|
25
|
+
|
|
26
|
+
// src/system/portal/portal-host.tsx
|
|
27
|
+
import { Fragment, useCallback, useMemo, useState } from "react";
|
|
28
|
+
import { StyleSheet, View } from "react-native";
|
|
29
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
|
+
var styles = StyleSheet.create({
|
|
31
|
+
container: { flex: 1 }
|
|
32
|
+
});
|
|
33
|
+
function PortalHost({ children, ...props }) {
|
|
34
|
+
const [styleProps] = useStyleProps(props);
|
|
35
|
+
const [portals, setPortals] = useState(/* @__PURE__ */ new Map());
|
|
36
|
+
const addPortal = useCallback((key, element) => {
|
|
37
|
+
setPortals((current) => new Map(current).set(key, element));
|
|
38
|
+
}, []);
|
|
39
|
+
const removePortal = useCallback((key) => {
|
|
40
|
+
setPortals((current) => {
|
|
41
|
+
if (!current.has(key)) return current;
|
|
42
|
+
const next = new Map(current);
|
|
43
|
+
next.delete(key);
|
|
44
|
+
return next;
|
|
45
|
+
});
|
|
46
|
+
}, []);
|
|
47
|
+
const methods = useMemo(
|
|
48
|
+
() => ({ addPortal, removePortal }),
|
|
49
|
+
[addPortal, removePortal]
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ jsx(PortalContext.Provider, { value: methods, children: /* @__PURE__ */ jsxs(View, { style: [styles.container, styleProps], children: [
|
|
52
|
+
children,
|
|
53
|
+
Array.from(portals, ([key, element]) => /* @__PURE__ */ jsx(Fragment, { children: element }, key))
|
|
54
|
+
] }) });
|
|
55
|
+
}
|
|
56
|
+
PortalHost.displayName = "XAUI.PortalHost";
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
PortalContext,
|
|
60
|
+
Portal,
|
|
61
|
+
PortalHost
|
|
62
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunk6ARON3XTcjs = require('../../chunk-6ARON3XT.cjs');
|
|
6
|
+
require('../../chunk-A4VD4MHK.cjs');
|
|
7
|
+
require('../../chunk-UVO4GFSW.cjs');
|
|
8
|
+
require('../../chunk-EVXZGNPA.cjs');
|
|
9
|
+
require('../../chunk-57SJ4LJF.cjs');
|
|
10
|
+
require('../../chunk-MC7SY2QH.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.Button = _chunk6ARON3XTcjs.Button; exports.buttonRecipe = _chunk6ARON3XTcjs.buttonRecipe; exports.useButton = _chunk6ARON3XTcjs.useButton;
|