@xaui/native 0.9.1-alpha.2 → 0.9.1-alpha.21
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-4NE3SLTM.cjs +695 -0
- package/dist/{chunk-M7P46XKI.cjs → chunk-57SJ4LJF.cjs} +33 -3
- package/dist/chunk-5LC6KVL3.cjs +68 -0
- package/dist/{chunk-RBNCR5KB.js → chunk-A3EGFI6T.js} +31 -1
- package/dist/chunk-APCBIHLR.cjs +507 -0
- package/dist/chunk-BPBY7ON7.cjs +451 -0
- package/dist/chunk-EVXZGNPA.cjs +303 -0
- package/dist/chunk-EXX6ATAS.js +303 -0
- package/dist/chunk-GGW42MY4.js +20 -0
- package/dist/chunk-IBRVMLUF.js +668 -0
- package/dist/chunk-ISVUXVFL.js +471 -0
- package/dist/chunk-JL27KVRT.js +68 -0
- package/dist/chunk-JXLRHKCQ.js +143 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/{chunk-RCP3SD26.js → chunk-N7C4UNUL.js} +2 -126
- package/dist/chunk-RMLFMRWL.js +102 -0
- package/dist/chunk-RRRGLRRP.cjs +28 -0
- package/dist/chunk-SGHP76GU.js +28 -0
- package/dist/{chunk-PBVPOX7D.js → chunk-TUJBDS5M.js} +30 -63
- package/dist/chunk-UBA6AEY6.cjs +102 -0
- package/dist/{chunk-NHPQQQ7P.cjs → chunk-UL263KGM.cjs} +56 -89
- package/dist/{chunk-B755PRVJ.cjs → chunk-UVO4GFSW.cjs} +3 -127
- package/dist/chunk-XHZBXYVU.js +62 -0
- package/dist/chunk-YRCUALUQ.js +451 -0
- package/dist/components/button/index.cjs +17 -0
- package/dist/components/button/index.d.cts +659 -0
- package/dist/components/button/index.d.ts +659 -0
- package/dist/components/button/index.js +17 -0
- package/dist/components/card/index.cjs +20 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +20 -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-CC3NNCqF.d.ts +94 -0
- package/dist/create-recipe-CPBFg7ym.d.cts +94 -0
- package/dist/icon.type-BkcEPJbK.d.ts +73 -0
- package/dist/icon.type-Cs1tMX0W.d.cts +73 -0
- package/dist/index.cjs +167 -5
- package/dist/index.d.cts +79 -4
- package/dist/index.d.ts +79 -4
- package/dist/index.js +171 -9
- package/dist/pressable-feedback.type-DsvWZXWC.d.ts +127 -0
- package/dist/pressable-feedback.type-wfeiJz5m.d.cts +127 -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 +66 -3
- package/dist/system/index.d.cts +301 -75
- package/dist/system/index.d.ts +301 -75
- package/dist/system/index.js +68 -5
- package/dist/theme/index.cjs +4 -3
- package/dist/theme/index.d.cts +27 -15
- package/dist/theme/index.d.ts +27 -15
- 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 +74 -18
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkEVXZGNPAcjs = require('./chunk-EVXZGNPA.cjs');
|
|
4
|
+
|
|
5
|
+
// src/system/portal/portal.tsx
|
|
6
|
+
var _react = require('react');
|
|
7
|
+
|
|
8
|
+
// src/system/portal/portal-context.ts
|
|
9
|
+
|
|
10
|
+
var PortalContext = _react.createContext.call(void 0, null);
|
|
11
|
+
|
|
12
|
+
// src/system/portal/portal.tsx
|
|
13
|
+
function Portal({ children }) {
|
|
14
|
+
const context = _react.useContext.call(void 0, PortalContext);
|
|
15
|
+
const key = _react.useId.call(void 0, );
|
|
16
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
17
|
+
_optionalChain([context, 'optionalAccess', _ => _.addPortal, 'call', _2 => _2(key, children)]);
|
|
18
|
+
}, [children, context, key]);
|
|
19
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
20
|
+
return () => _optionalChain([context, 'optionalAccess', _3 => _3.removePortal, 'call', _4 => _4(key)]);
|
|
21
|
+
}, [context, key]);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
Portal.displayName = "XAUI.Portal";
|
|
25
|
+
|
|
26
|
+
// src/system/portal/portal-host.tsx
|
|
27
|
+
|
|
28
|
+
var _reactnative = require('react-native');
|
|
29
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
30
|
+
var styles = _reactnative.StyleSheet.create({
|
|
31
|
+
container: { flex: 1 }
|
|
32
|
+
});
|
|
33
|
+
function PortalHost({ children, ...props }) {
|
|
34
|
+
const [styleProps] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
|
|
35
|
+
const [portals, setPortals] = _react.useState.call(void 0, /* @__PURE__ */ new Map());
|
|
36
|
+
const addPortal = _react.useCallback.call(void 0, (key, element) => {
|
|
37
|
+
setPortals((current) => new Map(current).set(key, element));
|
|
38
|
+
}, []);
|
|
39
|
+
const removePortal = _react.useCallback.call(void 0, (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 = _react.useMemo.call(void 0,
|
|
48
|
+
() => ({ addPortal, removePortal }),
|
|
49
|
+
[addPortal, removePortal]
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PortalContext.Provider, { value: methods, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles.container, styleProps], children: [
|
|
52
|
+
children,
|
|
53
|
+
Array.from(portals, ([key, element]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Fragment, { children: element }, key))
|
|
54
|
+
] }) });
|
|
55
|
+
}
|
|
56
|
+
PortalHost.displayName = "XAUI.PortalHost";
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
exports.PortalContext = PortalContext; exports.Portal = Portal; exports.PortalHost = PortalHost;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkEVXZGNPAcjs = require('./chunk-EVXZGNPA.cjs');
|
|
5
|
+
|
|
6
|
+
// src/components/view/grid.tsx
|
|
7
|
+
var _react = require('react');
|
|
8
|
+
var _reactnative = require('react-native');
|
|
9
|
+
|
|
10
|
+
// src/components/view/grid.context.ts
|
|
11
|
+
|
|
12
|
+
var GridContext = _react.createContext.call(void 0, null);
|
|
13
|
+
var GridProvider = GridContext.Provider;
|
|
14
|
+
function useGrid() {
|
|
15
|
+
const value = _react.useContext.call(void 0, GridContext);
|
|
16
|
+
if (value === null) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"XAUI: Grid.Item must be rendered inside a Grid \u2014 it spans that grid\u2019s columns, and outside one there is nothing to span."
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function spanWidth({ cellWidth, columns, gap }, span) {
|
|
24
|
+
const clamped = Math.min(Math.max(Math.floor(span), 1), columns);
|
|
25
|
+
if (cellWidth === void 0) return `${100 / columns * clamped}%`;
|
|
26
|
+
return cellWidth * clamped + gap * (clamped - 1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/components/view/grid.tsx
|
|
30
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
31
|
+
var GridRoot = _react.forwardRef.call(void 0, function Grid({ children, columns = 2, gap = 0, style, onLayout, ...props }, ref) {
|
|
32
|
+
const [width, setWidth] = _react.useState.call(void 0, );
|
|
33
|
+
const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
|
|
34
|
+
const safeColumns = Math.max(Math.floor(columns), 1);
|
|
35
|
+
const cellWidth = width === void 0 ? void 0 : (width - gap * (safeColumns - 1)) / safeColumns;
|
|
36
|
+
const context = _react.useMemo.call(void 0,
|
|
37
|
+
() => ({ cellWidth, columns: safeColumns, gap }),
|
|
38
|
+
[cellWidth, safeColumns, gap]
|
|
39
|
+
);
|
|
40
|
+
const handleLayout = (event) => {
|
|
41
|
+
const next = event.nativeEvent.layout.width;
|
|
42
|
+
if (next > 0 && next !== width) setWidth(next);
|
|
43
|
+
_optionalChain([onLayout, 'optionalCall', _ => _(event)]);
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GridProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
46
|
+
_reactnative.View,
|
|
47
|
+
{
|
|
48
|
+
ref,
|
|
49
|
+
onLayout: handleLayout,
|
|
50
|
+
style: [
|
|
51
|
+
{ flexDirection: "row", flexWrap: "wrap", rowGap: gap, columnGap: gap },
|
|
52
|
+
styleProps,
|
|
53
|
+
style
|
|
54
|
+
],
|
|
55
|
+
...rest,
|
|
56
|
+
children: _react.Children.map(
|
|
57
|
+
children,
|
|
58
|
+
(child) => isGridItem(child) ? child : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: { width: spanWidth(context, 1) }, children: child })
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
) });
|
|
62
|
+
});
|
|
63
|
+
GridRoot.displayName = "XAUI.Grid";
|
|
64
|
+
function isGridItem(child) {
|
|
65
|
+
if (child === null || typeof child !== "object") return false;
|
|
66
|
+
const type = child.type;
|
|
67
|
+
return _optionalChain([type, 'optionalAccess', _2 => _2.displayName]) === "XAUI.Grid.Item";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/components/view/grid-item.tsx
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var GridItem = _react.forwardRef.call(void 0, function GridItem2({ children, span = 1, style, ...props }, ref) {
|
|
75
|
+
const grid = useGrid();
|
|
76
|
+
const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
|
|
77
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
78
|
+
_reactnative.View,
|
|
79
|
+
{
|
|
80
|
+
ref,
|
|
81
|
+
style: [{ width: spanWidth(grid, span) }, styleProps, style],
|
|
82
|
+
...rest,
|
|
83
|
+
children
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
GridItem.displayName = "XAUI.Grid.Item";
|
|
88
|
+
|
|
89
|
+
// src/components/view/stack.tsx
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
var StackRoot = _react.forwardRef.call(void 0, function Stack({ children, asChild = false, style, ...props }, ref) {
|
|
94
|
+
const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
|
|
95
|
+
const Root = asChild ? _chunkEVXZGNPAcjs.Slot : _reactnative.View;
|
|
96
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ position: "relative" }, styleProps, style], ...rest, children });
|
|
97
|
+
});
|
|
98
|
+
StackRoot.displayName = "XAUI.Stack";
|
|
99
|
+
|
|
100
|
+
// src/components/view/stack-item.tsx
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
var StackItem = _react.forwardRef.call(void 0, function StackItem2({ children, asChild = false, style, ...props }, ref) {
|
|
105
|
+
const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
|
|
106
|
+
const Root = asChild ? _chunkEVXZGNPAcjs.Slot : _reactnative.View;
|
|
107
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ position: "absolute" }, styleProps, style], ...rest, children });
|
|
108
|
+
});
|
|
109
|
+
StackItem.displayName = "XAUI.Stack.Item";
|
|
110
|
+
|
|
111
|
+
// src/components/view/row.tsx
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
var Row = _react.forwardRef.call(void 0, function Row2({ children, asChild = false, style, ...props }, ref) {
|
|
116
|
+
const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
|
|
117
|
+
const Root = asChild ? _chunkEVXZGNPAcjs.Slot : _reactnative.View;
|
|
118
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ flexDirection: "row" }, styleProps, style], ...rest, children });
|
|
119
|
+
});
|
|
120
|
+
Row.displayName = "XAUI.Row";
|
|
121
|
+
|
|
122
|
+
// src/components/view/column.tsx
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
var Column = _react.forwardRef.call(void 0, function Column2({ children, asChild = false, style, ...props }, ref) {
|
|
127
|
+
const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
|
|
128
|
+
const Root = asChild ? _chunkEVXZGNPAcjs.Slot : _reactnative.View;
|
|
129
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ flexDirection: "column" }, styleProps, style], ...rest, children });
|
|
130
|
+
});
|
|
131
|
+
Column.displayName = "XAUI.Column";
|
|
132
|
+
|
|
133
|
+
// src/components/view/index.ts
|
|
134
|
+
var Stack2 = Object.assign(StackRoot, { Item: StackItem });
|
|
135
|
+
var Grid2 = Object.assign(GridRoot, { Item: GridItem });
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
exports.useGrid = useGrid; exports.Row = Row; exports.Column = Column; exports.Stack = Stack2; exports.Grid = Grid2;
|