@surdeddd/bottom-sheet 0.4.1 → 0.5.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/dist/{BottomSheetEngine-L05jGZvU.d.ts → BottomSheetEngine-BHjKFtnM.d.ts} +2 -0
- package/dist/{BottomSheetEngine-BJrH7qY3.d.cts → BottomSheetEngine-CqiCz64W.d.cts} +2 -0
- package/dist/element.cjs +111 -12
- package/dist/element.d.cts +1 -1
- package/dist/element.d.ts +1 -1
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +111 -12
- package/dist/index.cjs +91 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +91 -8
- package/dist/integrations/formik.d.cts +1 -1
- package/dist/integrations/formik.d.ts +1 -1
- package/dist/integrations/react-hook-form.d.cts +1 -1
- package/dist/integrations/react-hook-form.d.ts +1 -1
- package/dist/preact.d.cts +1 -1
- package/dist/preact.d.ts +1 -1
- package/dist/qwik.cjs +94 -10
- package/dist/qwik.d.cts +2 -2
- package/dist/qwik.d.ts +2 -2
- package/dist/qwik.js +94 -10
- package/dist/react.cjs +95 -10
- package/dist/react.d.cts +4 -2
- package/dist/react.d.ts +4 -2
- package/dist/react.js +95 -10
- package/dist/solid.cjs +122 -18
- package/dist/solid.d.cts +3 -0
- package/dist/solid.d.ts +3 -0
- package/dist/solid.js +124 -20
- package/dist/solid.source.jsx +100 -12
- package/dist/styles.css +17 -0
- package/dist/svelte-core.cjs +91 -8
- package/dist/svelte-core.js +91 -8
- package/dist/svelte-src/BottomSheet.svelte +5 -3
- package/dist/svelte.cjs +143 -45
- package/dist/svelte.d.cts +1 -0
- package/dist/svelte.d.ts +1 -0
- package/dist/svelte.js +143 -45
- package/dist/vue.cjs +106 -18
- package/dist/vue.js +106 -18
- package/package.json +1 -1
package/dist/svelte-core.cjs
CHANGED
|
@@ -2897,11 +2897,54 @@ var BottomSheetEngine = class {
|
|
|
2897
2897
|
this.updateAriaSlider();
|
|
2898
2898
|
}
|
|
2899
2899
|
}
|
|
2900
|
+
contentTargets() {
|
|
2901
|
+
const scroller = this.scrollContainer;
|
|
2902
|
+
if (!scroller) return [];
|
|
2903
|
+
const hasSlot = typeof HTMLSlotElement !== "undefined";
|
|
2904
|
+
const out = [];
|
|
2905
|
+
for (const child of Array.from(scroller.children)) {
|
|
2906
|
+
if (hasSlot && child instanceof HTMLSlotElement) {
|
|
2907
|
+
for (const el of child.assignedElements()) out.push(el);
|
|
2908
|
+
} else {
|
|
2909
|
+
out.push(child);
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
return out;
|
|
2913
|
+
}
|
|
2914
|
+
measureContentExtent(vertical) {
|
|
2915
|
+
const content = this.scrollContainer;
|
|
2916
|
+
if (!content) return 0;
|
|
2917
|
+
const targets = this.contentTargets();
|
|
2918
|
+
if (targets.length === 0) {
|
|
2919
|
+
return vertical ? content.scrollHeight : content.scrollWidth;
|
|
2920
|
+
}
|
|
2921
|
+
let min = Infinity;
|
|
2922
|
+
let max = -Infinity;
|
|
2923
|
+
for (const el of targets) {
|
|
2924
|
+
const r = el.getBoundingClientRect();
|
|
2925
|
+
if (vertical) {
|
|
2926
|
+
if (r.top < min) min = r.top;
|
|
2927
|
+
if (r.bottom > max) max = r.bottom;
|
|
2928
|
+
} else {
|
|
2929
|
+
if (r.left < min) min = r.left;
|
|
2930
|
+
if (r.right > max) max = r.right;
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
if (!isFinite(min) || !isFinite(max) || max <= min) {
|
|
2934
|
+
return vertical ? content.scrollHeight : content.scrollWidth;
|
|
2935
|
+
}
|
|
2936
|
+
let pad = 0;
|
|
2937
|
+
if (typeof getComputedStyle !== "undefined") {
|
|
2938
|
+
const cs = getComputedStyle(content);
|
|
2939
|
+
pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
|
|
2940
|
+
}
|
|
2941
|
+
return max - min + pad;
|
|
2942
|
+
}
|
|
2900
2943
|
measureFitSize() {
|
|
2901
2944
|
const vertical = layoutAxis(this.mode) === "height";
|
|
2902
2945
|
const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
|
|
2903
2946
|
const content = this.scrollContainer;
|
|
2904
|
-
const natural = content ? handleSize + (vertical
|
|
2947
|
+
const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
|
|
2905
2948
|
if (typeof window === "undefined") return natural;
|
|
2906
2949
|
const viewport = vertical ? window.innerHeight : window.innerWidth;
|
|
2907
2950
|
return viewport > 0 ? Math.min(natural, viewport) : natural;
|
|
@@ -2910,22 +2953,62 @@ var BottomSheetEngine = class {
|
|
|
2910
2953
|
if (typeof ResizeObserver === "undefined") return;
|
|
2911
2954
|
if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
|
|
2912
2955
|
return;
|
|
2913
|
-
const targets = [this.handle];
|
|
2914
|
-
if (this.scrollContainer && this.scrollContainer !== this.handle) {
|
|
2915
|
-
targets.push(this.scrollContainer);
|
|
2916
|
-
}
|
|
2917
2956
|
let raf = 0;
|
|
2918
|
-
const
|
|
2957
|
+
const schedule = () => {
|
|
2919
2958
|
if (raf) return;
|
|
2920
2959
|
raf = requestAnimationFrame(() => {
|
|
2921
2960
|
raf = 0;
|
|
2922
2961
|
if (this.destroyed || this.gesture?.isDragging) return;
|
|
2923
2962
|
this.recompute();
|
|
2924
2963
|
});
|
|
2925
|
-
}
|
|
2926
|
-
|
|
2964
|
+
};
|
|
2965
|
+
const ro = new ResizeObserver(schedule);
|
|
2966
|
+
ro.observe(this.handle);
|
|
2967
|
+
const scroller = this.scrollContainer;
|
|
2968
|
+
const observed = /* @__PURE__ */ new Set();
|
|
2969
|
+
const slots = /* @__PURE__ */ new Set();
|
|
2970
|
+
const hasSlot = typeof HTMLSlotElement !== "undefined";
|
|
2971
|
+
const onSlotChange = () => resync();
|
|
2972
|
+
const trackSlots = () => {
|
|
2973
|
+
if (!scroller || !hasSlot) return;
|
|
2974
|
+
for (const child of Array.from(scroller.children)) {
|
|
2975
|
+
if (child instanceof HTMLSlotElement && !slots.has(child)) {
|
|
2976
|
+
child.addEventListener("slotchange", onSlotChange);
|
|
2977
|
+
slots.add(child);
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
};
|
|
2981
|
+
const resync = () => {
|
|
2982
|
+
trackSlots();
|
|
2983
|
+
const targets = this.contentTargets();
|
|
2984
|
+
for (const el of observed) {
|
|
2985
|
+
if (!targets.includes(el)) {
|
|
2986
|
+
ro.unobserve(el);
|
|
2987
|
+
observed.delete(el);
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
for (const el of targets) {
|
|
2991
|
+
if (!observed.has(el)) {
|
|
2992
|
+
ro.observe(el);
|
|
2993
|
+
observed.add(el);
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
schedule();
|
|
2997
|
+
};
|
|
2998
|
+
let mo;
|
|
2999
|
+
if (scroller) {
|
|
3000
|
+
resync();
|
|
3001
|
+
if (typeof MutationObserver !== "undefined") {
|
|
3002
|
+
mo = new MutationObserver(resync);
|
|
3003
|
+
mo.observe(scroller, { childList: true });
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
2927
3006
|
this.teardowns.add(() => {
|
|
2928
3007
|
ro.disconnect();
|
|
3008
|
+
mo?.disconnect();
|
|
3009
|
+
for (const slot of slots) {
|
|
3010
|
+
slot.removeEventListener("slotchange", onSlotChange);
|
|
3011
|
+
}
|
|
2929
3012
|
if (raf) cancelAnimationFrame(raf);
|
|
2930
3013
|
});
|
|
2931
3014
|
}
|
package/dist/svelte-core.js
CHANGED
|
@@ -2895,11 +2895,54 @@ var BottomSheetEngine = class {
|
|
|
2895
2895
|
this.updateAriaSlider();
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
2898
|
+
contentTargets() {
|
|
2899
|
+
const scroller = this.scrollContainer;
|
|
2900
|
+
if (!scroller) return [];
|
|
2901
|
+
const hasSlot = typeof HTMLSlotElement !== "undefined";
|
|
2902
|
+
const out = [];
|
|
2903
|
+
for (const child of Array.from(scroller.children)) {
|
|
2904
|
+
if (hasSlot && child instanceof HTMLSlotElement) {
|
|
2905
|
+
for (const el of child.assignedElements()) out.push(el);
|
|
2906
|
+
} else {
|
|
2907
|
+
out.push(child);
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
return out;
|
|
2911
|
+
}
|
|
2912
|
+
measureContentExtent(vertical) {
|
|
2913
|
+
const content = this.scrollContainer;
|
|
2914
|
+
if (!content) return 0;
|
|
2915
|
+
const targets = this.contentTargets();
|
|
2916
|
+
if (targets.length === 0) {
|
|
2917
|
+
return vertical ? content.scrollHeight : content.scrollWidth;
|
|
2918
|
+
}
|
|
2919
|
+
let min = Infinity;
|
|
2920
|
+
let max = -Infinity;
|
|
2921
|
+
for (const el of targets) {
|
|
2922
|
+
const r = el.getBoundingClientRect();
|
|
2923
|
+
if (vertical) {
|
|
2924
|
+
if (r.top < min) min = r.top;
|
|
2925
|
+
if (r.bottom > max) max = r.bottom;
|
|
2926
|
+
} else {
|
|
2927
|
+
if (r.left < min) min = r.left;
|
|
2928
|
+
if (r.right > max) max = r.right;
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
if (!isFinite(min) || !isFinite(max) || max <= min) {
|
|
2932
|
+
return vertical ? content.scrollHeight : content.scrollWidth;
|
|
2933
|
+
}
|
|
2934
|
+
let pad = 0;
|
|
2935
|
+
if (typeof getComputedStyle !== "undefined") {
|
|
2936
|
+
const cs = getComputedStyle(content);
|
|
2937
|
+
pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
|
|
2938
|
+
}
|
|
2939
|
+
return max - min + pad;
|
|
2940
|
+
}
|
|
2898
2941
|
measureFitSize() {
|
|
2899
2942
|
const vertical = layoutAxis(this.mode) === "height";
|
|
2900
2943
|
const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
|
|
2901
2944
|
const content = this.scrollContainer;
|
|
2902
|
-
const natural = content ? handleSize + (vertical
|
|
2945
|
+
const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
|
|
2903
2946
|
if (typeof window === "undefined") return natural;
|
|
2904
2947
|
const viewport = vertical ? window.innerHeight : window.innerWidth;
|
|
2905
2948
|
return viewport > 0 ? Math.min(natural, viewport) : natural;
|
|
@@ -2908,22 +2951,62 @@ var BottomSheetEngine = class {
|
|
|
2908
2951
|
if (typeof ResizeObserver === "undefined") return;
|
|
2909
2952
|
if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
|
|
2910
2953
|
return;
|
|
2911
|
-
const targets = [this.handle];
|
|
2912
|
-
if (this.scrollContainer && this.scrollContainer !== this.handle) {
|
|
2913
|
-
targets.push(this.scrollContainer);
|
|
2914
|
-
}
|
|
2915
2954
|
let raf = 0;
|
|
2916
|
-
const
|
|
2955
|
+
const schedule = () => {
|
|
2917
2956
|
if (raf) return;
|
|
2918
2957
|
raf = requestAnimationFrame(() => {
|
|
2919
2958
|
raf = 0;
|
|
2920
2959
|
if (this.destroyed || this.gesture?.isDragging) return;
|
|
2921
2960
|
this.recompute();
|
|
2922
2961
|
});
|
|
2923
|
-
}
|
|
2924
|
-
|
|
2962
|
+
};
|
|
2963
|
+
const ro = new ResizeObserver(schedule);
|
|
2964
|
+
ro.observe(this.handle);
|
|
2965
|
+
const scroller = this.scrollContainer;
|
|
2966
|
+
const observed = /* @__PURE__ */ new Set();
|
|
2967
|
+
const slots = /* @__PURE__ */ new Set();
|
|
2968
|
+
const hasSlot = typeof HTMLSlotElement !== "undefined";
|
|
2969
|
+
const onSlotChange = () => resync();
|
|
2970
|
+
const trackSlots = () => {
|
|
2971
|
+
if (!scroller || !hasSlot) return;
|
|
2972
|
+
for (const child of Array.from(scroller.children)) {
|
|
2973
|
+
if (child instanceof HTMLSlotElement && !slots.has(child)) {
|
|
2974
|
+
child.addEventListener("slotchange", onSlotChange);
|
|
2975
|
+
slots.add(child);
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
};
|
|
2979
|
+
const resync = () => {
|
|
2980
|
+
trackSlots();
|
|
2981
|
+
const targets = this.contentTargets();
|
|
2982
|
+
for (const el of observed) {
|
|
2983
|
+
if (!targets.includes(el)) {
|
|
2984
|
+
ro.unobserve(el);
|
|
2985
|
+
observed.delete(el);
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
for (const el of targets) {
|
|
2989
|
+
if (!observed.has(el)) {
|
|
2990
|
+
ro.observe(el);
|
|
2991
|
+
observed.add(el);
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
schedule();
|
|
2995
|
+
};
|
|
2996
|
+
let mo;
|
|
2997
|
+
if (scroller) {
|
|
2998
|
+
resync();
|
|
2999
|
+
if (typeof MutationObserver !== "undefined") {
|
|
3000
|
+
mo = new MutationObserver(resync);
|
|
3001
|
+
mo.observe(scroller, { childList: true });
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
2925
3004
|
this.teardowns.add(() => {
|
|
2926
3005
|
ro.disconnect();
|
|
3006
|
+
mo?.disconnect();
|
|
3007
|
+
for (const slot of slots) {
|
|
3008
|
+
slot.removeEventListener("slotchange", onSlotChange);
|
|
3009
|
+
}
|
|
2927
3010
|
if (raf) cancelAnimationFrame(raf);
|
|
2928
3011
|
});
|
|
2929
3012
|
}
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
returnFocusTo?: HTMLElement | string | (() => HTMLElement | null);
|
|
40
40
|
ariaLabel?: string;
|
|
41
41
|
header?: Snippet<[EngineState & { activeId: TId }]>;
|
|
42
|
+
footer?: Snippet<[EngineState & { activeId: TId }]>;
|
|
42
43
|
leftButton?: Snippet;
|
|
43
44
|
rightButton?: Snippet;
|
|
44
45
|
screen?: Snippet;
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
returnFocusTo,
|
|
83
84
|
ariaLabel = "Bottom sheet",
|
|
84
85
|
header,
|
|
86
|
+
footer,
|
|
85
87
|
leftButton,
|
|
86
88
|
rightButton,
|
|
87
89
|
screen,
|
|
@@ -284,13 +286,13 @@
|
|
|
284
286
|
aria-valuemax={Math.max(0, allowedIds.length - 1)}
|
|
285
287
|
aria-valuenow={Math.max(0, activeIdx)}
|
|
286
288
|
aria-valuetext={viewState.activeId}
|
|
287
|
-
>
|
|
288
|
-
|
|
289
|
-
</div>
|
|
289
|
+
></div>
|
|
290
|
+
{#if header}<div class="bs-header">{@render header(viewState)}</div>{/if}
|
|
290
291
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
291
292
|
<div class="bs-content" bind:this={contentEl} tabindex="0" role="region" aria-label="Sheet content">
|
|
292
293
|
{#if children}{@render children()}{/if}
|
|
293
294
|
</div>
|
|
295
|
+
{#if footer}<div class="bs-footer">{@render footer(viewState)}</div>{/if}
|
|
294
296
|
<span class="bs-sr-only" role="status" aria-live="polite">
|
|
295
297
|
{viewState.activeId}
|
|
296
298
|
</span>
|
package/dist/svelte.cjs
CHANGED
|
@@ -2919,11 +2919,54 @@ var BottomSheetEngine = class {
|
|
|
2919
2919
|
this.updateAriaSlider();
|
|
2920
2920
|
}
|
|
2921
2921
|
}
|
|
2922
|
+
contentTargets() {
|
|
2923
|
+
const scroller = this.scrollContainer;
|
|
2924
|
+
if (!scroller) return [];
|
|
2925
|
+
const hasSlot = typeof HTMLSlotElement !== "undefined";
|
|
2926
|
+
const out = [];
|
|
2927
|
+
for (const child2 of Array.from(scroller.children)) {
|
|
2928
|
+
if (hasSlot && child2 instanceof HTMLSlotElement) {
|
|
2929
|
+
for (const el of child2.assignedElements()) out.push(el);
|
|
2930
|
+
} else {
|
|
2931
|
+
out.push(child2);
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
return out;
|
|
2935
|
+
}
|
|
2936
|
+
measureContentExtent(vertical) {
|
|
2937
|
+
const content = this.scrollContainer;
|
|
2938
|
+
if (!content) return 0;
|
|
2939
|
+
const targets = this.contentTargets();
|
|
2940
|
+
if (targets.length === 0) {
|
|
2941
|
+
return vertical ? content.scrollHeight : content.scrollWidth;
|
|
2942
|
+
}
|
|
2943
|
+
let min = Infinity;
|
|
2944
|
+
let max = -Infinity;
|
|
2945
|
+
for (const el of targets) {
|
|
2946
|
+
const r = el.getBoundingClientRect();
|
|
2947
|
+
if (vertical) {
|
|
2948
|
+
if (r.top < min) min = r.top;
|
|
2949
|
+
if (r.bottom > max) max = r.bottom;
|
|
2950
|
+
} else {
|
|
2951
|
+
if (r.left < min) min = r.left;
|
|
2952
|
+
if (r.right > max) max = r.right;
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
if (!isFinite(min) || !isFinite(max) || max <= min) {
|
|
2956
|
+
return vertical ? content.scrollHeight : content.scrollWidth;
|
|
2957
|
+
}
|
|
2958
|
+
let pad = 0;
|
|
2959
|
+
if (typeof getComputedStyle !== "undefined") {
|
|
2960
|
+
const cs = getComputedStyle(content);
|
|
2961
|
+
pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
|
|
2962
|
+
}
|
|
2963
|
+
return max - min + pad;
|
|
2964
|
+
}
|
|
2922
2965
|
measureFitSize() {
|
|
2923
2966
|
const vertical = layoutAxis(this.mode) === "height";
|
|
2924
2967
|
const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
|
|
2925
2968
|
const content = this.scrollContainer;
|
|
2926
|
-
const natural = content ? handleSize + (vertical
|
|
2969
|
+
const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
|
|
2927
2970
|
if (typeof window === "undefined") return natural;
|
|
2928
2971
|
const viewport = vertical ? window.innerHeight : window.innerWidth;
|
|
2929
2972
|
return viewport > 0 ? Math.min(natural, viewport) : natural;
|
|
@@ -2932,22 +2975,62 @@ var BottomSheetEngine = class {
|
|
|
2932
2975
|
if (typeof ResizeObserver === "undefined") return;
|
|
2933
2976
|
if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
|
|
2934
2977
|
return;
|
|
2935
|
-
const targets = [this.handle];
|
|
2936
|
-
if (this.scrollContainer && this.scrollContainer !== this.handle) {
|
|
2937
|
-
targets.push(this.scrollContainer);
|
|
2938
|
-
}
|
|
2939
2978
|
let raf = 0;
|
|
2940
|
-
const
|
|
2979
|
+
const schedule = () => {
|
|
2941
2980
|
if (raf) return;
|
|
2942
2981
|
raf = requestAnimationFrame(() => {
|
|
2943
2982
|
raf = 0;
|
|
2944
2983
|
if (this.destroyed || this.gesture?.isDragging) return;
|
|
2945
2984
|
this.recompute();
|
|
2946
2985
|
});
|
|
2947
|
-
}
|
|
2948
|
-
|
|
2986
|
+
};
|
|
2987
|
+
const ro = new ResizeObserver(schedule);
|
|
2988
|
+
ro.observe(this.handle);
|
|
2989
|
+
const scroller = this.scrollContainer;
|
|
2990
|
+
const observed = /* @__PURE__ */ new Set();
|
|
2991
|
+
const slots = /* @__PURE__ */ new Set();
|
|
2992
|
+
const hasSlot = typeof HTMLSlotElement !== "undefined";
|
|
2993
|
+
const onSlotChange = () => resync();
|
|
2994
|
+
const trackSlots = () => {
|
|
2995
|
+
if (!scroller || !hasSlot) return;
|
|
2996
|
+
for (const child2 of Array.from(scroller.children)) {
|
|
2997
|
+
if (child2 instanceof HTMLSlotElement && !slots.has(child2)) {
|
|
2998
|
+
child2.addEventListener("slotchange", onSlotChange);
|
|
2999
|
+
slots.add(child2);
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
};
|
|
3003
|
+
const resync = () => {
|
|
3004
|
+
trackSlots();
|
|
3005
|
+
const targets = this.contentTargets();
|
|
3006
|
+
for (const el of observed) {
|
|
3007
|
+
if (!targets.includes(el)) {
|
|
3008
|
+
ro.unobserve(el);
|
|
3009
|
+
observed.delete(el);
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
for (const el of targets) {
|
|
3013
|
+
if (!observed.has(el)) {
|
|
3014
|
+
ro.observe(el);
|
|
3015
|
+
observed.add(el);
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
schedule();
|
|
3019
|
+
};
|
|
3020
|
+
let mo;
|
|
3021
|
+
if (scroller) {
|
|
3022
|
+
resync();
|
|
3023
|
+
if (typeof MutationObserver !== "undefined") {
|
|
3024
|
+
mo = new MutationObserver(resync);
|
|
3025
|
+
mo.observe(scroller, { childList: true });
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
2949
3028
|
this.teardowns.add(() => {
|
|
2950
3029
|
ro.disconnect();
|
|
3030
|
+
mo?.disconnect();
|
|
3031
|
+
for (const slot of slots) {
|
|
3032
|
+
slot.removeEventListener("slotchange", onSlotChange);
|
|
3033
|
+
}
|
|
2951
3034
|
if (raf) cancelAnimationFrame(raf);
|
|
2952
3035
|
});
|
|
2953
3036
|
}
|
|
@@ -3438,9 +3521,11 @@ function createBottomSheet(opts) {
|
|
|
3438
3521
|
};
|
|
3439
3522
|
}
|
|
3440
3523
|
var root_1 = $2__namespace.from_html(`<div class="bs-backdrop" aria-hidden="true"></div>`);
|
|
3441
|
-
var
|
|
3442
|
-
var
|
|
3443
|
-
var
|
|
3524
|
+
var root_3 = $2__namespace.from_html(`<div class="bs-header"><!></div>`);
|
|
3525
|
+
var root_5 = $2__namespace.from_html(`<div class="bs-footer"><!></div>`);
|
|
3526
|
+
var root_6 = $2__namespace.from_html(`<div class="bs-button-slot" data-side="left"><!></div>`);
|
|
3527
|
+
var root_7 = $2__namespace.from_html(`<div class="bs-button-slot" data-side="right"><!></div>`);
|
|
3528
|
+
var root = $2__namespace.from_html(`<div class="bs-root"><!> <div class="bs-screen"><!></div> <section class="bs-sheet" role="dialog"><div class="bs-handle" role="slider" tabindex="0" aria-label="Resize sheet"></div> <!> <div class="bs-content" tabindex="0" role="region" aria-label="Sheet content"><!></div> <!> <span class="bs-sr-only" role="status" aria-live="polite"> </span></section> <!> <!></div>`);
|
|
3444
3529
|
function BottomSheet($$anchor, $$props) {
|
|
3445
3530
|
$2__namespace.push($$props, true);
|
|
3446
3531
|
let mode = $2__namespace.prop($$props, "mode", 3, "bottom"), animation = $2__namespace.prop($$props, "animation", 3, "spring"), focusTrap = $2__namespace.prop($$props, "focusTrap", 3, false), closeOnEscape = $2__namespace.prop($$props, "closeOnEscape", 3, true), closeOnBack = $2__namespace.prop($$props, "closeOnBack", 3, false), lockBodyScroll2 = $2__namespace.prop($$props, "lockBodyScroll", 3, true), rubberBand2 = $2__namespace.prop($$props, "rubberBand", 3, true), backdrop = $2__namespace.prop($$props, "backdrop", 3, true), closeOnBackdrop = $2__namespace.prop($$props, "closeOnBackdrop", 3, true), persistent = $2__namespace.prop($$props, "persistent", 3, false), disableClose = $2__namespace.prop($$props, "disableClose", 3, false), disableDrag = $2__namespace.prop($$props, "disableDrag", 3, false), closeOnRouteChange = $2__namespace.prop($$props, "closeOnRouteChange", 3, false), openProp = $2__namespace.prop($$props, "open", 15), snap = $2__namespace.prop($$props, "snap", 15), ariaLabel = $2__namespace.prop($$props, "ariaLabel", 3, "Bottom sheet");
|
|
@@ -3621,66 +3706,79 @@ function BottomSheet($$anchor, $$props) {
|
|
|
3621
3706
|
var section = $2__namespace.sibling(div_2, 2);
|
|
3622
3707
|
var div_3 = $2__namespace.child(section);
|
|
3623
3708
|
$2__namespace.set_attribute(div_3, "aria-valuemin", 0);
|
|
3624
|
-
|
|
3709
|
+
$2__namespace.bind_this(div_3, ($$value) => $2__namespace.set(handleEl, $$value), () => $2__namespace.get(handleEl));
|
|
3710
|
+
var node_3 = $2__namespace.sibling(div_3, 2);
|
|
3625
3711
|
{
|
|
3626
3712
|
var consequent_2 = ($$anchor2) => {
|
|
3627
|
-
var
|
|
3628
|
-
var node_4 = $2__namespace.
|
|
3713
|
+
var div_4 = root_3();
|
|
3714
|
+
var node_4 = $2__namespace.child(div_4);
|
|
3629
3715
|
$2__namespace.snippet(node_4, () => $$props.header, () => $2__namespace.get(viewState));
|
|
3630
|
-
$2__namespace.
|
|
3716
|
+
$2__namespace.reset(div_4);
|
|
3717
|
+
$2__namespace.append($$anchor2, div_4);
|
|
3631
3718
|
};
|
|
3632
3719
|
$2__namespace.if(node_3, ($$render) => {
|
|
3633
3720
|
if ($$props.header) $$render(consequent_2);
|
|
3634
3721
|
});
|
|
3635
3722
|
}
|
|
3636
|
-
$2__namespace.
|
|
3637
|
-
|
|
3638
|
-
var div_4 = $2__namespace.sibling(div_3, 2);
|
|
3639
|
-
var node_5 = $2__namespace.child(div_4);
|
|
3723
|
+
var div_5 = $2__namespace.sibling(node_3, 2);
|
|
3724
|
+
var node_5 = $2__namespace.child(div_5);
|
|
3640
3725
|
{
|
|
3641
3726
|
var consequent_3 = ($$anchor2) => {
|
|
3642
|
-
var
|
|
3643
|
-
var node_6 = $2__namespace.first_child(
|
|
3727
|
+
var fragment_1 = $2__namespace.comment();
|
|
3728
|
+
var node_6 = $2__namespace.first_child(fragment_1);
|
|
3644
3729
|
$2__namespace.snippet(node_6, () => $$props.children);
|
|
3645
|
-
$2__namespace.append($$anchor2,
|
|
3730
|
+
$2__namespace.append($$anchor2, fragment_1);
|
|
3646
3731
|
};
|
|
3647
3732
|
$2__namespace.if(node_5, ($$render) => {
|
|
3648
3733
|
if ($$props.children) $$render(consequent_3);
|
|
3649
3734
|
});
|
|
3650
3735
|
}
|
|
3651
|
-
$2__namespace.reset(
|
|
3652
|
-
$2__namespace.bind_this(
|
|
3653
|
-
var
|
|
3654
|
-
var text = $2__namespace.child(span, true);
|
|
3655
|
-
$2__namespace.reset(span);
|
|
3656
|
-
$2__namespace.reset(section);
|
|
3657
|
-
$2__namespace.bind_this(section, ($$value) => $2__namespace.set(sheetEl, $$value), () => $2__namespace.get(sheetEl));
|
|
3658
|
-
var node_7 = $2__namespace.sibling(section, 2);
|
|
3736
|
+
$2__namespace.reset(div_5);
|
|
3737
|
+
$2__namespace.bind_this(div_5, ($$value) => $2__namespace.set(contentEl, $$value), () => $2__namespace.get(contentEl));
|
|
3738
|
+
var node_7 = $2__namespace.sibling(div_5, 2);
|
|
3659
3739
|
{
|
|
3660
3740
|
var consequent_4 = ($$anchor2) => {
|
|
3661
|
-
var
|
|
3662
|
-
var node_8 = $2__namespace.child(
|
|
3663
|
-
$2__namespace.snippet(node_8, () => $$props.
|
|
3664
|
-
$2__namespace.reset(
|
|
3665
|
-
$2__namespace.
|
|
3666
|
-
$2__namespace.append($$anchor2, div_5);
|
|
3741
|
+
var div_6 = root_5();
|
|
3742
|
+
var node_8 = $2__namespace.child(div_6);
|
|
3743
|
+
$2__namespace.snippet(node_8, () => $$props.footer, () => $2__namespace.get(viewState));
|
|
3744
|
+
$2__namespace.reset(div_6);
|
|
3745
|
+
$2__namespace.append($$anchor2, div_6);
|
|
3667
3746
|
};
|
|
3668
3747
|
$2__namespace.if(node_7, ($$render) => {
|
|
3669
|
-
if ($$props.
|
|
3748
|
+
if ($$props.footer) $$render(consequent_4);
|
|
3670
3749
|
});
|
|
3671
3750
|
}
|
|
3672
|
-
var
|
|
3751
|
+
var span = $2__namespace.sibling(node_7, 2);
|
|
3752
|
+
var text = $2__namespace.child(span, true);
|
|
3753
|
+
$2__namespace.reset(span);
|
|
3754
|
+
$2__namespace.reset(section);
|
|
3755
|
+
$2__namespace.bind_this(section, ($$value) => $2__namespace.set(sheetEl, $$value), () => $2__namespace.get(sheetEl));
|
|
3756
|
+
var node_9 = $2__namespace.sibling(section, 2);
|
|
3673
3757
|
{
|
|
3674
3758
|
var consequent_5 = ($$anchor2) => {
|
|
3675
|
-
var
|
|
3676
|
-
var node_10 = $2__namespace.child(
|
|
3677
|
-
$2__namespace.snippet(node_10, () => $$props.
|
|
3678
|
-
$2__namespace.reset(
|
|
3679
|
-
$2__namespace.template_effect(() => $2__namespace.set_attribute(
|
|
3680
|
-
$2__namespace.append($$anchor2,
|
|
3759
|
+
var div_7 = root_6();
|
|
3760
|
+
var node_10 = $2__namespace.child(div_7);
|
|
3761
|
+
$2__namespace.snippet(node_10, () => $$props.leftButton);
|
|
3762
|
+
$2__namespace.reset(div_7);
|
|
3763
|
+
$2__namespace.template_effect(() => $2__namespace.set_attribute(div_7, "data-mode", mode()));
|
|
3764
|
+
$2__namespace.append($$anchor2, div_7);
|
|
3681
3765
|
};
|
|
3682
3766
|
$2__namespace.if(node_9, ($$render) => {
|
|
3683
|
-
if ($$props.
|
|
3767
|
+
if ($$props.leftButton) $$render(consequent_5);
|
|
3768
|
+
});
|
|
3769
|
+
}
|
|
3770
|
+
var node_11 = $2__namespace.sibling(node_9, 2);
|
|
3771
|
+
{
|
|
3772
|
+
var consequent_6 = ($$anchor2) => {
|
|
3773
|
+
var div_8 = root_7();
|
|
3774
|
+
var node_12 = $2__namespace.child(div_8);
|
|
3775
|
+
$2__namespace.snippet(node_12, () => $$props.rightButton);
|
|
3776
|
+
$2__namespace.reset(div_8);
|
|
3777
|
+
$2__namespace.template_effect(() => $2__namespace.set_attribute(div_8, "data-mode", mode()));
|
|
3778
|
+
$2__namespace.append($$anchor2, div_8);
|
|
3779
|
+
};
|
|
3780
|
+
$2__namespace.if(node_11, ($$render) => {
|
|
3781
|
+
if ($$props.rightButton) $$render(consequent_6);
|
|
3684
3782
|
});
|
|
3685
3783
|
}
|
|
3686
3784
|
$2__namespace.reset(div);
|
package/dist/svelte.d.cts
CHANGED
|
@@ -95,6 +95,7 @@ export type BottomSheetProps<TId extends string = string> = {
|
|
|
95
95
|
returnFocusTo?: HTMLElement | string | (() => HTMLElement | null);
|
|
96
96
|
ariaLabel?: string;
|
|
97
97
|
header?: Snippet<[EngineState & { activeId: TId }]>;
|
|
98
|
+
footer?: Snippet<[EngineState & { activeId: TId }]>;
|
|
98
99
|
leftButton?: Snippet;
|
|
99
100
|
rightButton?: Snippet;
|
|
100
101
|
screen?: Snippet;
|
package/dist/svelte.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ export type BottomSheetProps<TId extends string = string> = {
|
|
|
95
95
|
returnFocusTo?: HTMLElement | string | (() => HTMLElement | null);
|
|
96
96
|
ariaLabel?: string;
|
|
97
97
|
header?: Snippet<[EngineState & { activeId: TId }]>;
|
|
98
|
+
footer?: Snippet<[EngineState & { activeId: TId }]>;
|
|
98
99
|
leftButton?: Snippet;
|
|
99
100
|
rightButton?: Snippet;
|
|
100
101
|
screen?: Snippet;
|