@yewdiel21/motion-kit 0.15.0 → 0.16.0
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/README.md +4 -0
- package/dist/auto/index.d.ts +3 -3
- package/dist/auto/index.js +2 -2
- package/dist/{chunk-6IRJYXJU.js → chunk-NFZIX3IA.js} +2 -2
- package/dist/{chunk-JXRS3OEA.js → chunk-RBEKR5UZ.js} +29 -7
- package/dist/chunk-RBEKR5UZ.js.map +1 -0
- package/dist/{chunk-A6QQCF6V.js → chunk-SDQ776LG.js} +129 -17
- package/dist/chunk-SDQ776LG.js.map +1 -0
- package/dist/css/components/chart.css +7 -0
- package/dist/css/components/heatmap-chart.css +7 -0
- package/dist/css/components/pie-chart.css +7 -0
- package/dist/css/components/radar-chart.css +7 -0
- package/dist/css/components/radial-chart.css +16 -2
- package/dist/css/components/sankey-chart.css +7 -0
- package/dist/css/components/scroll-island.css +3 -0
- package/dist/elements/index.d.ts +3 -3
- package/dist/elements/index.js +11 -6
- package/dist/elements/index.js.map +1 -1
- package/dist/index.css +19 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/react/index.d.ts +9 -9
- package/dist/react/index.js +16 -10
- package/dist/react/index.js.map +1 -1
- package/dist/{reduced-6X_bns60.d.ts → reduced-DQwVXQYb.d.ts} +1 -1
- package/dist/{reveal-BfyKKsw4.d.ts → reveal-DRpNO4KP.d.ts} +12 -0
- package/dist/{store-CA2Qcun_.d.ts → store-Da3zSh8Z.d.ts} +5 -1
- package/package.json +1 -1
- package/src/components/add-to-cart/README.md +49 -34
- package/src/components/add-to-cart/react.tsx +4 -0
- package/src/components/chart/README.md +49 -34
- package/src/components/chart/chart.css +7 -0
- package/src/components/chart/element.ts +2 -1
- package/src/components/chart/engine.ts +105 -13
- package/src/components/chart/react.tsx +2 -2
- package/src/components/radial-chart/README.md +10 -0
- package/src/components/radial-chart/element.ts +2 -2
- package/src/components/radial-chart/engine.ts +33 -6
- package/src/components/radial-chart/radial-chart.css +9 -2
- package/src/components/radial-chart/react.tsx +2 -2
- package/src/components/scroll-island/README.md +44 -34
- package/src/components/scroll-island/element.ts +1 -1
- package/src/components/scroll-island/engine.ts +25 -3
- package/src/components/scroll-island/react.tsx +3 -3
- package/src/components/scroll-island/scroll-island.css +3 -0
- package/dist/chunk-A6QQCF6V.js.map +0 -1
- package/dist/chunk-JXRS3OEA.js.map +0 -1
- /package/dist/{chunk-6IRJYXJU.js.map → chunk-NFZIX3IA.js.map} +0 -0
|
@@ -6295,6 +6295,22 @@ function barPath(x, width, base, end, rounded) {
|
|
|
6295
6295
|
if (!r) return `M${round(x)},${round(base)}V${round(end)}H${round(x + width)}V${round(base)}Z`;
|
|
6296
6296
|
return `M${round(x)},${round(base)}V${round(end + dir * r)}Q${round(x)},${round(end)} ${round(x + r)},${round(end)}H${round(x + width - r)}Q${round(x + width)},${round(end)} ${round(x + width)},${round(end + dir * r)}V${round(base)}Z`;
|
|
6297
6297
|
}
|
|
6298
|
+
function pillPath(x, width, a, b) {
|
|
6299
|
+
const top = Math.min(a, b), bottom = Math.max(a, b);
|
|
6300
|
+
const r = Math.min(width / 2, (bottom - top) / 2);
|
|
6301
|
+
return `M${round(x + r)},${round(top)}H${round(x + width - r)}Q${round(x + width)},${round(top)} ${round(x + width)},${round(top + r)}V${round(bottom - r)}Q${round(x + width)},${round(bottom)} ${round(x + width - r)},${round(bottom)}H${round(x + r)}Q${round(x)},${round(bottom)} ${round(x)},${round(bottom - r)}V${round(top + r)}Q${round(x)},${round(top)} ${round(x + r)},${round(top)}Z`;
|
|
6302
|
+
}
|
|
6303
|
+
function linePath(points, smooth) {
|
|
6304
|
+
if (!points.length) return "";
|
|
6305
|
+
let path = `M${round(points[0][0])},${round(points[0][1])}`;
|
|
6306
|
+
const slopes = points.slice(1).map((point, i) => (point[1] - points[i][1]) / (point[0] - points[i][0] || 1));
|
|
6307
|
+
const tangents = points.map((_, i) => i === 0 ? slopes[0] : i === points.length - 1 ? slopes[i - 1] : slopes[i - 1] * slopes[i] <= 0 ? 0 : 2 * slopes[i - 1] * slopes[i] / (slopes[i - 1] + slopes[i]));
|
|
6308
|
+
for (let i = 1; i < points.length; i++) {
|
|
6309
|
+
const [x0, y0] = points[i - 1], [x, y] = points[i], dx = (x - x0) / 3;
|
|
6310
|
+
path += smooth ? `C${round(x0 + dx)},${round(y0 + tangents[i - 1] * dx)} ${round(x - dx)},${round(y - tangents[i] * dx)} ${round(x)},${round(y)}` : `L${round(x)},${round(y)}`;
|
|
6311
|
+
}
|
|
6312
|
+
return path;
|
|
6313
|
+
}
|
|
6298
6314
|
function modelOf(options) {
|
|
6299
6315
|
const fromPoints = options.points?.length ? { labels: options.points.map((point) => String(point.label)), series: [{ name: options.label ?? "", values: options.points.map((point) => point.value) }] } : null;
|
|
6300
6316
|
const labels = fromPoints?.labels ?? (options.labels ?? []).map(String);
|
|
@@ -6532,6 +6548,7 @@ function createChart(root, initial = {}) {
|
|
|
6532
6548
|
const slot = plotW / n;
|
|
6533
6549
|
const xs = model.labels.map((_, i) => bar ? left + slot * (i + 0.5) : n === 1 ? left + plotW / 2 : left + plotW * i / (n - 1));
|
|
6534
6550
|
geometry = { width, height, top, bottom: top + plotH, left, right: width - right, xs, y, base };
|
|
6551
|
+
shown4 = { values, lower, lo, hi, type: type(), stacked: stacked() };
|
|
6535
6552
|
const grid = svg("g", { "data-mk-part": "grid" });
|
|
6536
6553
|
if (!axis) {
|
|
6537
6554
|
const zero = svg("line", { x1: left, x2: width - right, y1: round(base), y2: round(base) });
|
|
@@ -6570,10 +6587,53 @@ function createChart(root, initial = {}) {
|
|
|
6570
6587
|
if (bar) {
|
|
6571
6588
|
const barIndices = model.series.flatMap((_, index) => seriesType(index) === "bar" ? [index] : []);
|
|
6572
6589
|
const groups = stacked() ? 1 : barIndices.length;
|
|
6573
|
-
const
|
|
6590
|
+
const maxWidth = finite3(options.barWidth) ? Math.max(2, Math.min(96, options.barWidth)) : BAR_MAX;
|
|
6591
|
+
const barWidth = Math.max(2, Math.min(maxWidth, (slot * 0.62 - GAP3 * (groups - 1)) / groups));
|
|
6592
|
+
const pill2 = options.barStyle === "pill";
|
|
6593
|
+
const trackLayer = svg("g", { "data-mk-part": "bar-tracks" });
|
|
6594
|
+
canvas.append(trackLayer);
|
|
6595
|
+
if (options.barFill && options.barFill !== "solid") {
|
|
6596
|
+
model.series.forEach((series, k) => {
|
|
6597
|
+
const gradient = svg("linearGradient", { id: `${uid2}-bar-${k}`, x1: 0, y1: 0, x2: 0, y2: 1 });
|
|
6598
|
+
for (const [offset, opacity] of [["0", "1"], ["1", "0.4"]]) {
|
|
6599
|
+
const stop2 = svg("stop", { offset });
|
|
6600
|
+
stop2.style.stopColor = series.color;
|
|
6601
|
+
stop2.style.stopOpacity = opacity;
|
|
6602
|
+
gradient.append(stop2);
|
|
6603
|
+
}
|
|
6604
|
+
defs.append(gradient);
|
|
6605
|
+
});
|
|
6606
|
+
const hatch = svg("pattern", { id: `${uid2}-hatch`, patternUnits: "userSpaceOnUse", width: 6, height: 6, patternTransform: "rotate(35)" });
|
|
6607
|
+
const ground = svg("rect", { width: 6, height: 6 });
|
|
6608
|
+
ground.style.fill = "var(--mk-chart-track)";
|
|
6609
|
+
const stripe = svg("line", { x1: 0, x2: 0, y1: 0, y2: 6 });
|
|
6610
|
+
stripe.style.stroke = "var(--mk-chart-grid)";
|
|
6611
|
+
stripe.style.strokeWidth = "2";
|
|
6612
|
+
hatch.append(ground, stripe);
|
|
6613
|
+
defs.append(hatch);
|
|
6614
|
+
}
|
|
6615
|
+
const fillBar = (path, k, index) => {
|
|
6616
|
+
const fill = options.barFill && options.barFill !== "solid" ? `url(#${uid2}-bar-${k})` : model.series[k].color;
|
|
6617
|
+
path.style.setProperty("--mk-bar-fill", fill);
|
|
6618
|
+
path.style.fill = options.barFill === "spotlight" && index !== (selected ?? n - 1) ? `url(#${uid2}-hatch)` : fill;
|
|
6619
|
+
};
|
|
6620
|
+
const addTrack = (x) => {
|
|
6621
|
+
if (!options.barTrack) return;
|
|
6622
|
+
const path = svg("path", { d: pillPath(x, barWidth, top, base), "data-mk-part": "bar-track" });
|
|
6623
|
+
trackLayer.append(path);
|
|
6624
|
+
};
|
|
6574
6625
|
const totalsLayer = svg("g", { "data-mk-part": "totals" });
|
|
6575
6626
|
model.labels.forEach((_, i) => {
|
|
6576
6627
|
if (stacked()) {
|
|
6628
|
+
const clipId = `${uid2}-stack-${i}`;
|
|
6629
|
+
if (pill2) {
|
|
6630
|
+
const sum = totalsOf(values, i);
|
|
6631
|
+
const clip = svg("clipPath", { id: clipId });
|
|
6632
|
+
if (sum.up) clip.append(svg("path", { d: pillPath(xs[i] - barWidth / 2, barWidth, base, y(sum.up)) }));
|
|
6633
|
+
if (sum.down) clip.append(svg("path", { d: pillPath(xs[i] - barWidth / 2, barWidth, base, y(sum.down)) }));
|
|
6634
|
+
defs.append(clip);
|
|
6635
|
+
}
|
|
6636
|
+
addTrack(xs[i] - barWidth / 2);
|
|
6577
6637
|
let up = 0;
|
|
6578
6638
|
let down = 0;
|
|
6579
6639
|
const outer = { up: -1, down: -1 };
|
|
@@ -6592,8 +6652,9 @@ function createChart(root, initial = {}) {
|
|
|
6592
6652
|
const start = y(from) + (from !== 0 ? value > 0 ? -GAP3 : GAP3 : 0);
|
|
6593
6653
|
const end = y(to);
|
|
6594
6654
|
if (value > 0 && end >= start || value < 0 && end <= start) return;
|
|
6595
|
-
const path = svg("path", { d: barPath(xs[i] - barWidth / 2, barWidth, start, end, k === (value > 0 ? outer.up : outer.down)), "data-mk-index": i, "data-mk-series": k });
|
|
6596
|
-
path.
|
|
6655
|
+
const path = svg("path", { d: barPath(xs[i] - barWidth / 2, barWidth, start, end, !pill2 && k === (value > 0 ? outer.up : outer.down)), "data-mk-part": "bar", "data-mk-index": i, "data-mk-series": k });
|
|
6656
|
+
if (pill2) path.setAttribute("clip-path", `url(#${clipId})`);
|
|
6657
|
+
fillBar(path, k, i);
|
|
6597
6658
|
marks.append(path);
|
|
6598
6659
|
});
|
|
6599
6660
|
if (slot >= 22 && up > 0) {
|
|
@@ -6607,10 +6668,11 @@ function createChart(root, initial = {}) {
|
|
|
6607
6668
|
values.forEach((list3, k) => {
|
|
6608
6669
|
if (seriesType(k) !== "bar") return;
|
|
6609
6670
|
const value = list3[i];
|
|
6610
|
-
if (!finite3(value) || value === 0) return;
|
|
6611
6671
|
const x = xs[i] - groupWidth / 2 + barIndices.indexOf(k) * (barWidth + GAP3);
|
|
6612
|
-
|
|
6613
|
-
|
|
6672
|
+
addTrack(x);
|
|
6673
|
+
if (!finite3(value) || value === 0) return;
|
|
6674
|
+
const path = svg("path", { d: pill2 ? pillPath(x, barWidth, base, y(value)) : barPath(x, barWidth, base, y(value), true), "data-mk-part": "bar", "data-mk-index": i, "data-mk-series": k });
|
|
6675
|
+
fillBar(path, k, i);
|
|
6614
6676
|
marks.append(path);
|
|
6615
6677
|
});
|
|
6616
6678
|
}
|
|
@@ -6644,7 +6706,9 @@ function createChart(root, initial = {}) {
|
|
|
6644
6706
|
defs.append(gradient);
|
|
6645
6707
|
for (const points of runs2) {
|
|
6646
6708
|
if (points.length < 2) continue;
|
|
6647
|
-
const
|
|
6709
|
+
const upper = linePath(points, options.curve === "smooth");
|
|
6710
|
+
const bottom2 = linePath([...points].reverse().map(([px, , py]) => [px, py]), options.curve === "smooth");
|
|
6711
|
+
const d = `${upper}${bottom2.replace(/^M/, "L")}Z`;
|
|
6648
6712
|
const area = svg("path", { d, "data-mk-part": "area", "data-mk-series": k });
|
|
6649
6713
|
area.style.fill = `url(#${uid2}-fill-${k})`;
|
|
6650
6714
|
marks.append(area);
|
|
@@ -6657,7 +6721,7 @@ function createChart(root, initial = {}) {
|
|
|
6657
6721
|
marks.append(dot);
|
|
6658
6722
|
continue;
|
|
6659
6723
|
}
|
|
6660
|
-
const line = svg("path", { d:
|
|
6724
|
+
const line = svg("path", { d: linePath(points, options.curve === "smooth"), "data-mk-part": "line" });
|
|
6661
6725
|
line.style.stroke = series.color;
|
|
6662
6726
|
const dotted = Boolean(series.dash) && Number(series.dash.trim().split(/[\s,]+/)[0]) <= 1;
|
|
6663
6727
|
line.style.strokeWidth = dotted ? "2.5" : series.dash ? "1.5" : k === 0 ? "2.5" : "2";
|
|
@@ -6692,6 +6756,11 @@ function createChart(root, initial = {}) {
|
|
|
6692
6756
|
cursor.replaceChildren();
|
|
6693
6757
|
if (band) band.style.display = "none";
|
|
6694
6758
|
for (const mark of canvas.querySelectorAll("[data-mk-index]")) mark.removeAttribute("data-mk-dim");
|
|
6759
|
+
for (const mark of canvas.querySelectorAll('[data-mk-part="bar"]')) {
|
|
6760
|
+
const index = Number(mark.dataset.mkIndex);
|
|
6761
|
+
mark.toggleAttribute("data-mk-active", index === selected);
|
|
6762
|
+
if (options.barFill === "spotlight") mark.style.fill = index === (selected ?? model.labels.length - 1) ? mark.style.getPropertyValue("--mk-bar-fill") : `url(#${uid2}-hatch)`;
|
|
6763
|
+
}
|
|
6695
6764
|
if (selected === null || !hasData()) {
|
|
6696
6765
|
if (!tooltip.hidden && !reduced()) {
|
|
6697
6766
|
gsap.killTweensOf(tooltip, "opacity,scale");
|
|
@@ -6716,6 +6785,24 @@ function createChart(root, initial = {}) {
|
|
|
6716
6785
|
for (const mark of canvas.querySelectorAll("[data-mk-index]")) if (mark.getAttribute("data-mk-index") !== String(i)) mark.setAttribute("data-mk-dim", "");
|
|
6717
6786
|
const { up, down } = totals(i);
|
|
6718
6787
|
anchorY = stacked() ? geometry.y(up || down) : Math.min(...model.series.map((series) => finite3(series.values[i]) ? geometry.y(series.values[i]) : geometry.bottom));
|
|
6788
|
+
if (options.barStyle === "pill") {
|
|
6789
|
+
const amount = stacked() ? up + down : model.series[0]?.values[i];
|
|
6790
|
+
if (finite3(amount)) {
|
|
6791
|
+
const label = format(amount), width = Math.max(40, label.length * 7 + 18);
|
|
6792
|
+
const bx = Math.max(0, Math.min(geometry.width - width, x - width / 2));
|
|
6793
|
+
const by = Math.max(0, anchorY - 32);
|
|
6794
|
+
const group = svg("g", { "data-mk-part": "bar-value" });
|
|
6795
|
+
group.append(svg("rect", { x: round(bx), y: round(by), width, height: 24, rx: 12 }));
|
|
6796
|
+
const text = svg("text", { x: round(bx + width / 2), y: round(by + 12), "text-anchor": "middle", "dominant-baseline": "middle" });
|
|
6797
|
+
text.textContent = label;
|
|
6798
|
+
group.append(text);
|
|
6799
|
+
cursor.append(group);
|
|
6800
|
+
const marker = svg("circle", { cx: round(x), cy: round(anchorY), r: 4, "data-mk-part": "marker" });
|
|
6801
|
+
marker.style.fill = model.series[0]?.color ?? "var(--mk-text)";
|
|
6802
|
+
cursor.append(marker);
|
|
6803
|
+
if (fresh && !reduced()) keep(gsap.fromTo(group, { opacity: 0, y: 6 }, { opacity: 1, y: 0, duration: 0.3, ease: EASE.pop }));
|
|
6804
|
+
}
|
|
6805
|
+
}
|
|
6719
6806
|
} else {
|
|
6720
6807
|
cursor.append(svg("line", { x1: round(x), x2: round(x), y1: geometry.top, y2: geometry.bottom, "data-mk-part": "guide" }));
|
|
6721
6808
|
model.series.forEach((series) => {
|
|
@@ -6798,6 +6885,7 @@ function createChart(root, initial = {}) {
|
|
|
6798
6885
|
glide?.kill();
|
|
6799
6886
|
canvas.setAttribute("aria-label", describe());
|
|
6800
6887
|
scope.attr(root, "data-mk-chart-type", type());
|
|
6888
|
+
scope.attr(root, "data-mk-bar-style", options.barStyle ?? "rounded");
|
|
6801
6889
|
renderTable();
|
|
6802
6890
|
renderLegend();
|
|
6803
6891
|
const ok = hasData();
|
|
@@ -6852,12 +6940,14 @@ function createChart(root, initial = {}) {
|
|
|
6852
6940
|
}
|
|
6853
6941
|
finish();
|
|
6854
6942
|
if (type() === "bar") {
|
|
6855
|
-
const
|
|
6943
|
+
const stagger = Math.min(0.045, 0.22 / Math.max(1, model.labels.length - 1));
|
|
6944
|
+
const length = 0.7 + stagger * (model.labels.length - 1);
|
|
6945
|
+
const state = { t: 0 }, ease = gsap.parseEase(EASE.swatch);
|
|
6856
6946
|
glide = gsap.to(state, {
|
|
6857
|
-
t:
|
|
6858
|
-
duration:
|
|
6859
|
-
ease:
|
|
6860
|
-
onUpdate: () => paint(target.map((list3) => list3.map((value) => finite3(value) ? value * state.t : value)), domain.lo, domain.hi, domain.step),
|
|
6947
|
+
t: length,
|
|
6948
|
+
duration: length,
|
|
6949
|
+
ease: "none",
|
|
6950
|
+
onUpdate: () => paint(target.map((list3) => list3.map((value, i) => finite3(value) ? value * Math.max(0, ease(Math.min(1, Math.max(0, (state.t - i * stagger) / 0.7)))) : value)), domain.lo, domain.hi, domain.step),
|
|
6861
6951
|
onComplete: () => {
|
|
6862
6952
|
finish();
|
|
6863
6953
|
settle();
|
|
@@ -20932,6 +21022,7 @@ function createScrollIsland(root, options = {}) {
|
|
|
20932
21022
|
const idle2 = Number.isFinite(options.idle) ? Math.max(0, options.idle) : 900;
|
|
20933
21023
|
const marked3 = page ? document.documentElement : root;
|
|
20934
21024
|
scope.attr(marked3, "data-mk-scroll-island-host", "");
|
|
21025
|
+
scope.attr(root, "data-mk-ready", "");
|
|
20935
21026
|
const island = document.createElement("div");
|
|
20936
21027
|
island.dataset.mkScrollIsland = "";
|
|
20937
21028
|
island.dataset.mkState = "hidden";
|
|
@@ -20973,6 +21064,16 @@ function createScrollIsland(root, options = {}) {
|
|
|
20973
21064
|
let section;
|
|
20974
21065
|
let hideTimer;
|
|
20975
21066
|
let dragging = null;
|
|
21067
|
+
let scrollBehavior = null;
|
|
21068
|
+
const restoreBehavior = () => {
|
|
21069
|
+
if (!scrollBehavior) return;
|
|
21070
|
+
const previous = scrollBehavior;
|
|
21071
|
+
if (previous.value) scroller.style.setProperty("scroll-behavior", previous.value, previous.priority);
|
|
21072
|
+
else scroller.style.removeProperty("scroll-behavior");
|
|
21073
|
+
if (!previous.hadStyle && !scroller.getAttribute("style")) scroller.removeAttribute("style");
|
|
21074
|
+
scrollBehavior = null;
|
|
21075
|
+
};
|
|
21076
|
+
scope.add(restoreBehavior);
|
|
20976
21077
|
scope.add(() => clearTimeout(hideTimer));
|
|
20977
21078
|
const headings = () => options.sections === false ? [] : [...(page ? document.body : root).querySelectorAll(options.sections ?? "h2, h3")];
|
|
20978
21079
|
const currentSection = () => {
|
|
@@ -20987,7 +21088,7 @@ function createScrollIsland(root, options = {}) {
|
|
|
20987
21088
|
const size = as === "island" ? ISLAND_HEIGHT : Math.max(MIN_BAR, Math.min(height, height * (scroller.clientHeight / Math.max(1, scroller.scrollHeight))));
|
|
20988
21089
|
const top = (height - size) * progress();
|
|
20989
21090
|
if (as !== "island") return { top, height: size, width: BAR_WIDTH, borderRadius: BAR_WIDTH / 2 };
|
|
20990
|
-
return { top, height: size, width: Math.max(ISLAND_HEIGHT, content.scrollWidth + 28), borderRadius: size / 2 };
|
|
21091
|
+
return { top, height: size, width: Math.min(Math.max(ISLAND_HEIGHT, track().right - track().left - INSET * 2), Math.max(ISLAND_HEIGHT, content.scrollWidth + 28)), borderRadius: size / 2 };
|
|
20991
21092
|
};
|
|
20992
21093
|
const place3 = () => {
|
|
20993
21094
|
const box = track();
|
|
@@ -21024,7 +21125,7 @@ function createScrollIsland(root, options = {}) {
|
|
|
21024
21125
|
const settleLater = () => {
|
|
21025
21126
|
clearTimeout(hideTimer);
|
|
21026
21127
|
hideTimer = setTimeout(() => {
|
|
21027
|
-
if (state === "bar" && !dragging) go("hidden");
|
|
21128
|
+
if (state === "bar" && !dragging && !options.persistent) go("hidden");
|
|
21028
21129
|
}, idle2);
|
|
21029
21130
|
};
|
|
21030
21131
|
const onScroll = () => {
|
|
@@ -21073,6 +21174,8 @@ function createScrollIsland(root, options = {}) {
|
|
|
21073
21174
|
if (state !== "island" || down.button !== 0) return;
|
|
21074
21175
|
down.preventDefault();
|
|
21075
21176
|
down.stopPropagation();
|
|
21177
|
+
if (!scrollBehavior) scrollBehavior = { value: scroller.style.getPropertyValue("scroll-behavior"), priority: scroller.style.getPropertyPriority("scroll-behavior"), hadStyle: scroller.hasAttribute("style") };
|
|
21178
|
+
scroller.style.setProperty("scroll-behavior", "auto", "important");
|
|
21076
21179
|
const box = thumb.getBoundingClientRect();
|
|
21077
21180
|
dragging = { id: down.pointerId, offset: down.clientY - box.top || ISLAND_HEIGHT / 2 };
|
|
21078
21181
|
island.setAttribute("data-mk-dragging", "");
|
|
@@ -21084,6 +21187,7 @@ function createScrollIsland(root, options = {}) {
|
|
|
21084
21187
|
const release = (event) => {
|
|
21085
21188
|
if (!dragging || event.pointerId !== dragging.id) return;
|
|
21086
21189
|
dragging = null;
|
|
21190
|
+
restoreBehavior();
|
|
21087
21191
|
island.removeAttribute("data-mk-dragging");
|
|
21088
21192
|
};
|
|
21089
21193
|
scope.on(window, "pointerup", release);
|
|
@@ -21098,7 +21202,15 @@ function createScrollIsland(root, options = {}) {
|
|
|
21098
21202
|
scroller.scrollTo({ top: Math.round(Math.min(1, Math.max(0, ratio)) * range()), behavior: reduced() ? "auto" : "smooth" });
|
|
21099
21203
|
});
|
|
21100
21204
|
paintText();
|
|
21101
|
-
go("hidden");
|
|
21205
|
+
go(options.persistent ? "bar" : "hidden");
|
|
21206
|
+
if (typeof ResizeObserver === "function") {
|
|
21207
|
+
const observer = scope.observe(new ResizeObserver(() => {
|
|
21208
|
+
paintText();
|
|
21209
|
+
go(state, true);
|
|
21210
|
+
}));
|
|
21211
|
+
observer.observe(root);
|
|
21212
|
+
for (const child of root.children) observer.observe(child);
|
|
21213
|
+
}
|
|
21102
21214
|
return {
|
|
21103
21215
|
refresh: () => {
|
|
21104
21216
|
paintText();
|
|
@@ -21330,4 +21442,4 @@ export {
|
|
|
21330
21442
|
createAddToCart,
|
|
21331
21443
|
createScrollIsland
|
|
21332
21444
|
};
|
|
21333
|
-
//# sourceMappingURL=chunk-
|
|
21445
|
+
//# sourceMappingURL=chunk-SDQ776LG.js.map
|