@vritti/quantum-ui 0.3.27 → 0.4.1
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/Avatar.js +5 -5
- package/dist/Checkbox.js +16 -11
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox2.js +4 -5
- package/dist/Checkbox2.js.map +1 -1
- package/dist/Combination.js +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/Progress.js +2 -2
- package/dist/RadioGroup.js +4 -5
- package/dist/RadioGroup.js.map +1 -1
- package/dist/Sidebar.js +1 -1
- package/dist/Sonner.js +1 -1
- package/dist/Switch.js +19 -14
- package/dist/Switch.js.map +1 -1
- package/dist/TabsSkeleton.js +1 -1
- package/dist/Toggle.js +1 -1
- package/dist/assets/quantum-ui.css +1 -1
- package/dist/components/RichTextEditor.js +1 -1
- package/dist/components/TreeView.js +2 -3
- package/dist/components/TreeView.js.map +1 -1
- package/dist/disabledTip.js +13 -0
- package/dist/disabledTip.js.map +1 -0
- package/dist/dropdown-menu.js +5 -7
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/image-component.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index13.js +4 -6
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +3 -5
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +8 -9
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +1 -1
- package/dist/index17.js +1 -1
- package/dist/index19.js +2 -4
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +1 -1
- package/dist/index21.js +139 -1
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +3 -4
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +70 -122
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +1128 -70
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +231 -11
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +2509 -1106
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +23 -223
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +3 -2535
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +36 -31
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +308 -3
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +8 -36
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +25 -305
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +60 -8
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +11 -30
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +35 -59
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +35348 -9
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +79 -36
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +184 -35341
- package/dist/index38.js.map +1 -1
- package/dist/index5.js +2 -4
- package/dist/index5.js.map +1 -1
- package/dist/index8.js +7 -0
- package/dist/index8.js.map +1 -1
- package/dist/lib/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/lib/components/Switch/Switch.d.ts +4 -1
- package/dist/lib/components/Switch/Switch.d.ts.map +1 -1
- package/dist/lib/config/index.d.ts +5 -0
- package/dist/lib/config/index.d.ts.map +1 -1
- package/dist/lib/hooks/useSSE.d.ts.map +1 -1
- package/dist/lib/selects/permission-group/PermissionGroupSelector.d.ts +4 -0
- package/dist/lib/selects/permission-group/PermissionGroupSelector.d.ts.map +1 -0
- package/dist/lib/selects/permission-group/index.d.ts +2 -0
- package/dist/lib/selects/permission-group/index.d.ts.map +1 -0
- package/dist/lib/types/catalog-resolver.d.ts +18 -6
- package/dist/lib/types/catalog-resolver.d.ts.map +1 -1
- package/dist/lib/utils/disabledTip.d.ts +3 -0
- package/dist/lib/utils/disabledTip.d.ts.map +1 -0
- package/dist/selects/permission-group.js +21 -0
- package/dist/selects/permission-group.js.map +1 -0
- package/dist/types/catalog-resolver.js +1 -1
- package/dist/types/catalog-resolver.js.map +1 -1
- package/dist/useTimer.js +2 -1
- package/dist/useTimer.js.map +1 -1
- package/dist/utils/motion.js +2 -2
- package/dist/value.js +1 -1
- package/package.json +5 -1
- package/dist/index39.js +0 -84
- package/dist/index39.js.map +0 -1
- package/dist/index40.js +0 -199
- package/dist/index40.js.map +0 -1
package/dist/index21.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { u as useLayoutEffect2 } from './index28.js';
|
|
4
|
+
import { u as useComposedRefs } from './index12.js';
|
|
3
5
|
|
|
4
6
|
// packages/react/context/src/create-context.tsx
|
|
5
7
|
function createContext2(rootComponentName, defaultContext) {
|
|
@@ -76,5 +78,141 @@ function composeContextScopes(...scopes) {
|
|
|
76
78
|
return createScope;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
// packages/react/id/src/id.tsx
|
|
82
|
+
var useReactId = React[" useId ".trim().toString()] || (() => void 0);
|
|
83
|
+
var count = 0;
|
|
84
|
+
function useId(deterministicId) {
|
|
85
|
+
const [id, setId] = React.useState(useReactId());
|
|
86
|
+
useLayoutEffect2(() => {
|
|
87
|
+
setId((reactId) => reactId ?? String(count++));
|
|
88
|
+
}, [deterministicId]);
|
|
89
|
+
return (id ? `radix-${id}` : "");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function useStateMachine(initialState, machine) {
|
|
93
|
+
return React.useReducer((state, event) => {
|
|
94
|
+
const nextState = machine[state][event];
|
|
95
|
+
return nextState ?? state;
|
|
96
|
+
}, initialState);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/presence.tsx
|
|
100
|
+
var Presence = (props) => {
|
|
101
|
+
const { present, children } = props;
|
|
102
|
+
const presence = usePresence(present);
|
|
103
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
104
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
105
|
+
const forceMount = typeof children === "function";
|
|
106
|
+
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
107
|
+
};
|
|
108
|
+
Presence.displayName = "Presence";
|
|
109
|
+
function usePresence(present) {
|
|
110
|
+
const [node, setNode] = React.useState();
|
|
111
|
+
const stylesRef = React.useRef(null);
|
|
112
|
+
const prevPresentRef = React.useRef(present);
|
|
113
|
+
const prevAnimationNameRef = React.useRef("none");
|
|
114
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
115
|
+
const [state, send] = useStateMachine(initialState, {
|
|
116
|
+
mounted: {
|
|
117
|
+
UNMOUNT: "unmounted",
|
|
118
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
119
|
+
},
|
|
120
|
+
unmountSuspended: {
|
|
121
|
+
MOUNT: "mounted",
|
|
122
|
+
ANIMATION_END: "unmounted"
|
|
123
|
+
},
|
|
124
|
+
unmounted: {
|
|
125
|
+
MOUNT: "mounted"
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
React.useEffect(() => {
|
|
129
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
130
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
131
|
+
}, [state]);
|
|
132
|
+
useLayoutEffect2(() => {
|
|
133
|
+
const styles = stylesRef.current;
|
|
134
|
+
const wasPresent = prevPresentRef.current;
|
|
135
|
+
const hasPresentChanged = wasPresent !== present;
|
|
136
|
+
if (hasPresentChanged) {
|
|
137
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
138
|
+
const currentAnimationName = getAnimationName(styles);
|
|
139
|
+
if (present) {
|
|
140
|
+
send("MOUNT");
|
|
141
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
142
|
+
send("UNMOUNT");
|
|
143
|
+
} else {
|
|
144
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
145
|
+
if (wasPresent && isAnimating) {
|
|
146
|
+
send("ANIMATION_OUT");
|
|
147
|
+
} else {
|
|
148
|
+
send("UNMOUNT");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
prevPresentRef.current = present;
|
|
152
|
+
}
|
|
153
|
+
}, [present, send]);
|
|
154
|
+
useLayoutEffect2(() => {
|
|
155
|
+
if (node) {
|
|
156
|
+
let timeoutId;
|
|
157
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
158
|
+
const handleAnimationEnd = (event) => {
|
|
159
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
160
|
+
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
161
|
+
if (event.target === node && isCurrentAnimation) {
|
|
162
|
+
send("ANIMATION_END");
|
|
163
|
+
if (!prevPresentRef.current) {
|
|
164
|
+
const currentFillMode = node.style.animationFillMode;
|
|
165
|
+
node.style.animationFillMode = "forwards";
|
|
166
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
167
|
+
if (node.style.animationFillMode === "forwards") {
|
|
168
|
+
node.style.animationFillMode = currentFillMode;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const handleAnimationStart = (event) => {
|
|
175
|
+
if (event.target === node) {
|
|
176
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
180
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
181
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
182
|
+
return () => {
|
|
183
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
184
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
185
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
186
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
187
|
+
};
|
|
188
|
+
} else {
|
|
189
|
+
send("ANIMATION_END");
|
|
190
|
+
}
|
|
191
|
+
}, [node, send]);
|
|
192
|
+
return {
|
|
193
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
194
|
+
ref: React.useCallback((node2) => {
|
|
195
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
196
|
+
setNode(node2);
|
|
197
|
+
}, [])
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function getAnimationName(styles) {
|
|
201
|
+
return styles?.animationName || "none";
|
|
202
|
+
}
|
|
203
|
+
function getElementRef(element) {
|
|
204
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
205
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
206
|
+
if (mayWarn) {
|
|
207
|
+
return element.ref;
|
|
208
|
+
}
|
|
209
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
210
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
211
|
+
if (mayWarn) {
|
|
212
|
+
return element.props.ref;
|
|
213
|
+
}
|
|
214
|
+
return element.props.ref || element.ref;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export { Presence as P, createContext2 as a, createContextScope as c, useId as u };
|
|
80
218
|
//# sourceMappingURL=index21.js.map
|
package/dist/index21.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index21.js","sources":["../node_modules/.pnpm/@radix-ui+react-context@1.1.2_@types+react@19.2.14_react@19.2.3/node_modules/@radix-ui/react-context/dist/index.mjs"],"sourcesContent":["// packages/react/context/src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n const Provider = (props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName) {\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n}\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope) {\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n }\n const createScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n };\n };\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = () => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\n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QAAQ,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,YAAY,EAAE;AAClD,MAAM,CAAC,EAAE,EAAE,CAAC;AACZ,MAAM,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AACnG,IAAI,CAAC;AACL,EAAE,CAAC;AACH,EAAE,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS;AAC7C,EAAE,OAAO,WAAW;AACpB;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index21.js","sources":["../node_modules/.pnpm/@radix-ui+react-context@1.1.2_@types+react@19.2.14_react@19.2.3/node_modules/@radix-ui/react-context/dist/index.mjs","../node_modules/.pnpm/@radix-ui+react-id@1.1.1_@types+react@19.2.14_react@19.2.3/node_modules/@radix-ui/react-id/dist/index.mjs","../node_modules/.pnpm/@radix-ui+react-presence@1.1.5_@types+react-dom@19.2.3_@types+react@19.2.14__@types+rea_ed1433b3a7b610ecabc4f5f1045d8cb3/node_modules/@radix-ui/react-presence/dist/index.mjs"],"sourcesContent":["// packages/react/context/src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n const Provider = (props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName) {\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n}\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope) {\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n }\n const createScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n };\n };\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = () => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\nexport {\n createContext2 as createContext,\n createContextScope\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/id/src/id.tsx\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nvar useReactId = React[\" useId \".trim().toString()] || (() => void 0);\nvar count = 0;\nfunction useId(deterministicId) {\n const [id, setId] = React.useState(useReactId());\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : \"\");\n}\nexport {\n useId\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/presence.tsx\nimport * as React2 from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\n\n// src/use-state-machine.tsx\nimport * as React from \"react\";\nfunction useStateMachine(initialState, machine) {\n return React.useReducer((state, event) => {\n const nextState = machine[state][event];\n return nextState ?? state;\n }, initialState);\n}\n\n// src/presence.tsx\nvar Presence = (props) => {\n const { present, children } = props;\n const presence = usePresence(present);\n const child = typeof children === \"function\" ? children({ present: presence.isPresent }) : React2.Children.only(children);\n const ref = useComposedRefs(presence.ref, getElementRef(child));\n const forceMount = typeof children === \"function\";\n return forceMount || presence.isPresent ? React2.cloneElement(child, { ref }) : null;\n};\nPresence.displayName = \"Presence\";\nfunction usePresence(present) {\n const [node, setNode] = React2.useState();\n const stylesRef = React2.useRef(null);\n const prevPresentRef = React2.useRef(present);\n const prevAnimationNameRef = React2.useRef(\"none\");\n const initialState = present ? \"mounted\" : \"unmounted\";\n const [state, send] = useStateMachine(initialState, {\n mounted: {\n UNMOUNT: \"unmounted\",\n ANIMATION_OUT: \"unmountSuspended\"\n },\n unmountSuspended: {\n MOUNT: \"mounted\",\n ANIMATION_END: \"unmounted\"\n },\n unmounted: {\n MOUNT: \"mounted\"\n }\n });\n React2.useEffect(() => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n prevAnimationNameRef.current = state === \"mounted\" ? currentAnimationName : \"none\";\n }, [state]);\n useLayoutEffect(() => {\n const styles = stylesRef.current;\n const wasPresent = prevPresentRef.current;\n const hasPresentChanged = wasPresent !== present;\n if (hasPresentChanged) {\n const prevAnimationName = prevAnimationNameRef.current;\n const currentAnimationName = getAnimationName(styles);\n if (present) {\n send(\"MOUNT\");\n } else if (currentAnimationName === \"none\" || styles?.display === \"none\") {\n send(\"UNMOUNT\");\n } else {\n const isAnimating = prevAnimationName !== currentAnimationName;\n if (wasPresent && isAnimating) {\n send(\"ANIMATION_OUT\");\n } else {\n send(\"UNMOUNT\");\n }\n }\n prevPresentRef.current = present;\n }\n }, [present, send]);\n useLayoutEffect(() => {\n if (node) {\n let timeoutId;\n const ownerWindow = node.ownerDocument.defaultView ?? window;\n const handleAnimationEnd = (event) => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n if (event.target === node && isCurrentAnimation) {\n send(\"ANIMATION_END\");\n if (!prevPresentRef.current) {\n const currentFillMode = node.style.animationFillMode;\n node.style.animationFillMode = \"forwards\";\n timeoutId = ownerWindow.setTimeout(() => {\n if (node.style.animationFillMode === \"forwards\") {\n node.style.animationFillMode = currentFillMode;\n }\n });\n }\n }\n };\n const handleAnimationStart = (event) => {\n if (event.target === node) {\n prevAnimationNameRef.current = getAnimationName(stylesRef.current);\n }\n };\n node.addEventListener(\"animationstart\", handleAnimationStart);\n node.addEventListener(\"animationcancel\", handleAnimationEnd);\n node.addEventListener(\"animationend\", handleAnimationEnd);\n return () => {\n ownerWindow.clearTimeout(timeoutId);\n node.removeEventListener(\"animationstart\", handleAnimationStart);\n node.removeEventListener(\"animationcancel\", handleAnimationEnd);\n node.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n } else {\n send(\"ANIMATION_END\");\n }\n }, [node, send]);\n return {\n isPresent: [\"mounted\", \"unmountSuspended\"].includes(state),\n ref: React2.useCallback((node2) => {\n stylesRef.current = node2 ? getComputedStyle(node2) : null;\n setNode(node2);\n }, [])\n };\n}\nfunction getAnimationName(styles) {\n return styles?.animationName || \"none\";\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Presence;\nexport {\n Presence,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["useLayoutEffect","React2"],"mappings":";;;;;AAAA;AAGA,SAAS,cAAc,CAAC,iBAAiB,EAAE,cAAc,EAAE;AAC3D,EAAE,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC;AACrD,EAAE,MAAM,QAAQ,GAAG,CAAC,KAAK,KAAK;AAC9B,IAAI,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK;AAC1C,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACtE,IAAI,uBAAuB,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACrE,EAAE,CAAC;AACH,EAAE,QAAQ,CAAC,WAAW,GAAG,iBAAiB,GAAG,UAAU;AACvD,EAAE,SAAS,WAAW,CAAC,YAAY,EAAE;AACrC,IAAI,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;AAC7C,IAAI,IAAI,OAAO,EAAE,OAAO,OAAO;AAC/B,IAAI,IAAI,cAAc,KAAK,MAAM,EAAE,OAAO,cAAc;AACxD,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,EAAE,EAAE,YAAY,CAAC,yBAAyB,EAAE,iBAAiB,CAAC,EAAE,CAAC,CAAC;AACvF,EAAE;AACF,EAAE,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC;AAChC;AACA,SAAS,kBAAkB,CAAC,SAAS,EAAE,s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AAE,IAAI,MAAM,GAAG,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,GAAG;AACzE,EAAE,IAAI,OAAO,GAAG,MAAM,IAAI,gBAAgB,IAAI,MAAM,IAAI,MAAM,CAAC,cAAc;AAC7E,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,OAAO,OAAO,CAAC,GAAG;AACtB,EAAE;AACF,EAAE,MAAM,GAAG,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,GAAG;AAC/D,EAAE,OAAO,GAAG,MAAM,IAAI,gBAAgB,IAAI,MAAM,IAAI,MAAM,CAAC,cAAc;AACzE,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG;AAC5B,EAAE;AACF,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG;AACzC;;;;","x_google_ignoreList":[0,1,2]}
|
package/dist/index22.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { P as Primitive, c as composeEventHandlers, u as useControllableState } from './index20.js';
|
|
3
|
-
import { c as createCollection, u as useDirection } from './
|
|
3
|
+
import { c as createCollection, u as useDirection } from './index23.js';
|
|
4
4
|
import { u as useComposedRefs } from './index12.js';
|
|
5
|
-
import { c as createContextScope } from './index21.js';
|
|
6
|
-
import { u as
|
|
7
|
-
import { u as useCallbackRef } from './index33.js';
|
|
5
|
+
import { u as useId, c as createContextScope } from './index21.js';
|
|
6
|
+
import { u as useCallbackRef } from './index31.js';
|
|
8
7
|
import { jsx } from 'react/jsx-runtime';
|
|
9
8
|
|
|
10
9
|
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
package/dist/index22.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index22.js","sources":["../node_modules/.pnpm/@radix-ui+react-roving-focus@1.1.11_@types+react-dom@19.2.3_@types+react@19.2.14__@type_201cfa283d5b26fb84e6cfb74449149c/node_modules/@radix-ui/react-roving-focus/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/roving-focus-group.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { jsx } from \"react/jsx-runtime\";\nvar ENTRY_FOCUS = \"rovingFocusGroup.onEntryFocus\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar GROUP_NAME = \"RovingFocusGroup\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);\nvar [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope]\n);\nvar [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);\nvar RovingFocusGroup = React.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });\n }\n);\nRovingFocusGroup.displayName = GROUP_NAME;\nvar RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId ?? null,\n onChange: onCurrentTabStopIdChange,\n caller: GROUP_NAME\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n return /* @__PURE__ */ jsx(\n RovingFocusProvider,\n {\n scope: __scopeRovingFocusGroup,\n orientation,\n dir: direction,\n loop,\n currentTabStopId,\n onItemFocus: React.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n ),\n onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),\n onFocusableItemAdd: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n ),\n onFocusableItemRemove: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n ),\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation,\n ...groupProps,\n ref: composedRefs,\n style: { outline: \"none\", ...props.style },\n onMouseDown: composeEventHandlers(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n }),\n onFocus: composeEventHandlers(props.onFocus, (event) => {\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n );\n const candidateNodes = candidateItems.map((item) => item.ref.current);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))\n }\n )\n }\n );\n});\nvar ITEM_NAME = \"RovingFocusGroupItem\";\nvar RovingFocusGroupItem = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n children,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;\n React.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n return /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeRovingFocusGroup,\n id,\n focusable,\n active,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation,\n ...itemProps,\n ref: forwardedRef,\n onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {\n if (!focusable) event.preventDefault();\n else context.onItemFocus(id);\n }),\n onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== void 0) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current);\n if (focusIntent === \"last\") candidateNodes.reverse();\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n }\n }),\n children: typeof children === \"function\" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children\n }\n )\n }\n );\n }\n);\nRovingFocusGroupItem.displayName = ITEM_NAME;\nvar MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\"\n};\nfunction getDirectionAwareKey(key, dir) {\n if (dir !== \"rtl\") return key;\n return key === \"ArrowLeft\" ? \"ArrowRight\" : key === \"ArrowRight\" ? \"ArrowLeft\" : key;\n}\nfunction getFocusIntent(event, orientation, dir) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === \"vertical\" && [\"ArrowLeft\", \"ArrowRight\"].includes(key)) return void 0;\n if (orientation === \"horizontal\" && [\"ArrowUp\", \"ArrowDown\"].includes(key)) return void 0;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction focusFirst(candidates, preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root = RovingFocusGroup;\nvar Item = RovingFocusGroupItem;\nexport {\n Item,\n Root,\n RovingFocusGroup,\n RovingFocusGroupItem,\n createRovingFocusGroupScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;;;;;;AAcA,IAAI,WAAW,GAAG,+BAA+B;AACjD,IAAI,aAAa,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE;AACxD,IAAI,UAAU,GAAG,kBAAkB;AACnC,IAAI,CAAC,UAAU,EAAE,aAAa,EAAE,qBAAqB,CAAC,GAAG,gBAAgB,CAAC,UAAU,CAAC;AAClF,IAAC,CAAC,6BAA6B,EAAE,2BAA2B,CAAC,GAAG,kBAAkB;AACrF,EAAE,UAAU;AACZ,EAAE,CAAC,qBAAqB;AACxB;AACA,IAAI,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,GAAG,6BAA6B,CAAC,UAAU,CAAC;AAC5F,IAAI,gBAAgB,GAAG,KAAK,CAAC,UAAU;AACvC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC3B,IAAI,uBAAuB,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,uBAAuB,EAAE,QAAQ,kBAAkB,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,uBAAuB,EAAE,QAAQ,kBAAkB,GAAG,CAAC,oBAAoB,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7Q,EAAE;AACF,CAAC;AACD,gBAAgB,CAAC,WAAW,GAAG,UAAU;AACzC,IAAI,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK;AACrE,EAAE,MAAM;AACR,IAAI,uBAAuB;AAC3B,IAAI,WAAW;AACf,IAAI,IAAI,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AY,GAAG,WAAW,GAAG,GAAG;AACtF;AACA,SAAS,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE;AACjD,EAAE,MAAM,GAAG,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;AAClD,EAAE,IAAI,WAAW,KAAK,UAAU,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,MAAM;AAC5F,EAAE,IAAI,WAAW,KAAK,YAAY,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,MAAM;AAC3F,EAAE,OAAO,uBAAuB,CAAC,GAAG,CAAC;AACrC;AACA,SAAS,UAAU,CAAC,UAAU,EAAE,aAAa,GAAG,KAAK,EAAE;AACvD,EAAE,MAAM,0BAA0B,GAAG,QAAQ,CAAC,aAAa;AAC3D,EAAE,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;AACtC,IAAI,IAAI,SAAS,KAAK,0BAA0B,EAAE;AAClD,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;AACtC,IAAI,IAAI,QAAQ,CAAC,aAAa,KAAK,0BAA0B,EAAE;AAC/D,EAAE;AACF;AACA,SAAS,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE;AACtC,EAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,UAAU,GAAG,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5E;AACG,IAAC,IAAI,GAAG;AACR,IAAC,IAAI,GAAG;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index22.js","sources":["../node_modules/.pnpm/@radix-ui+react-roving-focus@1.1.11_@types+react-dom@19.2.3_@types+react@19.2.14__@type_201cfa283d5b26fb84e6cfb74449149c/node_modules/@radix-ui/react-roving-focus/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/roving-focus-group.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { jsx } from \"react/jsx-runtime\";\nvar ENTRY_FOCUS = \"rovingFocusGroup.onEntryFocus\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar GROUP_NAME = \"RovingFocusGroup\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);\nvar [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope]\n);\nvar [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);\nvar RovingFocusGroup = React.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });\n }\n);\nRovingFocusGroup.displayName = GROUP_NAME;\nvar RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId ?? null,\n onChange: onCurrentTabStopIdChange,\n caller: GROUP_NAME\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n return /* @__PURE__ */ jsx(\n RovingFocusProvider,\n {\n scope: __scopeRovingFocusGroup,\n orientation,\n dir: direction,\n loop,\n currentTabStopId,\n onItemFocus: React.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n ),\n onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),\n onFocusableItemAdd: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n ),\n onFocusableItemRemove: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n ),\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation,\n ...groupProps,\n ref: composedRefs,\n style: { outline: \"none\", ...props.style },\n onMouseDown: composeEventHandlers(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n }),\n onFocus: composeEventHandlers(props.onFocus, (event) => {\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n );\n const candidateNodes = candidateItems.map((item) => item.ref.current);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))\n }\n )\n }\n );\n});\nvar ITEM_NAME = \"RovingFocusGroupItem\";\nvar RovingFocusGroupItem = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n children,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;\n React.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n return /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeRovingFocusGroup,\n id,\n focusable,\n active,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation,\n ...itemProps,\n ref: forwardedRef,\n onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {\n if (!focusable) event.preventDefault();\n else context.onItemFocus(id);\n }),\n onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== void 0) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current);\n if (focusIntent === \"last\") candidateNodes.reverse();\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n }\n }),\n children: typeof children === \"function\" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children\n }\n )\n }\n );\n }\n);\nRovingFocusGroupItem.displayName = ITEM_NAME;\nvar MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\"\n};\nfunction getDirectionAwareKey(key, dir) {\n if (dir !== \"rtl\") return key;\n return key === \"ArrowLeft\" ? \"ArrowRight\" : key === \"ArrowRight\" ? \"ArrowLeft\" : key;\n}\nfunction getFocusIntent(event, orientation, dir) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === \"vertical\" && [\"ArrowLeft\", \"ArrowRight\"].includes(key)) return void 0;\n if (orientation === \"horizontal\" && [\"ArrowUp\", \"ArrowDown\"].includes(key)) return void 0;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction focusFirst(candidates, preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root = RovingFocusGroup;\nvar Item = RovingFocusGroupItem;\nexport {\n Item,\n Root,\n RovingFocus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AACjD,EAAE,MAAM,GAAG,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;AAClD,EAAE,IAAI,WAAW,KAAK,UAAU,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,MAAM;AAC5F,EAAE,IAAI,WAAW,KAAK,YAAY,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,MAAM;AAC3F,EAAE,OAAO,uBAAuB,CAAC,GAAG,CAAC;AACrC;AACA,SAAS,UAAU,CAAC,UAAU,EAAE,aAAa,GAAG,KAAK,EAAE;AACvD,EAAE,MAAM,0BAA0B,GAAG,QAAQ,CAAC,aAAa;AAC3D,EAAE,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;AACtC,IAAI,IAAI,SAAS,KAAK,0BAA0B,EAAE;AAClD,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;AACtC,IAAI,IAAI,QAAQ,CAAC,aAAa,KAAK,0BAA0B,EAAE;AAC/D,EAAE;AACF;AACA,SAAS,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE;AACtC,EAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,UAAU,GAAG,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5E;AACG,IAAC,IAAI,GAAG;AACR,IAAC,IAAI,GAAG;;;;","x_google_ignoreList":[0]}
|
package/dist/index23.js
CHANGED
|
@@ -1,131 +1,79 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { c as createContextScope } from './index21.js';
|
|
2
4
|
import { u as useComposedRefs } from './index12.js';
|
|
3
|
-
import {
|
|
5
|
+
import { b as createSlot } from './index20.js';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
7
|
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
28
|
-
const [state, send] = useStateMachine(initialState, {
|
|
29
|
-
mounted: {
|
|
30
|
-
UNMOUNT: "unmounted",
|
|
31
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
32
|
-
},
|
|
33
|
-
unmountSuspended: {
|
|
34
|
-
MOUNT: "mounted",
|
|
35
|
-
ANIMATION_END: "unmounted"
|
|
36
|
-
},
|
|
37
|
-
unmounted: {
|
|
38
|
-
MOUNT: "mounted"
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
React.useEffect(() => {
|
|
42
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
43
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
44
|
-
}, [state]);
|
|
45
|
-
useLayoutEffect2(() => {
|
|
46
|
-
const styles = stylesRef.current;
|
|
47
|
-
const wasPresent = prevPresentRef.current;
|
|
48
|
-
const hasPresentChanged = wasPresent !== present;
|
|
49
|
-
if (hasPresentChanged) {
|
|
50
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
51
|
-
const currentAnimationName = getAnimationName(styles);
|
|
52
|
-
if (present) {
|
|
53
|
-
send("MOUNT");
|
|
54
|
-
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
55
|
-
send("UNMOUNT");
|
|
56
|
-
} else {
|
|
57
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
58
|
-
if (wasPresent && isAnimating) {
|
|
59
|
-
send("ANIMATION_OUT");
|
|
60
|
-
} else {
|
|
61
|
-
send("UNMOUNT");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
prevPresentRef.current = present;
|
|
8
|
+
function createCollection(name) {
|
|
9
|
+
const PROVIDER_NAME = name + "CollectionProvider";
|
|
10
|
+
const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
|
|
11
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
12
|
+
PROVIDER_NAME,
|
|
13
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
14
|
+
);
|
|
15
|
+
const CollectionProvider = (props) => {
|
|
16
|
+
const { scope, children } = props;
|
|
17
|
+
const ref = React__default.useRef(null);
|
|
18
|
+
const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
|
|
19
|
+
return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
20
|
+
};
|
|
21
|
+
CollectionProvider.displayName = PROVIDER_NAME;
|
|
22
|
+
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
23
|
+
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
24
|
+
const CollectionSlot = React__default.forwardRef(
|
|
25
|
+
(props, forwardedRef) => {
|
|
26
|
+
const { scope, children } = props;
|
|
27
|
+
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
28
|
+
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
29
|
+
return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });
|
|
65
30
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const handleAnimationStart = (event) => {
|
|
88
|
-
if (event.target === node) {
|
|
89
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
93
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
94
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
95
|
-
return () => {
|
|
96
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
97
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
98
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
99
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
100
|
-
};
|
|
101
|
-
} else {
|
|
102
|
-
send("ANIMATION_END");
|
|
31
|
+
);
|
|
32
|
+
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
33
|
+
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
34
|
+
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
35
|
+
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
36
|
+
const CollectionItemSlot = React__default.forwardRef(
|
|
37
|
+
(props, forwardedRef) => {
|
|
38
|
+
const { scope, children, ...itemData } = props;
|
|
39
|
+
const ref = React__default.useRef(null);
|
|
40
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
41
|
+
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
42
|
+
React__default.useEffect(() => {
|
|
43
|
+
context.itemMap.set(ref, { ref, ...itemData });
|
|
44
|
+
return () => void context.itemMap.delete(ref);
|
|
45
|
+
});
|
|
46
|
+
return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
103
47
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (mayWarn) {
|
|
120
|
-
return element.ref;
|
|
121
|
-
}
|
|
122
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
123
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
124
|
-
if (mayWarn) {
|
|
125
|
-
return element.props.ref;
|
|
48
|
+
);
|
|
49
|
+
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
50
|
+
function useCollection(scope) {
|
|
51
|
+
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
52
|
+
const getItems = React__default.useCallback(() => {
|
|
53
|
+
const collectionNode = context.collectionRef.current;
|
|
54
|
+
if (!collectionNode) return [];
|
|
55
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
56
|
+
const items = Array.from(context.itemMap.values());
|
|
57
|
+
const orderedItems = items.sort(
|
|
58
|
+
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
59
|
+
);
|
|
60
|
+
return orderedItems;
|
|
61
|
+
}, [context.collectionRef, context.itemMap]);
|
|
62
|
+
return getItems;
|
|
126
63
|
}
|
|
127
|
-
return
|
|
64
|
+
return [
|
|
65
|
+
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
66
|
+
useCollection,
|
|
67
|
+
createCollectionScope
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// packages/react/direction/src/direction.tsx
|
|
72
|
+
var DirectionContext = React.createContext(void 0);
|
|
73
|
+
function useDirection(localDir) {
|
|
74
|
+
const globalDir = React.useContext(DirectionContext);
|
|
75
|
+
return localDir || globalDir || "ltr";
|
|
128
76
|
}
|
|
129
77
|
|
|
130
|
-
export {
|
|
78
|
+
export { createCollection as c, useDirection as u };
|
|
131
79
|
//# sourceMappingURL=index23.js.map
|
package/dist/index23.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index23.js","sources":["../node_modules/.pnpm/@radix-ui+react-presence@1.1.5_@types+react-dom@19.2.3_@types+react@19.2.14__@types+rea_ed1433b3a7b610ecabc4f5f1045d8cb3/node_modules/@radix-ui/react-presence/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/presence.tsx\nimport * as React2 from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\n\n// src/use-state-machine.tsx\nimport * as React from \"react\";\nfunction useStateMachine(initialState, machine) {\n return React.useReducer((state, event) => {\n const nextState = machine[state][event];\n return nextState ?? state;\n }, initialState);\n}\n\n// src/presence.tsx\nvar Presence = (props) => {\n const { present, children } = props;\n const presence = usePresence(present);\n const child = typeof children === \"function\" ? children({ present: presence.isPresent }) : React2.Children.only(children);\n const ref = useComposedRefs(presence.ref, getElementRef(child));\n const forceMount = typeof children === \"function\";\n return forceMount || presence.isPresent ? React2.cloneElement(child, { ref }) : null;\n};\nPresence.displayName = \"Presence\";\nfunction usePresence(present) {\n const [node, setNode] = React2.useState();\n const stylesRef = React2.useRef(null);\n const prevPresentRef = React2.useRef(present);\n const prevAnimationNameRef = React2.useRef(\"none\");\n const initialState = present ? \"mounted\" : \"unmounted\";\n const [state, send] = useStateMachine(initialState, {\n mounted: {\n UNMOUNT: \"unmounted\",\n ANIMATION_OUT: \"unmountSuspended\"\n },\n unmountSuspended: {\n MOUNT: \"mounted\",\n ANIMATION_END: \"unmounted\"\n },\n unmounted: {\n MOUNT: \"mounted\"\n }\n });\n React2.useEffect(() => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n prevAnimationNameRef.current = state === \"mounted\" ? currentAnimationName : \"none\";\n }, [state]);\n useLayoutEffect(() => {\n const styles = stylesRef.current;\n const wasPresent = prevPresentRef.current;\n const hasPresentChanged = wasPresent !== present;\n if (hasPresentChanged) {\n const prevAnimationName = prevAnimationNameRef.current;\n const currentAnimationName = getAnimationName(styles);\n if (present) {\n send(\"MOUNT\");\n } else if (currentAnimationName === \"none\" || styles?.display === \"none\") {\n send(\"UNMOUNT\");\n } else {\n const isAnimating = prevAnimationName !== currentAnimationName;\n if (wasPresent && isAnimating) {\n send(\"ANIMATION_OUT\");\n } else {\n send(\"UNMOUNT\");\n }\n }\n prevPresentRef.current = present;\n }\n }, [present, send]);\n useLayoutEffect(() => {\n if (node) {\n let timeoutId;\n const ownerWindow = node.ownerDocument.defaultView ?? window;\n const handleAnimationEnd = (event) => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n if (event.target === node && isCurrentAnimation) {\n send(\"ANIMATION_END\");\n if (!prevPresentRef.current) {\n const currentFillMode = node.style.animationFillMode;\n node.style.animationFillMode = \"forwards\";\n timeoutId = ownerWindow.setTimeout(() => {\n if (node.style.animationFillMode === \"forwards\") {\n node.style.animationFillMode = currentFillMode;\n }\n });\n }\n }\n };\n const handleAnimationStart = (event) => {\n if (event.target === node) {\n prevAnimationNameRef.current = getAnimationName(stylesRef.current);\n }\n };\n node.addEventListener(\"animationstart\", handleAnimationStart);\n node.addEventListener(\"animationcancel\", handleAnimationEnd);\n node.addEventListener(\"animationend\", handleAnimationEnd);\n return () => {\n ownerWindow.clearTimeout(timeoutId);\n node.removeEventListener(\"animationstart\", handleAnimationStart);\n node.removeEventListener(\"animationcancel\", handleAnimationEnd);\n node.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n } else {\n send(\"ANIMATION_END\");\n }\n }, [node, send]);\n return {\n isPresent: [\"mounted\", \"unmountSuspended\"].includes(state),\n ref: React2.useCallback((node2) => {\n stylesRef.current = node2 ? getComputedStyle(node2) : null;\n setNode(node2);\n }, [])\n };\n}\nfunction getAnimationName(styles) {\n return styles?.animationName || \"none\";\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Presence;\nexport {\n Presence,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["React2","useLayoutEffect"],"mappings":";;;;AASA,SAAS,eAAe,CAAC,YAAY,EAAE,OAAO,EAAE;AAChD,EAAE,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK;AAC5C,IAAI,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;AAC3C,IAAI,OAAO,SAAS,IAAI,KAAK;AAC7B,EAAE,CAAC,EAAE,YAAY,CAAC;AAClB;;AAEA;AACG,IAAC,QAAQ,GAAG,CAAC,KAAK,KAAK;AAC1B,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK;AACrC,EAAE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;AACvC,EAAE,MAAM,KAAK,GAAG,OAAO,QAAQ,KAAK,UAAU,GAAG,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAGA,KAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC3H,EAAE,MAAM,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;AACjE,EAAE,MAAM,UAAU,GAAG,OAAO,QAAQ,KAAK,UAAU;AACnD,EAAE,OAAO,UAAU,IAAI,QAAQ,CAAC,SAAS,GAAGA,KAAM,CAAC,YAAY,CAAC,KAAK,EA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EAAE,OAAO;AACT,IAAI,SAAS,EAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC9D,IAAI,GAAG,EAAED,KAAM,CAAC,WAAW,CAAC,CAAC,KAAK,KAAK;AACvC,MAAM,SAAS,CAAC,OAAO,GAAG,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,IAAI;AAChE,MAAM,OAAO,CAAC,KAAK,CAAC;AACpB,IAAI,CAAC,EAAE,EAAE;AACT,GAAG;AACH;AACA,SAAS,gBAAgB,CAAC,MAAM,EAAE;AAClC,EAAE,OAAO,MAAM,EAAE,aAAa,IAAI,MAAM;AACxC;AACA,SAAS,aAAa,CAAC,OAAO,EAAE;AAChC,EAAE,IAAI,MAAM,GAAG,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,GAAG;AACzE,EAAE,IAAI,OAAO,GAAG,MAAM,IAAI,gBAAgB,IAAI,MAAM,IAAI,MAAM,CAAC,cAAc;AAC7E,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,OAAO,OAAO,CAAC,GAAG;AACtB,EAAE;AACF,EAAE,MAAM,GAAG,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,GAAG;AAC/D,EAAE,OAAO,GAAG,MAAM,IAAI,gBAAgB,IAAI,MAAM,IAAI,MAAM,CAAC,cAAc;AACzE,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG;AAC5B,EAAE;AACF,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG;AACzC;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index23.js","sources":["../node_modules/.pnpm/@radix-ui+react-collection@1.1.7_@types+react-dom@19.2.3_@types+react@19.2.14__@types+r_866d2b1ec480a6792c715ca737417d06/node_modules/@radix-ui/react-collection/dist/index.mjs","../node_modules/.pnpm/@radix-ui+react-direction@1.1.1_@types+react@19.2.14_react@19.2.3/node_modules/@radix-ui/react-direction/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n insert(index, key, value) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i];\n if (keys[i] === key) {\n nextKey = keys[i + 1];\n }\n if (has) {\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1];\n const currentValue = nextValue;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n find(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return void 0;\n }\n findIndex(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n filter(predicate, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new _OrderedDict(entries);\n }\n map(callbackfn, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new _OrderedDict(entries);\n }\n reduce(...args) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0);\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1);\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index);\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index);\n const element = this.get(key);\n reversed.set(key, element);\n }\n return reversed;\n }\n toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\n }\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index);\n const element = this.get(key);\n result.set(key, element);\n }\n return result;\n }\n every(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n some(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n};\nfunction at(array, index) {\n if (\"at\" in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0\n }\n );\n const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\n });\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\n if (a === b) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\") return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === \"childList\") {\n callback();\n return;\n }\n }\n });\n return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/direction/src/direction.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DirectionContext = React.createContext(void 0);\nvar DirectionProvider = (props) => {\n const { dir, children } = props;\n return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });\n};\nfunction useDirection(localDir) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\nvar Provider = DirectionProvider;\nexport {\n DirectionProvider,\n Provider,\n useDirection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["React"],"mappings":";;;;;;;AAQA,SAAS,gBAAgB,CAAC,IAAI,EAAE;AAChC,EAAE,MAAM,aAAa,GAAG,IAAI,GAAG,oBAAoB;AACnD,EAAE,MAAM,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,GAAG,kBAAkB,CAAC,aAAa,CAAC;AAC5F,EAAE,MAAM,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,GAAG,uBAAuB;AAChF,IAAI,aAAa;AACjB,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,kBAAkB,IAAI,GAAG,EAAE;AAC1E,GAAG;AACH,EAAE,MAAM,kBAAkB,GAAG,CAAC,KAAK,KAAK;AACxC,IAAI,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK;AACrC,IAAI,MAAM,GAAG,GAAGA,cAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AAClC,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