@tamagui/menu 1.79.10 → 1.79.12
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/cjs/createNativeMenu/createNativeMenu.android.js +263 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.android.js.map +6 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.ios.js +336 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.ios.js.map +6 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.js +46 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.js.map +6 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.native.js +47 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.native.js.map +6 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.js +14 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.js.map +6 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.native.js +15 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.native.js.map +6 -0
- package/dist/cjs/createNativeMenu/index.js +21 -0
- package/dist/cjs/createNativeMenu/index.js.map +6 -0
- package/dist/cjs/createNativeMenu/index.native.js +22 -0
- package/dist/cjs/createNativeMenu/index.native.js.map +6 -0
- package/dist/cjs/createNativeMenu/utils.js +78 -0
- package/dist/cjs/createNativeMenu/utils.js.map +6 -0
- package/dist/cjs/createNativeMenu/utils.native.js +79 -0
- package/dist/cjs/createNativeMenu/utils.native.js.map +6 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.js +40 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.js.map +6 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.native.js +41 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.native.js.map +6 -0
- package/dist/esm/createNativeMenu/createNativeMenu.android.js +251 -0
- package/dist/esm/createNativeMenu/createNativeMenu.android.js.map +6 -0
- package/dist/esm/createNativeMenu/createNativeMenu.ios.js +323 -0
- package/dist/esm/createNativeMenu/createNativeMenu.ios.js.map +6 -0
- package/dist/esm/createNativeMenu/createNativeMenu.js +26 -0
- package/dist/esm/createNativeMenu/createNativeMenu.js.map +6 -0
- package/dist/esm/createNativeMenu/createNativeMenu.native.js +26 -0
- package/dist/esm/createNativeMenu/createNativeMenu.native.js.map +6 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.js +1 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.js.map +6 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.native.js +1 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.native.js.map +6 -0
- package/dist/esm/createNativeMenu/index.js +3 -0
- package/dist/esm/createNativeMenu/index.js.map +6 -0
- package/dist/esm/createNativeMenu/index.native.js +3 -0
- package/dist/esm/createNativeMenu/index.native.js.map +6 -0
- package/dist/esm/createNativeMenu/utils.js +47 -0
- package/dist/esm/createNativeMenu/utils.js.map +6 -0
- package/dist/esm/createNativeMenu/utils.native.js +47 -0
- package/dist/esm/createNativeMenu/utils.native.js.map +6 -0
- package/dist/esm/createNativeMenu/withNativeMenu.js +21 -0
- package/dist/esm/createNativeMenu/withNativeMenu.js.map +6 -0
- package/dist/esm/createNativeMenu/withNativeMenu.native.js +21 -0
- package/dist/esm/createNativeMenu/withNativeMenu.native.js.map +6 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.android.js +245 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.android.js.map +6 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.ios.js +322 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.ios.js.map +6 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.js +26 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.js.map +6 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.native.js +26 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.native.js.map +6 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.js +1 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.js.map +6 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.native.js +1 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.native.js.map +6 -0
- package/dist/jsx/createNativeMenu/index.js +3 -0
- package/dist/jsx/createNativeMenu/index.js.map +6 -0
- package/dist/jsx/createNativeMenu/index.native.js +3 -0
- package/dist/jsx/createNativeMenu/index.native.js.map +6 -0
- package/dist/jsx/createNativeMenu/utils.js +46 -0
- package/dist/jsx/createNativeMenu/utils.js.map +6 -0
- package/dist/jsx/createNativeMenu/utils.native.js +49 -0
- package/dist/jsx/createNativeMenu/utils.native.js.map +6 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.js +20 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.js.map +6 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.native.js +20 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.native.js.map +6 -0
- package/package.json +4 -4
- package/types/createNativeMenu/createNativeMenu.android.d.ts.map +1 -0
- package/types/createNativeMenu/createNativeMenu.d.ts.map +1 -0
- package/types/createNativeMenu/createNativeMenu.ios.d.ts.map +1 -0
- package/types/createNativeMenu/createNativeMenuTypes.d.ts.map +1 -0
- package/types/createNativeMenu/index.d.ts.map +1 -0
- package/types/createNativeMenu/utils.d.ts.map +1 -0
- package/types/createNativeMenu/withNativeMenu.d.ts.map +1 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { MenuView } from "@react-native-menu/menu";
|
|
2
|
+
import { withStaticProperties } from "@tamagui/core";
|
|
3
|
+
import { Children, cloneElement } from "react";
|
|
4
|
+
import { View } from "tamagui";
|
|
5
|
+
import { NativePropProvider } from "../Menu";
|
|
6
|
+
import {
|
|
7
|
+
create,
|
|
8
|
+
filterNull,
|
|
9
|
+
flattenChildren,
|
|
10
|
+
isInstanceOfComponent,
|
|
11
|
+
pickChildren
|
|
12
|
+
} from "./utils";
|
|
13
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
14
|
+
const COMPONENTS_TO_IGNORE = ["Portal", "Radio"], createAndroidMenu = (MenuType) => {
|
|
15
|
+
const Trigger = create(({ children, asChild, ...rest }) => asChild ? cloneElement(children, {
|
|
16
|
+
...rest
|
|
17
|
+
}) : /* @__PURE__ */ jsx(View, { ...rest, children }), `${MenuType}Trigger`), Auxiliary = create(
|
|
18
|
+
({ children }) => null,
|
|
19
|
+
`${MenuType}Auxiliary`
|
|
20
|
+
), Group = create(({ children }) => /* @__PURE__ */ jsx(Fragment, { children }), `${MenuType}Group`), Content = create(({ children }) => (children || console.error(`Menu <Content /> children must be written directly inline.
|
|
21
|
+
|
|
22
|
+
You cannot wrap this component into its own component. It should look like this:
|
|
23
|
+
|
|
24
|
+
<Menu>
|
|
25
|
+
<Content>
|
|
26
|
+
<Item />
|
|
27
|
+
<Item />
|
|
28
|
+
</Content>
|
|
29
|
+
</Menu>
|
|
30
|
+
|
|
31
|
+
Notice that the <Item /> are all children of the <Content /> component. That's important.
|
|
32
|
+
|
|
33
|
+
If you want to use a custom component as your <Content />, you can use the create() method. But you still need to pass all items as children of <Content />.`), /* @__PURE__ */ jsx(Fragment, { children })), `${MenuType}Content`), ItemTitle = create(({ children }) => {
|
|
34
|
+
if (typeof children != "string")
|
|
35
|
+
throw new Error("Menu <ItemTitle /> child must be a string");
|
|
36
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
37
|
+
}, `${MenuType}ItemTitle`), ItemIcon = create((props) => (props.androidIconName || console.warn(
|
|
38
|
+
"Menu <ItemIcon /> missing androidIconName prop. Will do nothing on android. Consider passing an androidIconName or switching to <ItemImage />."
|
|
39
|
+
), /* @__PURE__ */ jsx(Fragment, {})), `${MenuType}ItemIcon`), ItemImage = create((props) => (props.androidIconName || console.warn(
|
|
40
|
+
"Menu <ItemImage /> will not use your custom image on android. You should use the androidIconName prop to render an icon on android too."
|
|
41
|
+
), /* @__PURE__ */ jsx(Fragment, {})), `${MenuType}ItemImage`), ItemSubtitle = create(({ children }) => {
|
|
42
|
+
if (children && typeof children != "string")
|
|
43
|
+
throw new Error("Menu <ItemSubtitle /> child must be a string");
|
|
44
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
45
|
+
}, `${MenuType}ItemSubtitle`), Item = create(({ children }) => {
|
|
46
|
+
const titleChild = pickChildren(children, ItemTitle).targetChildren;
|
|
47
|
+
return typeof children != "string" && !titleChild?.length && console.error(
|
|
48
|
+
`Menu Invalid <Item />. It either needs <ItemTitle /> in the children.
|
|
49
|
+
|
|
50
|
+
<Item>
|
|
51
|
+
<ItemTitle>
|
|
52
|
+
Title here
|
|
53
|
+
</ItemTitle>
|
|
54
|
+
</Item>
|
|
55
|
+
`
|
|
56
|
+
), /* @__PURE__ */ jsx(Fragment, { children });
|
|
57
|
+
}, `${MenuType}Item`), SubTrigger = create(({ children }) => {
|
|
58
|
+
const titleChild = pickChildren(children, ItemTitle).targetChildren;
|
|
59
|
+
return typeof children != "string" && !titleChild?.length && console.error(
|
|
60
|
+
`Menu Invalid <SubTrigger />. It either needs an <ItemTitle /> in the children.
|
|
61
|
+
|
|
62
|
+
<SubTrigger>
|
|
63
|
+
<ItemTitle>
|
|
64
|
+
Title here
|
|
65
|
+
</ItemTitle>
|
|
66
|
+
</SubTrigger>
|
|
67
|
+
`
|
|
68
|
+
), /* @__PURE__ */ jsx(Fragment, { children });
|
|
69
|
+
}, `${MenuType}SubTrigger`), Sub = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Sub`), SubContent = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}SubContent`), CheckboxItem = create(({ children }) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}CheckboxItem`), Label = create(({ children }) => (typeof children != "string" && console.error("Menu <Label /> children must be a string."), /* @__PURE__ */ jsx(Fragment, {})), `${MenuType}Label`), Menu = create((props) => {
|
|
70
|
+
const trigger = pickChildren(props.children, Trigger), content = pickChildren(
|
|
71
|
+
props.children,
|
|
72
|
+
Content,
|
|
73
|
+
COMPONENTS_TO_IGNORE
|
|
74
|
+
).targetChildren?.[0], callbacks = {}, getItemFromChild = (child, index) => {
|
|
75
|
+
let title;
|
|
76
|
+
const key = child.key ? `${child.key}` : `item-${index}`;
|
|
77
|
+
let subtitle;
|
|
78
|
+
const menuAttributes = {};
|
|
79
|
+
child.props.disabled && (menuAttributes.disabled = !0), child.props.destructive && (menuAttributes.destructive = !0), child.props.hidden && (menuAttributes.hidden = !0);
|
|
80
|
+
let icon;
|
|
81
|
+
if (typeof child.props.children == "string")
|
|
82
|
+
title = child.props.children;
|
|
83
|
+
else {
|
|
84
|
+
const titleChild = pickChildren(
|
|
85
|
+
child.props.children,
|
|
86
|
+
ItemTitle,
|
|
87
|
+
COMPONENTS_TO_IGNORE
|
|
88
|
+
).targetChildren, maybeTitle = child.props.textValue ?? titleChild?.[0]?.props.children;
|
|
89
|
+
typeof maybeTitle == "string" ? title = maybeTitle : console.error(
|
|
90
|
+
`Menu Invalid <${Menu}.Item key="${key}" /> Missing valid title. Make sure you do one of the following:
|
|
91
|
+
|
|
92
|
+
1. pass a string as the child of <${Menu}.ItemTitle />, nested directly inside of <${Menu}.Item />.
|
|
93
|
+
2. OR, use the textValue prop on <${Menu}.Item textValue="Some value" />`
|
|
94
|
+
);
|
|
95
|
+
const subtitleChild = pickChildren(
|
|
96
|
+
child.props.children,
|
|
97
|
+
ItemSubtitle
|
|
98
|
+
).targetChildren;
|
|
99
|
+
typeof subtitleChild?.[0]?.props.children == "string" && (subtitle = subtitleChild[0].props.children);
|
|
100
|
+
const iconChildren = pickChildren(
|
|
101
|
+
child.props.children,
|
|
102
|
+
ItemIcon
|
|
103
|
+
).targetChildren;
|
|
104
|
+
if (iconChildren?.[0]?.props.androidIconName)
|
|
105
|
+
icon = iconChildren[0].props.androidIconName;
|
|
106
|
+
else {
|
|
107
|
+
const imageChild = pickChildren(
|
|
108
|
+
child.props.children,
|
|
109
|
+
ItemImage
|
|
110
|
+
).targetChildren?.[0];
|
|
111
|
+
if (imageChild) {
|
|
112
|
+
const { androidIconName } = imageChild.props;
|
|
113
|
+
androidIconName && (icon = androidIconName);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (title) {
|
|
118
|
+
const maybeIndexKey = typeof child.key == "string" && child.key.startsWith(".") ? child.key.substring(1) : void 0;
|
|
119
|
+
if (
|
|
120
|
+
// if the key doesn't exist as a string
|
|
121
|
+
(typeof child.key != "string" || // or if flattenChildren assigned the key as `.${key}${index}`
|
|
122
|
+
child.key.startsWith(".") && !isNaN(Number(maybeIndexKey))) && console.warn(
|
|
123
|
+
`Menu <Item /> is missing a unique key. Pass a unique key string for each item, such as: <Item key="${title.toLowerCase().replace(/ /g, "-") || `action-${index}`}" />. Falling back to index (${key}) instead, but this may have negative consequences.`
|
|
124
|
+
), "onSelect" in child.props && child.props.onSelect
|
|
125
|
+
)
|
|
126
|
+
callbacks[key] = child.props.onSelect;
|
|
127
|
+
else if ("onValueChange" in child.props) {
|
|
128
|
+
const menuState = child.props.value, currentState = menuState === !0 ? "on" : menuState === !1 ? "off" : menuState, nextState = currentState === "mixed" || currentState === "on" ? "off" : "on", { onValueChange } = child.props;
|
|
129
|
+
callbacks[key] = () => {
|
|
130
|
+
onValueChange?.(nextState, currentState);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
key,
|
|
135
|
+
title,
|
|
136
|
+
subtitle,
|
|
137
|
+
menuAttributes,
|
|
138
|
+
icon
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}, mapItemsChildren = (children) => Children.map(
|
|
142
|
+
flattenChildren(children, [...COMPONENTS_TO_IGNORE, "Group"]),
|
|
143
|
+
(_child, index) => {
|
|
144
|
+
if (isInstanceOfComponent(_child, Item)) {
|
|
145
|
+
const item = getItemFromChild(_child, index);
|
|
146
|
+
if (item) {
|
|
147
|
+
const { icon, title, key, menuAttributes, subtitle } = item;
|
|
148
|
+
return {
|
|
149
|
+
id: key,
|
|
150
|
+
title,
|
|
151
|
+
image: icon,
|
|
152
|
+
attributes: menuAttributes,
|
|
153
|
+
subtitle
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
} else if (isInstanceOfComponent(_child, CheckboxItem)) {
|
|
157
|
+
const child = _child, item = getItemFromChild(child, index);
|
|
158
|
+
if (item) {
|
|
159
|
+
const { icon, title, key, menuAttributes, subtitle } = item, menuState = child.props.value;
|
|
160
|
+
return {
|
|
161
|
+
id: key,
|
|
162
|
+
title,
|
|
163
|
+
image: icon,
|
|
164
|
+
attributes: menuAttributes,
|
|
165
|
+
subtitle,
|
|
166
|
+
state: menuState === !0 ? "on" : menuState === !1 ? "off" : menuState
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
} else if (isInstanceOfComponent(_child, Sub)) {
|
|
170
|
+
const child = _child, key = child.key ? `${child.key}` : `sub-${index}`, triggerItemChild = pickChildren(
|
|
171
|
+
child.props.children,
|
|
172
|
+
SubTrigger
|
|
173
|
+
).targetChildren?.[0], triggerItem2 = triggerItemChild && getItemFromChild(triggerItemChild, index);
|
|
174
|
+
if (triggerItem2) {
|
|
175
|
+
const nestedContent = pickChildren(
|
|
176
|
+
child.props.children,
|
|
177
|
+
SubContent,
|
|
178
|
+
COMPONENTS_TO_IGNORE
|
|
179
|
+
).targetChildren?.[0];
|
|
180
|
+
if (nestedContent) {
|
|
181
|
+
const nestedItems = mapItemsChildren(nestedContent.props.children).filter(
|
|
182
|
+
filterNull
|
|
183
|
+
);
|
|
184
|
+
if (nestedItems.length)
|
|
185
|
+
return {
|
|
186
|
+
id: key,
|
|
187
|
+
title: triggerItem2?.title,
|
|
188
|
+
image: triggerItem2?.icon,
|
|
189
|
+
subactions: nestedItems,
|
|
190
|
+
attributes: triggerItem2.menuAttributes
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
), menuItems = mapItemsChildren(content?.props.children).filter(filterNull), labelComp = pickChildren(content?.props.children, Label).targetChildren?.[0];
|
|
198
|
+
let menuTitle = "";
|
|
199
|
+
typeof labelComp?.props.children == "string" ? menuTitle = labelComp.props.children : labelComp?.props.textValue && (menuTitle = labelComp.props.textValue);
|
|
200
|
+
const triggerItem = trigger.targetChildren?.[0];
|
|
201
|
+
let shouldOpenOnLongPress = MenuType === "ContextMenu";
|
|
202
|
+
return triggerItem?.props.action && (shouldOpenOnLongPress = triggerItem.props.action === "longPress"), /* @__PURE__ */ jsx(
|
|
203
|
+
NativePropProvider,
|
|
204
|
+
{
|
|
205
|
+
native: !0,
|
|
206
|
+
scope: MenuType === "DropdownMenu" ? "DropdownMenuContext" : "ContextMenuContext",
|
|
207
|
+
children: /* @__PURE__ */ jsx(
|
|
208
|
+
MenuView,
|
|
209
|
+
{
|
|
210
|
+
title: menuTitle,
|
|
211
|
+
onPressAction: ({ nativeEvent }) => {
|
|
212
|
+
callbacks[nativeEvent.event]();
|
|
213
|
+
},
|
|
214
|
+
shouldOpenOnLongPress,
|
|
215
|
+
actions: menuItems,
|
|
216
|
+
children: triggerItem
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}, `${MenuType}`), Separator = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Separator`), ItemIndicator = create(
|
|
222
|
+
(_) => /* @__PURE__ */ jsx(Fragment, {}),
|
|
223
|
+
`${MenuType}ItemIndicator`
|
|
224
|
+
), Preview = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Preview`), Arrow = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Arrow`);
|
|
225
|
+
return {
|
|
226
|
+
Menu: withStaticProperties(Menu, {
|
|
227
|
+
Trigger,
|
|
228
|
+
Content,
|
|
229
|
+
Item,
|
|
230
|
+
ItemTitle,
|
|
231
|
+
ItemSubtitle,
|
|
232
|
+
SubTrigger,
|
|
233
|
+
Group,
|
|
234
|
+
Separator,
|
|
235
|
+
ItemIcon,
|
|
236
|
+
ItemIndicator,
|
|
237
|
+
CheckboxItem,
|
|
238
|
+
ItemImage,
|
|
239
|
+
Label,
|
|
240
|
+
Preview,
|
|
241
|
+
Arrow,
|
|
242
|
+
Sub,
|
|
243
|
+
SubContent,
|
|
244
|
+
Auxiliary
|
|
245
|
+
})
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
export {
|
|
249
|
+
createAndroidMenu as createNativeMenu
|
|
250
|
+
};
|
|
251
|
+
//# sourceMappingURL=createNativeMenu.android.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/createNativeMenu/createNativeMenu.android.tsx"],
|
|
4
|
+
"mappings": "AAGA,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAgB,UAAwB,oBAAoB;AAC5D,SAAS,YAAY;AAErB,SAAS,0BAA0B;AAuBnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWI,SASA,UATA;AATX,MAAM,uBAAuB,CAAC,UAAU,OAAO,GAEzC,oBAAoB,CAAC,aAA6C;AACtE,QAAM,UAAU,OAAO,CAAC,EAAE,UAAU,SAAS,GAAG,KAAK,MAC/C,UACK,aAAa,UAAU;AAAA,IAC5B,GAAG;AAAA,EACL,CAAC,IAEI,oBAAC,QAAM,GAAG,MAAO,UAAS,GAChC,GAAG,QAAQ,SAAS,GAEjB,YAAY;AAAA,IAChB,CAAC,EAAE,SAAS,MAAkC;AAAA,IAC9C,GAAG,QAAQ;AAAA,EACb,GAEM,QAAQ,OAAO,CAAC,EAAE,SAAS,MACxB,gCAAG,UAAS,GAClB,GAAG,QAAQ,OAAO,GAEf,UAAU,OAAO,CAAC,EAAE,SAAS,OAC5B,YACH,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
5
|
+
"names": ["triggerItem"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { withStaticProperties } from "@tamagui/core";
|
|
2
|
+
import { Children, cloneElement, useRef } from "react";
|
|
3
|
+
import { Image } from "react-native";
|
|
4
|
+
import {
|
|
5
|
+
ContextMenuButton,
|
|
6
|
+
ContextMenuView
|
|
7
|
+
} from "react-native-ios-context-menu";
|
|
8
|
+
import { View } from "tamagui";
|
|
9
|
+
import { NativePropProvider } from "../Menu";
|
|
10
|
+
import {
|
|
11
|
+
create,
|
|
12
|
+
filterNull,
|
|
13
|
+
flattenChildren,
|
|
14
|
+
isInstanceOfComponent,
|
|
15
|
+
pickChildren
|
|
16
|
+
} from "./utils";
|
|
17
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
18
|
+
const COMPONENTS_TO_IGNORE = ["Portal", "Radio"], createIosMenu = (MenuType) => {
|
|
19
|
+
const Trigger = create(({ children, asChild, ...rest }) => asChild ? cloneElement(children, {
|
|
20
|
+
...rest
|
|
21
|
+
}) : /* @__PURE__ */ jsx(View, { ...rest, children }), `${MenuType}Trigger`), Auxiliary = create(({ children }) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Auxiliary`), Group = create(({ children }) => /* @__PURE__ */ jsx(Fragment, { children }), `${MenuType}Group`), Content = create(({ children }) => (children || console.error(`Menu <Content /> children must be written directly inline.
|
|
22
|
+
|
|
23
|
+
You cannot wrap this component into its own component. It should look like this:
|
|
24
|
+
|
|
25
|
+
<Menu>
|
|
26
|
+
<Content>
|
|
27
|
+
<Item />
|
|
28
|
+
<Item />
|
|
29
|
+
</Content>
|
|
30
|
+
</Menu>
|
|
31
|
+
|
|
32
|
+
Notice that the <Item /> are all children of the <Content /> component. That's important.
|
|
33
|
+
|
|
34
|
+
If you want to use a custom component as your <Content />, you can use the create() method. But you still need to pass all items as children of <Content />.`), /* @__PURE__ */ jsx(Fragment, { children })), `${MenuType}Content`), ItemTitle = create(({ children }) => {
|
|
35
|
+
if (typeof children != "string")
|
|
36
|
+
throw new Error("Menu <ItemTitle /> child must be a string");
|
|
37
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
38
|
+
}, `${MenuType}ItemTitle`), ItemIcon = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}ItemIcon`), ItemImage = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}ItemImage`), ItemSubtitle = create(({ children }) => {
|
|
39
|
+
if (children && typeof children != "string")
|
|
40
|
+
throw new Error("Menu <ItemSubtitle /> child must be a string");
|
|
41
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
42
|
+
}, `${MenuType}ItemSubtitle`), Item = create(({ children }) => {
|
|
43
|
+
const titleChild = pickChildren(children, ItemTitle).targetChildren;
|
|
44
|
+
return typeof children != "string" && !titleChild?.length && console.error(
|
|
45
|
+
`Menu Invalid <Item />. It either needs <ItemTitle /> in the children.
|
|
46
|
+
|
|
47
|
+
<Item>
|
|
48
|
+
<ItemTitle>
|
|
49
|
+
Title here
|
|
50
|
+
</ItemTitle>
|
|
51
|
+
</Item>
|
|
52
|
+
`
|
|
53
|
+
), /* @__PURE__ */ jsx(Fragment, { children });
|
|
54
|
+
}, `${MenuType}Item`), SubTrigger = create(({ children }) => {
|
|
55
|
+
const titleChild = pickChildren(children, ItemTitle).targetChildren;
|
|
56
|
+
return typeof children != "string" && !titleChild?.length && console.error(
|
|
57
|
+
`Menu Invalid <SubTrigger />. It either needs a string as the children, or a <ItemTitle /> in the children. However, it got neither.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
<SubTrigger>
|
|
61
|
+
<ItemTitle>
|
|
62
|
+
Title here
|
|
63
|
+
</ItemTitle>
|
|
64
|
+
</SubTrigger>
|
|
65
|
+
`
|
|
66
|
+
), /* @__PURE__ */ jsx(Fragment, { children });
|
|
67
|
+
}, `${MenuType}SubTrigger`), Sub = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Sub`), SubContent = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}SubContent`), Preview = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Preview`);
|
|
68
|
+
Preview.defaultProps = {
|
|
69
|
+
isResizeAnimated: !0
|
|
70
|
+
};
|
|
71
|
+
const CheckboxItem = create(({ children }) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}CheckboxItem`), Label = create(({ children }) => (typeof children != "string" && console.error("Menu <Label /> children must be a string."), /* @__PURE__ */ jsx(Fragment, {})), `${MenuType}Label`), Menu = create((props) => {
|
|
72
|
+
const trigger = pickChildren(props.children, Trigger), content = pickChildren(
|
|
73
|
+
props.children,
|
|
74
|
+
Content,
|
|
75
|
+
COMPONENTS_TO_IGNORE
|
|
76
|
+
).targetChildren?.[0], callbacks = {}, getItemFromChild = (child, index) => {
|
|
77
|
+
let title;
|
|
78
|
+
const key = child.key ? `${child.key}` : `item-${index}`;
|
|
79
|
+
let subtitle;
|
|
80
|
+
const menuAttributes = [];
|
|
81
|
+
child.props.disabled && menuAttributes.push("disabled"), child.props.destructive && menuAttributes.push("destructive"), child.props.hidden && menuAttributes.push("hidden");
|
|
82
|
+
let icon;
|
|
83
|
+
if (typeof child.props.children == "string")
|
|
84
|
+
title = child.props.children;
|
|
85
|
+
else {
|
|
86
|
+
const titleChild = pickChildren(
|
|
87
|
+
child.props.children,
|
|
88
|
+
ItemTitle
|
|
89
|
+
).targetChildren, maybeTitle = child.props.textValue ?? titleChild?.[0]?.props.children;
|
|
90
|
+
typeof maybeTitle == "string" ? title = maybeTitle : console.error(
|
|
91
|
+
`Menu Invalid <${Menu}.Item key="${key}" /> Missing valid title. Make sure you do one of the following:
|
|
92
|
+
|
|
93
|
+
1. pass a string as the child of <${Menu}.ItemTitle />, nested directly inside of <${Menu}.Item />.
|
|
94
|
+
2. OR, use the textValue prop on <${Menu}.Item textValue="Some value" />`
|
|
95
|
+
);
|
|
96
|
+
const subtitleChild = pickChildren(
|
|
97
|
+
child.props.children,
|
|
98
|
+
ItemSubtitle
|
|
99
|
+
).targetChildren;
|
|
100
|
+
typeof subtitleChild?.[0]?.props.children == "string" && (subtitle = subtitleChild[0].props.children);
|
|
101
|
+
const iconChildren = pickChildren(
|
|
102
|
+
child.props.children,
|
|
103
|
+
ItemIcon
|
|
104
|
+
).targetChildren;
|
|
105
|
+
if (iconChildren?.[0]?.props.iosIconName || iconChildren?.[0]?.props.ios) {
|
|
106
|
+
const iconConfiguration = iconChildren?.[0]?.props.ios;
|
|
107
|
+
icon = {
|
|
108
|
+
type: "IMAGE_SYSTEM",
|
|
109
|
+
imageValue: {
|
|
110
|
+
...iconConfiguration,
|
|
111
|
+
systemName: iconConfiguration?.name ?? iconChildren[0].props.iosIconName
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
} else {
|
|
115
|
+
const imageChild = pickChildren(
|
|
116
|
+
child.props.children,
|
|
117
|
+
ItemImage
|
|
118
|
+
).targetChildren?.[0];
|
|
119
|
+
if (imageChild && imageChild.props.source) {
|
|
120
|
+
const { source, ios: { lazy = !0, style } = {} } = imageChild.props;
|
|
121
|
+
typeof source == "object" && "uri" in source && source.uri ? icon = {
|
|
122
|
+
type: "IMAGE_REMOTE_URL",
|
|
123
|
+
imageValue: {
|
|
124
|
+
url: source.uri
|
|
125
|
+
},
|
|
126
|
+
imageLoadingConfig: {
|
|
127
|
+
shouldLazyLoad: lazy ?? !0
|
|
128
|
+
},
|
|
129
|
+
imageOptions: style
|
|
130
|
+
} : icon = {
|
|
131
|
+
type: "IMAGE_REQUIRE",
|
|
132
|
+
imageValue: Image.resolveAssetSource(imageChild.props.source)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (title) {
|
|
138
|
+
const maybeIndexKey = typeof child.key == "string" && child.key.startsWith(".") ? child.key.substring(1) : void 0;
|
|
139
|
+
if (
|
|
140
|
+
// if the key doesn't exist as a string
|
|
141
|
+
(typeof child.key != "string" || // or if flattenChildren assigned the key as `.${key}${index}`
|
|
142
|
+
child.key.startsWith(".") && !isNaN(Number(maybeIndexKey))) && console.warn(
|
|
143
|
+
`Menu <Item /> is missing a unique key. Pass a unique key string for each item, such as: <Item key="${title.toLowerCase().replace(/ /g, "-") || `action-${index}`}" />. Falling back to index (${key}) instead, but this may have negative consequences.`
|
|
144
|
+
), "onSelect" in child.props && child.props.onSelect
|
|
145
|
+
)
|
|
146
|
+
callbacks[key] = child.props.onSelect;
|
|
147
|
+
else if ("onValueChange" in child.props) {
|
|
148
|
+
const menuState = child.props.value, currentState = menuState === !0 ? "on" : menuState === !1 ? "off" : menuState, nextState = currentState === "mixed" || currentState === "on" ? "off" : "on", { onValueChange } = child.props;
|
|
149
|
+
callbacks[key] = () => {
|
|
150
|
+
onValueChange?.(nextState, currentState);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
key,
|
|
155
|
+
title,
|
|
156
|
+
subtitle,
|
|
157
|
+
menuAttributes,
|
|
158
|
+
icon
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}, mapItemsChildren = (children) => Children.map(flattenChildren(children), (_child, index) => {
|
|
162
|
+
if (isInstanceOfComponent(_child, Item)) {
|
|
163
|
+
const item = getItemFromChild(_child, index);
|
|
164
|
+
if (item) {
|
|
165
|
+
const { icon, title, key, menuAttributes, subtitle } = item;
|
|
166
|
+
return {
|
|
167
|
+
actionKey: key,
|
|
168
|
+
actionTitle: title,
|
|
169
|
+
icon,
|
|
170
|
+
menuAttributes,
|
|
171
|
+
discoverabilityTitle: subtitle
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
} else if (isInstanceOfComponent(_child, CheckboxItem)) {
|
|
175
|
+
const child = _child, item = getItemFromChild(child, index);
|
|
176
|
+
if (item) {
|
|
177
|
+
const { icon, title, key, menuAttributes, subtitle } = item, menuState = child.props.value;
|
|
178
|
+
return {
|
|
179
|
+
actionKey: key,
|
|
180
|
+
actionTitle: title,
|
|
181
|
+
icon,
|
|
182
|
+
menuAttributes,
|
|
183
|
+
discoverabilityTitle: subtitle,
|
|
184
|
+
menuState: menuState === !0 ? "on" : menuState === !1 ? "off" : menuState
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
} else if (isInstanceOfComponent(_child, Sub)) {
|
|
188
|
+
const child = _child, triggerItemChild = pickChildren(
|
|
189
|
+
child.props.children,
|
|
190
|
+
SubTrigger
|
|
191
|
+
).targetChildren?.[0], triggerItem2 = triggerItemChild && getItemFromChild(triggerItemChild, index);
|
|
192
|
+
if (triggerItem2) {
|
|
193
|
+
const nestedContent = pickChildren(child.props.children, SubContent, COMPONENTS_TO_IGNORE).targetChildren?.[0];
|
|
194
|
+
if (nestedContent) {
|
|
195
|
+
const nestedItems = mapItemsChildren(nestedContent.props.children).filter(
|
|
196
|
+
filterNull
|
|
197
|
+
);
|
|
198
|
+
if (nestedItems.length) {
|
|
199
|
+
const menuOptions = [];
|
|
200
|
+
return new Set(triggerItem2.menuAttributes || []).has("destructive") && menuOptions.push("destructive"), {
|
|
201
|
+
menuTitle: triggerItem2?.title,
|
|
202
|
+
icon: triggerItem2?.icon,
|
|
203
|
+
menuItems: nestedItems,
|
|
204
|
+
menuOptions,
|
|
205
|
+
menuAttributes: triggerItem2.menuAttributes
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} else if (isInstanceOfComponent(_child, Group))
|
|
211
|
+
return {
|
|
212
|
+
menuTitle: "",
|
|
213
|
+
menuItems: mapItemsChildren(_child.props.children).filter(filterNull),
|
|
214
|
+
menuOptions: ["displayInline"]
|
|
215
|
+
};
|
|
216
|
+
return null;
|
|
217
|
+
}), menuItems = mapItemsChildren(content?.props.children).filter(filterNull), labelComp = pickChildren(content?.props.children, Label).targetChildren?.[0];
|
|
218
|
+
let menuTitle = "";
|
|
219
|
+
typeof labelComp?.props.children == "string" ? menuTitle = labelComp.props.children : labelComp?.props.textValue && (menuTitle = labelComp.props.textValue);
|
|
220
|
+
const Component = MenuType === "ContextMenu" ? ContextMenuView : ContextMenuButton, preview = pickChildren(content?.props.children, Preview).targetChildren?.[0], previewProps = preview?.props, onMenuDidHide = props.onOpenChange && (() => {
|
|
221
|
+
props.onOpenChange?.(!1);
|
|
222
|
+
}), onMenuDidShow = props.onOpenChange && (() => {
|
|
223
|
+
props.onOpenChange?.(!0);
|
|
224
|
+
}), onMenuWillShow = props.onOpenWillChange && (() => {
|
|
225
|
+
props.onOpenWillChange?.(!0);
|
|
226
|
+
}), onMenuWillHide = props.onOpenWillChange && (() => {
|
|
227
|
+
props.onOpenWillChange?.(!1);
|
|
228
|
+
}), triggerItem = trigger.targetChildren?.[0];
|
|
229
|
+
let shouldOpenOnSingleTap = MenuType === "DropdownMenu";
|
|
230
|
+
triggerItem?.props.action && (shouldOpenOnSingleTap = triggerItem.props.action === "press");
|
|
231
|
+
const auxiliaryProps = (MenuType === "ContextMenu" ? pickChildren(content?.props.children, Auxiliary)?.targetChildren : void 0)?.[0]?.props, menuRef = useRef();
|
|
232
|
+
return /* @__PURE__ */ jsx(
|
|
233
|
+
NativePropProvider,
|
|
234
|
+
{
|
|
235
|
+
native: !0,
|
|
236
|
+
scope: MenuType === "DropdownMenu" ? "DropdownMenuContext" : "ContextMenuContext",
|
|
237
|
+
children: /* @__PURE__ */ jsx(
|
|
238
|
+
Component,
|
|
239
|
+
{
|
|
240
|
+
ref: menuRef,
|
|
241
|
+
onPressMenuItem: ({ nativeEvent }) => {
|
|
242
|
+
callbacks[nativeEvent.actionKey] && callbacks[nativeEvent.actionKey]();
|
|
243
|
+
},
|
|
244
|
+
isMenuPrimaryAction: shouldOpenOnSingleTap,
|
|
245
|
+
style: [{ flexGrow: 0 }, props.style],
|
|
246
|
+
menuConfig: {
|
|
247
|
+
menuTitle,
|
|
248
|
+
menuItems
|
|
249
|
+
},
|
|
250
|
+
renderPreview: MenuType === "ContextMenu" && preview && previewProps?.children ? () => /* @__PURE__ */ jsx(Fragment, { children: typeof previewProps?.children == "function" ? previewProps.children() : previewProps?.children }) : void 0,
|
|
251
|
+
lazyPreview: MenuType === "ContextMenu" ? typeof previewProps?.children == "function" : void 0,
|
|
252
|
+
onPressMenuPreview: MenuType === "ContextMenu" ? previewProps?.onPress : void 0,
|
|
253
|
+
auxiliaryPreviewConfig: auxiliaryProps?.children ? {
|
|
254
|
+
alignmentHorizontal: auxiliaryProps?.alignmentHorizontal,
|
|
255
|
+
anchorPosition: auxiliaryProps?.anchorPosition,
|
|
256
|
+
height: auxiliaryProps?.height,
|
|
257
|
+
marginAuxiliaryPreview: auxiliaryProps?.marginWithScreenEdge,
|
|
258
|
+
marginPreview: auxiliaryProps?.marginPreview,
|
|
259
|
+
transitionConfigEntrance: auxiliaryProps?.transitionConfigEntrance,
|
|
260
|
+
transitionEntranceDelay: auxiliaryProps?.transitionEntranceDelay,
|
|
261
|
+
width: auxiliaryProps?.width
|
|
262
|
+
} : void 0,
|
|
263
|
+
isAuxiliaryPreviewEnabled: !!auxiliaryProps?.children,
|
|
264
|
+
onMenuAuxiliaryPreviewDidShow: auxiliaryProps?.onDidShow,
|
|
265
|
+
onMenuAuxiliaryPreviewWillShow: auxiliaryProps?.onWillShow,
|
|
266
|
+
renderAuxiliaryPreview: auxiliaryProps?.children ? () => {
|
|
267
|
+
const child = typeof auxiliaryProps?.children == "function" ? auxiliaryProps?.children({
|
|
268
|
+
dismissMenu() {
|
|
269
|
+
menuRef.current?.dismissMenu();
|
|
270
|
+
}
|
|
271
|
+
}) : auxiliaryProps?.children;
|
|
272
|
+
return /* @__PURE__ */ jsx(Fragment, { children: child });
|
|
273
|
+
} : void 0,
|
|
274
|
+
previewConfig: preview ? {
|
|
275
|
+
// ...previewProps,
|
|
276
|
+
previewType: "CUSTOM",
|
|
277
|
+
previewSize: previewProps?.size,
|
|
278
|
+
backgroundColor: previewProps?.backgroundColor,
|
|
279
|
+
borderRadius: previewProps?.borderRadius,
|
|
280
|
+
isResizeAnimated: previewProps?.isResizeAnimated,
|
|
281
|
+
preferredCommitStyle: previewProps?.preferredCommitStyle
|
|
282
|
+
} : void 0,
|
|
283
|
+
onMenuDidHide,
|
|
284
|
+
onMenuDidShow,
|
|
285
|
+
onMenuWillHide,
|
|
286
|
+
onMenuWillShow,
|
|
287
|
+
...props.__unsafeIosProps,
|
|
288
|
+
children: triggerItem
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}, `${MenuType}`), Separator = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Separator`), ItemIndicator = create(
|
|
294
|
+
(_) => /* @__PURE__ */ jsx(Fragment, {}),
|
|
295
|
+
`${MenuType}ItemIndicator`
|
|
296
|
+
), Arrow = create((_) => /* @__PURE__ */ jsx(Fragment, {}), `${MenuType}Arrow`);
|
|
297
|
+
return {
|
|
298
|
+
Menu: withStaticProperties(Menu, {
|
|
299
|
+
Trigger,
|
|
300
|
+
Content,
|
|
301
|
+
Item,
|
|
302
|
+
ItemTitle,
|
|
303
|
+
ItemSubtitle,
|
|
304
|
+
SubTrigger,
|
|
305
|
+
Group,
|
|
306
|
+
Separator,
|
|
307
|
+
ItemIcon,
|
|
308
|
+
ItemIndicator,
|
|
309
|
+
CheckboxItem,
|
|
310
|
+
ItemImage,
|
|
311
|
+
Label,
|
|
312
|
+
Preview,
|
|
313
|
+
Arrow,
|
|
314
|
+
Sub,
|
|
315
|
+
SubContent,
|
|
316
|
+
Auxiliary
|
|
317
|
+
})
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
export {
|
|
321
|
+
createIosMenu as createNativeMenu
|
|
322
|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enu = (MenuType) => ({
|
|
3
|
+
Menu: withStaticProperties({}, {
|
|
4
|
+
Trigger: {},
|
|
5
|
+
Content: {},
|
|
6
|
+
Item: {},
|
|
7
|
+
ItemTitle: {},
|
|
8
|
+
ItemSubtitle: {},
|
|
9
|
+
SubTrigger: {},
|
|
10
|
+
Group: {},
|
|
11
|
+
ItemIcon: {},
|
|
12
|
+
Separator: {},
|
|
13
|
+
CheckboxItem: {},
|
|
14
|
+
ItemIndicator: {},
|
|
15
|
+
ItemImage: {},
|
|
16
|
+
Label: {},
|
|
17
|
+
Arrow: {},
|
|
18
|
+
Sub: {},
|
|
19
|
+
SubContent: {},
|
|
20
|
+
Preview: {}
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
createNativeMenu
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=createNativeMenu.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/createNativeMenu/createNativeMenu.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,4BAA4B;AAwB9B,MAAM,mBAAmB,CAAC,cAoCxB;AAAA,EACL,MAAM,qBApCK,CAAC,GAoCqB;AAAA,IAC/B,SAnCY,CAAC;AAAA,IAoCb,SAlCY,CAAC;AAAA,IAmCb,MAhCS,CAAC;AAAA,IAiCV,WAzBc,CAAC;AAAA,IA0Bf,cAxBiB,CAAC;AAAA,IAyBlB,YA7Be,CAAC;AAAA,IA8BhB,OAxBU,CAAC;AAAA,IAyBX,UAnCa,CAAC;AAAA,IAoCd,WAxBc,CAAC;AAAA,IAyBf,cAvBiB,CAAC;AAAA,IAwBlB,eAtBkB,CAAC;AAAA,IAuBnB,WArCc,CAAC;AAAA,IAsCf,OAtBU,CAAC;AAAA,IAuBX,OArBU,CAAC;AAAA,IAsBX,KApBQ,CAAC;AAAA,IAqBT,YAnBe,CAAC;AAAA,IAoBhB,SAhDY,CAAC;AAAA,EAiDf,CAAC;AACH;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|