@surdeddd/bottom-sheet 0.13.0 → 0.20.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.
Files changed (66) hide show
  1. package/README.md +46 -0
  2. package/dist/{BottomSheetCore-D16lsa6g.d.ts → BottomSheetCore-Cgn8b_6A.d.ts} +36 -2
  3. package/dist/{BottomSheetCore-CsIjyq7C.d.cts → BottomSheetCore-VPJZcKcg.d.cts} +36 -2
  4. package/dist/{BottomSheetEngine-BYjAVrmd.d.cts → BottomSheetEngine-B8C2CwF9.d.cts} +1 -1
  5. package/dist/{BottomSheetEngine-YuCNugZn.d.ts → BottomSheetEngine-DwYR_ygJ.d.ts} +1 -1
  6. package/dist/core.cjs +328 -33
  7. package/dist/core.d.cts +2 -2
  8. package/dist/core.d.ts +2 -2
  9. package/dist/core.js +328 -33
  10. package/dist/debug.d.cts +1 -1
  11. package/dist/debug.d.ts +1 -1
  12. package/dist/element.cjs +404 -108
  13. package/dist/element.d.cts +2 -2
  14. package/dist/element.d.ts +2 -2
  15. package/dist/element.iife.global.js +2 -2
  16. package/dist/element.js +404 -108
  17. package/dist/features.cjs +6 -50
  18. package/dist/features.d.cts +4 -4
  19. package/dist/features.d.ts +4 -4
  20. package/dist/features.js +6 -50
  21. package/dist/index-CnfbOKx0.d.cts +9 -0
  22. package/dist/index-DcMkhXAy.d.ts +9 -0
  23. package/dist/index.cjs +335 -829
  24. package/dist/index.d.cts +44 -47
  25. package/dist/index.d.ts +44 -47
  26. package/dist/index.js +336 -816
  27. package/dist/integrations/formik.d.cts +1 -1
  28. package/dist/integrations/formik.d.ts +1 -1
  29. package/dist/integrations/react-hook-form.d.cts +1 -1
  30. package/dist/integrations/react-hook-form.d.ts +1 -1
  31. package/dist/overlay.cjs +5 -5
  32. package/dist/overlay.js +5 -5
  33. package/dist/preact.d.cts +2 -2
  34. package/dist/preact.d.ts +2 -2
  35. package/dist/qwik-lib/index.qwik.cjs +323 -83
  36. package/dist/qwik-lib/index.qwik.mjs +323 -83
  37. package/dist/qwik.cjs +342 -83
  38. package/dist/qwik.d.cts +4 -2
  39. package/dist/qwik.d.ts +4 -2
  40. package/dist/qwik.js +342 -83
  41. package/dist/react.cjs +347 -85
  42. package/dist/react.d.cts +3 -4
  43. package/dist/react.d.ts +3 -4
  44. package/dist/react.js +347 -85
  45. package/dist/solid.cjs +348 -83
  46. package/dist/solid.d.cts +37 -1
  47. package/dist/solid.d.ts +37 -1
  48. package/dist/solid.js +348 -83
  49. package/dist/solid.source.jsx +356 -83
  50. package/dist/styles.css +24 -4
  51. package/dist/svelte-core.cjs +334 -83
  52. package/dist/svelte-core.js +334 -83
  53. package/dist/svelte-src/BottomSheet.svelte +14 -0
  54. package/dist/svelte.cjs +344 -83
  55. package/dist/svelte.d.cts +2 -0
  56. package/dist/svelte.d.ts +2 -0
  57. package/dist/svelte.js +344 -83
  58. package/dist/vue.cjs +350 -83
  59. package/dist/vue.js +350 -83
  60. package/dist/webgl.cjs +673 -0
  61. package/dist/webgl.d.cts +17 -0
  62. package/dist/webgl.d.ts +17 -0
  63. package/dist/webgl.js +671 -0
  64. package/package.json +64 -40
  65. package/dist/index-DdYLOIIT.d.ts +0 -15
  66. package/dist/index-dfrzw-lI.d.cts +0 -15
package/dist/features.cjs CHANGED
@@ -303,50 +303,10 @@ function installAutoCollapse(deps) {
303
303
  };
304
304
  }
305
305
 
