astro-md-editor 0.0.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/.output/nitro.json +17 -0
- package/.output/public/assets/index-Cc7yKB0o.js +19 -0
- package/.output/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/.output/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/.output/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/.output/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/.output/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/.output/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/.output/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/.output/public/assets/main-DDBjVFnt.js +17 -0
- package/.output/public/assets/styles-ggfdUHMo.css +1 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/logo192.png +0 -0
- package/.output/public/logo512.png +0 -0
- package/.output/public/manifest.json +25 -0
- package/.output/public/robots.txt +3 -0
- package/.output/server/__root-C09LBXMv.mjs +40 -0
- package/.output/server/_chunks/ssr-renderer.mjs +21 -0
- package/.output/server/_libs/ajv-formats.mjs +330 -0
- package/.output/server/_libs/ajv.mjs +5484 -0
- package/.output/server/_libs/base-ui__react.mjs +8712 -0
- package/.output/server/_libs/base-ui__utils.mjs +980 -0
- package/.output/server/_libs/class-variance-authority.mjs +44 -0
- package/.output/server/_libs/clsx.mjs +16 -0
- package/.output/server/_libs/cookie-es.mjs +58 -0
- package/.output/server/_libs/croner.mjs +1 -0
- package/.output/server/_libs/crossws.mjs +1 -0
- package/.output/server/_libs/date-fns.mjs +1716 -0
- package/.output/server/_libs/date-fns__tz.mjs +217 -0
- package/.output/server/_libs/extend-shallow.mjs +35 -0
- package/.output/server/_libs/fast-deep-equal.mjs +38 -0
- package/.output/server/_libs/fast-uri.mjs +725 -0
- package/.output/server/_libs/floating-ui__core.mjs +663 -0
- package/.output/server/_libs/floating-ui__dom.mjs +624 -0
- package/.output/server/_libs/floating-ui__react-dom.mjs +279 -0
- package/.output/server/_libs/floating-ui__utils.mjs +322 -0
- package/.output/server/_libs/gray-matter.mjs +393 -0
- package/.output/server/_libs/h3-v2.mjs +276 -0
- package/.output/server/_libs/h3.mjs +400 -0
- package/.output/server/_libs/hookable.mjs +1 -0
- package/.output/server/_libs/is-extendable.mjs +13 -0
- package/.output/server/_libs/isbot.mjs +20 -0
- package/.output/server/_libs/js-yaml.mjs +2822 -0
- package/.output/server/_libs/json-schema-traverse.mjs +91 -0
- package/.output/server/_libs/kind-of.mjs +125 -0
- package/.output/server/_libs/lucide-react.mjs +177 -0
- package/.output/server/_libs/ohash.mjs +1 -0
- package/.output/server/_libs/react-day-picker.mjs +2216 -0
- package/.output/server/_libs/react-dom.mjs +10779 -0
- package/.output/server/_libs/react-resizable-panels.mjs +2024 -0
- package/.output/server/_libs/react.mjs +513 -0
- package/.output/server/_libs/reselect.mjs +326 -0
- package/.output/server/_libs/rou3.mjs +8 -0
- package/.output/server/_libs/section-matter.mjs +112 -0
- package/.output/server/_libs/seroval-plugins.mjs +58 -0
- package/.output/server/_libs/seroval.mjs +1765 -0
- package/.output/server/_libs/srvx.mjs +736 -0
- package/.output/server/_libs/strip-bom-string.mjs +16 -0
- package/.output/server/_libs/tabbable.mjs +342 -0
- package/.output/server/_libs/tailwind-merge.mjs +3175 -0
- package/.output/server/_libs/tanstack__history.mjs +217 -0
- package/.output/server/_libs/tanstack__react-router.mjs +1464 -0
- package/.output/server/_libs/tanstack__react-store.mjs +1 -0
- package/.output/server/_libs/tanstack__router-core.mjs +4912 -0
- package/.output/server/_libs/tanstack__store.mjs +1 -0
- package/.output/server/_libs/tiny-invariant.mjs +12 -0
- package/.output/server/_libs/tiny-warning.mjs +5 -0
- package/.output/server/_libs/ufo.mjs +54 -0
- package/.output/server/_libs/unctx.mjs +1 -0
- package/.output/server/_libs/unstorage.mjs +1 -0
- package/.output/server/_libs/use-sync-external-store.mjs +139 -0
- package/.output/server/_libs/zod.mjs +3634 -0
- package/.output/server/_libs/zustand.mjs +43 -0
- package/.output/server/_ssr/RightSidebar-RSY9M7XF.mjs +218 -0
- package/.output/server/_ssr/collections.server-D6U2tEsT.mjs +120 -0
- package/.output/server/_ssr/createServerRpc-29xaFZcb.mjs +12 -0
- package/.output/server/_ssr/index-BaqV4cZC.mjs +2083 -0
- package/.output/server/_ssr/index-sQBM6rwN.mjs +115 -0
- package/.output/server/_ssr/index.mjs +1448 -0
- package/.output/server/_ssr/router-D4G1DGr3.mjs +155 -0
- package/.output/server/_ssr/start-HYkvq4Ni.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-CYEHh_qB.mjs +4 -0
- package/.output/server/index.mjs +451 -0
- package/README.md +118 -0
- package/index.mjs +21 -0
- package/package.json +86 -0
- package/scripts/bootstrap-collections.mjs +1201 -0
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
import { n as evaluate, t as getSide, u as getSideAxis, v as getOppositePlacement, w as getExpandedPlacements, x as getOppositeAxisPlacements, y as getAlignmentSides, q as getAlignment, z as min, A as max, p as getAlignmentAxis, o as getPaddingObject, B as rectToClientRect, C as sides, r as getAxisLength, s as clamp, D as getOppositeAxis } from "./floating-ui__utils.mjs";
|
|
2
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
3
|
+
let {
|
|
4
|
+
reference,
|
|
5
|
+
floating
|
|
6
|
+
} = _ref;
|
|
7
|
+
const sideAxis = getSideAxis(placement);
|
|
8
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
9
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
10
|
+
const side = getSide(placement);
|
|
11
|
+
const isVertical = sideAxis === "y";
|
|
12
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
13
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
14
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
15
|
+
let coords;
|
|
16
|
+
switch (side) {
|
|
17
|
+
case "top":
|
|
18
|
+
coords = {
|
|
19
|
+
x: commonX,
|
|
20
|
+
y: reference.y - floating.height
|
|
21
|
+
};
|
|
22
|
+
break;
|
|
23
|
+
case "bottom":
|
|
24
|
+
coords = {
|
|
25
|
+
x: commonX,
|
|
26
|
+
y: reference.y + reference.height
|
|
27
|
+
};
|
|
28
|
+
break;
|
|
29
|
+
case "right":
|
|
30
|
+
coords = {
|
|
31
|
+
x: reference.x + reference.width,
|
|
32
|
+
y: commonY
|
|
33
|
+
};
|
|
34
|
+
break;
|
|
35
|
+
case "left":
|
|
36
|
+
coords = {
|
|
37
|
+
x: reference.x - floating.width,
|
|
38
|
+
y: commonY
|
|
39
|
+
};
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
coords = {
|
|
43
|
+
x: reference.x,
|
|
44
|
+
y: reference.y
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
switch (getAlignment(placement)) {
|
|
48
|
+
case "start":
|
|
49
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
50
|
+
break;
|
|
51
|
+
case "end":
|
|
52
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
return coords;
|
|
56
|
+
}
|
|
57
|
+
async function detectOverflow(state, options) {
|
|
58
|
+
var _await$platform$isEle;
|
|
59
|
+
if (options === void 0) {
|
|
60
|
+
options = {};
|
|
61
|
+
}
|
|
62
|
+
const {
|
|
63
|
+
x,
|
|
64
|
+
y,
|
|
65
|
+
platform,
|
|
66
|
+
rects,
|
|
67
|
+
elements,
|
|
68
|
+
strategy
|
|
69
|
+
} = state;
|
|
70
|
+
const {
|
|
71
|
+
boundary = "clippingAncestors",
|
|
72
|
+
rootBoundary = "viewport",
|
|
73
|
+
elementContext = "floating",
|
|
74
|
+
altBoundary = false,
|
|
75
|
+
padding = 0
|
|
76
|
+
} = evaluate(options, state);
|
|
77
|
+
const paddingObject = getPaddingObject(padding);
|
|
78
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
79
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
80
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
81
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
|
|
82
|
+
boundary,
|
|
83
|
+
rootBoundary,
|
|
84
|
+
strategy
|
|
85
|
+
}));
|
|
86
|
+
const rect = elementContext === "floating" ? {
|
|
87
|
+
x,
|
|
88
|
+
y,
|
|
89
|
+
width: rects.floating.width,
|
|
90
|
+
height: rects.floating.height
|
|
91
|
+
} : rects.reference;
|
|
92
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
93
|
+
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
|
94
|
+
x: 1,
|
|
95
|
+
y: 1
|
|
96
|
+
} : {
|
|
97
|
+
x: 1,
|
|
98
|
+
y: 1
|
|
99
|
+
};
|
|
100
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
101
|
+
elements,
|
|
102
|
+
rect,
|
|
103
|
+
offsetParent,
|
|
104
|
+
strategy
|
|
105
|
+
}) : rect);
|
|
106
|
+
return {
|
|
107
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
108
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
109
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
110
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const MAX_RESET_COUNT = 50;
|
|
114
|
+
const computePosition = async (reference, floating, config) => {
|
|
115
|
+
const {
|
|
116
|
+
placement = "bottom",
|
|
117
|
+
strategy = "absolute",
|
|
118
|
+
middleware = [],
|
|
119
|
+
platform
|
|
120
|
+
} = config;
|
|
121
|
+
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
122
|
+
...platform,
|
|
123
|
+
detectOverflow
|
|
124
|
+
};
|
|
125
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
126
|
+
let rects = await platform.getElementRects({
|
|
127
|
+
reference,
|
|
128
|
+
floating,
|
|
129
|
+
strategy
|
|
130
|
+
});
|
|
131
|
+
let {
|
|
132
|
+
x,
|
|
133
|
+
y
|
|
134
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
135
|
+
let statefulPlacement = placement;
|
|
136
|
+
let resetCount = 0;
|
|
137
|
+
const middlewareData = {};
|
|
138
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
139
|
+
const currentMiddleware = middleware[i];
|
|
140
|
+
if (!currentMiddleware) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const {
|
|
144
|
+
name,
|
|
145
|
+
fn
|
|
146
|
+
} = currentMiddleware;
|
|
147
|
+
const {
|
|
148
|
+
x: nextX,
|
|
149
|
+
y: nextY,
|
|
150
|
+
data,
|
|
151
|
+
reset
|
|
152
|
+
} = await fn({
|
|
153
|
+
x,
|
|
154
|
+
y,
|
|
155
|
+
initialPlacement: placement,
|
|
156
|
+
placement: statefulPlacement,
|
|
157
|
+
strategy,
|
|
158
|
+
middlewareData,
|
|
159
|
+
rects,
|
|
160
|
+
platform: platformWithDetectOverflow,
|
|
161
|
+
elements: {
|
|
162
|
+
reference,
|
|
163
|
+
floating
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
x = nextX != null ? nextX : x;
|
|
167
|
+
y = nextY != null ? nextY : y;
|
|
168
|
+
middlewareData[name] = {
|
|
169
|
+
...middlewareData[name],
|
|
170
|
+
...data
|
|
171
|
+
};
|
|
172
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
173
|
+
resetCount++;
|
|
174
|
+
if (typeof reset === "object") {
|
|
175
|
+
if (reset.placement) {
|
|
176
|
+
statefulPlacement = reset.placement;
|
|
177
|
+
}
|
|
178
|
+
if (reset.rects) {
|
|
179
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
180
|
+
reference,
|
|
181
|
+
floating,
|
|
182
|
+
strategy
|
|
183
|
+
}) : reset.rects;
|
|
184
|
+
}
|
|
185
|
+
({
|
|
186
|
+
x,
|
|
187
|
+
y
|
|
188
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
189
|
+
}
|
|
190
|
+
i = -1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
x,
|
|
195
|
+
y,
|
|
196
|
+
placement: statefulPlacement,
|
|
197
|
+
strategy,
|
|
198
|
+
middlewareData
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
const flip = function(options) {
|
|
202
|
+
if (options === void 0) {
|
|
203
|
+
options = {};
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
name: "flip",
|
|
207
|
+
options,
|
|
208
|
+
async fn(state) {
|
|
209
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
210
|
+
const {
|
|
211
|
+
placement,
|
|
212
|
+
middlewareData,
|
|
213
|
+
rects,
|
|
214
|
+
initialPlacement,
|
|
215
|
+
platform,
|
|
216
|
+
elements
|
|
217
|
+
} = state;
|
|
218
|
+
const {
|
|
219
|
+
mainAxis: checkMainAxis = true,
|
|
220
|
+
crossAxis: checkCrossAxis = true,
|
|
221
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
222
|
+
fallbackStrategy = "bestFit",
|
|
223
|
+
fallbackAxisSideDirection = "none",
|
|
224
|
+
flipAlignment = true,
|
|
225
|
+
...detectOverflowOptions
|
|
226
|
+
} = evaluate(options, state);
|
|
227
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
228
|
+
return {};
|
|
229
|
+
}
|
|
230
|
+
const side = getSide(placement);
|
|
231
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
232
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
233
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
234
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
235
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
236
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
237
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
238
|
+
}
|
|
239
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
240
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
241
|
+
const overflows = [];
|
|
242
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
243
|
+
if (checkMainAxis) {
|
|
244
|
+
overflows.push(overflow[side]);
|
|
245
|
+
}
|
|
246
|
+
if (checkCrossAxis) {
|
|
247
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
248
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
249
|
+
}
|
|
250
|
+
overflowsData = [...overflowsData, {
|
|
251
|
+
placement,
|
|
252
|
+
overflows
|
|
253
|
+
}];
|
|
254
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
255
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
256
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
257
|
+
const nextPlacement = placements[nextIndex];
|
|
258
|
+
if (nextPlacement) {
|
|
259
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
260
|
+
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
261
|
+
// overflows the main axis.
|
|
262
|
+
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
263
|
+
return {
|
|
264
|
+
data: {
|
|
265
|
+
index: nextIndex,
|
|
266
|
+
overflows: overflowsData
|
|
267
|
+
},
|
|
268
|
+
reset: {
|
|
269
|
+
placement: nextPlacement
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
275
|
+
if (!resetPlacement) {
|
|
276
|
+
switch (fallbackStrategy) {
|
|
277
|
+
case "bestFit": {
|
|
278
|
+
var _overflowsData$filter2;
|
|
279
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
280
|
+
if (hasFallbackAxisSideDirection) {
|
|
281
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
282
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
283
|
+
// reading directions favoring greater width.
|
|
284
|
+
currentSideAxis === "y";
|
|
285
|
+
}
|
|
286
|
+
return true;
|
|
287
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
288
|
+
if (placement2) {
|
|
289
|
+
resetPlacement = placement2;
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
case "initialPlacement":
|
|
294
|
+
resetPlacement = initialPlacement;
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (placement !== resetPlacement) {
|
|
299
|
+
return {
|
|
300
|
+
reset: {
|
|
301
|
+
placement: resetPlacement
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return {};
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
function getSideOffsets(overflow, rect) {
|
|
311
|
+
return {
|
|
312
|
+
top: overflow.top - rect.height,
|
|
313
|
+
right: overflow.right - rect.width,
|
|
314
|
+
bottom: overflow.bottom - rect.height,
|
|
315
|
+
left: overflow.left - rect.width
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function isAnySideFullyClipped(overflow) {
|
|
319
|
+
return sides.some((side) => overflow[side] >= 0);
|
|
320
|
+
}
|
|
321
|
+
const hide = function(options) {
|
|
322
|
+
if (options === void 0) {
|
|
323
|
+
options = {};
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
name: "hide",
|
|
327
|
+
options,
|
|
328
|
+
async fn(state) {
|
|
329
|
+
const {
|
|
330
|
+
rects,
|
|
331
|
+
platform
|
|
332
|
+
} = state;
|
|
333
|
+
const {
|
|
334
|
+
strategy = "referenceHidden",
|
|
335
|
+
...detectOverflowOptions
|
|
336
|
+
} = evaluate(options, state);
|
|
337
|
+
switch (strategy) {
|
|
338
|
+
case "referenceHidden": {
|
|
339
|
+
const overflow = await platform.detectOverflow(state, {
|
|
340
|
+
...detectOverflowOptions,
|
|
341
|
+
elementContext: "reference"
|
|
342
|
+
});
|
|
343
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
344
|
+
return {
|
|
345
|
+
data: {
|
|
346
|
+
referenceHiddenOffsets: offsets,
|
|
347
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
case "escaped": {
|
|
352
|
+
const overflow = await platform.detectOverflow(state, {
|
|
353
|
+
...detectOverflowOptions,
|
|
354
|
+
altBoundary: true
|
|
355
|
+
});
|
|
356
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
357
|
+
return {
|
|
358
|
+
data: {
|
|
359
|
+
escapedOffsets: offsets,
|
|
360
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
default: {
|
|
365
|
+
return {};
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
const originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
372
|
+
async function convertValueToCoords(state, options) {
|
|
373
|
+
const {
|
|
374
|
+
placement,
|
|
375
|
+
platform,
|
|
376
|
+
elements
|
|
377
|
+
} = state;
|
|
378
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
379
|
+
const side = getSide(placement);
|
|
380
|
+
const alignment = getAlignment(placement);
|
|
381
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
382
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
383
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
384
|
+
const rawValue = evaluate(options, state);
|
|
385
|
+
let {
|
|
386
|
+
mainAxis,
|
|
387
|
+
crossAxis,
|
|
388
|
+
alignmentAxis
|
|
389
|
+
} = typeof rawValue === "number" ? {
|
|
390
|
+
mainAxis: rawValue,
|
|
391
|
+
crossAxis: 0,
|
|
392
|
+
alignmentAxis: null
|
|
393
|
+
} : {
|
|
394
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
395
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
396
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
397
|
+
};
|
|
398
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
399
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
400
|
+
}
|
|
401
|
+
return isVertical ? {
|
|
402
|
+
x: crossAxis * crossAxisMulti,
|
|
403
|
+
y: mainAxis * mainAxisMulti
|
|
404
|
+
} : {
|
|
405
|
+
x: mainAxis * mainAxisMulti,
|
|
406
|
+
y: crossAxis * crossAxisMulti
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
const offset = function(options) {
|
|
410
|
+
if (options === void 0) {
|
|
411
|
+
options = 0;
|
|
412
|
+
}
|
|
413
|
+
return {
|
|
414
|
+
name: "offset",
|
|
415
|
+
options,
|
|
416
|
+
async fn(state) {
|
|
417
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
418
|
+
const {
|
|
419
|
+
x,
|
|
420
|
+
y,
|
|
421
|
+
placement,
|
|
422
|
+
middlewareData
|
|
423
|
+
} = state;
|
|
424
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
425
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
426
|
+
return {};
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
x: x + diffCoords.x,
|
|
430
|
+
y: y + diffCoords.y,
|
|
431
|
+
data: {
|
|
432
|
+
...diffCoords,
|
|
433
|
+
placement
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
const shift = function(options) {
|
|
440
|
+
if (options === void 0) {
|
|
441
|
+
options = {};
|
|
442
|
+
}
|
|
443
|
+
return {
|
|
444
|
+
name: "shift",
|
|
445
|
+
options,
|
|
446
|
+
async fn(state) {
|
|
447
|
+
const {
|
|
448
|
+
x,
|
|
449
|
+
y,
|
|
450
|
+
placement,
|
|
451
|
+
platform
|
|
452
|
+
} = state;
|
|
453
|
+
const {
|
|
454
|
+
mainAxis: checkMainAxis = true,
|
|
455
|
+
crossAxis: checkCrossAxis = false,
|
|
456
|
+
limiter = {
|
|
457
|
+
fn: (_ref) => {
|
|
458
|
+
let {
|
|
459
|
+
x: x2,
|
|
460
|
+
y: y2
|
|
461
|
+
} = _ref;
|
|
462
|
+
return {
|
|
463
|
+
x: x2,
|
|
464
|
+
y: y2
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
...detectOverflowOptions
|
|
469
|
+
} = evaluate(options, state);
|
|
470
|
+
const coords = {
|
|
471
|
+
x,
|
|
472
|
+
y
|
|
473
|
+
};
|
|
474
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
475
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
476
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
477
|
+
let mainAxisCoord = coords[mainAxis];
|
|
478
|
+
let crossAxisCoord = coords[crossAxis];
|
|
479
|
+
if (checkMainAxis) {
|
|
480
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
481
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
482
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
483
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
484
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
485
|
+
}
|
|
486
|
+
if (checkCrossAxis) {
|
|
487
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
488
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
489
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
490
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
491
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
492
|
+
}
|
|
493
|
+
const limitedCoords = limiter.fn({
|
|
494
|
+
...state,
|
|
495
|
+
[mainAxis]: mainAxisCoord,
|
|
496
|
+
[crossAxis]: crossAxisCoord
|
|
497
|
+
});
|
|
498
|
+
return {
|
|
499
|
+
...limitedCoords,
|
|
500
|
+
data: {
|
|
501
|
+
x: limitedCoords.x - x,
|
|
502
|
+
y: limitedCoords.y - y,
|
|
503
|
+
enabled: {
|
|
504
|
+
[mainAxis]: checkMainAxis,
|
|
505
|
+
[crossAxis]: checkCrossAxis
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
const limitShift = function(options) {
|
|
513
|
+
if (options === void 0) {
|
|
514
|
+
options = {};
|
|
515
|
+
}
|
|
516
|
+
return {
|
|
517
|
+
options,
|
|
518
|
+
fn(state) {
|
|
519
|
+
const {
|
|
520
|
+
x,
|
|
521
|
+
y,
|
|
522
|
+
placement,
|
|
523
|
+
rects,
|
|
524
|
+
middlewareData
|
|
525
|
+
} = state;
|
|
526
|
+
const {
|
|
527
|
+
offset: offset2 = 0,
|
|
528
|
+
mainAxis: checkMainAxis = true,
|
|
529
|
+
crossAxis: checkCrossAxis = true
|
|
530
|
+
} = evaluate(options, state);
|
|
531
|
+
const coords = {
|
|
532
|
+
x,
|
|
533
|
+
y
|
|
534
|
+
};
|
|
535
|
+
const crossAxis = getSideAxis(placement);
|
|
536
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
537
|
+
let mainAxisCoord = coords[mainAxis];
|
|
538
|
+
let crossAxisCoord = coords[crossAxis];
|
|
539
|
+
const rawOffset = evaluate(offset2, state);
|
|
540
|
+
const computedOffset = typeof rawOffset === "number" ? {
|
|
541
|
+
mainAxis: rawOffset,
|
|
542
|
+
crossAxis: 0
|
|
543
|
+
} : {
|
|
544
|
+
mainAxis: 0,
|
|
545
|
+
crossAxis: 0,
|
|
546
|
+
...rawOffset
|
|
547
|
+
};
|
|
548
|
+
if (checkMainAxis) {
|
|
549
|
+
const len = mainAxis === "y" ? "height" : "width";
|
|
550
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
551
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
552
|
+
if (mainAxisCoord < limitMin) {
|
|
553
|
+
mainAxisCoord = limitMin;
|
|
554
|
+
} else if (mainAxisCoord > limitMax) {
|
|
555
|
+
mainAxisCoord = limitMax;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
if (checkCrossAxis) {
|
|
559
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
|
560
|
+
const len = mainAxis === "y" ? "width" : "height";
|
|
561
|
+
const isOriginSide = originSides.has(getSide(placement));
|
|
562
|
+
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
563
|
+
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
564
|
+
if (crossAxisCoord < limitMin) {
|
|
565
|
+
crossAxisCoord = limitMin;
|
|
566
|
+
} else if (crossAxisCoord > limitMax) {
|
|
567
|
+
crossAxisCoord = limitMax;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return {
|
|
571
|
+
[mainAxis]: mainAxisCoord,
|
|
572
|
+
[crossAxis]: crossAxisCoord
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
const size = function(options) {
|
|
578
|
+
if (options === void 0) {
|
|
579
|
+
options = {};
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
name: "size",
|
|
583
|
+
options,
|
|
584
|
+
async fn(state) {
|
|
585
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
586
|
+
const {
|
|
587
|
+
placement,
|
|
588
|
+
rects,
|
|
589
|
+
platform,
|
|
590
|
+
elements
|
|
591
|
+
} = state;
|
|
592
|
+
const {
|
|
593
|
+
apply = () => {
|
|
594
|
+
},
|
|
595
|
+
...detectOverflowOptions
|
|
596
|
+
} = evaluate(options, state);
|
|
597
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
598
|
+
const side = getSide(placement);
|
|
599
|
+
const alignment = getAlignment(placement);
|
|
600
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
601
|
+
const {
|
|
602
|
+
width,
|
|
603
|
+
height
|
|
604
|
+
} = rects.floating;
|
|
605
|
+
let heightSide;
|
|
606
|
+
let widthSide;
|
|
607
|
+
if (side === "top" || side === "bottom") {
|
|
608
|
+
heightSide = side;
|
|
609
|
+
widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
610
|
+
} else {
|
|
611
|
+
widthSide = side;
|
|
612
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
613
|
+
}
|
|
614
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
615
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
616
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
617
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
618
|
+
const noShift = !state.middlewareData.shift;
|
|
619
|
+
let availableHeight = overflowAvailableHeight;
|
|
620
|
+
let availableWidth = overflowAvailableWidth;
|
|
621
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
622
|
+
availableWidth = maximumClippingWidth;
|
|
623
|
+
}
|
|
624
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
625
|
+
availableHeight = maximumClippingHeight;
|
|
626
|
+
}
|
|
627
|
+
if (noShift && !alignment) {
|
|
628
|
+
const xMin = max(overflow.left, 0);
|
|
629
|
+
const xMax = max(overflow.right, 0);
|
|
630
|
+
const yMin = max(overflow.top, 0);
|
|
631
|
+
const yMax = max(overflow.bottom, 0);
|
|
632
|
+
if (isYAxis) {
|
|
633
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
634
|
+
} else {
|
|
635
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
await apply({
|
|
639
|
+
...state,
|
|
640
|
+
availableWidth,
|
|
641
|
+
availableHeight
|
|
642
|
+
});
|
|
643
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
644
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
645
|
+
return {
|
|
646
|
+
reset: {
|
|
647
|
+
rects: true
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
return {};
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
export {
|
|
656
|
+
shift as a,
|
|
657
|
+
computePosition as c,
|
|
658
|
+
flip as f,
|
|
659
|
+
hide as h,
|
|
660
|
+
limitShift as l,
|
|
661
|
+
offset as o,
|
|
662
|
+
size as s
|
|
663
|
+
};
|