@morscherlab/mint-sdk 1.0.0-rc.5 → 1.0.0-rc.7
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/components/AppSidebar.vue.d.ts +6 -3
- package/dist/components/BaseCheckbox.vue.d.ts +6 -1
- package/dist/components/BasePill.vue.d.ts +1 -1
- package/dist/components/BaseRadioGroup.vue.d.ts +1 -1
- package/dist/components/BaseToggle.vue.d.ts +6 -1
- package/dist/components/CollapsibleCard.vue.d.ts +9 -0
- package/dist/components/ControlWorkspaceView.vue.d.ts +1 -1
- package/dist/components/DoseDesignWorkspaceView.vue.d.ts +1 -1
- package/dist/components/PluginWorkspaceView.vue.d.ts +5 -1
- package/dist/components/index.js +2 -2
- package/dist/{components-DtHA2bgp.js → components-Blx4MG--.js} +565 -1477
- package/dist/components-Blx4MG--.js.map +1 -0
- package/dist/composables/controlSchemaTypes.d.ts +7 -1
- package/dist/composables/index.js +3 -3
- package/dist/{composables-Dlg8jenH.js → composables-CHDjDIQT.js} +2 -2
- package/dist/{composables-Dlg8jenH.js.map → composables-CHDjDIQT.js.map} +1 -1
- package/dist/index.js +4 -4
- package/dist/install.js +2 -2
- package/dist/styles.css +867 -126
- package/dist/templates/index.js +1 -1
- package/dist/{templates-DtdUvJ4c.js → templates-DSbHJC4v.js} +1351 -120
- package/dist/templates-DSbHJC4v.js.map +1 -0
- package/dist/types/components.d.ts +12 -0
- package/dist/types/form-builder.d.ts +3 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/{useProtocolTemplates-Bm5vyH4_.js → useProtocolTemplates-BbPOYPzO.js} +2 -2
- package/dist/{useProtocolTemplates-Bm5vyH4_.js.map → useProtocolTemplates-BbPOYPzO.js.map} +1 -1
- package/package.json +1 -1
- package/src/__tests__/components/AppSidebar.test.ts +67 -0
- package/src/__tests__/components/CollapsibleCard.test.ts +47 -0
- package/src/__tests__/components/FormBuilder.test.ts +57 -0
- package/src/__tests__/components/PluginWorkspaceView.shell.test.ts +2 -0
- package/src/components/AppSidebar.story.vue +79 -6
- package/src/components/AppSidebar.vue +72 -0
- package/src/components/BaseCheckbox.story.vue +27 -0
- package/src/components/BaseCheckbox.vue +63 -1
- package/src/components/BaseToggle.story.vue +27 -0
- package/src/components/BaseToggle.vue +66 -1
- package/src/components/CollapsibleCard.vue +123 -45
- package/src/components/FormBuilder.story.vue +13 -0
- package/src/components/PluginWorkspaceView.shell.ts +1 -0
- package/src/components/PluginWorkspaceView.vue +3 -0
- package/src/components/internal/FormFieldRendererInternal.vue +23 -5
- package/src/composables/controlSchemaAdapters.ts +3 -0
- package/src/composables/controlSchemaFormFields.ts +3 -0
- package/src/composables/controlSchemaTypes.ts +8 -0
- package/src/styles/components/app-sidebar.css +134 -6
- package/src/styles/components/checkbox.css +87 -0
- package/src/styles/components/collapsible-card.css +154 -14
- package/src/styles/components/toggle.css +80 -0
- package/src/types/components.ts +21 -0
- package/src/types/form-builder.ts +3 -0
- package/src/types/index.ts +2 -0
- package/dist/components-DtHA2bgp.js.map +0 -1
- package/dist/templates-DtdUvJ4c.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fragment, Teleport, Transition, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createStaticVNode, createTextVNode, createVNode, defineComponent, isRef, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, renderList, renderSlot, toDisplayString, toValue, unref, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
1
|
+
import { Fragment, Teleport, Transition, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createStaticVNode, createTextVNode, createVNode, defineComponent, isRef, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onUnmounted, openBlock, reactive, ref, renderList, renderSlot, toDisplayString, toValue, unref, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
2
2
|
//#region src/components/BaseInput.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
-
var _hoisted_1$
|
|
3
|
+
var _hoisted_1$20 = [
|
|
4
4
|
"type",
|
|
5
5
|
"value",
|
|
6
6
|
"placeholder",
|
|
@@ -80,13 +80,13 @@ var BaseInput_default = /* @__PURE__ */ defineComponent({
|
|
|
80
80
|
onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
|
|
81
81
|
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event)),
|
|
82
82
|
onKeydown: _cache[2] || (_cache[2] = ($event) => emit("keydown", $event))
|
|
83
|
-
}, null, 42, _hoisted_1$
|
|
83
|
+
}, null, 42, _hoisted_1$20);
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region src/components/BaseTextarea.vue?vue&type=script&setup=true&lang.ts
|
|
89
|
-
var _hoisted_1$
|
|
89
|
+
var _hoisted_1$19 = [
|
|
90
90
|
"value",
|
|
91
91
|
"placeholder",
|
|
92
92
|
"disabled",
|
|
@@ -154,7 +154,7 @@ var BaseTextarea_default = /* @__PURE__ */ defineComponent({
|
|
|
154
154
|
onInput: handleInput,
|
|
155
155
|
onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
|
|
156
156
|
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
|
|
157
|
-
}, null, 42, _hoisted_1$
|
|
157
|
+
}, null, 42, _hoisted_1$19);
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
});
|
|
@@ -172,19 +172,19 @@ function findOptionByDomValue(options, value) {
|
|
|
172
172
|
}
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region src/components/BaseSelect.vue?vue&type=script&setup=true&lang.ts
|
|
175
|
-
var _hoisted_1$
|
|
176
|
-
var _hoisted_2$
|
|
175
|
+
var _hoisted_1$18 = { class: "mint-select" };
|
|
176
|
+
var _hoisted_2$17 = [
|
|
177
177
|
"value",
|
|
178
178
|
"disabled",
|
|
179
179
|
"aria-invalid",
|
|
180
180
|
"aria-describedby"
|
|
181
181
|
];
|
|
182
|
-
var _hoisted_3$
|
|
182
|
+
var _hoisted_3$16 = {
|
|
183
183
|
key: 0,
|
|
184
184
|
value: "",
|
|
185
185
|
disabled: ""
|
|
186
186
|
};
|
|
187
|
-
var _hoisted_4$
|
|
187
|
+
var _hoisted_4$14 = ["value", "disabled"];
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region src/components/BaseSelect.vue
|
|
190
190
|
var BaseSelect_default = /* @__PURE__ */ defineComponent({
|
|
@@ -215,7 +215,7 @@ var BaseSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
215
215
|
emit("update:modelValue", findOptionByDomValue(normalizedOptions.value, target.value)?.value ?? target.value);
|
|
216
216
|
}
|
|
217
217
|
return (_ctx, _cache) => {
|
|
218
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
218
|
+
return openBlock(), createElementBlock("div", _hoisted_1$18, [createElementVNode("select", {
|
|
219
219
|
value: __props.modelValue,
|
|
220
220
|
disabled: __props.disabled,
|
|
221
221
|
"aria-invalid": __props.error || void 0,
|
|
@@ -227,13 +227,13 @@ var BaseSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
227
227
|
__props.disabled ? "mint-select__control--disabled" : ""
|
|
228
228
|
]),
|
|
229
229
|
onChange: handleChange
|
|
230
|
-
}, [__props.placeholder ? (openBlock(), createElementBlock("option", _hoisted_3$
|
|
230
|
+
}, [__props.placeholder ? (openBlock(), createElementBlock("option", _hoisted_3$16, toDisplayString(__props.placeholder), 1)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(normalizedOptions.value, (option) => {
|
|
231
231
|
return openBlock(), createElementBlock("option", {
|
|
232
232
|
key: String(option.value),
|
|
233
233
|
value: option.value,
|
|
234
234
|
disabled: option.disabled
|
|
235
|
-
}, toDisplayString(option.label), 9, _hoisted_4$
|
|
236
|
-
}), 128))], 42, _hoisted_2$
|
|
235
|
+
}, toDisplayString(option.label), 9, _hoisted_4$14);
|
|
236
|
+
}), 128))], 42, _hoisted_2$17), _cache[0] || (_cache[0] = createElementVNode("div", { class: "mint-select__icon" }, [createElementVNode("svg", {
|
|
237
237
|
fill: "none",
|
|
238
238
|
stroke: "currentColor",
|
|
239
239
|
"stroke-width": "2",
|
|
@@ -245,9 +245,1170 @@ var BaseSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
//#endregion
|
|
248
|
+
//#region ../../node_modules/.bun/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
249
|
+
var min = Math.min;
|
|
250
|
+
var max = Math.max;
|
|
251
|
+
var round = Math.round;
|
|
252
|
+
var createCoords = (v) => ({
|
|
253
|
+
x: v,
|
|
254
|
+
y: v
|
|
255
|
+
});
|
|
256
|
+
var oppositeSideMap = {
|
|
257
|
+
left: "right",
|
|
258
|
+
right: "left",
|
|
259
|
+
bottom: "top",
|
|
260
|
+
top: "bottom"
|
|
261
|
+
};
|
|
262
|
+
function clamp(start, value, end) {
|
|
263
|
+
return max(start, min(value, end));
|
|
264
|
+
}
|
|
265
|
+
function evaluate(value, param) {
|
|
266
|
+
return typeof value === "function" ? value(param) : value;
|
|
267
|
+
}
|
|
268
|
+
function getSide(placement) {
|
|
269
|
+
return placement.split("-")[0];
|
|
270
|
+
}
|
|
271
|
+
function getAlignment(placement) {
|
|
272
|
+
return placement.split("-")[1];
|
|
273
|
+
}
|
|
274
|
+
function getOppositeAxis(axis) {
|
|
275
|
+
return axis === "x" ? "y" : "x";
|
|
276
|
+
}
|
|
277
|
+
function getAxisLength(axis) {
|
|
278
|
+
return axis === "y" ? "height" : "width";
|
|
279
|
+
}
|
|
280
|
+
function getSideAxis(placement) {
|
|
281
|
+
const firstChar = placement[0];
|
|
282
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
283
|
+
}
|
|
284
|
+
function getAlignmentAxis(placement) {
|
|
285
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
286
|
+
}
|
|
287
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
288
|
+
if (rtl === void 0) rtl = false;
|
|
289
|
+
const alignment = getAlignment(placement);
|
|
290
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
291
|
+
const length = getAxisLength(alignmentAxis);
|
|
292
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
293
|
+
if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
294
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
295
|
+
}
|
|
296
|
+
function getExpandedPlacements(placement) {
|
|
297
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
298
|
+
return [
|
|
299
|
+
getOppositeAlignmentPlacement(placement),
|
|
300
|
+
oppositePlacement,
|
|
301
|
+
getOppositeAlignmentPlacement(oppositePlacement)
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
305
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
306
|
+
}
|
|
307
|
+
var lrPlacement = ["left", "right"];
|
|
308
|
+
var rlPlacement = ["right", "left"];
|
|
309
|
+
var tbPlacement = ["top", "bottom"];
|
|
310
|
+
var btPlacement = ["bottom", "top"];
|
|
311
|
+
function getSideList(side, isStart, rtl) {
|
|
312
|
+
switch (side) {
|
|
313
|
+
case "top":
|
|
314
|
+
case "bottom":
|
|
315
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
316
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
317
|
+
case "left":
|
|
318
|
+
case "right": return isStart ? tbPlacement : btPlacement;
|
|
319
|
+
default: return [];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
323
|
+
const alignment = getAlignment(placement);
|
|
324
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
325
|
+
if (alignment) {
|
|
326
|
+
list = list.map((side) => side + "-" + alignment);
|
|
327
|
+
if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
328
|
+
}
|
|
329
|
+
return list;
|
|
330
|
+
}
|
|
331
|
+
function getOppositePlacement(placement) {
|
|
332
|
+
const side = getSide(placement);
|
|
333
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
334
|
+
}
|
|
335
|
+
function expandPaddingObject(padding) {
|
|
336
|
+
return {
|
|
337
|
+
top: 0,
|
|
338
|
+
right: 0,
|
|
339
|
+
bottom: 0,
|
|
340
|
+
left: 0,
|
|
341
|
+
...padding
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function getPaddingObject(padding) {
|
|
345
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
346
|
+
top: padding,
|
|
347
|
+
right: padding,
|
|
348
|
+
bottom: padding,
|
|
349
|
+
left: padding
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function rectToClientRect(rect) {
|
|
353
|
+
const { x, y, width, height } = rect;
|
|
354
|
+
return {
|
|
355
|
+
width,
|
|
356
|
+
height,
|
|
357
|
+
top: y,
|
|
358
|
+
left: x,
|
|
359
|
+
right: x + width,
|
|
360
|
+
bottom: y + height,
|
|
361
|
+
x,
|
|
362
|
+
y
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region ../../node_modules/.bun/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
367
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
368
|
+
let { reference, floating } = _ref;
|
|
369
|
+
const sideAxis = getSideAxis(placement);
|
|
370
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
371
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
372
|
+
const side = getSide(placement);
|
|
373
|
+
const isVertical = sideAxis === "y";
|
|
374
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
375
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
376
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
377
|
+
let coords;
|
|
378
|
+
switch (side) {
|
|
379
|
+
case "top":
|
|
380
|
+
coords = {
|
|
381
|
+
x: commonX,
|
|
382
|
+
y: reference.y - floating.height
|
|
383
|
+
};
|
|
384
|
+
break;
|
|
385
|
+
case "bottom":
|
|
386
|
+
coords = {
|
|
387
|
+
x: commonX,
|
|
388
|
+
y: reference.y + reference.height
|
|
389
|
+
};
|
|
390
|
+
break;
|
|
391
|
+
case "right":
|
|
392
|
+
coords = {
|
|
393
|
+
x: reference.x + reference.width,
|
|
394
|
+
y: commonY
|
|
395
|
+
};
|
|
396
|
+
break;
|
|
397
|
+
case "left":
|
|
398
|
+
coords = {
|
|
399
|
+
x: reference.x - floating.width,
|
|
400
|
+
y: commonY
|
|
401
|
+
};
|
|
402
|
+
break;
|
|
403
|
+
default: coords = {
|
|
404
|
+
x: reference.x,
|
|
405
|
+
y: reference.y
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
switch (getAlignment(placement)) {
|
|
409
|
+
case "start":
|
|
410
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
411
|
+
break;
|
|
412
|
+
case "end":
|
|
413
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
return coords;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
420
|
+
* element is overflowing a given clipping boundary on each side.
|
|
421
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
422
|
+
* - negative = how many pixels left before it will overflow
|
|
423
|
+
* - 0 = lies flush with the boundary
|
|
424
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
425
|
+
*/
|
|
426
|
+
async function detectOverflow(state, options) {
|
|
427
|
+
var _await$platform$isEle;
|
|
428
|
+
if (options === void 0) options = {};
|
|
429
|
+
const { x, y, platform, rects, elements, strategy } = state;
|
|
430
|
+
const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state);
|
|
431
|
+
const paddingObject = getPaddingObject(padding);
|
|
432
|
+
const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
|
|
433
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
434
|
+
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)),
|
|
435
|
+
boundary,
|
|
436
|
+
rootBoundary,
|
|
437
|
+
strategy
|
|
438
|
+
}));
|
|
439
|
+
const rect = elementContext === "floating" ? {
|
|
440
|
+
x,
|
|
441
|
+
y,
|
|
442
|
+
width: rects.floating.width,
|
|
443
|
+
height: rects.floating.height
|
|
444
|
+
} : rects.reference;
|
|
445
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
446
|
+
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
|
447
|
+
x: 1,
|
|
448
|
+
y: 1
|
|
449
|
+
} : {
|
|
450
|
+
x: 1,
|
|
451
|
+
y: 1
|
|
452
|
+
};
|
|
453
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
454
|
+
elements,
|
|
455
|
+
rect,
|
|
456
|
+
offsetParent,
|
|
457
|
+
strategy
|
|
458
|
+
}) : rect);
|
|
459
|
+
return {
|
|
460
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
461
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
462
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
463
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
var MAX_RESET_COUNT = 50;
|
|
467
|
+
/**
|
|
468
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
469
|
+
* next to a given reference element.
|
|
470
|
+
*
|
|
471
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
472
|
+
* write one for the platform you are using Floating UI with.
|
|
473
|
+
*/
|
|
474
|
+
var computePosition$1 = async (reference, floating, config) => {
|
|
475
|
+
const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config;
|
|
476
|
+
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
477
|
+
...platform,
|
|
478
|
+
detectOverflow
|
|
479
|
+
};
|
|
480
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
481
|
+
let rects = await platform.getElementRects({
|
|
482
|
+
reference,
|
|
483
|
+
floating,
|
|
484
|
+
strategy
|
|
485
|
+
});
|
|
486
|
+
let { x, y } = computeCoordsFromPlacement(rects, placement, rtl);
|
|
487
|
+
let statefulPlacement = placement;
|
|
488
|
+
let resetCount = 0;
|
|
489
|
+
const middlewareData = {};
|
|
490
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
491
|
+
const currentMiddleware = middleware[i];
|
|
492
|
+
if (!currentMiddleware) continue;
|
|
493
|
+
const { name, fn } = currentMiddleware;
|
|
494
|
+
const { x: nextX, y: nextY, data, reset } = await fn({
|
|
495
|
+
x,
|
|
496
|
+
y,
|
|
497
|
+
initialPlacement: placement,
|
|
498
|
+
placement: statefulPlacement,
|
|
499
|
+
strategy,
|
|
500
|
+
middlewareData,
|
|
501
|
+
rects,
|
|
502
|
+
platform: platformWithDetectOverflow,
|
|
503
|
+
elements: {
|
|
504
|
+
reference,
|
|
505
|
+
floating
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
x = nextX != null ? nextX : x;
|
|
509
|
+
y = nextY != null ? nextY : y;
|
|
510
|
+
middlewareData[name] = {
|
|
511
|
+
...middlewareData[name],
|
|
512
|
+
...data
|
|
513
|
+
};
|
|
514
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
515
|
+
resetCount++;
|
|
516
|
+
if (typeof reset === "object") {
|
|
517
|
+
if (reset.placement) statefulPlacement = reset.placement;
|
|
518
|
+
if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({
|
|
519
|
+
reference,
|
|
520
|
+
floating,
|
|
521
|
+
strategy
|
|
522
|
+
}) : reset.rects;
|
|
523
|
+
({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
524
|
+
}
|
|
525
|
+
i = -1;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return {
|
|
529
|
+
x,
|
|
530
|
+
y,
|
|
531
|
+
placement: statefulPlacement,
|
|
532
|
+
strategy,
|
|
533
|
+
middlewareData
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
538
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
539
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
540
|
+
* @see https://floating-ui.com/docs/flip
|
|
541
|
+
*/
|
|
542
|
+
var flip$1 = function(options) {
|
|
543
|
+
if (options === void 0) options = {};
|
|
544
|
+
return {
|
|
545
|
+
name: "flip",
|
|
546
|
+
options,
|
|
547
|
+
async fn(state) {
|
|
548
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
549
|
+
const { placement, middlewareData, rects, initialPlacement, platform, elements } = state;
|
|
550
|
+
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state);
|
|
551
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
|
|
552
|
+
const side = getSide(placement);
|
|
553
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
554
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
555
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
556
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
557
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
558
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
559
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
560
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
561
|
+
const overflows = [];
|
|
562
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
563
|
+
if (checkMainAxis) overflows.push(overflow[side]);
|
|
564
|
+
if (checkCrossAxis) {
|
|
565
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
566
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
567
|
+
}
|
|
568
|
+
overflowsData = [...overflowsData, {
|
|
569
|
+
placement,
|
|
570
|
+
overflows
|
|
571
|
+
}];
|
|
572
|
+
if (!overflows.every((side) => side <= 0)) {
|
|
573
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
574
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
575
|
+
const nextPlacement = placements[nextIndex];
|
|
576
|
+
if (nextPlacement) {
|
|
577
|
+
if (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false) || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) return {
|
|
578
|
+
data: {
|
|
579
|
+
index: nextIndex,
|
|
580
|
+
overflows: overflowsData
|
|
581
|
+
},
|
|
582
|
+
reset: { placement: nextPlacement }
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
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;
|
|
586
|
+
if (!resetPlacement) switch (fallbackStrategy) {
|
|
587
|
+
case "bestFit": {
|
|
588
|
+
var _overflowsData$filter2;
|
|
589
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
590
|
+
if (hasFallbackAxisSideDirection) {
|
|
591
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
592
|
+
return currentSideAxis === initialSideAxis || currentSideAxis === "y";
|
|
593
|
+
}
|
|
594
|
+
return true;
|
|
595
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow) => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
596
|
+
if (placement) resetPlacement = placement;
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
case "initialPlacement":
|
|
600
|
+
resetPlacement = initialPlacement;
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
if (placement !== resetPlacement) return { reset: { placement: resetPlacement } };
|
|
604
|
+
}
|
|
605
|
+
return {};
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
var originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
610
|
+
async function convertValueToCoords(state, options) {
|
|
611
|
+
const { placement, platform, elements } = state;
|
|
612
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
613
|
+
const side = getSide(placement);
|
|
614
|
+
const alignment = getAlignment(placement);
|
|
615
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
616
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
617
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
618
|
+
const rawValue = evaluate(options, state);
|
|
619
|
+
let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? {
|
|
620
|
+
mainAxis: rawValue,
|
|
621
|
+
crossAxis: 0,
|
|
622
|
+
alignmentAxis: null
|
|
623
|
+
} : {
|
|
624
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
625
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
626
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
627
|
+
};
|
|
628
|
+
if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
629
|
+
return isVertical ? {
|
|
630
|
+
x: crossAxis * crossAxisMulti,
|
|
631
|
+
y: mainAxis * mainAxisMulti
|
|
632
|
+
} : {
|
|
633
|
+
x: mainAxis * mainAxisMulti,
|
|
634
|
+
y: crossAxis * crossAxisMulti
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Modifies the placement by translating the floating element along the
|
|
639
|
+
* specified axes.
|
|
640
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
641
|
+
* object may be passed.
|
|
642
|
+
* @see https://floating-ui.com/docs/offset
|
|
643
|
+
*/
|
|
644
|
+
var offset$1 = function(options) {
|
|
645
|
+
if (options === void 0) options = 0;
|
|
646
|
+
return {
|
|
647
|
+
name: "offset",
|
|
648
|
+
options,
|
|
649
|
+
async fn(state) {
|
|
650
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
651
|
+
const { x, y, placement, middlewareData } = state;
|
|
652
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
653
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
|
|
654
|
+
return {
|
|
655
|
+
x: x + diffCoords.x,
|
|
656
|
+
y: y + diffCoords.y,
|
|
657
|
+
data: {
|
|
658
|
+
...diffCoords,
|
|
659
|
+
placement
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
};
|
|
665
|
+
/**
|
|
666
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
667
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
668
|
+
* @see https://floating-ui.com/docs/shift
|
|
669
|
+
*/
|
|
670
|
+
var shift$1 = function(options) {
|
|
671
|
+
if (options === void 0) options = {};
|
|
672
|
+
return {
|
|
673
|
+
name: "shift",
|
|
674
|
+
options,
|
|
675
|
+
async fn(state) {
|
|
676
|
+
const { x, y, placement, platform } = state;
|
|
677
|
+
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => {
|
|
678
|
+
let { x, y } = _ref;
|
|
679
|
+
return {
|
|
680
|
+
x,
|
|
681
|
+
y
|
|
682
|
+
};
|
|
683
|
+
} }, ...detectOverflowOptions } = evaluate(options, state);
|
|
684
|
+
const coords = {
|
|
685
|
+
x,
|
|
686
|
+
y
|
|
687
|
+
};
|
|
688
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
689
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
690
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
691
|
+
let mainAxisCoord = coords[mainAxis];
|
|
692
|
+
let crossAxisCoord = coords[crossAxis];
|
|
693
|
+
if (checkMainAxis) {
|
|
694
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
695
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
696
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
697
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
698
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
699
|
+
}
|
|
700
|
+
if (checkCrossAxis) {
|
|
701
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
702
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
703
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
704
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
705
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
706
|
+
}
|
|
707
|
+
const limitedCoords = limiter.fn({
|
|
708
|
+
...state,
|
|
709
|
+
[mainAxis]: mainAxisCoord,
|
|
710
|
+
[crossAxis]: crossAxisCoord
|
|
711
|
+
});
|
|
712
|
+
return {
|
|
713
|
+
...limitedCoords,
|
|
714
|
+
data: {
|
|
715
|
+
x: limitedCoords.x - x,
|
|
716
|
+
y: limitedCoords.y - y,
|
|
717
|
+
enabled: {
|
|
718
|
+
[mainAxis]: checkMainAxis,
|
|
719
|
+
[crossAxis]: checkCrossAxis
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
//#endregion
|
|
727
|
+
//#region ../../node_modules/.bun/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
728
|
+
function hasWindow() {
|
|
729
|
+
return typeof window !== "undefined";
|
|
730
|
+
}
|
|
731
|
+
function getNodeName(node) {
|
|
732
|
+
if (isNode(node)) return (node.nodeName || "").toLowerCase();
|
|
733
|
+
return "#document";
|
|
734
|
+
}
|
|
735
|
+
function getWindow(node) {
|
|
736
|
+
var _node$ownerDocument;
|
|
737
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
738
|
+
}
|
|
739
|
+
function getDocumentElement(node) {
|
|
740
|
+
var _ref;
|
|
741
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
742
|
+
}
|
|
743
|
+
function isNode(value) {
|
|
744
|
+
if (!hasWindow()) return false;
|
|
745
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
746
|
+
}
|
|
747
|
+
function isElement(value) {
|
|
748
|
+
if (!hasWindow()) return false;
|
|
749
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
750
|
+
}
|
|
751
|
+
function isHTMLElement(value) {
|
|
752
|
+
if (!hasWindow()) return false;
|
|
753
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
754
|
+
}
|
|
755
|
+
function isShadowRoot(value) {
|
|
756
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") return false;
|
|
757
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
758
|
+
}
|
|
759
|
+
function isOverflowElement(element) {
|
|
760
|
+
const { overflow, overflowX, overflowY, display } = getComputedStyle$1(element);
|
|
761
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
762
|
+
}
|
|
763
|
+
function isTableElement(element) {
|
|
764
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
765
|
+
}
|
|
766
|
+
function isTopLayer(element) {
|
|
767
|
+
try {
|
|
768
|
+
if (element.matches(":popover-open")) return true;
|
|
769
|
+
} catch (_e) {}
|
|
770
|
+
try {
|
|
771
|
+
return element.matches(":modal");
|
|
772
|
+
} catch (_e) {
|
|
773
|
+
return false;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
777
|
+
var containRe = /paint|layout|strict|content/;
|
|
778
|
+
var isNotNone = (value) => !!value && value !== "none";
|
|
779
|
+
var isWebKitValue;
|
|
780
|
+
function isContainingBlock(elementOrCss) {
|
|
781
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
782
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
783
|
+
}
|
|
784
|
+
function getContainingBlock(element) {
|
|
785
|
+
let currentNode = getParentNode(element);
|
|
786
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
787
|
+
if (isContainingBlock(currentNode)) return currentNode;
|
|
788
|
+
else if (isTopLayer(currentNode)) return null;
|
|
789
|
+
currentNode = getParentNode(currentNode);
|
|
790
|
+
}
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
793
|
+
function isWebKit() {
|
|
794
|
+
if (isWebKitValue == null) isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
795
|
+
return isWebKitValue;
|
|
796
|
+
}
|
|
797
|
+
function isLastTraversableNode(node) {
|
|
798
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
799
|
+
}
|
|
800
|
+
function getComputedStyle$1(element) {
|
|
801
|
+
return getWindow(element).getComputedStyle(element);
|
|
802
|
+
}
|
|
803
|
+
function getNodeScroll(element) {
|
|
804
|
+
if (isElement(element)) return {
|
|
805
|
+
scrollLeft: element.scrollLeft,
|
|
806
|
+
scrollTop: element.scrollTop
|
|
807
|
+
};
|
|
808
|
+
return {
|
|
809
|
+
scrollLeft: element.scrollX,
|
|
810
|
+
scrollTop: element.scrollY
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function getParentNode(node) {
|
|
814
|
+
if (getNodeName(node) === "html") return node;
|
|
815
|
+
const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
|
|
816
|
+
return isShadowRoot(result) ? result.host : result;
|
|
817
|
+
}
|
|
818
|
+
function getNearestOverflowAncestor(node) {
|
|
819
|
+
const parentNode = getParentNode(node);
|
|
820
|
+
if (isLastTraversableNode(parentNode)) return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
821
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
|
|
822
|
+
return getNearestOverflowAncestor(parentNode);
|
|
823
|
+
}
|
|
824
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
825
|
+
var _node$ownerDocument2;
|
|
826
|
+
if (list === void 0) list = [];
|
|
827
|
+
if (traverseIframes === void 0) traverseIframes = true;
|
|
828
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
829
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
830
|
+
const win = getWindow(scrollableAncestor);
|
|
831
|
+
if (isBody) {
|
|
832
|
+
const frameElement = getFrameElement(win);
|
|
833
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
834
|
+
} else return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
835
|
+
}
|
|
836
|
+
function getFrameElement(win) {
|
|
837
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
838
|
+
}
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region ../../node_modules/.bun/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
841
|
+
function getCssDimensions(element) {
|
|
842
|
+
const css = getComputedStyle$1(element);
|
|
843
|
+
let width = parseFloat(css.width) || 0;
|
|
844
|
+
let height = parseFloat(css.height) || 0;
|
|
845
|
+
const hasOffset = isHTMLElement(element);
|
|
846
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
847
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
848
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
849
|
+
if (shouldFallback) {
|
|
850
|
+
width = offsetWidth;
|
|
851
|
+
height = offsetHeight;
|
|
852
|
+
}
|
|
853
|
+
return {
|
|
854
|
+
width,
|
|
855
|
+
height,
|
|
856
|
+
$: shouldFallback
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
function unwrapElement(element) {
|
|
860
|
+
return !isElement(element) ? element.contextElement : element;
|
|
861
|
+
}
|
|
862
|
+
function getScale(element) {
|
|
863
|
+
const domElement = unwrapElement(element);
|
|
864
|
+
if (!isHTMLElement(domElement)) return createCoords(1);
|
|
865
|
+
const rect = domElement.getBoundingClientRect();
|
|
866
|
+
const { width, height, $ } = getCssDimensions(domElement);
|
|
867
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
868
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
869
|
+
if (!x || !Number.isFinite(x)) x = 1;
|
|
870
|
+
if (!y || !Number.isFinite(y)) y = 1;
|
|
871
|
+
return {
|
|
872
|
+
x,
|
|
873
|
+
y
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
var noOffsets = /* @__PURE__ */ createCoords(0);
|
|
877
|
+
function getVisualOffsets(element) {
|
|
878
|
+
const win = getWindow(element);
|
|
879
|
+
if (!isWebKit() || !win.visualViewport) return noOffsets;
|
|
880
|
+
return {
|
|
881
|
+
x: win.visualViewport.offsetLeft,
|
|
882
|
+
y: win.visualViewport.offsetTop
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
886
|
+
if (isFixed === void 0) isFixed = false;
|
|
887
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) return false;
|
|
888
|
+
return isFixed;
|
|
889
|
+
}
|
|
890
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
891
|
+
if (includeScale === void 0) includeScale = false;
|
|
892
|
+
if (isFixedStrategy === void 0) isFixedStrategy = false;
|
|
893
|
+
const clientRect = element.getBoundingClientRect();
|
|
894
|
+
const domElement = unwrapElement(element);
|
|
895
|
+
let scale = createCoords(1);
|
|
896
|
+
if (includeScale) if (offsetParent) {
|
|
897
|
+
if (isElement(offsetParent)) scale = getScale(offsetParent);
|
|
898
|
+
} else scale = getScale(element);
|
|
899
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
900
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
901
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
902
|
+
let width = clientRect.width / scale.x;
|
|
903
|
+
let height = clientRect.height / scale.y;
|
|
904
|
+
if (domElement) {
|
|
905
|
+
const win = getWindow(domElement);
|
|
906
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
907
|
+
let currentWin = win;
|
|
908
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
909
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
910
|
+
const iframeScale = getScale(currentIFrame);
|
|
911
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
912
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
913
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
914
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
915
|
+
x *= iframeScale.x;
|
|
916
|
+
y *= iframeScale.y;
|
|
917
|
+
width *= iframeScale.x;
|
|
918
|
+
height *= iframeScale.y;
|
|
919
|
+
x += left;
|
|
920
|
+
y += top;
|
|
921
|
+
currentWin = getWindow(currentIFrame);
|
|
922
|
+
currentIFrame = getFrameElement(currentWin);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
return rectToClientRect({
|
|
926
|
+
width,
|
|
927
|
+
height,
|
|
928
|
+
x,
|
|
929
|
+
y
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
function getWindowScrollBarX(element, rect) {
|
|
933
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
934
|
+
if (!rect) return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
935
|
+
return rect.left + leftScroll;
|
|
936
|
+
}
|
|
937
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
938
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
939
|
+
return {
|
|
940
|
+
x: htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect),
|
|
941
|
+
y: htmlRect.top + scroll.scrollTop
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
945
|
+
let { elements, rect, offsetParent, strategy } = _ref;
|
|
946
|
+
const isFixed = strategy === "fixed";
|
|
947
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
948
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
949
|
+
if (offsetParent === documentElement || topLayer && isFixed) return rect;
|
|
950
|
+
let scroll = {
|
|
951
|
+
scrollLeft: 0,
|
|
952
|
+
scrollTop: 0
|
|
953
|
+
};
|
|
954
|
+
let scale = createCoords(1);
|
|
955
|
+
const offsets = createCoords(0);
|
|
956
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
957
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
958
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
|
|
959
|
+
if (isOffsetParentAnElement) {
|
|
960
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
961
|
+
scale = getScale(offsetParent);
|
|
962
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
963
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
967
|
+
return {
|
|
968
|
+
width: rect.width * scale.x,
|
|
969
|
+
height: rect.height * scale.y,
|
|
970
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
971
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
function getClientRects(element) {
|
|
975
|
+
return Array.from(element.getClientRects());
|
|
976
|
+
}
|
|
977
|
+
function getDocumentRect(element) {
|
|
978
|
+
const html = getDocumentElement(element);
|
|
979
|
+
const scroll = getNodeScroll(element);
|
|
980
|
+
const body = element.ownerDocument.body;
|
|
981
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
982
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
983
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
984
|
+
const y = -scroll.scrollTop;
|
|
985
|
+
if (getComputedStyle$1(body).direction === "rtl") x += max(html.clientWidth, body.clientWidth) - width;
|
|
986
|
+
return {
|
|
987
|
+
width,
|
|
988
|
+
height,
|
|
989
|
+
x,
|
|
990
|
+
y
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
var SCROLLBAR_MAX = 25;
|
|
994
|
+
function getViewportRect(element, strategy) {
|
|
995
|
+
const win = getWindow(element);
|
|
996
|
+
const html = getDocumentElement(element);
|
|
997
|
+
const visualViewport = win.visualViewport;
|
|
998
|
+
let width = html.clientWidth;
|
|
999
|
+
let height = html.clientHeight;
|
|
1000
|
+
let x = 0;
|
|
1001
|
+
let y = 0;
|
|
1002
|
+
if (visualViewport) {
|
|
1003
|
+
width = visualViewport.width;
|
|
1004
|
+
height = visualViewport.height;
|
|
1005
|
+
const visualViewportBased = isWebKit();
|
|
1006
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
1007
|
+
x = visualViewport.offsetLeft;
|
|
1008
|
+
y = visualViewport.offsetTop;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
1012
|
+
if (windowScrollbarX <= 0) {
|
|
1013
|
+
const doc = html.ownerDocument;
|
|
1014
|
+
const body = doc.body;
|
|
1015
|
+
const bodyStyles = getComputedStyle(body);
|
|
1016
|
+
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
1017
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
1018
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) width -= clippingStableScrollbarWidth;
|
|
1019
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) width += windowScrollbarX;
|
|
1020
|
+
return {
|
|
1021
|
+
width,
|
|
1022
|
+
height,
|
|
1023
|
+
x,
|
|
1024
|
+
y
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1028
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1029
|
+
const top = clientRect.top + element.clientTop;
|
|
1030
|
+
const left = clientRect.left + element.clientLeft;
|
|
1031
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1032
|
+
return {
|
|
1033
|
+
width: element.clientWidth * scale.x,
|
|
1034
|
+
height: element.clientHeight * scale.y,
|
|
1035
|
+
x: left * scale.x,
|
|
1036
|
+
y: top * scale.y
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1040
|
+
let rect;
|
|
1041
|
+
if (clippingAncestor === "viewport") rect = getViewportRect(element, strategy);
|
|
1042
|
+
else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element));
|
|
1043
|
+
else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1044
|
+
else {
|
|
1045
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1046
|
+
rect = {
|
|
1047
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1048
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1049
|
+
width: clippingAncestor.width,
|
|
1050
|
+
height: clippingAncestor.height
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
return rectToClientRect(rect);
|
|
1054
|
+
}
|
|
1055
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
1056
|
+
const parentNode = getParentNode(element);
|
|
1057
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) return false;
|
|
1058
|
+
return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1059
|
+
}
|
|
1060
|
+
function getClippingElementAncestors(element, cache) {
|
|
1061
|
+
const cachedResult = cache.get(element);
|
|
1062
|
+
if (cachedResult) return cachedResult;
|
|
1063
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1064
|
+
let currentContainingBlockComputedStyle = null;
|
|
1065
|
+
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
1066
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1067
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1068
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1069
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1070
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") currentContainingBlockComputedStyle = null;
|
|
1071
|
+
if (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1072
|
+
else currentContainingBlockComputedStyle = computedStyle;
|
|
1073
|
+
currentNode = getParentNode(currentNode);
|
|
1074
|
+
}
|
|
1075
|
+
cache.set(element, result);
|
|
1076
|
+
return result;
|
|
1077
|
+
}
|
|
1078
|
+
function getClippingRect(_ref) {
|
|
1079
|
+
let { element, boundary, rootBoundary, strategy } = _ref;
|
|
1080
|
+
const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary];
|
|
1081
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
1082
|
+
let top = firstRect.top;
|
|
1083
|
+
let right = firstRect.right;
|
|
1084
|
+
let bottom = firstRect.bottom;
|
|
1085
|
+
let left = firstRect.left;
|
|
1086
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
1087
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
1088
|
+
top = max(rect.top, top);
|
|
1089
|
+
right = min(rect.right, right);
|
|
1090
|
+
bottom = min(rect.bottom, bottom);
|
|
1091
|
+
left = max(rect.left, left);
|
|
1092
|
+
}
|
|
1093
|
+
return {
|
|
1094
|
+
width: right - left,
|
|
1095
|
+
height: bottom - top,
|
|
1096
|
+
x: left,
|
|
1097
|
+
y: top
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
function getDimensions(element) {
|
|
1101
|
+
const { width, height } = getCssDimensions(element);
|
|
1102
|
+
return {
|
|
1103
|
+
width,
|
|
1104
|
+
height
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1108
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1109
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1110
|
+
const isFixed = strategy === "fixed";
|
|
1111
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1112
|
+
let scroll = {
|
|
1113
|
+
scrollLeft: 0,
|
|
1114
|
+
scrollTop: 0
|
|
1115
|
+
};
|
|
1116
|
+
const offsets = createCoords(0);
|
|
1117
|
+
function setLeftRTLScrollbarOffset() {
|
|
1118
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1119
|
+
}
|
|
1120
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1121
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
|
|
1122
|
+
if (isOffsetParentAnElement) {
|
|
1123
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1124
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1125
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1126
|
+
} else if (documentElement) setLeftRTLScrollbarOffset();
|
|
1127
|
+
}
|
|
1128
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) setLeftRTLScrollbarOffset();
|
|
1129
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1130
|
+
return {
|
|
1131
|
+
x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x,
|
|
1132
|
+
y: rect.top + scroll.scrollTop - offsets.y - htmlOffset.y,
|
|
1133
|
+
width: rect.width,
|
|
1134
|
+
height: rect.height
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
function isStaticPositioned(element) {
|
|
1138
|
+
return getComputedStyle$1(element).position === "static";
|
|
1139
|
+
}
|
|
1140
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1141
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") return null;
|
|
1142
|
+
if (polyfill) return polyfill(element);
|
|
1143
|
+
let rawOffsetParent = element.offsetParent;
|
|
1144
|
+
if (getDocumentElement(element) === rawOffsetParent) rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1145
|
+
return rawOffsetParent;
|
|
1146
|
+
}
|
|
1147
|
+
function getOffsetParent(element, polyfill) {
|
|
1148
|
+
const win = getWindow(element);
|
|
1149
|
+
if (isTopLayer(element)) return win;
|
|
1150
|
+
if (!isHTMLElement(element)) {
|
|
1151
|
+
let svgOffsetParent = getParentNode(element);
|
|
1152
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1153
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) return svgOffsetParent;
|
|
1154
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1155
|
+
}
|
|
1156
|
+
return win;
|
|
1157
|
+
}
|
|
1158
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1159
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1160
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) return win;
|
|
1161
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1162
|
+
}
|
|
1163
|
+
var getElementRects = async function(data) {
|
|
1164
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1165
|
+
const getDimensionsFn = this.getDimensions;
|
|
1166
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1167
|
+
return {
|
|
1168
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1169
|
+
floating: {
|
|
1170
|
+
x: 0,
|
|
1171
|
+
y: 0,
|
|
1172
|
+
width: floatingDimensions.width,
|
|
1173
|
+
height: floatingDimensions.height
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
};
|
|
1177
|
+
function isRTL(element) {
|
|
1178
|
+
return getComputedStyle$1(element).direction === "rtl";
|
|
1179
|
+
}
|
|
1180
|
+
var platform = {
|
|
1181
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1182
|
+
getDocumentElement,
|
|
1183
|
+
getClippingRect,
|
|
1184
|
+
getOffsetParent,
|
|
1185
|
+
getElementRects,
|
|
1186
|
+
getClientRects,
|
|
1187
|
+
getDimensions,
|
|
1188
|
+
getScale,
|
|
1189
|
+
isElement,
|
|
1190
|
+
isRTL
|
|
1191
|
+
};
|
|
1192
|
+
/**
|
|
1193
|
+
* Modifies the placement by translating the floating element along the
|
|
1194
|
+
* specified axes.
|
|
1195
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
1196
|
+
* object may be passed.
|
|
1197
|
+
* @see https://floating-ui.com/docs/offset
|
|
1198
|
+
*/
|
|
1199
|
+
var offset = offset$1;
|
|
1200
|
+
/**
|
|
1201
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
1202
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
1203
|
+
* @see https://floating-ui.com/docs/shift
|
|
1204
|
+
*/
|
|
1205
|
+
var shift = shift$1;
|
|
1206
|
+
/**
|
|
1207
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
1208
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
1209
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
1210
|
+
* @see https://floating-ui.com/docs/flip
|
|
1211
|
+
*/
|
|
1212
|
+
var flip = flip$1;
|
|
1213
|
+
/**
|
|
1214
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1215
|
+
* next to a given reference element.
|
|
1216
|
+
*/
|
|
1217
|
+
var computePosition = (reference, floating, options) => {
|
|
1218
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1219
|
+
const mergedOptions = {
|
|
1220
|
+
platform,
|
|
1221
|
+
...options
|
|
1222
|
+
};
|
|
1223
|
+
const platformWithCache = {
|
|
1224
|
+
...mergedOptions.platform,
|
|
1225
|
+
_c: cache
|
|
1226
|
+
};
|
|
1227
|
+
return computePosition$1(reference, floating, {
|
|
1228
|
+
...mergedOptions,
|
|
1229
|
+
platform: platformWithCache
|
|
1230
|
+
});
|
|
1231
|
+
};
|
|
1232
|
+
//#endregion
|
|
1233
|
+
//#region src/composables/useEventListener.ts
|
|
1234
|
+
/** Bind a DOM event listener on mount, remove it on unmount, and rebind when a ref target changes. */
|
|
1235
|
+
function useEventListener(target, type, listener, options) {
|
|
1236
|
+
let stopCurrent;
|
|
1237
|
+
let mounted = false;
|
|
1238
|
+
function stop() {
|
|
1239
|
+
stopCurrent?.();
|
|
1240
|
+
stopCurrent = void 0;
|
|
1241
|
+
}
|
|
1242
|
+
function start() {
|
|
1243
|
+
stop();
|
|
1244
|
+
if (!mounted || !isEnabled(options)) return;
|
|
1245
|
+
const resolvedTarget = resolveEventTarget(target);
|
|
1246
|
+
if (!resolvedTarget) return;
|
|
1247
|
+
const eventListener = listener;
|
|
1248
|
+
const eventOptions = getEventOptions(options);
|
|
1249
|
+
resolvedTarget.addEventListener(type, eventListener, eventOptions);
|
|
1250
|
+
stopCurrent = () => {
|
|
1251
|
+
resolvedTarget.removeEventListener(type, eventListener, eventOptions);
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
onMounted(() => {
|
|
1255
|
+
mounted = true;
|
|
1256
|
+
start();
|
|
1257
|
+
});
|
|
1258
|
+
if (isRef(target)) watch(target, start, { flush: "post" });
|
|
1259
|
+
const enabled = getEnabledOption(options);
|
|
1260
|
+
if (isRef(enabled)) watch(enabled, start, { flush: "post" });
|
|
1261
|
+
onUnmounted(() => {
|
|
1262
|
+
mounted = false;
|
|
1263
|
+
stop();
|
|
1264
|
+
});
|
|
1265
|
+
return stop;
|
|
1266
|
+
}
|
|
1267
|
+
function resolveEventTarget(target) {
|
|
1268
|
+
if (isRef(target)) return target.value;
|
|
1269
|
+
if (typeof target === "function") return target();
|
|
1270
|
+
return target;
|
|
1271
|
+
}
|
|
1272
|
+
function getEnabledOption(options) {
|
|
1273
|
+
return typeof options === "object" ? options.enabled : void 0;
|
|
1274
|
+
}
|
|
1275
|
+
function isEnabled(options) {
|
|
1276
|
+
const enabled = getEnabledOption(options);
|
|
1277
|
+
if (isRef(enabled)) return enabled.value;
|
|
1278
|
+
return enabled ?? true;
|
|
1279
|
+
}
|
|
1280
|
+
function getEventOptions(options) {
|
|
1281
|
+
if (typeof options !== "object") return options;
|
|
1282
|
+
const { enabled: _enabled, ...eventOptions } = options;
|
|
1283
|
+
return eventOptions;
|
|
1284
|
+
}
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region src/components/Tooltip.vue?vue&type=script&setup=true&lang.ts
|
|
1287
|
+
var _hoisted_1$17 = ["aria-describedby"];
|
|
1288
|
+
var _hoisted_2$16 = { class: "mint-tooltip__body" };
|
|
1289
|
+
var _hoisted_3$15 = {
|
|
1290
|
+
key: 0,
|
|
1291
|
+
class: "mint-tooltip__shortcut"
|
|
1292
|
+
};
|
|
1293
|
+
//#endregion
|
|
1294
|
+
//#region src/components/Tooltip.vue
|
|
1295
|
+
var Tooltip_default = /* @__PURE__ */ defineComponent({
|
|
1296
|
+
__name: "Tooltip",
|
|
1297
|
+
props: {
|
|
1298
|
+
text: {},
|
|
1299
|
+
position: { default: "top" },
|
|
1300
|
+
delay: { default: 200 },
|
|
1301
|
+
shortcut: { default: void 0 },
|
|
1302
|
+
maxWidth: { default: void 0 }
|
|
1303
|
+
},
|
|
1304
|
+
setup(__props) {
|
|
1305
|
+
/** Floating tooltip using @floating-ui with auto-flip, delay, optional keyboard shortcut badge, and body Teleport. */
|
|
1306
|
+
const props = __props;
|
|
1307
|
+
const tooltipId = `mint-tooltip-${Math.random().toString(36).slice(2, 9)}`;
|
|
1308
|
+
const visible = ref(false);
|
|
1309
|
+
const actualPlacement = ref(props.position);
|
|
1310
|
+
const triggerRef = ref(null);
|
|
1311
|
+
const contentRef = ref(null);
|
|
1312
|
+
const coords = ref({
|
|
1313
|
+
top: "0px",
|
|
1314
|
+
left: "0px"
|
|
1315
|
+
});
|
|
1316
|
+
let timeoutId;
|
|
1317
|
+
async function updatePosition() {
|
|
1318
|
+
if (!triggerRef.value || !contentRef.value) return;
|
|
1319
|
+
const { x, y, placement } = await computePosition(triggerRef.value, contentRef.value, {
|
|
1320
|
+
placement: props.position,
|
|
1321
|
+
middleware: [
|
|
1322
|
+
offset(6),
|
|
1323
|
+
flip(),
|
|
1324
|
+
shift({ padding: 8 })
|
|
1325
|
+
]
|
|
1326
|
+
});
|
|
1327
|
+
coords.value = {
|
|
1328
|
+
top: `${y}px`,
|
|
1329
|
+
left: `${x}px`
|
|
1330
|
+
};
|
|
1331
|
+
actualPlacement.value = placement;
|
|
1332
|
+
}
|
|
1333
|
+
useEventListener(() => window, "scroll", updatePosition, {
|
|
1334
|
+
passive: true,
|
|
1335
|
+
capture: true,
|
|
1336
|
+
enabled: visible
|
|
1337
|
+
});
|
|
1338
|
+
useEventListener(() => window, "resize", updatePosition, { enabled: visible });
|
|
1339
|
+
async function show() {
|
|
1340
|
+
timeoutId = setTimeout(async () => {
|
|
1341
|
+
visible.value = true;
|
|
1342
|
+
await nextTick();
|
|
1343
|
+
await updatePosition();
|
|
1344
|
+
}, props.delay);
|
|
1345
|
+
}
|
|
1346
|
+
function hide() {
|
|
1347
|
+
clearTimeout(timeoutId);
|
|
1348
|
+
timeoutId = void 0;
|
|
1349
|
+
visible.value = false;
|
|
1350
|
+
}
|
|
1351
|
+
onBeforeUnmount(() => {
|
|
1352
|
+
clearTimeout(timeoutId);
|
|
1353
|
+
});
|
|
1354
|
+
function resolvedMaxWidth(value) {
|
|
1355
|
+
if (value === void 0) return void 0;
|
|
1356
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
1357
|
+
}
|
|
1358
|
+
return (_ctx, _cache) => {
|
|
1359
|
+
return openBlock(), createElementBlock("span", {
|
|
1360
|
+
ref_key: "triggerRef",
|
|
1361
|
+
ref: triggerRef,
|
|
1362
|
+
class: "mint-tooltip",
|
|
1363
|
+
"aria-describedby": visible.value ? tooltipId : void 0,
|
|
1364
|
+
onMouseenter: show,
|
|
1365
|
+
onMouseleave: hide,
|
|
1366
|
+
onFocusin: show,
|
|
1367
|
+
onFocusout: hide
|
|
1368
|
+
}, [renderSlot(_ctx.$slots, "default"), (openBlock(), createBlock(Teleport, { to: "body" }, [visible.value ? (openBlock(), createElementBlock("span", {
|
|
1369
|
+
key: 0,
|
|
1370
|
+
id: tooltipId,
|
|
1371
|
+
ref_key: "contentRef",
|
|
1372
|
+
ref: contentRef,
|
|
1373
|
+
class: normalizeClass([
|
|
1374
|
+
"mint-tooltip__content",
|
|
1375
|
+
`mint-tooltip__content--${actualPlacement.value}`,
|
|
1376
|
+
__props.maxWidth ? "mint-tooltip__content--multiline" : ""
|
|
1377
|
+
]),
|
|
1378
|
+
style: normalizeStyle({
|
|
1379
|
+
top: coords.value.top,
|
|
1380
|
+
left: coords.value.left,
|
|
1381
|
+
maxWidth: resolvedMaxWidth(__props.maxWidth)
|
|
1382
|
+
}),
|
|
1383
|
+
role: "tooltip"
|
|
1384
|
+
}, [createElementVNode("span", _hoisted_2$16, toDisplayString(__props.text), 1), __props.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_3$15, toDisplayString(__props.shortcut), 1)) : createCommentVNode("", true)], 6)) : createCommentVNode("", true)]))], 40, _hoisted_1$17);
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
//#endregion
|
|
248
1389
|
//#region src/components/BaseCheckbox.vue?vue&type=script&setup=true&lang.ts
|
|
249
|
-
var _hoisted_1$16 = {
|
|
250
|
-
|
|
1390
|
+
var _hoisted_1$16 = {
|
|
1391
|
+
key: 0,
|
|
1392
|
+
class: "mint-checkbox__row-svg",
|
|
1393
|
+
viewBox: "0 0 24 24",
|
|
1394
|
+
fill: "none",
|
|
1395
|
+
stroke: "currentColor",
|
|
1396
|
+
"stroke-width": "2",
|
|
1397
|
+
"stroke-linecap": "round",
|
|
1398
|
+
"stroke-linejoin": "round"
|
|
1399
|
+
};
|
|
1400
|
+
var _hoisted_2$15 = ["d"];
|
|
1401
|
+
var _hoisted_3$14 = ["d"];
|
|
1402
|
+
var _hoisted_4$13 = {
|
|
1403
|
+
key: 1,
|
|
1404
|
+
class: "mint-checkbox__row-text-icon"
|
|
1405
|
+
};
|
|
1406
|
+
var _hoisted_5$11 = {
|
|
1407
|
+
key: 1,
|
|
1408
|
+
class: "mint-checkbox__copy"
|
|
1409
|
+
};
|
|
1410
|
+
var _hoisted_6$11 = { class: "mint-checkbox__input-wrapper" };
|
|
1411
|
+
var _hoisted_7$9 = [
|
|
251
1412
|
"checked",
|
|
252
1413
|
"disabled",
|
|
253
1414
|
"aria-label"
|
|
@@ -262,11 +1423,16 @@ var BaseCheckbox_default = /* @__PURE__ */ defineComponent({
|
|
|
262
1423
|
default: false
|
|
263
1424
|
},
|
|
264
1425
|
label: {},
|
|
1426
|
+
description: {},
|
|
1427
|
+
icon: {},
|
|
1428
|
+
iconColor: {},
|
|
1429
|
+
iconBg: {},
|
|
265
1430
|
disabled: {
|
|
266
1431
|
type: Boolean,
|
|
267
1432
|
default: false
|
|
268
1433
|
},
|
|
269
|
-
size: { default: "md" }
|
|
1434
|
+
size: { default: "md" },
|
|
1435
|
+
variant: { default: "default" }
|
|
270
1436
|
},
|
|
271
1437
|
emits: ["update:modelValue"],
|
|
272
1438
|
setup(__props, { emit: __emit }) {
|
|
@@ -277,40 +1443,105 @@ var BaseCheckbox_default = /* @__PURE__ */ defineComponent({
|
|
|
277
1443
|
const target = event.target;
|
|
278
1444
|
emit("update:modelValue", target.checked);
|
|
279
1445
|
}
|
|
1446
|
+
function isSvgIcon(icon) {
|
|
1447
|
+
if (!icon) return false;
|
|
1448
|
+
return Array.isArray(icon) || icon.startsWith("M") || icon.startsWith("m");
|
|
1449
|
+
}
|
|
1450
|
+
function iconStyle() {
|
|
1451
|
+
return { color: props.iconColor ?? (props.modelValue ? "var(--color-primary)" : "var(--text-muted)") };
|
|
1452
|
+
}
|
|
280
1453
|
return (_ctx, _cache) => {
|
|
281
|
-
return openBlock(), createElementBlock("label", { class: normalizeClass([
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
disabled:
|
|
285
|
-
"
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
"
|
|
301
|
-
"
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
1454
|
+
return openBlock(), createElementBlock("label", { class: normalizeClass([
|
|
1455
|
+
"mint-checkbox",
|
|
1456
|
+
`mint-checkbox--${props.variant}`,
|
|
1457
|
+
props.disabled ? "mint-checkbox--disabled" : "",
|
|
1458
|
+
props.modelValue ? "mint-checkbox--checked" : ""
|
|
1459
|
+
]) }, [
|
|
1460
|
+
props.variant === "row" && props.icon ? (openBlock(), createElementBlock("span", {
|
|
1461
|
+
key: 0,
|
|
1462
|
+
class: "mint-checkbox__row-icon",
|
|
1463
|
+
style: normalizeStyle(iconStyle()),
|
|
1464
|
+
"aria-hidden": "true"
|
|
1465
|
+
}, [isSvgIcon(props.icon) ? (openBlock(), createElementBlock("svg", _hoisted_1$16, [Array.isArray(props.icon) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(props.icon, (d, i) => {
|
|
1466
|
+
return openBlock(), createElementBlock("path", {
|
|
1467
|
+
key: i,
|
|
1468
|
+
d
|
|
1469
|
+
}, null, 8, _hoisted_2$15);
|
|
1470
|
+
}), 128)) : (openBlock(), createElementBlock("path", {
|
|
1471
|
+
key: 1,
|
|
1472
|
+
d: props.icon
|
|
1473
|
+
}, null, 8, _hoisted_3$14))])) : (openBlock(), createElementBlock("span", _hoisted_4$13, toDisplayString(props.icon), 1))], 4)) : createCommentVNode("", true),
|
|
1474
|
+
props.variant === "row" && props.label ? (openBlock(), createElementBlock("span", _hoisted_5$11, [props.description ? (openBlock(), createBlock(Tooltip_default, {
|
|
1475
|
+
key: 0,
|
|
1476
|
+
text: props.description,
|
|
1477
|
+
position: "right",
|
|
1478
|
+
"max-width": "16rem"
|
|
1479
|
+
}, {
|
|
1480
|
+
default: withCtx(() => [createElementVNode("span", { class: normalizeClass([
|
|
1481
|
+
"mint-checkbox__label",
|
|
1482
|
+
`mint-checkbox__label--${props.size}`,
|
|
1483
|
+
"mint-checkbox__label--tooltip"
|
|
1484
|
+
]) }, toDisplayString(props.label), 3)]),
|
|
1485
|
+
_: 1
|
|
1486
|
+
}, 8, ["text"])) : (openBlock(), createElementBlock("span", {
|
|
1487
|
+
key: 1,
|
|
1488
|
+
class: normalizeClass(["mint-checkbox__label", `mint-checkbox__label--${props.size}`])
|
|
1489
|
+
}, toDisplayString(props.label), 3))])) : createCommentVNode("", true),
|
|
1490
|
+
createElementVNode("div", _hoisted_6$11, [createElementVNode("input", {
|
|
1491
|
+
type: "checkbox",
|
|
1492
|
+
checked: props.modelValue,
|
|
1493
|
+
disabled: props.disabled,
|
|
1494
|
+
"aria-label": props.label || "Checkbox",
|
|
1495
|
+
class: "mint-checkbox__native",
|
|
1496
|
+
onChange: handleChange
|
|
1497
|
+
}, null, 40, _hoisted_7$9), createElementVNode("div", { class: normalizeClass([
|
|
1498
|
+
"mint-checkbox__box",
|
|
1499
|
+
`mint-checkbox__box--${props.size}`,
|
|
1500
|
+
props.modelValue ? "mint-checkbox__box--checked" : ""
|
|
1501
|
+
]) }, [props.modelValue ? (openBlock(), createElementBlock("svg", {
|
|
1502
|
+
key: 0,
|
|
1503
|
+
class: normalizeClass(["mint-checkbox__icon", `mint-checkbox__icon--${props.size}`]),
|
|
1504
|
+
fill: "none",
|
|
1505
|
+
stroke: "currentColor",
|
|
1506
|
+
viewBox: "0 0 24 24",
|
|
1507
|
+
"aria-hidden": "true"
|
|
1508
|
+
}, [..._cache[0] || (_cache[0] = [createElementVNode("path", {
|
|
1509
|
+
"stroke-linecap": "round",
|
|
1510
|
+
"stroke-linejoin": "round",
|
|
1511
|
+
"stroke-width": "3",
|
|
1512
|
+
d: "M5 13l4 4L19 7"
|
|
1513
|
+
}, null, -1)])], 2)) : createCommentVNode("", true)], 2)]),
|
|
1514
|
+
props.label && props.variant !== "row" ? (openBlock(), createElementBlock("span", {
|
|
1515
|
+
key: 2,
|
|
1516
|
+
class: normalizeClass(["mint-checkbox__label", `mint-checkbox__label--${props.size}`])
|
|
1517
|
+
}, toDisplayString(props.label), 3)) : createCommentVNode("", true)
|
|
1518
|
+
], 2);
|
|
308
1519
|
};
|
|
309
1520
|
}
|
|
310
1521
|
});
|
|
311
1522
|
//#endregion
|
|
312
1523
|
//#region src/components/BaseToggle.vue?vue&type=script&setup=true&lang.ts
|
|
313
|
-
var _hoisted_1$15 =
|
|
1524
|
+
var _hoisted_1$15 = {
|
|
1525
|
+
key: 0,
|
|
1526
|
+
class: "mint-toggle__row-svg",
|
|
1527
|
+
viewBox: "0 0 24 24",
|
|
1528
|
+
fill: "none",
|
|
1529
|
+
stroke: "currentColor",
|
|
1530
|
+
"stroke-width": "2",
|
|
1531
|
+
"stroke-linecap": "round",
|
|
1532
|
+
"stroke-linejoin": "round"
|
|
1533
|
+
};
|
|
1534
|
+
var _hoisted_2$14 = ["d"];
|
|
1535
|
+
var _hoisted_3$13 = ["d"];
|
|
1536
|
+
var _hoisted_4$12 = {
|
|
1537
|
+
key: 1,
|
|
1538
|
+
class: "mint-toggle__row-text-icon"
|
|
1539
|
+
};
|
|
1540
|
+
var _hoisted_5$10 = {
|
|
1541
|
+
key: 1,
|
|
1542
|
+
class: "mint-toggle__copy"
|
|
1543
|
+
};
|
|
1544
|
+
var _hoisted_6$10 = [
|
|
314
1545
|
"tabindex",
|
|
315
1546
|
"aria-checked",
|
|
316
1547
|
"aria-label"
|
|
@@ -325,6 +1556,10 @@ var BaseToggle_default = /* @__PURE__ */ defineComponent({
|
|
|
325
1556
|
default: false
|
|
326
1557
|
},
|
|
327
1558
|
label: {},
|
|
1559
|
+
description: {},
|
|
1560
|
+
icon: {},
|
|
1561
|
+
iconColor: {},
|
|
1562
|
+
iconBg: {},
|
|
328
1563
|
disabled: {
|
|
329
1564
|
type: Boolean,
|
|
330
1565
|
default: false
|
|
@@ -333,7 +1568,8 @@ var BaseToggle_default = /* @__PURE__ */ defineComponent({
|
|
|
333
1568
|
reverse: {
|
|
334
1569
|
type: Boolean,
|
|
335
1570
|
default: false
|
|
336
|
-
}
|
|
1571
|
+
},
|
|
1572
|
+
variant: { default: "default" }
|
|
337
1573
|
},
|
|
338
1574
|
emits: ["update:modelValue"],
|
|
339
1575
|
setup(__props, { emit: __emit }) {
|
|
@@ -349,33 +1585,75 @@ var BaseToggle_default = /* @__PURE__ */ defineComponent({
|
|
|
349
1585
|
toggle();
|
|
350
1586
|
}
|
|
351
1587
|
}
|
|
1588
|
+
function isSvgIcon(icon) {
|
|
1589
|
+
if (!icon) return false;
|
|
1590
|
+
return Array.isArray(icon) || icon.startsWith("M") || icon.startsWith("m");
|
|
1591
|
+
}
|
|
1592
|
+
function iconStyle() {
|
|
1593
|
+
return { color: props.iconColor ?? (props.modelValue ? "var(--color-primary)" : "var(--text-muted)") };
|
|
1594
|
+
}
|
|
352
1595
|
return (_ctx, _cache) => {
|
|
353
1596
|
return openBlock(), createElementBlock("div", {
|
|
354
1597
|
class: normalizeClass([
|
|
355
1598
|
"mint-toggle",
|
|
1599
|
+
`mint-toggle--${__props.variant}`,
|
|
356
1600
|
__props.reverse ? "mint-toggle--reverse" : "",
|
|
357
|
-
__props.disabled ? "mint-toggle--disabled" : ""
|
|
1601
|
+
__props.disabled ? "mint-toggle--disabled" : "",
|
|
1602
|
+
__props.modelValue ? "mint-toggle--checked" : ""
|
|
358
1603
|
]),
|
|
359
1604
|
onClick: toggle
|
|
360
|
-
}, [
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
1605
|
+
}, [
|
|
1606
|
+
__props.variant === "row" && __props.icon ? (openBlock(), createElementBlock("span", {
|
|
1607
|
+
key: 0,
|
|
1608
|
+
class: "mint-toggle__row-icon",
|
|
1609
|
+
style: normalizeStyle(iconStyle()),
|
|
1610
|
+
"aria-hidden": "true"
|
|
1611
|
+
}, [isSvgIcon(__props.icon) ? (openBlock(), createElementBlock("svg", _hoisted_1$15, [Array.isArray(__props.icon) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.icon, (d, i) => {
|
|
1612
|
+
return openBlock(), createElementBlock("path", {
|
|
1613
|
+
key: i,
|
|
1614
|
+
d
|
|
1615
|
+
}, null, 8, _hoisted_2$14);
|
|
1616
|
+
}), 128)) : (openBlock(), createElementBlock("path", {
|
|
1617
|
+
key: 1,
|
|
1618
|
+
d: __props.icon
|
|
1619
|
+
}, null, 8, _hoisted_3$13))])) : (openBlock(), createElementBlock("span", _hoisted_4$12, toDisplayString(__props.icon), 1))], 4)) : createCommentVNode("", true),
|
|
1620
|
+
__props.variant === "row" && __props.label ? (openBlock(), createElementBlock("span", _hoisted_5$10, [__props.description ? (openBlock(), createBlock(Tooltip_default, {
|
|
1621
|
+
key: 0,
|
|
1622
|
+
text: __props.description,
|
|
1623
|
+
position: "right",
|
|
1624
|
+
"max-width": "16rem"
|
|
1625
|
+
}, {
|
|
1626
|
+
default: withCtx(() => [createElementVNode("span", { class: normalizeClass([
|
|
1627
|
+
"mint-toggle__label",
|
|
1628
|
+
`mint-toggle__label--${__props.size}`,
|
|
1629
|
+
"mint-toggle__label--tooltip"
|
|
1630
|
+
]) }, toDisplayString(__props.label), 3)]),
|
|
1631
|
+
_: 1
|
|
1632
|
+
}, 8, ["text"])) : (openBlock(), createElementBlock("span", {
|
|
1633
|
+
key: 1,
|
|
1634
|
+
class: normalizeClass(["mint-toggle__label", `mint-toggle__label--${__props.size}`])
|
|
1635
|
+
}, toDisplayString(__props.label), 3))])) : createCommentVNode("", true),
|
|
1636
|
+
createElementVNode("div", {
|
|
1637
|
+
role: "switch",
|
|
1638
|
+
tabindex: __props.disabled ? -1 : 0,
|
|
1639
|
+
"aria-checked": __props.modelValue,
|
|
1640
|
+
"aria-label": __props.label || "Toggle",
|
|
1641
|
+
class: normalizeClass([
|
|
1642
|
+
"mint-toggle__track",
|
|
1643
|
+
`mint-toggle__track--${__props.size}`,
|
|
1644
|
+
__props.modelValue ? "mint-toggle__track--on" : "mint-toggle__track--off"
|
|
1645
|
+
]),
|
|
1646
|
+
onKeydown: handleKeydown
|
|
1647
|
+
}, [createElementVNode("span", { class: normalizeClass([
|
|
1648
|
+
"mint-toggle__knob",
|
|
1649
|
+
`mint-toggle__knob--${__props.size}`,
|
|
1650
|
+
__props.modelValue ? `mint-toggle__knob--on-${__props.size}` : "mint-toggle__knob--off"
|
|
1651
|
+
]) }, null, 2)], 42, _hoisted_6$10),
|
|
1652
|
+
__props.label && __props.variant !== "row" ? (openBlock(), createElementBlock("span", {
|
|
1653
|
+
key: 2,
|
|
1654
|
+
class: normalizeClass(["mint-toggle__label", `mint-toggle__label--${__props.size}`])
|
|
1655
|
+
}, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
|
|
1656
|
+
], 2);
|
|
379
1657
|
};
|
|
380
1658
|
}
|
|
381
1659
|
});
|
|
@@ -611,59 +1889,6 @@ var BaseSlider_default = /* @__PURE__ */ defineComponent({
|
|
|
611
1889
|
}
|
|
612
1890
|
});
|
|
613
1891
|
//#endregion
|
|
614
|
-
//#region src/composables/useEventListener.ts
|
|
615
|
-
/** Bind a DOM event listener on mount, remove it on unmount, and rebind when a ref target changes. */
|
|
616
|
-
function useEventListener(target, type, listener, options) {
|
|
617
|
-
let stopCurrent;
|
|
618
|
-
let mounted = false;
|
|
619
|
-
function stop() {
|
|
620
|
-
stopCurrent?.();
|
|
621
|
-
stopCurrent = void 0;
|
|
622
|
-
}
|
|
623
|
-
function start() {
|
|
624
|
-
stop();
|
|
625
|
-
if (!mounted || !isEnabled(options)) return;
|
|
626
|
-
const resolvedTarget = resolveEventTarget(target);
|
|
627
|
-
if (!resolvedTarget) return;
|
|
628
|
-
const eventListener = listener;
|
|
629
|
-
const eventOptions = getEventOptions(options);
|
|
630
|
-
resolvedTarget.addEventListener(type, eventListener, eventOptions);
|
|
631
|
-
stopCurrent = () => {
|
|
632
|
-
resolvedTarget.removeEventListener(type, eventListener, eventOptions);
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
onMounted(() => {
|
|
636
|
-
mounted = true;
|
|
637
|
-
start();
|
|
638
|
-
});
|
|
639
|
-
if (isRef(target)) watch(target, start, { flush: "post" });
|
|
640
|
-
const enabled = getEnabledOption(options);
|
|
641
|
-
if (isRef(enabled)) watch(enabled, start, { flush: "post" });
|
|
642
|
-
onUnmounted(() => {
|
|
643
|
-
mounted = false;
|
|
644
|
-
stop();
|
|
645
|
-
});
|
|
646
|
-
return stop;
|
|
647
|
-
}
|
|
648
|
-
function resolveEventTarget(target) {
|
|
649
|
-
if (isRef(target)) return target.value;
|
|
650
|
-
if (typeof target === "function") return target();
|
|
651
|
-
return target;
|
|
652
|
-
}
|
|
653
|
-
function getEnabledOption(options) {
|
|
654
|
-
return typeof options === "object" ? options.enabled : void 0;
|
|
655
|
-
}
|
|
656
|
-
function isEnabled(options) {
|
|
657
|
-
const enabled = getEnabledOption(options);
|
|
658
|
-
if (isRef(enabled)) return enabled.value;
|
|
659
|
-
return enabled ?? true;
|
|
660
|
-
}
|
|
661
|
-
function getEventOptions(options) {
|
|
662
|
-
if (typeof options !== "object") return options;
|
|
663
|
-
const { enabled: _enabled, ...eventOptions } = options;
|
|
664
|
-
return eventOptions;
|
|
665
|
-
}
|
|
666
|
-
//#endregion
|
|
667
1892
|
//#region src/composables/useSelectionLimit.ts
|
|
668
1893
|
/** Shared cap logic for chip, tag, and multi-select controls. */
|
|
669
1894
|
function useSelectionLimit(options) {
|
|
@@ -4321,6 +5546,9 @@ function controlToFormField(control) {
|
|
|
4321
5546
|
defaultValue: defaultValueForControl(definition, type),
|
|
4322
5547
|
placeholder: definition.placeholder,
|
|
4323
5548
|
hint: definition.hint,
|
|
5549
|
+
icon: definition.icon,
|
|
5550
|
+
iconColor: definition.iconColor,
|
|
5551
|
+
iconBg: definition.iconBg,
|
|
4324
5552
|
size: definition.size,
|
|
4325
5553
|
disabled: definition.disabled,
|
|
4326
5554
|
readonly: definition.readonly,
|
|
@@ -4435,6 +5663,9 @@ function controlsToSidebarPanels(controls, options = {}) {
|
|
|
4435
5663
|
icon: sidebarConfig?.icon ?? config.icon,
|
|
4436
5664
|
iconColor: sidebarConfig?.iconColor ?? config.iconColor,
|
|
4437
5665
|
iconBg: sidebarConfig?.iconBg ?? config.iconBg,
|
|
5666
|
+
badge: sidebarConfig?.badge ?? config.badge,
|
|
5667
|
+
badgeTone: sidebarConfig?.badgeTone ?? config.badgeTone,
|
|
5668
|
+
actions: sidebarConfig?.actions ?? config.actions,
|
|
4438
5669
|
defaultOpen: sidebarConfig?.defaultOpen ?? config.defaultOpen,
|
|
4439
5670
|
showToggle: sidebarConfig?.showToggle ?? config.showToggle
|
|
4440
5671
|
};
|
|
@@ -10045,6 +11276,6 @@ function getBioTemplateControlDefaults(target) {
|
|
|
10045
11276
|
return getControlDefaults(requireBioTemplateControlSchema(target));
|
|
10046
11277
|
}
|
|
10047
11278
|
//#endregion
|
|
10048
|
-
export { toTimeCourseRows as $, TimePicker_default as $n, listBioTemplatePacks as $t, createSamplePrepTemplate as A, controlsToSectionFormSchema as An, toCalibrationCurveRows as At, toBioTemplateComponentProps as B, ConcentrationInput_default as Bn, validatePlateMapData as Bt, createFlowCytometryPanelTemplate as C, defineControlModel as Cn,
|
|
11279
|
+
export { toTimeCourseRows as $, TimePicker_default as $n, listBioTemplatePacks as $t, createSamplePrepTemplate as A, controlsToSectionFormSchema as An, BaseInput_default as Ar, toCalibrationCurveRows as At, toBioTemplateComponentProps as B, ConcentrationInput_default as Bn, validatePlateMapData as Bt, createFlowCytometryPanelTemplate as C, defineControlModel as Cn, BaseToggle_default as Cr, toInstrumentRunScheduleEvents as Ct, createTimeCourseTemplate as D, controlValuesToComponentProps as Dn, BaseSelect_default as Dr, toFlowPanelRows as Dt, createProtocolStepsTemplate as E, controlValuesToComponentBindingsById as En, useEventListener as Er, toFlowPanelDataFrame as Et, getBioTemplateComponentProps as F, controlsToViewIds as Fn, validateAssayMatrixData as Ft, toTemplateDataFrame as G, useSequenceUtils as Gn, validateSampleSheetData as Gt, toBioTemplateComponentPropsById as H, useConcentrationUnits as Hn, validateQpcrPlateData as Ht, listBioTemplateComponentBindings as I, controlsToViewItems as In, validateCalibrationCurveData as It, toDoseLayoutState as J, useChemicalFormula as Jn, getBioTemplatePresetInfo as Jt, toWellMapArray as K, FormulaInput_default as Kn, validateTimeCourseData as Kt, toBioTemplateComponentBindings as L, getDefaultControlView as Ln, validateDoseResponseData as Lt, createPlateMapTemplate as M, controlsToSettingsSchema as Mn, toAssayMatrixDataFrame as Mt, bioTemplatePresetControlValuesToOptions as N, controlsToSidebarPanels as Nn, toAssayMatrixRows as Nt, createCalibrationCurveTemplate as O, mergeControlWorkspaceOptions as On, normalizeOptionInput as Or, toCalibrationCurveColumns as Ot, getBioTemplateComponentBindings as P, controlsToTopBarSettingsConfig as Pn, toAssayMatrixSampleOptions as Pt, toTimeCourseDataFrame as Q, TagsInput_default as Qn, getBioTemplatePackInfo as Qt, toBioTemplateComponentBindingsById as R, getFieldRegistryEntry as Rn, validateFlowCytometryPanelData as Rt, createInstrumentRunTemplate as S, useControlWorkspace as Sn, BaseRadioGroup_default as Sr, toInstrumentRunRows as St, createAssayMatrixTemplate as T, controlValuesToComponentBindings as Tn, Tooltip_default as Tr, toFlowPanelColumns as Tt, toBioTemplateComponentSnippets as U, MoleculeInput_default as Un, validateReagentListData as Ut, toBioTemplateComponentPropsByComponent as V, UnitInput_default as Vn, validateProtocolStepsData as Vt, toBioTemplateComponentUsage as W, SequenceInput_default as Wn, validateSamplePrepData as Wt, toWellPlateWells as X, FileUploader_default as Xn, searchBioTemplatePresets as Xt, toPlateMapEditorState as Y, DateTimePicker_default as Yn, listBioTemplatePresets as Yt, toTimeCourseColumns as Z, NumberInput_default as Zn, bioTemplatePacks as Zt, createElisaAssayCollection as _, defineDoseCalculatorControlProps as _n, useDropdownState as _r, toProtocolDataFrame as _t, getBioTemplateControlDefaults as a, TEMPLATE_COLLECTION_KEY as an, formatDuration as ar, toSamplePrepColumns as at, createQpcrExpressionCollection as b, defineWellPlateDoseComponentBindings as bn, useSelectionLimit as br, toInstrumentRunColumns as bt, listBioTemplatePresetControlSchemas as c, createTemplateEnvelope as cn, fromMinutes as cr, toReagentColumns as ct, createBioTemplatePresetCollectionFromControls as d, extractTemplateCollection as dn, parseTime as dr, toReagentRows as dt, searchBioTemplatePacks as en, addMinutes$1 as er, toTimeCourseSteps as et, createWellPlateScreenCollection as f, getTemplateData as fn, rangesOverlap as fr, toQpcrColumns as ft, createFlowCytometryAssayCollection as g, useControlSchema as gn, DatePicker_default as gr, toProtocolColumns as gt, createWesternBlotAssayCollection as h, getControlDefaults as hn, useTimeUtils as hr, toQpcrWellPlateWells as ht, createBioTemplateControlToolkit as i, searchBioTemplateCatalog as in, findNearestTimeSlotIndex as ir, toSampleRows as it, createSampleSheetTemplate as j, controlsToSectionFormSchemas as jn, toAssayMatrixColumns as jt, createDoseResponseTemplate as k, controlsToFormSchema as kn, BaseTextarea_default as kr, toCalibrationCurveDataFrame as kt, requireBioTemplateControlSchema as l, ensureTemplateEnvelope as ln, generateTimeSlots as lr, toReagentDataFrame as lt, createDefaultBioTemplate as m, defineControls as mn, toMinutes as mr, toQpcrRows as mt, bioTemplateControlsToSectionFormSchemas as n, getBioTemplateInfo as nn, durationMinutes as nr, toSampleDataFrame as nt, getBioTemplateControlSchema as o, assertTemplateEnvelope as on, formatTime as or, toSamplePrepDataFrame as ot, createBioTemplatePackCollection as p, defineControlComponentBindings as pn, snapToSlot as pr, toQpcrDataFrame as pt, toDoseConditions as q, ATOMIC_WEIGHTS as qn, bioTemplatePresets as qt, bioTemplateControlsToSidebarPanels as r, listBioTemplateCatalog as rn, findAvailableSlots as rr, toSampleOptions as rt, listBioTemplateControlSchemas as s, createTemplateCollection as sn, formatTimeSlot as sr, toSamplePrepRows as st, bioTemplateControlsToFormSchema as t, bioTemplateCatalog as tn, compareTime as tr, toSampleColumns as tt, createBioTemplatePresetCollection as u, ensureTemplateFromCollection as un, isTimeInRange as ur, toReagentListItems as ut, createTargetedMetabolomicsCollection as v, defineDoseDesignControlModel as vn, MultiSelect_default as vr, toProtocolRows as vt, createReagentListTemplate as w, resolveControlModel as wn, BaseCheckbox_default as wr, toInstrumentRunSteps as wt, createQpcrPlateTemplate as x, defineWellPlateDoseControlProps as xn, BaseSlider_default as xr, toInstrumentRunDataFrame as xt, createLcmsBatchCollection as y, defineWellPlateControlProps as yn, useListSelection as yr, toProtocolSteps as yt, toBioTemplateComponentImports as z, getTypeDefault as zn, validateInstrumentRunData as zt };
|
|
10049
11280
|
|
|
10050
|
-
//# sourceMappingURL=templates-
|
|
11281
|
+
//# sourceMappingURL=templates-DSbHJC4v.js.map
|