306
- // src/core/features/content-swipe.ts
307
- var CONTENT_PULL_THRESHOLD = 60;
308
- function installContentSwipe(deps) {
309
- const { container } = deps;
310
- let startY = 0;
311
- let startScrollTop = 0;
312
- let moved = false;
313
- const onTouchStart = (e) => {
314
- const t = e.touches[0];
315
- if (!t) return;
316
- startY = t.clientY;
317
- startScrollTop = container.scrollTop;
318
- moved = false;
319
- };
320
- const onTouchMove = (e) => {
321
- const t = e.touches[0];
322
- if (!t) return;
323
- if (Math.abs(t.clientY - startY) > CONTENT_PULL_THRESHOLD) moved = true;
324
- };
325
- const onTouchEnd = (e) => {
326
- if (!moved) return;
327
- if (deps.isDragging() || deps.isAnimating()) return;
328
- if (container.scrollTop !== startScrollTop) return;
329
- const t = e.changedTouches[0];
330
- if (!t) return;
331
- const deltaY = t.clientY - startY;
332
- const atTop = container.scrollTop <= 0;
333
- const allowed = deps.getAllowedIds();
334
- const idx = allowed.indexOf(deps.getActiveId());
335
- if (idx === -1) return;
336
- if (atTop && deltaY > CONTENT_PULL_THRESHOLD && idx > 0) {
337
- deps.snapTo(allowed[idx - 1]);
338
- } else if (deltaY < -CONTENT_PULL_THRESHOLD && idx < allowed.length - 1) {
339
- deps.snapTo(allowed[idx + 1]);
340
- }
341
- };
342
- container.addEventListener("touchstart", onTouchStart, { passive: true });
343
- container.addEventListener("touchmove", onTouchMove, { passive: true });
344
- container.addEventListener("touchend", onTouchEnd, { passive: true });
345
- return () => {
346
- container.removeEventListener("touchstart", onTouchStart);
347
- container.removeEventListener("touchmove", onTouchMove);
348
- container.removeEventListener("touchend", onTouchEnd);
349
- };
306
+ // src/core/features/content-drag.ts
307
+ function installContentDrag(deps) {
308
+ const detach = deps.attachDragSurface(deps.container, "content");
309
+ return () => detach?.();
350
310
  }
351
311
 
352
312
  // src/core/features/visual-viewport.ts
@@ -475,13 +435,9 @@ function contentSwipeFeature() {
475
435
  stage: "attach",
476
436
  install: (ctx) => {
477
437
  if (!ctx.scrollContainer) return;
478
- return installContentSwipe({
438
+ return installContentDrag({
479
439
  container: ctx.scrollContainer,
480
- isDragging: ctx.isDragging,
481
- isAnimating: ctx.isAnimating,
482
- getAllowedIds: ctx.allowedIdsBySize,
483
- getActiveId: ctx.getActiveId,
484
- snapTo: ctx.snapTo
440
+ attachDragSurface: ctx.attachDragSurface
485
441
  });
486
442
  }
487
443
  };
@@ -1,13 +1,13 @@
1
- import { l as EngineFeature } from './BottomSheetCore-CsIjyq7C.cjs';
2
- export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-CsIjyq7C.cjs';
1
+ import { f as EngineFeature } from './BottomSheetCore-VPJZcKcg.cjs';
2
+ export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-VPJZcKcg.cjs';
3
3
  import './transform-jVfAikE9.cjs';
4
4
 
5
- declare function defaultEngineFeatures(): EngineFeature[];
6
-
7
5
  declare function routeFeature(): EngineFeature;
8
6
  declare function persistFeature(): EngineFeature;
9
7
  declare function autoCollapseFeature(): EngineFeature;
10
8
  declare function contentSwipeFeature(): EngineFeature;
11
9
  declare function visualViewportFeature(): EngineFeature;
12
10
 
11
+ declare function defaultEngineFeatures(): EngineFeature[];
12
+
13
13
  export { EngineFeature, autoCollapseFeature, contentSwipeFeature, defaultEngineFeatures, persistFeature, routeFeature, visualViewportFeature };
@@ -1,13 +1,13 @@
1
- import { l as EngineFeature } from './BottomSheetCore-D16lsa6g.js';
2
- export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-D16lsa6g.js';
1
+ import { f as EngineFeature } from './BottomSheetCore-Cgn8b_6A.js';
2
+ export { m as EngineFeatureContext, n as EngineFeatureOptions, o as EngineFeatureStage } from './BottomSheetCore-Cgn8b_6A.js';
3
3
  import './transform-jVfAikE9.js';
4
4
 
5
- declare function defaultEngineFeatures(): EngineFeature[];
6
-
7
5
  declare function routeFeature(): EngineFeature;
8
6
  declare function persistFeature(): EngineFeature;
9
7
  declare function autoCollapseFeature(): EngineFeature;
10
8
  declare function contentSwipeFeature(): EngineFeature;
11
9
  declare function visualViewportFeature(): EngineFeature;
12
10
 
11
+ declare function defaultEngineFeatures(): EngineFeature[];
12
+
13
13
  export { EngineFeature, autoCollapseFeature, contentSwipeFeature, defaultEngineFeatures, persistFeature, routeFeature, visualViewportFeature };
package/dist/features.js CHANGED
@@ -301,50 +301,10 @@ function installAutoCollapse(deps) {
301
301
  };
302
302
  }
303
303
 
304
- // src/core/features/content-swipe.ts
305
- var CONTENT_PULL_THRESHOLD = 60;
306
- function installContentSwipe(deps) {
307
- const { container } = deps;
308
- let startY = 0;
309
- let startScrollTop = 0;
310
- let moved = false;
311
- const onTouchStart = (e) => {
312
- const t = e.touches[0];
313
- if (!t) return;
314
- startY = t.clientY;
315
- startScrollTop = container.scrollTop;
316
- moved = false;
317
- };
318
- const onTouchMove = (e) => {
319
- const t = e.touches[0];
320
- if (!t) return;
321
- if (Math.abs(t.clientY - startY) > CONTENT_PULL_THRESHOLD) moved = true;
322
- };
323
- const onTouchEnd = (e) => {
324
- if (!moved) return;
325
- if (deps.isDragging() || deps.isAnimating()) return;
326
- if (container.scrollTop !== startScrollTop) return;
327
- const t = e.changedTouches[0];
328
- if (!t) return;
329
- const deltaY = t.clientY - startY;
330
- const atTop = container.scrollTop <= 0;
331
- const allowed = deps.getAllowedIds();
332
- const idx = allowed.indexOf(deps.getActiveId());
333
- if (idx === -1) return;
334
- if (atTop && deltaY > CONTENT_PULL_THRESHOLD && idx > 0) {
335
- deps.snapTo(allowed[idx - 1]);
336
- } else if (deltaY < -CONTENT_PULL_THRESHOLD && idx < allowed.length - 1) {
337
- deps.snapTo(allowed[idx + 1]);
338
- }
339
- };
340
- container.addEventListener("touchstart", onTouchStart, { passive: true });
341
- container.addEventListener("touchmove", onTouchMove, { passive: true });
342
- container.addEventListener("touchend", onTouchEnd, { passive: true });
343
- return () => {
344
- container.removeEventListener("touchstart", onTouchStart);
345
- container.removeEventListener("touchmove", onTouchMove);
346
- container.removeEventListener("touchend", onTouchEnd);
347
- };
304
+ // src/core/features/content-drag.ts
305
+ function installContentDrag(deps) {
306
+ const detach = deps.attachDragSurface(deps.container, "content");
307
+ return () => detach?.();
348
308
  }
349
309
 
350
310
  // src/core/features/visual-viewport.ts
@@ -473,13 +433,9 @@ function contentSwipeFeature() {
473
433
  stage: "attach",
474
434
  install: (ctx) => {
475
435
  if (!ctx.scrollContainer) return;
476
- return installContentSwipe({
436
+ return installContentDrag({
477
437
  container: ctx.scrollContainer,
478
- isDragging: ctx.isDragging,
479
- isAnimating: ctx.isAnimating,
480
- getAllowedIds: ctx.allowedIdsBySize,
481
- getActiveId: ctx.getActiveId,
482
- snapTo: ctx.snapTo
438
+ attachDragSurface: ctx.attachDragSurface
483
439
  });
484
440
  }
485
441
  };
@@ -0,0 +1,9 @@
1
+ import { a as SnapPointDef, b as SheetMode } from './BottomSheetCore-VPJZcKcg.cjs';
2
+
3
+ type ResolvedSnap = {
4
+ id: string;
5
+ size: number;
6
+ };
7
+ declare const resolveSnapList: (points: SnapPointDef[], mode: SheetMode, measureFit?: () => number) => ResolvedSnap[];
8
+
9
+ export { type ResolvedSnap as R, resolveSnapList as r };
@@ -0,0 +1,9 @@
1
+ import { a as SnapPointDef, b as SheetMode } from './BottomSheetCore-Cgn8b_6A.js';
2
+
3
+ type ResolvedSnap = {
4
+ id: string;
5
+ size: number;
6
+ };
7
+ declare const resolveSnapList: (points: SnapPointDef[], mode: SheetMode, measureFit?: () => number) => ResolvedSnap[];
8
+
9
+ export { type ResolvedSnap as R, resolveSnapList as r };