@eldrajs/ui 0.3.12 → 0.3.14
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/CHANGELOG.md +4 -0
- package/README.md +18 -1
- package/dist/{PhoneInput-BVH32MEg.js → PhoneInput-B5AgJJVE.js} +1 -1
- package/dist/{VariantPicker-9sOtHHEk.js → VariantPicker-Buz_8mHq.js} +2 -2
- package/dist/components/autocomplete/Autocomplete.vue.d.ts +2 -0
- package/dist/components/chip/Chip.vue.d.ts +2 -0
- package/dist/components/dialog/Dialog.vue.d.ts +2 -0
- package/dist/components/drawer/Drawer.vue.d.ts +2 -0
- package/dist/components/filter-panel/FilterGroup.vue.d.ts +2 -0
- package/dist/components/filter-panel/FilterPanel.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ColourFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ListFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/RangeFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/SizeFacet.vue.d.ts +2 -0
- package/dist/components/filter-panel/facets/ToggleFacet.vue.d.ts +2 -0
- package/dist/components/lightbox/Lightbox.vue.d.ts +3 -0
- package/dist/components/lightbox/types.d.ts +9 -1
- package/dist/components/lightbox/zoom.d.ts +32 -0
- package/dist/components/nav-menu/NavMenu.vue.d.ts +2 -0
- package/dist/components/pagination/Pagination.vue.d.ts +2 -0
- package/dist/components/range-slider/RangeSlider.vue.d.ts +2 -0
- package/dist/components/search-bar/SearchBar.vue.d.ts +2 -0
- package/dist/components/search-modal/SearchModal.vue.d.ts +2 -0
- package/dist/components/select/MultiSelect.vue.d.ts +2 -0
- package/dist/components/select/Select.vue.d.ts +2 -0
- package/dist/components/site-form/SiteForm.vue.d.ts +2 -0
- package/dist/components/toast/Toast.vue.d.ts +2 -0
- package/dist/components/toast/Toaster.vue.d.ts +2 -0
- package/dist/components.css +58 -0
- package/dist/composables/dialogStack.d.ts +2 -1
- package/dist/index.js +419 -39
- package/dist/messages/en-US.d.ts +4 -0
- package/dist/messages/is-IS.js +2 -0
- package/dist/phone/PhoneInput.vue.d.ts +2 -0
- package/dist/phone/vee-validate.js +2 -2
- package/dist/phone.js +1 -1
- package/dist/style.css +58 -0
- package/dist/{useMessages-CYnyGVRG.js → useMessages-CrSnIuLt.js} +4 -0
- package/dist/vee-validate.js +2 -2
- package/dist/vue-i18n.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $ as FIELD_KEY, A as ICON_STROKE_WIDTH$6, G as FIELD_SEARCH_APPEARANCE, I as FIELD_CLEAR_BUTTON_BOX, K as FIELD_SIZE, N as FIELD_BASE, R as FIELD_DISABLED, V as FIELD_LIVE, _ as useFloating, a as CURRENCY_KEY, c as provideEldraUiCurrency, d as useEldraUiLocale, et as mergeClass, f as Spinner_default, g as useTeleportTarget, h as topLayerDialog, k as ICON_SIZE_CLASS, l as provideEldraUiLocale, m as useOverlay, n as matchRange, nt as joinIds, o as DEFAULT_UI_LOCALE, p as usePopover, rt as useUiId, s as LOCALE_KEY, tt as useControllableModel, u as useEldraUiCurrency, v as normalizeText, y as useListbox } from "./useOptionList-CPHHDvPF.js";
|
|
2
2
|
import { n as provideEldraScope, r as useEldraScope, t as ELDRA_SCOPE_KEY } from "./useEldraScope-BDbGzt7R.js";
|
|
3
|
-
import { $ as defaultCharacterMeaning, A as defaultUnitFormat, B as CheckboxGroup_default, C as Switch_default, D as createNumberFormat, E as UnitInput_default, F as parseLocaleNumber, G as Button_default, H as VisuallyHidden_default, I as useHeadingTag, J as FORM_SUBMITTING_KEY, K as Icon_default, L as TAG_FILL, M as formatNumber, N as formatUnit, O as currencyFractionDigits, P as localeSeparators, Q as applyMask, R as TAG_SHAPE, S as focusInvalid, T as CurrencyInput_default, U as RequiredMark_default, V as Checkbox_default, W as FieldError_default, X as Input_default, Y as Autocomplete_default, Z as useSlotPresence, _ as optionCursor, a as claimShortcut, b as MultiSelect_default, c as SearchResultsPanel_default, d as INPUT, et as stripMask, f as PLAIN_BOX_ONLY, g as labelRecipe, h as dotRecipe, i as SearchBar_default, j as formatCurrency, k as currencySymbol, l as RadioGroup_default, m as PLAIN_OPTION, n as Textarea_default, o as ownsShortcut, p as PLAIN_COLUMNS, q as FORM_LAYOUT_KEY, r as Select_default, s as releaseShortcut, t as VariantPicker_default, u as HINT, v as radioRecipe, w as filterNumericBeforeInput, x as FormLayout_default, y as QuantityStepper_default, z as tagPadding } from "./VariantPicker-
|
|
4
|
-
import { i as enUS, n as provideEldraUiMessages, r as useMessages, t as MESSAGES_KEY } from "./useMessages-
|
|
3
|
+
import { $ as defaultCharacterMeaning, A as defaultUnitFormat, B as CheckboxGroup_default, C as Switch_default, D as createNumberFormat, E as UnitInput_default, F as parseLocaleNumber, G as Button_default, H as VisuallyHidden_default, I as useHeadingTag, J as FORM_SUBMITTING_KEY, K as Icon_default, L as TAG_FILL, M as formatNumber, N as formatUnit, O as currencyFractionDigits, P as localeSeparators, Q as applyMask, R as TAG_SHAPE, S as focusInvalid, T as CurrencyInput_default, U as RequiredMark_default, V as Checkbox_default, W as FieldError_default, X as Input_default, Y as Autocomplete_default, Z as useSlotPresence, _ as optionCursor, a as claimShortcut, b as MultiSelect_default, c as SearchResultsPanel_default, d as INPUT, et as stripMask, f as PLAIN_BOX_ONLY, g as labelRecipe, h as dotRecipe, i as SearchBar_default, j as formatCurrency, k as currencySymbol, l as RadioGroup_default, m as PLAIN_OPTION, n as Textarea_default, o as ownsShortcut, p as PLAIN_COLUMNS, q as FORM_LAYOUT_KEY, r as Select_default, s as releaseShortcut, t as VariantPicker_default, u as HINT, v as radioRecipe, w as filterNumericBeforeInput, x as FormLayout_default, y as QuantityStepper_default, z as tagPadding } from "./VariantPicker-Buz_8mHq.js";
|
|
4
|
+
import { i as enUS, n as provideEldraUiMessages, r as useMessages, t as MESSAGES_KEY } from "./useMessages-CrSnIuLt.js";
|
|
5
5
|
import { Comment, Fragment, Teleport, Text, Transition, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, isRef, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, onServerPrefetch, onUnmounted, onUpdated, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, toValue, unref, useAttrs, useId, useSlots, useTemplateRef, vModelText, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
6
6
|
import { dateTimeFormat } from "@eldrajs/sdk/format/date";
|
|
7
7
|
// src/components/accordion/context.ts
|
|
@@ -2312,13 +2312,13 @@ var _hoisted_7$8 = [
|
|
|
2312
2312
|
"tabindex",
|
|
2313
2313
|
"aria-label"
|
|
2314
2314
|
];
|
|
2315
|
-
var _hoisted_8$
|
|
2315
|
+
var _hoisted_8$5 = {
|
|
2316
2316
|
key: 2,
|
|
2317
2317
|
class: "eldra:flex eldra:items-center eldra:justify-between eldra:gap-4"
|
|
2318
2318
|
};
|
|
2319
|
-
var _hoisted_9$
|
|
2320
|
-
var _hoisted_10$
|
|
2321
|
-
var _hoisted_11$
|
|
2319
|
+
var _hoisted_9$5 = ["aria-label"];
|
|
2320
|
+
var _hoisted_10$2 = { key: 1 };
|
|
2321
|
+
var _hoisted_11$2 = [
|
|
2322
2322
|
"aria-current",
|
|
2323
2323
|
"aria-label",
|
|
2324
2324
|
"onClick"
|
|
@@ -2631,7 +2631,7 @@ var Carousel_default = /* @__PURE__ */ defineComponent({
|
|
|
2631
2631
|
style: normalizeStyle(trackStyle.value),
|
|
2632
2632
|
onKeydown: _cache[2] || (_cache[2] = (...args) => unref(onTrackKeydown) && unref(onTrackKeydown)(...args))
|
|
2633
2633
|
}, [renderSlot(_ctx.$slots, "default")], 46, _hoisted_7$8),
|
|
2634
|
-
showBelowRow.value ? (openBlock(), createElementBlock("div", _hoisted_8$
|
|
2634
|
+
showBelowRow.value ? (openBlock(), createElementBlock("div", _hoisted_8$5, [
|
|
2635
2635
|
showPause.value ? (openBlock(), createElementBlock("button", {
|
|
2636
2636
|
key: 0,
|
|
2637
2637
|
type: "button",
|
|
@@ -2639,7 +2639,7 @@ var Carousel_default = /* @__PURE__ */ defineComponent({
|
|
|
2639
2639
|
class: normalizeClass(pauseClass.value),
|
|
2640
2640
|
"aria-label": unref(playing) ? unref(messages).pause : unref(messages).play,
|
|
2641
2641
|
onClick: _cache[3] || (_cache[3] = (...args) => unref(toggle) && unref(toggle)(...args))
|
|
2642
|
-
}, toDisplayString(unref(playing) ? unref(messages).pause : unref(messages).play), 11, _hoisted_9$
|
|
2642
|
+
}, toDisplayString(unref(playing) ? unref(messages).pause : unref(messages).play), 11, _hoisted_9$5)) : (openBlock(), createElementBlock("span", _hoisted_10$2)),
|
|
2643
2643
|
__props.dots ? (openBlock(), createElementBlock("div", {
|
|
2644
2644
|
key: 2,
|
|
2645
2645
|
"data-part": "dots",
|
|
@@ -2653,7 +2653,7 @@ var Carousel_default = /* @__PURE__ */ defineComponent({
|
|
|
2653
2653
|
"aria-current": dotNumber - 1 === unref(index) ? "true" : void 0,
|
|
2654
2654
|
"aria-label": unref(messages).goToSlide(dotNumber),
|
|
2655
2655
|
onClick: ($event) => unref(goTo)(dotNumber - 1)
|
|
2656
|
-
}, [..._cache[8] || (_cache[8] = [createElementVNode("span", { class: "eldra:eldra-carousel-dot" }, null, -1)])], 10, _hoisted_11$
|
|
2656
|
+
}, [..._cache[8] || (_cache[8] = [createElementVNode("span", { class: "eldra:eldra-carousel-dot" }, null, -1)])], 10, _hoisted_11$2);
|
|
2657
2657
|
}), 128))], 2)) : (openBlock(), createElementBlock("span", _hoisted_12$1)),
|
|
2658
2658
|
__props.controls === "below" ? (openBlock(), createElementBlock("div", _hoisted_13, [
|
|
2659
2659
|
createElementVNode("button", {
|
|
@@ -3772,8 +3772,8 @@ var _hoisted_4$18 = ["data-eldra-slot"];
|
|
|
3772
3772
|
var _hoisted_5$13 = ["data-eldra-slot"];
|
|
3773
3773
|
var _hoisted_6$9 = ["datetime"];
|
|
3774
3774
|
var _hoisted_7$7 = ["data-eldra-slot"];
|
|
3775
|
-
var _hoisted_8$
|
|
3776
|
-
var _hoisted_9$
|
|
3775
|
+
var _hoisted_8$4 = ["data-eldra-scope"];
|
|
3776
|
+
var _hoisted_9$4 = ["d"];
|
|
3777
3777
|
// src/components/card/ContentCard.vue
|
|
3778
3778
|
var ContentCard_default = /* @__PURE__ */ defineComponent({
|
|
3779
3779
|
__name: "ContentCard",
|
|
@@ -4036,8 +4036,8 @@ var ContentCard_default = /* @__PURE__ */ defineComponent({
|
|
|
4036
4036
|
return openBlock(), createElementBlock("path", {
|
|
4037
4037
|
key: d,
|
|
4038
4038
|
d
|
|
4039
|
-
}, null, 8, _hoisted_9$
|
|
4040
|
-
}), 128))], 10, _hoisted_8$
|
|
4039
|
+
}, null, 8, _hoisted_9$4);
|
|
4040
|
+
}), 128))], 10, _hoisted_8$4))], 10, _hoisted_7$7)) : createCommentVNode("", true)
|
|
4041
4041
|
], 2)], 10, _hoisted_2$34));
|
|
4042
4042
|
};
|
|
4043
4043
|
}
|
|
@@ -4047,16 +4047,64 @@ var ContentCard_default = /* @__PURE__ */ defineComponent({
|
|
|
4047
4047
|
var stack = [];
|
|
4048
4048
|
/** The `<html>` inline `overflow` this module overwrote, restored when the lock is released. */
|
|
4049
4049
|
var previousHtmlOverflow = null;
|
|
4050
|
+
/** The `<html>` inline `padding-right` this module overwrote, restored when the lock is released. */
|
|
4051
|
+
var previousHtmlPaddingRight = null;
|
|
4052
|
+
/** The `<html>` inline `--eldra-scrollbar-width` this module overwrote, restored on release. */
|
|
4053
|
+
var previousScrollbarWidthVar = null;
|
|
4054
|
+
/**
|
|
4055
|
+
* Set on `<html>` while a modal holds the lock: the width of the scrollbar the lock hid (`0px` when
|
|
4056
|
+
* it hid none). Padding `<html>` holds the page's own content still, but a `position: fixed` element
|
|
4057
|
+
* is laid out against the viewport, not `<html>`'s content box, so a full-width fixed header still
|
|
4058
|
+
* widens into the freed strip. Such an element opts in by padding itself with this variable,
|
|
4059
|
+
* `padding-right: var(--eldra-scrollbar-width, 0px)` (`pr-[var(--eldra-scrollbar-width,0px)]`).
|
|
4060
|
+
*/
|
|
4061
|
+
var SCROLLBAR_WIDTH_VAR = "--eldra-scrollbar-width";
|
|
4062
|
+
/**
|
|
4063
|
+
* The width the root's classic scrollbar takes from the viewport, `0` when there is none to take:
|
|
4064
|
+
* a page short enough not to scroll, or a platform drawing overlay scrollbars (macOS's default,
|
|
4065
|
+
* every phone) that never take layout space. A `clientWidth` of `0` means no layout at all (a
|
|
4066
|
+
* DOM-less test environment), not a scrollbar as wide as the window.
|
|
4067
|
+
*/
|
|
4068
|
+
function rootScrollbarWidth(html) {
|
|
4069
|
+
if (html.clientWidth === 0) return 0;
|
|
4070
|
+
return Math.max(0, window.innerWidth - html.clientWidth);
|
|
4071
|
+
}
|
|
4072
|
+
/**
|
|
4073
|
+
* `overflow: hidden` on `<html>` removes a classic scrollbar, and the page's content widens into the
|
|
4074
|
+
* space it leaves — everything centred or right-aligned jumps sideways the moment a modal opens and
|
|
4075
|
+
* back when it closes. The lock pads `<html>` on the right by exactly the scrollbar's width for as
|
|
4076
|
+
* long as it holds, so the content box stays where it was.
|
|
4077
|
+
*
|
|
4078
|
+
* Padding rather than `scrollbar-gutter: stable`: a gutter keeps the strip but leaves it empty, so
|
|
4079
|
+
* the dialog's `::backdrop` stops short of the right edge and a right-hand `Drawer` docks against
|
|
4080
|
+
* the gutter instead of the window's edge, an undimmed bar beside it. Padding sits inside `<html>`'s
|
|
4081
|
+
* box, which the top layer covers whole. The cost is that a `position: fixed` element does not
|
|
4082
|
+
* move with that padding; `SCROLLBAR_WIDTH_VAR` is what lets one follow.
|
|
4083
|
+
*/
|
|
4050
4084
|
function lockScroll() {
|
|
4051
4085
|
if (typeof document === "undefined") return;
|
|
4052
4086
|
const html = document.documentElement;
|
|
4087
|
+
const scrollbarWidth = rootScrollbarWidth(html);
|
|
4053
4088
|
previousHtmlOverflow = html.style.overflow;
|
|
4089
|
+
previousHtmlPaddingRight = html.style.paddingRight;
|
|
4090
|
+
previousScrollbarWidthVar = html.style.getPropertyValue(SCROLLBAR_WIDTH_VAR);
|
|
4091
|
+
html.style.setProperty(SCROLLBAR_WIDTH_VAR, `${scrollbarWidth}px`);
|
|
4092
|
+
if (scrollbarWidth > 0) {
|
|
4093
|
+
const padding = Number.parseFloat(getComputedStyle(html).paddingRight) || 0;
|
|
4094
|
+
html.style.paddingRight = `${padding + scrollbarWidth}px`;
|
|
4095
|
+
}
|
|
4054
4096
|
html.style.overflow = "hidden";
|
|
4055
4097
|
}
|
|
4056
4098
|
function unlockScroll() {
|
|
4057
4099
|
if (typeof document === "undefined") return;
|
|
4058
|
-
document.documentElement
|
|
4100
|
+
const html = document.documentElement;
|
|
4101
|
+
html.style.overflow = previousHtmlOverflow ?? "";
|
|
4102
|
+
html.style.paddingRight = previousHtmlPaddingRight ?? "";
|
|
4103
|
+
if (previousScrollbarWidthVar) html.style.setProperty(SCROLLBAR_WIDTH_VAR, previousScrollbarWidthVar);
|
|
4104
|
+
else html.style.removeProperty(SCROLLBAR_WIDTH_VAR);
|
|
4059
4105
|
previousHtmlOverflow = null;
|
|
4106
|
+
previousHtmlPaddingRight = null;
|
|
4107
|
+
previousScrollbarWidthVar = null;
|
|
4060
4108
|
}
|
|
4061
4109
|
/**
|
|
4062
4110
|
* The DOM element a `Toaster` should render its live region into while a modal dialog is open, or
|
|
@@ -4090,7 +4138,8 @@ var TOAST_HOST_KEY = shallowRef(null);
|
|
|
4090
4138
|
*
|
|
4091
4139
|
* The *first* claim (the stack going from empty to non-empty) locks the page's scroll (`<html>`
|
|
4092
4140
|
* gets `overflow: hidden`, the shared modal rule: "While any modal surface is open … the root
|
|
4093
|
-
* element does not scroll")
|
|
4141
|
+
* element does not scroll"), padding `<html>` by the scrollbar's width so nothing shifts — later
|
|
4142
|
+
* pushes leave it locked, already true. `TOAST_HOST_KEY` always
|
|
4094
4143
|
* points at the new top.
|
|
4095
4144
|
*/
|
|
4096
4145
|
function openDialog(dialog) {
|
|
@@ -6619,8 +6668,8 @@ var _hoisted_4$12 = ["data-eldra-scope"];
|
|
|
6619
6668
|
var _hoisted_5$9 = ["data-eldra-scope"];
|
|
6620
6669
|
var _hoisted_6$6 = ["aria-label"];
|
|
6621
6670
|
var _hoisted_7$5 = ["data-eldra-scope"];
|
|
6622
|
-
var _hoisted_8$
|
|
6623
|
-
var _hoisted_9$
|
|
6671
|
+
var _hoisted_8$3 = ["data-eldra-scope"];
|
|
6672
|
+
var _hoisted_9$3 = ["data-eldra-scope"];
|
|
6624
6673
|
var SEARCH_BASE = "eldra:mb-2 eldra:w-full";
|
|
6625
6674
|
/** Spec → Sizes, Facet search: '"No matches" line: 0.875rem `muted`, 0.5rem vertical padding.' */
|
|
6626
6675
|
var NO_MATCHES_BASE = "eldra:text-body-sm eldra:text-muted";
|
|
@@ -6834,7 +6883,7 @@ var ListFacet_default = /* @__PURE__ */ defineComponent({
|
|
|
6834
6883
|
"data-eldra-scope": unref(eldra).scope,
|
|
6835
6884
|
"data-part": "count",
|
|
6836
6885
|
class: normalizeClass(countClass.value)
|
|
6837
|
-
}, toDisplayString(child.count), 11, _hoisted_8$
|
|
6886
|
+
}, toDisplayString(child.count), 11, _hoisted_8$3)]),
|
|
6838
6887
|
_: 2
|
|
6839
6888
|
}, 1032, [
|
|
6840
6889
|
"model-value",
|
|
@@ -6874,7 +6923,7 @@ var ListFacet_default = /* @__PURE__ */ defineComponent({
|
|
|
6874
6923
|
"stroke-linejoin": "round",
|
|
6875
6924
|
"aria-hidden": "true",
|
|
6876
6925
|
focusable: "false"
|
|
6877
|
-
}, [..._cache[3] || (_cache[3] = [createElementVNode("path", { d: "M6 9l6 6l6 -6" }, null, -1)])], 10, _hoisted_9$
|
|
6926
|
+
}, [..._cache[3] || (_cache[3] = [createElementVNode("path", { d: "M6 9l6 6l6 -6" }, null, -1)])], 10, _hoisted_9$3))]),
|
|
6878
6927
|
default: withCtx(() => [createTextVNode(toDisplayString(expanded.value ? unref(m).filterPanelShowFewer : unref(m).filterPanelShowAll(total.value)) + " ", 1)]),
|
|
6879
6928
|
_: 1
|
|
6880
6929
|
}, 8, [
|
|
@@ -9063,21 +9112,81 @@ var FilterPanel_default = /* @__PURE__ */ defineComponent({
|
|
|
9063
9112
|
};
|
|
9064
9113
|
}
|
|
9065
9114
|
});
|
|
9115
|
+
/**
|
|
9116
|
+
* The box an `object-fit: contain` image of `naturalWidth` × `naturalHeight` paints inside `frame`,
|
|
9117
|
+
* centred. The frame is only the image's own box on a stage wide enough for it; on a narrower one
|
|
9118
|
+
* the frame is taller than the picture, and the strips above and below are letterbox, not image.
|
|
9119
|
+
*/
|
|
9120
|
+
function containedRect(frame, naturalWidth, naturalHeight) {
|
|
9121
|
+
const scale = Math.min(frame.width / naturalWidth, frame.height / naturalHeight);
|
|
9122
|
+
const width = naturalWidth * scale;
|
|
9123
|
+
const height = naturalHeight * scale;
|
|
9124
|
+
return {
|
|
9125
|
+
left: frame.left + (frame.width - width) / 2,
|
|
9126
|
+
top: frame.top + (frame.height - height) / 2,
|
|
9127
|
+
width,
|
|
9128
|
+
height
|
|
9129
|
+
};
|
|
9130
|
+
}
|
|
9131
|
+
/** How far the painted image may grow before it passes its real size. */
|
|
9132
|
+
function zoomScale(naturalWidth, paintedWidth) {
|
|
9133
|
+
return paintedWidth > 0 ? naturalWidth / paintedWidth : 1;
|
|
9134
|
+
}
|
|
9135
|
+
var clamp01 = (value) => Math.min(1, Math.max(0, value));
|
|
9136
|
+
/** One axis of `zoomTransform`: the zoomed image's centre, less the painted one's. */
|
|
9137
|
+
function axisOffset(paintedStart, paintedSize, stageStart, stageSize, scale, focus) {
|
|
9138
|
+
const zoomed = paintedSize * scale;
|
|
9139
|
+
return (zoomed <= stageSize ? stageStart + (stageSize - zoomed) / 2 : stageStart - clamp01(focus) * (zoomed - stageSize)) + zoomed / 2 - (paintedStart + paintedSize / 2);
|
|
9140
|
+
}
|
|
9141
|
+
/**
|
|
9142
|
+
* The `translate` (px) that goes with `scale(scale)` about the painted box's centre. `focus` says
|
|
9143
|
+
* which part of a zoomed image larger than the stage shows, per axis: `0` its leading edge, `1` its
|
|
9144
|
+
* trailing edge, clamped. An axis the zoomed image still fits on is centred in the stage instead.
|
|
9145
|
+
*/
|
|
9146
|
+
function zoomTransform(painted, stage, scale, focus) {
|
|
9147
|
+
return {
|
|
9148
|
+
x: axisOffset(painted.left, painted.width, stage.left, stage.width, scale, focus.x),
|
|
9149
|
+
y: axisOffset(painted.top, painted.height, stage.top, stage.height, scale, focus.y)
|
|
9150
|
+
};
|
|
9151
|
+
}
|
|
9066
9152
|
// src/components/lightbox/Lightbox.vue?vue&type=script&setup=true&lang.ts
|
|
9067
9153
|
var _hoisted_1$24 = ["data-eldra-scope", "aria-label"];
|
|
9068
9154
|
var _hoisted_2$19 = { key: 1 };
|
|
9069
9155
|
var _hoisted_3$13 = ["aria-label"];
|
|
9070
9156
|
var _hoisted_4$9 = ["disabled", "aria-label"];
|
|
9071
|
-
var _hoisted_5$6 = ["aria-label"];
|
|
9072
|
-
var _hoisted_6$4 = ["
|
|
9073
|
-
var _hoisted_7$3 = [
|
|
9157
|
+
var _hoisted_5$6 = ["aria-label", "data-zoomed"];
|
|
9158
|
+
var _hoisted_6$4 = ["data-zoomed"];
|
|
9159
|
+
var _hoisted_7$3 = ["disabled", "aria-label"];
|
|
9160
|
+
var _hoisted_8$2 = ["aria-label"];
|
|
9161
|
+
var _hoisted_9$2 = {
|
|
9162
|
+
class: "eldra:size-5",
|
|
9163
|
+
viewBox: "0 0 24 24",
|
|
9164
|
+
fill: "none",
|
|
9165
|
+
stroke: "currentColor",
|
|
9166
|
+
"stroke-width": "1.75",
|
|
9167
|
+
"stroke-linecap": "round",
|
|
9168
|
+
"stroke-linejoin": "round",
|
|
9169
|
+
"aria-hidden": "true",
|
|
9170
|
+
focusable: "false"
|
|
9171
|
+
};
|
|
9172
|
+
var _hoisted_10$1 = {
|
|
9173
|
+
key: 0,
|
|
9174
|
+
d: "M10 7l0 6"
|
|
9175
|
+
};
|
|
9176
|
+
var _hoisted_11$1 = [
|
|
9074
9177
|
"aria-current",
|
|
9075
9178
|
"aria-label",
|
|
9076
9179
|
"onClick"
|
|
9077
9180
|
];
|
|
9181
|
+
var PAN_STEP = .1;
|
|
9182
|
+
var CLICK_SLOP = 4;
|
|
9078
9183
|
var barClass = "eldra:flex eldra:shrink-0 eldra:items-center eldra:justify-between eldra:gap-4 eldra:px-4 eldra:py-3 eldra:text-body-sm eldra:text-background";
|
|
9079
9184
|
var imageRootClass = "eldra:flex eldra:h-full eldra:w-full eldra:flex-col eldra:items-center";
|
|
9080
|
-
|
|
9185
|
+
/** While its slide is zoomed, the frame stops clipping (`Image` merges this over its own
|
|
9186
|
+
* `overflow-hidden`): the enlarged `<img>` spills past the frame to the slide's edges. */
|
|
9187
|
+
var imageFrameClass = "eldra:w-auto eldra:max-w-full eldra:flex-1 eldra:min-h-0 eldra:rounded-md eldra:[[data-zoomed=true]_&]:overflow-visible";
|
|
9188
|
+
/** The zoom transform eases rather than jumps; `zoom` off, nothing ever sets one. */
|
|
9189
|
+
var imageMediaClass = "eldra:transition-transform eldra:duration-fast eldra:ease-out eldra:motion-reduce:transition-none";
|
|
9081
9190
|
/** Spec "Sizes": "Caption: 0.875rem, centred, padding 0.75rem 1rem 1rem" — overriding `Image`'s own
|
|
9082
9191
|
* default caption style (`text-caption text-muted mt-2`, sized/coloured for a light card ground)
|
|
9083
9192
|
* for this component's dark one. */
|
|
@@ -9097,6 +9206,10 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9097
9206
|
type: Boolean,
|
|
9098
9207
|
default: false
|
|
9099
9208
|
},
|
|
9209
|
+
zoom: {
|
|
9210
|
+
type: Boolean,
|
|
9211
|
+
default: false
|
|
9212
|
+
},
|
|
9100
9213
|
messages: { default: void 0 },
|
|
9101
9214
|
classes: { default: void 0 }
|
|
9102
9215
|
},
|
|
@@ -9141,11 +9254,22 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9141
9254
|
* who still passes `thumbnails` with one image gets the same result the spec's own rule implies. */
|
|
9142
9255
|
const single = computed(() => props.images.length <= 1);
|
|
9143
9256
|
const showThumbnails = computed(() => props.thumbnails && !single.value);
|
|
9257
|
+
/** `zoom` state — see the zoom section below. Declared here: `useCarousel`'s `draggable` reads it. */
|
|
9258
|
+
const zoomed = ref(false);
|
|
9259
|
+
/** A mouse or pen is over the picture itself (not its letterbox) while not zoomed. */
|
|
9260
|
+
const hoverImage = ref(false);
|
|
9261
|
+
/** A mouse or pen is anywhere over the stage — what keeps the zoom button shown on the way to it,
|
|
9262
|
+
* across the letterbox and off the track onto the button itself. */
|
|
9263
|
+
const hoverStage = ref(false);
|
|
9264
|
+
const focus = reactive({
|
|
9265
|
+
x: .5,
|
|
9266
|
+
y: .5
|
|
9267
|
+
});
|
|
9144
9268
|
const { index: carouselIndex, count, canPrev, canNext, goTo, next, prev } = useCarousel({
|
|
9145
9269
|
rootRef,
|
|
9146
9270
|
trackRef,
|
|
9147
9271
|
slideLabel: () => m.value.imageOf,
|
|
9148
|
-
draggable:
|
|
9272
|
+
draggable: () => !zoomed.value,
|
|
9149
9273
|
onChange: (value) => emit("update:index", value)
|
|
9150
9274
|
});
|
|
9151
9275
|
/**
|
|
@@ -9203,6 +9327,7 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9203
9327
|
},
|
|
9204
9328
|
dialog: dialogEl,
|
|
9205
9329
|
dismissable: false,
|
|
9330
|
+
closeOnEscape: () => !zoomed.value && !escapeZoomedOut,
|
|
9206
9331
|
initialFocus: closeButtonEl
|
|
9207
9332
|
});
|
|
9208
9333
|
watch(model, (isOpen) => {
|
|
@@ -9220,7 +9345,44 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9220
9345
|
* `onTrackKeydown` on the track — binding both would fire `next()`/`prev()` twice whenever the
|
|
9221
9346
|
* track itself has focus, once from each listener.
|
|
9222
9347
|
*/
|
|
9348
|
+
/** Set for the rest of an `Esc` press that zoomed out — cleared on the next task, after the
|
|
9349
|
+
* dialog's `cancel` for the same press has been dispatched. */
|
|
9350
|
+
let escapeZoomedOut = false;
|
|
9351
|
+
/** `zoom`, while zoomed: the arrow keys move the view a tenth of the way per press. */
|
|
9352
|
+
const PAN_KEYS = {
|
|
9353
|
+
ArrowLeft: [-.1, 0],
|
|
9354
|
+
ArrowRight: [PAN_STEP, 0],
|
|
9355
|
+
ArrowUp: [0, -.1],
|
|
9356
|
+
ArrowDown: [0, PAN_STEP]
|
|
9357
|
+
};
|
|
9358
|
+
/** `Esc` while zoomed: zooms out, and keeps the rest of the same press from closing the viewer. */
|
|
9359
|
+
function zoomOutOnEscape(event) {
|
|
9360
|
+
event.preventDefault();
|
|
9361
|
+
escapeZoomedOut = true;
|
|
9362
|
+
setTimeout(() => {
|
|
9363
|
+
escapeZoomedOut = false;
|
|
9364
|
+
}, 0);
|
|
9365
|
+
setZoomed(false);
|
|
9366
|
+
}
|
|
9367
|
+
/** The dialog's own `cancel` (an `Esc` press): it reaches the dialog even when the `keydown` did not
|
|
9368
|
+
* (focus on `<body>`), so zooming out never depends on where focus is. */
|
|
9369
|
+
function onViewerCancel(event) {
|
|
9370
|
+
if (zoomed.value) zoomOutOnEscape(event);
|
|
9371
|
+
}
|
|
9223
9372
|
function onViewerKeydown(event) {
|
|
9373
|
+
if (zoomed.value) {
|
|
9374
|
+
if (event.key === "Escape") {
|
|
9375
|
+
zoomOutOnEscape(event);
|
|
9376
|
+
return;
|
|
9377
|
+
}
|
|
9378
|
+
const step = PAN_KEYS[event.key];
|
|
9379
|
+
if (step) {
|
|
9380
|
+
event.preventDefault();
|
|
9381
|
+
focus.x = Math.min(1, Math.max(0, focus.x + step[0]));
|
|
9382
|
+
focus.y = Math.min(1, Math.max(0, focus.y + step[1]));
|
|
9383
|
+
}
|
|
9384
|
+
return;
|
|
9385
|
+
}
|
|
9224
9386
|
if (event.key === "ArrowRight") {
|
|
9225
9387
|
event.preventDefault();
|
|
9226
9388
|
next();
|
|
@@ -9229,6 +9391,165 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9229
9391
|
prev();
|
|
9230
9392
|
}
|
|
9231
9393
|
}
|
|
9394
|
+
/** Whether the current image gains at least `MIN_ZOOM_SCALE` by zooming, as last measured. Layout
|
|
9395
|
+
* is not reactive, so this is refreshed on open, on a change of image and on a window resize. */
|
|
9396
|
+
const zoomable = ref(false);
|
|
9397
|
+
const canZoom = computed(() => props.zoom && model.value && zoomable.value);
|
|
9398
|
+
const toRect = (r) => ({
|
|
9399
|
+
left: r.left,
|
|
9400
|
+
top: r.top,
|
|
9401
|
+
width: r.width,
|
|
9402
|
+
height: r.height
|
|
9403
|
+
});
|
|
9404
|
+
function currentSlide() {
|
|
9405
|
+
return trackRef.value?.children[carouselIndex.value] ?? null;
|
|
9406
|
+
}
|
|
9407
|
+
/** The current image's geometry, measured now: its frame, the part of the frame the picture
|
|
9408
|
+
* paints (`contain` letterboxes it on a narrow stage), the slide the zoomed image may fill, and how
|
|
9409
|
+
* far it may grow. `null` while there is nothing laid out to measure. */
|
|
9410
|
+
function measure() {
|
|
9411
|
+
const slide = currentSlide();
|
|
9412
|
+
const image = props.images[carouselIndex.value];
|
|
9413
|
+
const frame = slide?.querySelector("[data-part=\"frame\"]");
|
|
9414
|
+
if (!slide || !frame || !image) return null;
|
|
9415
|
+
const painted = containedRect(toRect(frame.getBoundingClientRect()), image.width, image.height);
|
|
9416
|
+
if (painted.width <= 0) return null;
|
|
9417
|
+
return {
|
|
9418
|
+
painted,
|
|
9419
|
+
stage: toRect(slide.getBoundingClientRect()),
|
|
9420
|
+
scale: zoomScale(image.width, painted.width)
|
|
9421
|
+
};
|
|
9422
|
+
}
|
|
9423
|
+
function refreshZoomable() {
|
|
9424
|
+
const geometry = props.zoom && model.value ? measure() : null;
|
|
9425
|
+
zoomable.value = geometry !== null && geometry.scale >= 1.25;
|
|
9426
|
+
if (!zoomable.value && zoomed.value) setZoomed(false);
|
|
9427
|
+
}
|
|
9428
|
+
watch(canZoom, (can) => {
|
|
9429
|
+
const button = dialogEl.value?.querySelector("[data-part=\"zoomButton\"]");
|
|
9430
|
+
if (!can && button && typeof document !== "undefined" && document.activeElement === button) trackRef.value?.focus();
|
|
9431
|
+
});
|
|
9432
|
+
function setZoomed(on) {
|
|
9433
|
+
if (on && !canZoom.value) return;
|
|
9434
|
+
if (!on) {
|
|
9435
|
+
focus.x = .5;
|
|
9436
|
+
focus.y = .5;
|
|
9437
|
+
}
|
|
9438
|
+
zoomed.value = on;
|
|
9439
|
+
}
|
|
9440
|
+
/** Writes the transform onto the current slide's `<img>` and clears it from every other one. */
|
|
9441
|
+
function applyZoom() {
|
|
9442
|
+
const track = trackRef.value;
|
|
9443
|
+
if (!track) return;
|
|
9444
|
+
const slide = currentSlide();
|
|
9445
|
+
const geometry = zoomed.value ? measure() : null;
|
|
9446
|
+
for (const media of track.querySelectorAll("img[data-part=\"image\"]")) {
|
|
9447
|
+
if (geometry === null || !slide?.contains(media)) {
|
|
9448
|
+
media.style.transform = "";
|
|
9449
|
+
continue;
|
|
9450
|
+
}
|
|
9451
|
+
const { x, y } = zoomTransform(geometry.painted, geometry.stage, geometry.scale, focus);
|
|
9452
|
+
media.style.transform = `translate(${x}px, ${y}px) scale(${geometry.scale})`;
|
|
9453
|
+
}
|
|
9454
|
+
}
|
|
9455
|
+
watch([
|
|
9456
|
+
zoomed,
|
|
9457
|
+
() => focus.x,
|
|
9458
|
+
() => focus.y
|
|
9459
|
+
], applyZoom, { flush: "post" });
|
|
9460
|
+
watch(carouselIndex, () => setZoomed(false));
|
|
9461
|
+
watch(model, (isOpen) => {
|
|
9462
|
+
if (isOpen) return;
|
|
9463
|
+
setZoomed(false);
|
|
9464
|
+
hoverImage.value = false;
|
|
9465
|
+
hoverStage.value = false;
|
|
9466
|
+
});
|
|
9467
|
+
watch([
|
|
9468
|
+
model,
|
|
9469
|
+
carouselIndex,
|
|
9470
|
+
() => props.zoom
|
|
9471
|
+
], () => void nextTick(refreshZoomable), { immediate: true });
|
|
9472
|
+
function onWindowResize() {
|
|
9473
|
+
refreshZoomable();
|
|
9474
|
+
applyZoom();
|
|
9475
|
+
}
|
|
9476
|
+
onMounted(() => window.addEventListener("resize", onWindowResize));
|
|
9477
|
+
onBeforeUnmount(() => window.removeEventListener("resize", onWindowResize));
|
|
9478
|
+
/** Inside the painted image, as fractions of it — or `null` for a point outside it. */
|
|
9479
|
+
function pointInPainted(clientX, clientY) {
|
|
9480
|
+
const geometry = measure();
|
|
9481
|
+
if (geometry === null) return null;
|
|
9482
|
+
const { painted } = geometry;
|
|
9483
|
+
const x = (clientX - painted.left) / painted.width;
|
|
9484
|
+
const y = (clientY - painted.top) / painted.height;
|
|
9485
|
+
return x >= 0 && x <= 1 && y >= 0 && y <= 1 ? {
|
|
9486
|
+
x,
|
|
9487
|
+
y
|
|
9488
|
+
} : null;
|
|
9489
|
+
}
|
|
9490
|
+
/** Where the last press on the track went down: a click that ends more than `CLICK_SLOP` px from it
|
|
9491
|
+
* was a drag between images, not a click on the image. */
|
|
9492
|
+
let pressAt = null;
|
|
9493
|
+
function onTrackPointerdown(event) {
|
|
9494
|
+
pressAt = {
|
|
9495
|
+
x: event.clientX,
|
|
9496
|
+
y: event.clientY
|
|
9497
|
+
};
|
|
9498
|
+
}
|
|
9499
|
+
function onStagePointerenter(event) {
|
|
9500
|
+
if (props.zoom && event.pointerType !== "touch") hoverStage.value = true;
|
|
9501
|
+
}
|
|
9502
|
+
function onStagePointerleave() {
|
|
9503
|
+
hoverStage.value = false;
|
|
9504
|
+
}
|
|
9505
|
+
/**
|
|
9506
|
+
* A mouse or pen over the stage. Not zoomed: whether it is over the picture (the zoom-in cursor).
|
|
9507
|
+
* Zoomed: where it is over the stage picks the part of the image shown, measured
|
|
9508
|
+
* afresh each time so a resized window never pans against a stale box. Touch has neither: it keeps
|
|
9509
|
+
* the browser's own pinch-zoom and native swipe.
|
|
9510
|
+
*/
|
|
9511
|
+
function onTrackPointermove(event) {
|
|
9512
|
+
if (!props.zoom || event.pointerType === "touch") return;
|
|
9513
|
+
if (!zoomed.value) {
|
|
9514
|
+
hoverImage.value = canZoom.value && pointInPainted(event.clientX, event.clientY) !== null;
|
|
9515
|
+
return;
|
|
9516
|
+
}
|
|
9517
|
+
const geometry = measure();
|
|
9518
|
+
if (geometry === null) return;
|
|
9519
|
+
const { stage } = geometry;
|
|
9520
|
+
focus.x = Math.min(1, Math.max(0, (event.clientX - stage.left) / stage.width));
|
|
9521
|
+
focus.y = Math.min(1, Math.max(0, (event.clientY - stage.top) / stage.height));
|
|
9522
|
+
applyZoom();
|
|
9523
|
+
}
|
|
9524
|
+
function onTrackPointerleave() {
|
|
9525
|
+
hoverImage.value = false;
|
|
9526
|
+
}
|
|
9527
|
+
/** Zoomed, `useCarousel` no longer cancels `dragstart` (its drag is off), so the browser's own image
|
|
9528
|
+
* drag would pick up a ghost copy of the photo and swallow the pan. */
|
|
9529
|
+
function onTrackDragstart(event) {
|
|
9530
|
+
if (zoomed.value) event.preventDefault();
|
|
9531
|
+
}
|
|
9532
|
+
/** A click on the stage: zooms in when it lands on the picture itself (centred on where it
|
|
9533
|
+
* landed), never on the letterbox, the caption or the empty stage; zoomed, any click zooms out. */
|
|
9534
|
+
function onTrackClick(event) {
|
|
9535
|
+
if (!props.zoom) return;
|
|
9536
|
+
const press = pressAt;
|
|
9537
|
+
pressAt = null;
|
|
9538
|
+
if (press && Math.hypot(event.clientX - press.x, event.clientY - press.y) > CLICK_SLOP) return;
|
|
9539
|
+
if (zoomed.value) {
|
|
9540
|
+
setZoomed(false);
|
|
9541
|
+
return;
|
|
9542
|
+
}
|
|
9543
|
+
refreshZoomable();
|
|
9544
|
+
const point = pointInPainted(event.clientX, event.clientY);
|
|
9545
|
+
if (point === null || !canZoom.value) return;
|
|
9546
|
+
focus.x = point.x;
|
|
9547
|
+
focus.y = point.y;
|
|
9548
|
+
setZoomed(true);
|
|
9549
|
+
}
|
|
9550
|
+
function onZoomButtonClick() {
|
|
9551
|
+
setZoomed(!zoomed.value);
|
|
9552
|
+
}
|
|
9232
9553
|
/** So a consumer can close the viewer with its own action value from outside — the same mechanism
|
|
9233
9554
|
* `Dialog`/`Drawer` expose. */
|
|
9234
9555
|
__expose({
|
|
@@ -9289,7 +9610,9 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9289
9610
|
* own (`useCarousel` call above).
|
|
9290
9611
|
*/
|
|
9291
9612
|
const trackClass = computed(() => [
|
|
9292
|
-
"eldra:flex eldra:h-full eldra:touch-pan-x eldra:touch-pan-y eldra:
|
|
9613
|
+
"eldra:flex eldra:h-full eldra:touch-pan-x eldra:touch-pan-y eldra:snap-x eldra:snap-mandatory eldra:overflow-x-auto eldra:overscroll-x-contain",
|
|
9614
|
+
zoomed.value ? "eldra:cursor-zoom-out" : hoverImage.value ? "eldra:cursor-zoom-in" : "eldra:cursor-grab",
|
|
9615
|
+
"eldra:data-[zoomed=true]:overflow-x-hidden",
|
|
9293
9616
|
"eldra:scroll-smooth eldra:motion-reduce:scroll-auto eldra:eldra-scrollbar-hide eldra:eldra-focus",
|
|
9294
9617
|
"eldra:[--eldra-focus-offset:4px] eldra:data-[dragging=true]:cursor-grabbing eldra:data-[dragging=true]:snap-none",
|
|
9295
9618
|
"eldra:data-[dragging=true]:scroll-auto eldra:data-[dragging=true]:select-none",
|
|
@@ -9323,7 +9646,11 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9323
9646
|
* outer width is still exactly the track's own (border-box already includes the padding) — so the
|
|
9324
9647
|
* peek disappears and the image alone loses the 4rem the arrows need.
|
|
9325
9648
|
*/
|
|
9326
|
-
const slideClass = computed(() => [
|
|
9649
|
+
const slideClass = computed(() => [
|
|
9650
|
+
"eldra:flex eldra:h-full eldra:px-16",
|
|
9651
|
+
"eldra:data-[zoomed=true]:overflow-hidden",
|
|
9652
|
+
props.classes?.slide
|
|
9653
|
+
]);
|
|
9327
9654
|
/** The `<figure>` Image itself renders (given `caption`) — sized to fill the slide and centre its
|
|
9328
9655
|
* frame both ways, `flex-col` so the (`flex-1`) frame and the (`shrink-0`) caption stack. */
|
|
9329
9656
|
const ARROW_BASE = [
|
|
@@ -9334,16 +9661,36 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9334
9661
|
"eldra:disabled:cursor-not-allowed eldra:disabled:text-background/45",
|
|
9335
9662
|
"eldra:disabled:hover:bg-transparent"
|
|
9336
9663
|
];
|
|
9664
|
+
/** `zoom`: the arrows step aside while zoomed — the enlarged image fills the stage they sit on, and
|
|
9665
|
+
* changing image then would throw the shopper out of the close-up. */
|
|
9666
|
+
const arrowZoomedClass = computed(() => zoomed.value && "eldra:invisible");
|
|
9337
9667
|
const prevClass = computed(() => [
|
|
9338
9668
|
ARROW_BASE,
|
|
9339
9669
|
"eldra:left-3",
|
|
9670
|
+
arrowZoomedClass.value,
|
|
9340
9671
|
props.classes?.prev
|
|
9341
9672
|
]);
|
|
9342
9673
|
const nextClass = computed(() => [
|
|
9343
9674
|
ARROW_BASE,
|
|
9344
9675
|
"eldra:right-3",
|
|
9676
|
+
arrowZoomedClass.value,
|
|
9345
9677
|
props.classes?.next
|
|
9346
9678
|
]);
|
|
9679
|
+
/**
|
|
9680
|
+
* The zoom button sits in the stage's bottom-right corner, the arrows' circle with a dark fill so it
|
|
9681
|
+
* reads over a light photo too. It shows while the pointer is over the image (`hoverImage`), while
|
|
9682
|
+
* zoomed, while it has keyboard focus, and always on a device with no hover to reveal it.
|
|
9683
|
+
*/
|
|
9684
|
+
const zoomButtonClass = computed(() => [
|
|
9685
|
+
"eldra:absolute eldra:right-3 eldra:bottom-3 eldra:inline-flex eldra:size-11 eldra:cursor-pointer eldra:items-center",
|
|
9686
|
+
"eldra:justify-center eldra:rounded-full eldra:border eldra:text-background eldra:eldra-focus",
|
|
9687
|
+
"eldra:border-[color-mix(in_oklab,var(--eldra-color-background)_70%,transparent)]",
|
|
9688
|
+
"eldra:bg-[color-mix(in_oklab,var(--eldra-color-text)_60%,transparent)]",
|
|
9689
|
+
"eldra:hover:bg-[color-mix(in_oklab,var(--eldra-color-text)_80%,transparent)]",
|
|
9690
|
+
"eldra:transition-opacity eldra:duration-fast eldra:ease-out eldra:motion-reduce:transition-none",
|
|
9691
|
+
hoverStage.value || zoomed.value ? "eldra:opacity-100" : "eldra:opacity-0 eldra:focus-visible:opacity-100 eldra:[@media(hover:none)]:opacity-100",
|
|
9692
|
+
props.classes?.zoomButton
|
|
9693
|
+
]);
|
|
9347
9694
|
const thumbnailsClass = computed(() => ["eldra:flex eldra:shrink-0 eldra:items-center eldra:justify-center eldra:gap-2 eldra:overflow-x-auto eldra:px-4 eldra:pt-2 eldra:pb-4", props.classes?.thumbnails]);
|
|
9348
9695
|
/** The strip is a scroll container, so it clips anything drawn outside a tile's box: `pt-2` above
|
|
9349
9696
|
* gives the current tile's 2px outline + 2px offset room at the top (`pb-4` already covers the
|
|
@@ -9368,7 +9715,8 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9368
9715
|
"data-part": "root",
|
|
9369
9716
|
class: normalizeClass(rootClass),
|
|
9370
9717
|
"aria-label": __props.ariaLabel,
|
|
9371
|
-
onKeydown: onViewerKeydown
|
|
9718
|
+
onKeydown: onViewerKeydown,
|
|
9719
|
+
onCancel: onViewerCancel
|
|
9372
9720
|
}, [createElementVNode("div", {
|
|
9373
9721
|
ref_key: "rootRef",
|
|
9374
9722
|
ref: rootRef,
|
|
@@ -9399,7 +9747,11 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9399
9747
|
"aria-hidden": "true",
|
|
9400
9748
|
focusable: "false"
|
|
9401
9749
|
}, [createElementVNode("path", { d: "M18 6l-12 12" }), createElementVNode("path", { d: "M6 6l12 12" })], -1)])], 10, _hoisted_3$13)]),
|
|
9402
|
-
createElementVNode("div", {
|
|
9750
|
+
createElementVNode("div", {
|
|
9751
|
+
class: normalizeClass(stageClass.value),
|
|
9752
|
+
onPointerenter: onStagePointerenter,
|
|
9753
|
+
onPointerleave: onStagePointerleave
|
|
9754
|
+
}, [
|
|
9403
9755
|
!single.value ? (openBlock(), createElementBlock("button", {
|
|
9404
9756
|
key: 0,
|
|
9405
9757
|
ref_key: "prevButtonRef",
|
|
@@ -9407,7 +9759,7 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9407
9759
|
type: "button",
|
|
9408
9760
|
"data-part": "prev",
|
|
9409
9761
|
class: normalizeClass(prevClass.value),
|
|
9410
|
-
disabled: !unref(canPrev),
|
|
9762
|
+
disabled: !unref(canPrev) || zoomed.value,
|
|
9411
9763
|
"aria-label": unref(m).previousImage,
|
|
9412
9764
|
onClick: _cache[0] || (_cache[0] = (...args) => unref(prev) && unref(prev)(...args))
|
|
9413
9765
|
}, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
|
|
@@ -9429,17 +9781,25 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9429
9781
|
"aria-label": unref(m).lightboxImages,
|
|
9430
9782
|
"aria-live": "off",
|
|
9431
9783
|
class: normalizeClass(trackClass.value),
|
|
9432
|
-
style: normalizeStyle(unref(TRACK_STYLE))
|
|
9784
|
+
style: normalizeStyle(unref(TRACK_STYLE)),
|
|
9785
|
+
"data-zoomed": zoomed.value ? "true" : void 0,
|
|
9786
|
+
onClick: onTrackClick,
|
|
9787
|
+
onPointerdown: onTrackPointerdown,
|
|
9788
|
+
onPointermove: onTrackPointermove,
|
|
9789
|
+
onPointerleave: onTrackPointerleave,
|
|
9790
|
+
onDragstart: onTrackDragstart
|
|
9433
9791
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.images, (img, i) => {
|
|
9434
9792
|
return openBlock(), createElementBlock("div", {
|
|
9435
9793
|
key: `${img.src}-${i}`,
|
|
9436
|
-
class: normalizeClass(slideClass.value)
|
|
9794
|
+
class: normalizeClass(slideClass.value),
|
|
9795
|
+
"data-zoomed": zoomed.value && i === unref(carouselIndex) ? "true" : void 0
|
|
9437
9796
|
}, [unref(model) ? (openBlock(), createBlock(Image_default, {
|
|
9438
9797
|
key: 0,
|
|
9439
9798
|
"data-part": "image",
|
|
9440
9799
|
class: normalizeClass(imageRootClass),
|
|
9441
9800
|
classes: {
|
|
9442
9801
|
frame: imageFrameClass,
|
|
9802
|
+
media: imageMediaClass,
|
|
9443
9803
|
caption: imageCaptionClass
|
|
9444
9804
|
},
|
|
9445
9805
|
media: {
|
|
@@ -9458,8 +9818,8 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9458
9818
|
"media",
|
|
9459
9819
|
"alt",
|
|
9460
9820
|
"caption"
|
|
9461
|
-
])) : createCommentVNode("", true)],
|
|
9462
|
-
}), 128))],
|
|
9821
|
+
])) : createCommentVNode("", true)], 10, _hoisted_6$4);
|
|
9822
|
+
}), 128))], 46, _hoisted_5$6),
|
|
9463
9823
|
!single.value ? (openBlock(), createElementBlock("button", {
|
|
9464
9824
|
key: 1,
|
|
9465
9825
|
ref_key: "nextButtonRef",
|
|
@@ -9467,7 +9827,7 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9467
9827
|
type: "button",
|
|
9468
9828
|
"data-part": "next",
|
|
9469
9829
|
class: normalizeClass(nextClass.value),
|
|
9470
|
-
disabled: !unref(canNext),
|
|
9830
|
+
disabled: !unref(canNext) || zoomed.value,
|
|
9471
9831
|
"aria-label": unref(m).nextImage,
|
|
9472
9832
|
onClick: _cache[1] || (_cache[1] = (...args) => unref(next) && unref(next)(...args))
|
|
9473
9833
|
}, [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
|
|
@@ -9480,8 +9840,21 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9480
9840
|
"stroke-linejoin": "round",
|
|
9481
9841
|
"aria-hidden": "true",
|
|
9482
9842
|
focusable: "false"
|
|
9483
|
-
}, [createElementVNode("path", { d: "M9 6l6 6l-6 6" })], -1)])], 10,
|
|
9484
|
-
|
|
9843
|
+
}, [createElementVNode("path", { d: "M9 6l6 6l-6 6" })], -1)])], 10, _hoisted_7$3)) : createCommentVNode("", true),
|
|
9844
|
+
canZoom.value ? (openBlock(), createElementBlock("button", {
|
|
9845
|
+
key: 2,
|
|
9846
|
+
type: "button",
|
|
9847
|
+
"data-part": "zoomButton",
|
|
9848
|
+
class: normalizeClass(zoomButtonClass.value),
|
|
9849
|
+
"aria-label": zoomed.value ? unref(m).lightboxZoomOut : unref(m).lightboxZoomIn,
|
|
9850
|
+
onClick: onZoomButtonClick
|
|
9851
|
+
}, [(openBlock(), createElementBlock("svg", _hoisted_9$2, [
|
|
9852
|
+
_cache[5] || (_cache[5] = createElementVNode("path", { d: "M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" }, null, -1)),
|
|
9853
|
+
_cache[6] || (_cache[6] = createElementVNode("path", { d: "M7 10l6 0" }, null, -1)),
|
|
9854
|
+
!zoomed.value ? (openBlock(), createElementBlock("path", _hoisted_10$1)) : createCommentVNode("", true),
|
|
9855
|
+
_cache[7] || (_cache[7] = createElementVNode("path", { d: "M21 21l-6 -6" }, null, -1))
|
|
9856
|
+
]))], 10, _hoisted_8$2)) : createCommentVNode("", true)
|
|
9857
|
+
], 34),
|
|
9485
9858
|
showThumbnails.value && unref(model) ? (openBlock(), createElementBlock("div", {
|
|
9486
9859
|
key: 0,
|
|
9487
9860
|
"data-part": "thumbnails",
|
|
@@ -9503,7 +9876,7 @@ var Lightbox_default = /* @__PURE__ */ defineComponent({
|
|
|
9503
9876
|
decorative: "",
|
|
9504
9877
|
ratio: "1x1",
|
|
9505
9878
|
fit: "cover"
|
|
9506
|
-
}, null, 8, ["media"])], 10,
|
|
9879
|
+
}, null, 8, ["media"])], 10, _hoisted_11$1);
|
|
9507
9880
|
}), 128))], 2)) : createCommentVNode("", true)
|
|
9508
9881
|
], 2)], 40, _hoisted_1$24);
|
|
9509
9882
|
};
|
|
@@ -13747,8 +14120,15 @@ var SearchModal_default = /* @__PURE__ */ defineComponent({
|
|
|
13747
14120
|
]);
|
|
13748
14121
|
/** The frame's own bounding box around the reused panel (spec → Sizes, Panel row: "fills the
|
|
13749
14122
|
* remaining height and scrolls") — distinct from that panel's own `panel` part, the scrollable box
|
|
13750
|
-
* inside it.
|
|
13751
|
-
|
|
14123
|
+
* inside it.
|
|
14124
|
+
*
|
|
14125
|
+
* `flex-auto`, not `flex-1`: the dialog has a `max-height` but no height on desktop, and Safari sizes
|
|
14126
|
+
* a `flex-basis: 0%` item in a column of indefinite height to nothing — the dialog drew the field
|
|
14127
|
+
* and the footer with no results between them. A content basis grows to the content and shrinks
|
|
14128
|
+
* under the max (`min-h-0`). It is a flex column itself so the panel inside shrinks to it and
|
|
14129
|
+
* scrolls, which a `height: 100%` against this box's indefinite height never did in any browser:
|
|
14130
|
+
* long results were clipped at the max with no way to reach them. */
|
|
14131
|
+
const resultsClass = computed(() => ["eldra:flex eldra:min-h-0 eldra:flex-auto eldra:flex-col eldra:overflow-hidden", props.classes?.results]);
|
|
13752
14132
|
/** "Foot | padding 0.625rem 1rem, gap 0.5rem 1.25rem … 1px border above … hidden [below 48rem]." */
|
|
13753
14133
|
const footerClass = computed(() => [
|
|
13754
14134
|
"eldra:hidden eldra:items-center eldra:gap-x-5 eldra:gap-y-2 eldra:border-t eldra:border-border eldra:bg-surface eldra:px-4 eldra:py-2.5 eldra:md:flex",
|