astro-md-editor 0.0.7 → 0.0.8
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/.output/nitro.json +1 -1
- package/.output/public/assets/index-CstiJsWh.js +378 -0
- package/.output/public/assets/{main-BrRIwdKE.js → main-Cc9C-tdG.js} +1 -1
- package/.output/public/assets/styles-DCSwPMSs.css +1 -0
- package/.output/server/{__root-CL_tq3ov.mjs → __root-Bv3dTvZ5.mjs} +1 -1
- package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +210 -0
- package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +11 -0
- package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +69 -0
- package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-escape-keydown+[...].mjs +17 -0
- package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +6 -0
- package/.output/server/_libs/aria-hidden.mjs +122 -0
- package/.output/server/_libs/base-ui__react.mjs +2548 -2548
- package/.output/server/_libs/base-ui__utils.mjs +2 -2
- package/.output/server/_libs/cmdk.mjs +315 -0
- package/.output/server/_libs/detect-node-es.mjs +1 -0
- package/.output/server/_libs/get-nonce.mjs +9 -0
- package/.output/server/_libs/lucide-react.mjs +25 -17
- package/.output/server/_libs/radix-ui__primitive.mjs +11 -0
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +39 -0
- package/.output/server/_libs/radix-ui__react-context.mjs +78 -0
- package/.output/server/_libs/radix-ui__react-dialog.mjs +319 -0
- package/.output/server/_libs/radix-ui__react-focus-guards.mjs +29 -0
- package/.output/server/_libs/radix-ui__react-focus-scope.mjs +206 -0
- package/.output/server/_libs/radix-ui__react-id.mjs +14 -0
- package/.output/server/_libs/radix-ui__react-portal.mjs +16 -0
- package/.output/server/_libs/radix-ui__react-presence.mjs +128 -0
- package/.output/server/_libs/radix-ui__react-primitive.mjs +75 -0
- package/.output/server/_libs/radix-ui__react-slot.mjs +184 -0
- package/.output/server/_libs/react-remove-scroll-bar.mjs +82 -0
- package/.output/server/_libs/react-remove-scroll.mjs +328 -0
- package/.output/server/_libs/react-style-singleton.mjs +69 -0
- package/.output/server/_libs/react.mjs +2 -0
- package/.output/server/_libs/tslib.mjs +576 -0
- package/.output/server/_libs/use-callback-ref.mjs +66 -0
- package/.output/server/_libs/use-sidecar.mjs +106 -0
- package/.output/server/_ssr/{ImageAssetBrowser-DNDdTqtf.mjs → ImageAssetBrowser-DuPVChYO.mjs} +2 -2
- package/.output/server/_ssr/{collections.server-s12asITg.mjs → collections.server-DjgohZR7.mjs} +2 -1
- package/.output/server/_ssr/{file-history.api-oydnxFVV.mjs → file-history.api-JMkTXrYq.mjs} +1 -1
- package/.output/server/_ssr/{image-assets.server-Ci2E1_Tm.mjs → image-assets.server-2-0DgxSb.mjs} +1 -1
- package/.output/server/_ssr/{image-preview.api-pcN5PQhH.mjs → image-preview.api-V_Q-MBx9.mjs} +2 -2
- package/.output/server/_ssr/{index-BjQuGIib.mjs → index-ByW88Uz2.mjs} +3 -2
- package/.output/server/_ssr/{index-qpTkRHX1.mjs → index-C6Fb3DjG.mjs} +796 -409
- package/.output/server/_ssr/index.mjs +15 -15
- package/.output/server/_ssr/{router-DU3Hv7p_.mjs → router-DbnWNAi_.mjs} +2 -2
- package/.output/server/{_tanstack-start-manifest_v-BdKE8Xjm.mjs → _tanstack-start-manifest_v-BDWWBEf1.mjs} +1 -1
- package/.output/server/index.mjs +49 -49
- package/LICENSE.md +1 -1
- package/package.json +2 -1
- package/scripts/bootstrap-collections.mjs +2 -0
- package/.output/public/assets/index-CBGDT9fi.js +0 -334
- package/.output/public/assets/styles-CezfLgHY.css +0 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { r as reactExports } from "./react.mjs";
|
|
2
|
+
import { u as useComposedRefs } from "./radix-ui__react-compose-refs.mjs";
|
|
3
|
+
import { u as useLayoutEffect2 } from "./@radix-ui/react-use-layout-effect+[...].mjs";
|
|
4
|
+
function useStateMachine(initialState, machine) {
|
|
5
|
+
return reactExports.useReducer((state, event) => {
|
|
6
|
+
const nextState = machine[state][event];
|
|
7
|
+
return nextState ?? state;
|
|
8
|
+
}, initialState);
|
|
9
|
+
}
|
|
10
|
+
var Presence = (props) => {
|
|
11
|
+
const { present, children } = props;
|
|
12
|
+
const presence = usePresence(present);
|
|
13
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : reactExports.Children.only(children);
|
|
14
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
15
|
+
const forceMount = typeof children === "function";
|
|
16
|
+
return forceMount || presence.isPresent ? reactExports.cloneElement(child, { ref }) : null;
|
|
17
|
+
};
|
|
18
|
+
Presence.displayName = "Presence";
|
|
19
|
+
function usePresence(present) {
|
|
20
|
+
const [node, setNode] = reactExports.useState();
|
|
21
|
+
const stylesRef = reactExports.useRef(null);
|
|
22
|
+
const prevPresentRef = reactExports.useRef(present);
|
|
23
|
+
const prevAnimationNameRef = reactExports.useRef("none");
|
|
24
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
25
|
+
const [state, send] = useStateMachine(initialState, {
|
|
26
|
+
mounted: {
|
|
27
|
+
UNMOUNT: "unmounted",
|
|
28
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
29
|
+
},
|
|
30
|
+
unmountSuspended: {
|
|
31
|
+
MOUNT: "mounted",
|
|
32
|
+
ANIMATION_END: "unmounted"
|
|
33
|
+
},
|
|
34
|
+
unmounted: {
|
|
35
|
+
MOUNT: "mounted"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
reactExports.useEffect(() => {
|
|
39
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
40
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
41
|
+
}, [state]);
|
|
42
|
+
useLayoutEffect2(() => {
|
|
43
|
+
const styles = stylesRef.current;
|
|
44
|
+
const wasPresent = prevPresentRef.current;
|
|
45
|
+
const hasPresentChanged = wasPresent !== present;
|
|
46
|
+
if (hasPresentChanged) {
|
|
47
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
48
|
+
const currentAnimationName = getAnimationName(styles);
|
|
49
|
+
if (present) {
|
|
50
|
+
send("MOUNT");
|
|
51
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
52
|
+
send("UNMOUNT");
|
|
53
|
+
} else {
|
|
54
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
55
|
+
if (wasPresent && isAnimating) {
|
|
56
|
+
send("ANIMATION_OUT");
|
|
57
|
+
} else {
|
|
58
|
+
send("UNMOUNT");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
prevPresentRef.current = present;
|
|
62
|
+
}
|
|
63
|
+
}, [present, send]);
|
|
64
|
+
useLayoutEffect2(() => {
|
|
65
|
+
if (node) {
|
|
66
|
+
let timeoutId;
|
|
67
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
68
|
+
const handleAnimationEnd = (event) => {
|
|
69
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
70
|
+
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
71
|
+
if (event.target === node && isCurrentAnimation) {
|
|
72
|
+
send("ANIMATION_END");
|
|
73
|
+
if (!prevPresentRef.current) {
|
|
74
|
+
const currentFillMode = node.style.animationFillMode;
|
|
75
|
+
node.style.animationFillMode = "forwards";
|
|
76
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
77
|
+
if (node.style.animationFillMode === "forwards") {
|
|
78
|
+
node.style.animationFillMode = currentFillMode;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const handleAnimationStart = (event) => {
|
|
85
|
+
if (event.target === node) {
|
|
86
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
90
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
91
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
92
|
+
return () => {
|
|
93
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
94
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
95
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
96
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
97
|
+
};
|
|
98
|
+
} else {
|
|
99
|
+
send("ANIMATION_END");
|
|
100
|
+
}
|
|
101
|
+
}, [node, send]);
|
|
102
|
+
return {
|
|
103
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
104
|
+
ref: reactExports.useCallback((node2) => {
|
|
105
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
106
|
+
setNode(node2);
|
|
107
|
+
}, [])
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function getAnimationName(styles) {
|
|
111
|
+
return styles?.animationName || "none";
|
|
112
|
+
}
|
|
113
|
+
function getElementRef(element) {
|
|
114
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
115
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
116
|
+
if (mayWarn) {
|
|
117
|
+
return element.ref;
|
|
118
|
+
}
|
|
119
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
120
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
121
|
+
if (mayWarn) {
|
|
122
|
+
return element.props.ref;
|
|
123
|
+
}
|
|
124
|
+
return element.props.ref || element.ref;
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
Presence as P
|
|
128
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports } from "./react.mjs";
|
|
2
|
+
import { r as reactDomExports } from "./react-dom.mjs";
|
|
3
|
+
import { c as createSlot, a as createSlot$1 } from "./radix-ui__react-slot.mjs";
|
|
4
|
+
var NODES$1 = [
|
|
5
|
+
"a",
|
|
6
|
+
"button",
|
|
7
|
+
"div",
|
|
8
|
+
"form",
|
|
9
|
+
"h2",
|
|
10
|
+
"h3",
|
|
11
|
+
"img",
|
|
12
|
+
"input",
|
|
13
|
+
"label",
|
|
14
|
+
"li",
|
|
15
|
+
"nav",
|
|
16
|
+
"ol",
|
|
17
|
+
"p",
|
|
18
|
+
"select",
|
|
19
|
+
"span",
|
|
20
|
+
"svg",
|
|
21
|
+
"ul"
|
|
22
|
+
];
|
|
23
|
+
var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
24
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
25
|
+
const Node = reactExports.forwardRef((props, forwardedRef) => {
|
|
26
|
+
const { asChild, ...primitiveProps } = props;
|
|
27
|
+
const Comp = asChild ? Slot : node;
|
|
28
|
+
if (typeof window !== "undefined") {
|
|
29
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
32
|
+
});
|
|
33
|
+
Node.displayName = `Primitive.${node}`;
|
|
34
|
+
return { ...primitive, [node]: Node };
|
|
35
|
+
}, {});
|
|
36
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
37
|
+
if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
|
|
38
|
+
}
|
|
39
|
+
var NODES = [
|
|
40
|
+
"a",
|
|
41
|
+
"button",
|
|
42
|
+
"div",
|
|
43
|
+
"form",
|
|
44
|
+
"h2",
|
|
45
|
+
"h3",
|
|
46
|
+
"img",
|
|
47
|
+
"input",
|
|
48
|
+
"label",
|
|
49
|
+
"li",
|
|
50
|
+
"nav",
|
|
51
|
+
"ol",
|
|
52
|
+
"p",
|
|
53
|
+
"select",
|
|
54
|
+
"span",
|
|
55
|
+
"svg",
|
|
56
|
+
"ul"
|
|
57
|
+
];
|
|
58
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
59
|
+
const Slot = createSlot$1(`Primitive.${node}`);
|
|
60
|
+
const Node = reactExports.forwardRef((props, forwardedRef) => {
|
|
61
|
+
const { asChild, ...primitiveProps } = props;
|
|
62
|
+
const Comp = asChild ? Slot : node;
|
|
63
|
+
if (typeof window !== "undefined") {
|
|
64
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
67
|
+
});
|
|
68
|
+
Node.displayName = `Primitive.${node}`;
|
|
69
|
+
return { ...primitive, [node]: Node };
|
|
70
|
+
}, {});
|
|
71
|
+
export {
|
|
72
|
+
Primitive as P,
|
|
73
|
+
Primitive$1 as a,
|
|
74
|
+
dispatchDiscreteCustomEvent as d
|
|
75
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports, R as React } from "./react.mjs";
|
|
2
|
+
import { c as composeRefs } from "./radix-ui__react-compose-refs.mjs";
|
|
3
|
+
// @__NO_SIDE_EFFECTS__
|
|
4
|
+
function createSlot$1(ownerName) {
|
|
5
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
|
|
6
|
+
const Slot2 = reactExports.forwardRef((props, forwardedRef) => {
|
|
7
|
+
const { children, ...slotProps } = props;
|
|
8
|
+
const childrenArray = reactExports.Children.toArray(children);
|
|
9
|
+
const slottable = childrenArray.find(isSlottable$1);
|
|
10
|
+
if (slottable) {
|
|
11
|
+
const newElement = slottable.props.children;
|
|
12
|
+
const newChildren = childrenArray.map((child) => {
|
|
13
|
+
if (child === slottable) {
|
|
14
|
+
if (reactExports.Children.count(newElement) > 1) return reactExports.Children.only(null);
|
|
15
|
+
return reactExports.isValidElement(newElement) ? newElement.props.children : null;
|
|
16
|
+
} else {
|
|
17
|
+
return child;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: reactExports.isValidElement(newElement) ? reactExports.cloneElement(newElement, void 0, newChildren) : null });
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
23
|
+
});
|
|
24
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
25
|
+
return Slot2;
|
|
26
|
+
}
|
|
27
|
+
// @__NO_SIDE_EFFECTS__
|
|
28
|
+
function createSlotClone$1(ownerName) {
|
|
29
|
+
const SlotClone = reactExports.forwardRef((props, forwardedRef) => {
|
|
30
|
+
const { children, ...slotProps } = props;
|
|
31
|
+
if (reactExports.isValidElement(children)) {
|
|
32
|
+
const childrenRef = getElementRef$1(children);
|
|
33
|
+
const props2 = mergeProps$1(slotProps, children.props);
|
|
34
|
+
if (children.type !== reactExports.Fragment) {
|
|
35
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
36
|
+
}
|
|
37
|
+
return reactExports.cloneElement(children, props2);
|
|
38
|
+
}
|
|
39
|
+
return reactExports.Children.count(children) > 1 ? reactExports.Children.only(null) : null;
|
|
40
|
+
});
|
|
41
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
42
|
+
return SlotClone;
|
|
43
|
+
}
|
|
44
|
+
var SLOTTABLE_IDENTIFIER$1 = /* @__PURE__ */ Symbol("radix.slottable");
|
|
45
|
+
function isSlottable$1(child) {
|
|
46
|
+
return reactExports.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
|
|
47
|
+
}
|
|
48
|
+
function mergeProps$1(slotProps, childProps) {
|
|
49
|
+
const overrideProps = { ...childProps };
|
|
50
|
+
for (const propName in childProps) {
|
|
51
|
+
const slotPropValue = slotProps[propName];
|
|
52
|
+
const childPropValue = childProps[propName];
|
|
53
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
54
|
+
if (isHandler) {
|
|
55
|
+
if (slotPropValue && childPropValue) {
|
|
56
|
+
overrideProps[propName] = (...args) => {
|
|
57
|
+
const result = childPropValue(...args);
|
|
58
|
+
slotPropValue(...args);
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
} else if (slotPropValue) {
|
|
62
|
+
overrideProps[propName] = slotPropValue;
|
|
63
|
+
}
|
|
64
|
+
} else if (propName === "style") {
|
|
65
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
66
|
+
} else if (propName === "className") {
|
|
67
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return { ...slotProps, ...overrideProps };
|
|
71
|
+
}
|
|
72
|
+
function getElementRef$1(element) {
|
|
73
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
74
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
75
|
+
if (mayWarn) {
|
|
76
|
+
return element.ref;
|
|
77
|
+
}
|
|
78
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
79
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
80
|
+
if (mayWarn) {
|
|
81
|
+
return element.props.ref;
|
|
82
|
+
}
|
|
83
|
+
return element.props.ref || element.ref;
|
|
84
|
+
}
|
|
85
|
+
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
86
|
+
var use = React[" use ".trim().toString()];
|
|
87
|
+
function isPromiseLike(value) {
|
|
88
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
89
|
+
}
|
|
90
|
+
function isLazyComponent(element) {
|
|
91
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
92
|
+
}
|
|
93
|
+
// @__NO_SIDE_EFFECTS__
|
|
94
|
+
function createSlot(ownerName) {
|
|
95
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
96
|
+
const Slot2 = reactExports.forwardRef((props, forwardedRef) => {
|
|
97
|
+
let { children, ...slotProps } = props;
|
|
98
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
99
|
+
children = use(children._payload);
|
|
100
|
+
}
|
|
101
|
+
const childrenArray = reactExports.Children.toArray(children);
|
|
102
|
+
const slottable = childrenArray.find(isSlottable);
|
|
103
|
+
if (slottable) {
|
|
104
|
+
const newElement = slottable.props.children;
|
|
105
|
+
const newChildren = childrenArray.map((child) => {
|
|
106
|
+
if (child === slottable) {
|
|
107
|
+
if (reactExports.Children.count(newElement) > 1) return reactExports.Children.only(null);
|
|
108
|
+
return reactExports.isValidElement(newElement) ? newElement.props.children : null;
|
|
109
|
+
} else {
|
|
110
|
+
return child;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: reactExports.isValidElement(newElement) ? reactExports.cloneElement(newElement, void 0, newChildren) : null });
|
|
114
|
+
}
|
|
115
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
116
|
+
});
|
|
117
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
118
|
+
return Slot2;
|
|
119
|
+
}
|
|
120
|
+
// @__NO_SIDE_EFFECTS__
|
|
121
|
+
function createSlotClone(ownerName) {
|
|
122
|
+
const SlotClone = reactExports.forwardRef((props, forwardedRef) => {
|
|
123
|
+
let { children, ...slotProps } = props;
|
|
124
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
125
|
+
children = use(children._payload);
|
|
126
|
+
}
|
|
127
|
+
if (reactExports.isValidElement(children)) {
|
|
128
|
+
const childrenRef = getElementRef(children);
|
|
129
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
130
|
+
if (children.type !== reactExports.Fragment) {
|
|
131
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
132
|
+
}
|
|
133
|
+
return reactExports.cloneElement(children, props2);
|
|
134
|
+
}
|
|
135
|
+
return reactExports.Children.count(children) > 1 ? reactExports.Children.only(null) : null;
|
|
136
|
+
});
|
|
137
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
138
|
+
return SlotClone;
|
|
139
|
+
}
|
|
140
|
+
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
141
|
+
function isSlottable(child) {
|
|
142
|
+
return reactExports.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
143
|
+
}
|
|
144
|
+
function mergeProps(slotProps, childProps) {
|
|
145
|
+
const overrideProps = { ...childProps };
|
|
146
|
+
for (const propName in childProps) {
|
|
147
|
+
const slotPropValue = slotProps[propName];
|
|
148
|
+
const childPropValue = childProps[propName];
|
|
149
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
150
|
+
if (isHandler) {
|
|
151
|
+
if (slotPropValue && childPropValue) {
|
|
152
|
+
overrideProps[propName] = (...args) => {
|
|
153
|
+
const result = childPropValue(...args);
|
|
154
|
+
slotPropValue(...args);
|
|
155
|
+
return result;
|
|
156
|
+
};
|
|
157
|
+
} else if (slotPropValue) {
|
|
158
|
+
overrideProps[propName] = slotPropValue;
|
|
159
|
+
}
|
|
160
|
+
} else if (propName === "style") {
|
|
161
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
162
|
+
} else if (propName === "className") {
|
|
163
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return { ...slotProps, ...overrideProps };
|
|
167
|
+
}
|
|
168
|
+
function getElementRef(element) {
|
|
169
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
170
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
171
|
+
if (mayWarn) {
|
|
172
|
+
return element.ref;
|
|
173
|
+
}
|
|
174
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
175
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
176
|
+
if (mayWarn) {
|
|
177
|
+
return element.props.ref;
|
|
178
|
+
}
|
|
179
|
+
return element.props.ref || element.ref;
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
createSlot as a,
|
|
183
|
+
createSlot$1 as c
|
|
184
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { r as reactExports } from "./react.mjs";
|
|
2
|
+
import { s as styleSingleton } from "./react-style-singleton.mjs";
|
|
3
|
+
var zeroRightClassName = "right-scroll-bar-position";
|
|
4
|
+
var fullWidthClassName = "width-before-scroll-bar";
|
|
5
|
+
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
6
|
+
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
7
|
+
var zeroGap = {
|
|
8
|
+
left: 0,
|
|
9
|
+
top: 0,
|
|
10
|
+
right: 0,
|
|
11
|
+
gap: 0
|
|
12
|
+
};
|
|
13
|
+
var parse = function(x) {
|
|
14
|
+
return parseInt(x || "", 10) || 0;
|
|
15
|
+
};
|
|
16
|
+
var getOffset = function(gapMode) {
|
|
17
|
+
var cs = window.getComputedStyle(document.body);
|
|
18
|
+
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
19
|
+
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
20
|
+
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
21
|
+
return [parse(left), parse(top), parse(right)];
|
|
22
|
+
};
|
|
23
|
+
var getGapWidth = function(gapMode) {
|
|
24
|
+
if (gapMode === void 0) {
|
|
25
|
+
gapMode = "margin";
|
|
26
|
+
}
|
|
27
|
+
if (typeof window === "undefined") {
|
|
28
|
+
return zeroGap;
|
|
29
|
+
}
|
|
30
|
+
var offsets = getOffset(gapMode);
|
|
31
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
32
|
+
var windowWidth = window.innerWidth;
|
|
33
|
+
return {
|
|
34
|
+
left: offsets[0],
|
|
35
|
+
top: offsets[1],
|
|
36
|
+
right: offsets[2],
|
|
37
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
var Style = styleSingleton();
|
|
41
|
+
var lockAttribute = "data-scroll-locked";
|
|
42
|
+
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
43
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
44
|
+
if (gapMode === void 0) {
|
|
45
|
+
gapMode = "margin";
|
|
46
|
+
}
|
|
47
|
+
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
48
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
49
|
+
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
50
|
+
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
51
|
+
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
52
|
+
};
|
|
53
|
+
var getCurrentUseCounter = function() {
|
|
54
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
55
|
+
return isFinite(counter) ? counter : 0;
|
|
56
|
+
};
|
|
57
|
+
var useLockAttribute = function() {
|
|
58
|
+
reactExports.useEffect(function() {
|
|
59
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
60
|
+
return function() {
|
|
61
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
62
|
+
if (newCounter <= 0) {
|
|
63
|
+
document.body.removeAttribute(lockAttribute);
|
|
64
|
+
} else {
|
|
65
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}, []);
|
|
69
|
+
};
|
|
70
|
+
var RemoveScrollBar = function(_a) {
|
|
71
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
72
|
+
useLockAttribute();
|
|
73
|
+
var gap = reactExports.useMemo(function() {
|
|
74
|
+
return getGapWidth(gapMode);
|
|
75
|
+
}, [gapMode]);
|
|
76
|
+
return reactExports.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
RemoveScrollBar as R,
|
|
80
|
+
fullWidthClassName as f,
|
|
81
|
+
zeroRightClassName as z
|
|
82
|
+
};
|