scroll-system 1.2.1 → 1.3.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ControlledView.d.ts","sourceRoot":"","sources":["../../components/ControlledView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAwB,MAAM,UAAU,CAAC;AAE1E,wBAAgB,cAAc,CAAC,EAC7B,EAAE,EACF,QAAQ,EACR,SAAc,EACd,eAAwB,EACxB,mBAA2B,EAC3B,UAAkB,EAClB,WAAkB,EAClB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,mBAAmB,2CAqErB;AAMD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM;;;;;eAc5B,MAAM,GAAG,MAAM;EAI/B"}
1
+ {"version":3,"file":"ControlledView.d.ts","sourceRoot":"","sources":["../../components/ControlledView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAwB,MAAM,UAAU,CAAC;AAE1E,wBAAgB,cAAc,CAAC,EAC7B,EAAE,EACF,QAAQ,EACR,SAAc,EACd,eAAwB,EACxB,mBAA2B,EAC3B,UAAkB,EAClB,WAAkB,EAClB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,mBAAmB,2CA+ErB;AAMD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM;;;;;eAc5B,MAAM,GAAG,MAAM;EAI/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"FullView.d.ts","sourceRoot":"","sources":["../../components/FullView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,UAAU,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,QAAQ,EACR,SAAc,EACd,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,aAAa,2CAyCf"}
1
+ {"version":3,"file":"FullView.d.ts","sourceRoot":"","sources":["../../components/FullView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,UAAU,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,QAAQ,EACR,SAAc,EACd,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,aAAa,2CAwCf"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollContainer.d.ts","sourceRoot":"","sources":["../../components/ScrollContainer.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,OAAO,KAAK,EAAE,oBAAoB,EAAmC,MAAM,UAAU,CAAC;AAEtF,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,SAAc,EACd,kBAAgD,EAChD,gBAA4C,EAC5C,YAAY,EACZ,aAAa,EAEb,cAAsB,EACtB,eAAuB,EACvB,UAAe,EAEf,oBAA2B,EAC3B,qBAA4B,EAE5B,iBAAyB,EAEzB,WAAwB,EAExB,oBAA4B,EAC5B,UAAU,EACV,aAAa,EACb,UAAU,EACV,cAAsB,EACtB,OAAc,GACf,EAAE,oBAAoB,2CA6KtB"}
1
+ {"version":3,"file":"ScrollContainer.d.ts","sourceRoot":"","sources":["../../components/ScrollContainer.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,OAAO,KAAK,EAAE,oBAAoB,EAAmC,MAAM,UAAU,CAAC;AAEtF,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,SAAc,EACd,kBAAgD,EAChD,gBAA4C,EAC5C,YAAY,EACZ,aAAa,EAEb,cAAsB,EACtB,eAAuB,EACvB,UAAe,EAEf,oBAA2B,EAC3B,qBAA4B,EAE5B,iBAAyB,EAEzB,WAAwB,EAExB,oBAA4B,EAC5B,UAAU,EACV,aAAa,EACb,UAAU,EACV,cAAsB,EACtB,OAAc,GACf,EAAE,oBAAoB,2CAuLtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollLockedView.d.ts","sourceRoot":"","sources":["../../components/ScrollLockedView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,UAAU,CAAC;AAE3E,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,QAAQ,EACR,SAAc,EACd,eAA4B,EAC5B,kBAAyB,EACzB,mBAAuC,EACvC,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,qBAAqB,2CAmGvB"}
1
+ {"version":3,"file":"ScrollLockedView.d.ts","sourceRoot":"","sources":["../../components/ScrollLockedView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,UAAU,CAAC;AAE3E,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,QAAQ,EACR,SAAc,EACd,eAA4B,EAC5B,kBAAyB,EACzB,mBAAuC,EACvC,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,qBAAqB,2CAkHvB"}
package/dist/index.js CHANGED
@@ -333,7 +333,7 @@ function useWheelHandler() {
333
333
  const activeView = state.views[state.activeIndex];
334
334
  if (activeView?.capability === "internal") {
335
335
  const scrollContainer = document.querySelector(
336
- `[data-view-type="scroll-locked"][data-active="true"] > div`
336
+ `[data-view-type="scroll-locked"][data-active="true"] [data-scrollable="true"]`
337
337
  );
338
338
  if (scrollContainer) {
339
339
  const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
@@ -381,7 +381,7 @@ function canNavigateFromScrollPosition(direction) {
381
381
  return true;
382
382
  }
383
383
  const scrollContainer = document.querySelector(
384
- `[data-view-type="scroll-locked"][data-active="true"] > div`
384
+ `[data-view-type="scroll-locked"][data-active="true"] [data-scrollable="true"]`
385
385
  );
386
386
  if (!scrollContainer) {
387
387
  return true;
@@ -1183,10 +1183,20 @@ function ScrollContainer({
1183
1183
  "div",
1184
1184
  {
1185
1185
  ref: containerRef,
1186
- className: `scroll-container fixed inset-0 overflow-hidden w-screen h-screen ${className}`,
1186
+ className: `scroll-container ${className}`,
1187
1187
  role: "main",
1188
1188
  "aria-label": "Scroll container",
1189
1189
  "data-auto-scrolling": autoScrollState.isPlaying,
1190
+ style: {
1191
+ position: "fixed",
1192
+ top: 0,
1193
+ left: 0,
1194
+ right: 0,
1195
+ bottom: 0,
1196
+ overflow: "hidden",
1197
+ width: "100vw",
1198
+ height: "100vh"
1199
+ },
1190
1200
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "scroll-wrapper", style: wrapperStyle, children })
1191
1201
  }
1192
1202
  ) });
@@ -1302,14 +1312,13 @@ function FullView({
1302
1312
  "section",
1303
1313
  {
1304
1314
  id,
1305
- className: `
1306
- full-view
1307
- relative
1308
- w-full h-screen
1309
- overflow-hidden
1310
- ${isActive ? "is-active" : ""}
1311
- ${className}
1312
- `,
1315
+ className: `full-view ${isActive ? "is-active" : ""} ${className}`,
1316
+ style: {
1317
+ position: "relative",
1318
+ width: "100%",
1319
+ height: "100vh",
1320
+ overflow: "hidden"
1321
+ },
1313
1322
  "data-view-type": "full",
1314
1323
  "data-view-index": index,
1315
1324
  "data-view-active": isActive,
@@ -1442,20 +1451,35 @@ function ScrollLockedView({
1442
1451
  }
1443
1452
  wasActive.current = isActive;
1444
1453
  }, [isActive, lastNavigationDirection, scrollResetBehavior, scrollDirection]);
1445
- const scrollClasses = scrollDirection === "vertical" ? "overflow-y-auto overflow-x-hidden" : "overflow-x-auto overflow-y-hidden";
1454
+ const scrollStyles = scrollDirection === "vertical" ? { overflowY: "auto", overflowX: "hidden" } : { overflowX: "auto", overflowY: "hidden" };
1446
1455
  return /* @__PURE__ */ jsxRuntime.jsx(
1447
1456
  "section",
1448
1457
  {
1449
1458
  id,
1450
- className: `relative w-full h-screen ${className}`,
1459
+ className: `scroll-locked-view ${className}`,
1451
1460
  "data-view-type": "scroll-locked",
1452
1461
  "data-active": isActive ? "true" : "false",
1462
+ style: {
1463
+ position: "relative",
1464
+ width: "100%",
1465
+ height: "100vh",
1466
+ overflow: "hidden"
1467
+ },
1453
1468
  children: /* @__PURE__ */ jsxRuntime.jsx(
1454
1469
  "div",
1455
1470
  {
1456
1471
  ref: scrollRef,
1457
- className: `w-full h-full ${scrollClasses} no-scrollbar`,
1458
- style: { scrollbarWidth: "none" },
1472
+ className: "no-scrollbar",
1473
+ style: {
1474
+ position: "absolute",
1475
+ top: 0,
1476
+ left: 0,
1477
+ right: 0,
1478
+ bottom: 0,
1479
+ scrollbarWidth: "none",
1480
+ touchAction: scrollDirection === "vertical" ? "pan-y" : "pan-x",
1481
+ ...scrollStyles
1482
+ },
1459
1483
  "data-scrollable": "true",
1460
1484
  children
1461
1485
  }
@@ -1507,29 +1531,39 @@ function ControlledView({
1507
1531
  const lockState = canProceed ? "unlocked" : "locked";
1508
1532
  setExplicitLock(id, lockState);
1509
1533
  }, [id, canProceed, setExplicitLock]);
1510
- const overflowClasses = react.useMemo(() => {
1511
- if (!allowInternalScroll) return "overflow-hidden";
1534
+ const overflowStyles = react.useMemo(() => {
1535
+ if (!allowInternalScroll) return { overflow: "hidden" };
1512
1536
  switch (scrollDirection) {
1513
1537
  case "vertical":
1514
- return "overflow-y-auto overflow-x-hidden";
1538
+ return { overflowY: "auto", overflowX: "hidden" };
1515
1539
  case "horizontal":
1516
- return "overflow-x-auto overflow-y-hidden";
1540
+ return { overflowX: "auto", overflowY: "hidden" };
1517
1541
  default:
1518
- return "overflow-auto";
1542
+ return { overflow: "auto" };
1519
1543
  }
1520
1544
  }, [allowInternalScroll, scrollDirection]);
1521
1545
  return /* @__PURE__ */ jsxRuntime.jsx(
1522
1546
  "section",
1523
1547
  {
1524
1548
  id,
1525
- className: `relative w-full h-screen ${isActive ? "z-10" : "z-0"} ${className}`,
1549
+ className: `controlled-view ${className}`,
1526
1550
  "data-view-type": "controlled",
1527
1551
  "data-active": isActive,
1552
+ style: {
1553
+ position: "relative",
1554
+ width: "100%",
1555
+ height: "100vh",
1556
+ zIndex: isActive ? 10 : 0
1557
+ },
1528
1558
  children: /* @__PURE__ */ jsxRuntime.jsx(
1529
1559
  "div",
1530
1560
  {
1531
1561
  ref: scrollRef,
1532
- className: `w-full h-full ${overflowClasses}`,
1562
+ style: {
1563
+ width: "100%",
1564
+ height: "100%",
1565
+ ...overflowStyles
1566
+ },
1533
1567
  children
1534
1568
  }
1535
1569
  )
package/dist/index.mjs CHANGED
@@ -331,7 +331,7 @@ function useWheelHandler() {
331
331
  const activeView = state.views[state.activeIndex];
332
332
  if (activeView?.capability === "internal") {
333
333
  const scrollContainer = document.querySelector(
334
- `[data-view-type="scroll-locked"][data-active="true"] > div`
334
+ `[data-view-type="scroll-locked"][data-active="true"] [data-scrollable="true"]`
335
335
  );
336
336
  if (scrollContainer) {
337
337
  const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
@@ -379,7 +379,7 @@ function canNavigateFromScrollPosition(direction) {
379
379
  return true;
380
380
  }
381
381
  const scrollContainer = document.querySelector(
382
- `[data-view-type="scroll-locked"][data-active="true"] > div`
382
+ `[data-view-type="scroll-locked"][data-active="true"] [data-scrollable="true"]`
383
383
  );
384
384
  if (!scrollContainer) {
385
385
  return true;
@@ -1181,10 +1181,20 @@ function ScrollContainer({
1181
1181
  "div",
1182
1182
  {
1183
1183
  ref: containerRef,
1184
- className: `scroll-container fixed inset-0 overflow-hidden w-screen h-screen ${className}`,
1184
+ className: `scroll-container ${className}`,
1185
1185
  role: "main",
1186
1186
  "aria-label": "Scroll container",
1187
1187
  "data-auto-scrolling": autoScrollState.isPlaying,
1188
+ style: {
1189
+ position: "fixed",
1190
+ top: 0,
1191
+ left: 0,
1192
+ right: 0,
1193
+ bottom: 0,
1194
+ overflow: "hidden",
1195
+ width: "100vw",
1196
+ height: "100vh"
1197
+ },
1188
1198
  children: /* @__PURE__ */ jsx("div", { className: "scroll-wrapper", style: wrapperStyle, children })
1189
1199
  }
1190
1200
  ) });
@@ -1300,14 +1310,13 @@ function FullView({
1300
1310
  "section",
1301
1311
  {
1302
1312
  id,
1303
- className: `
1304
- full-view
1305
- relative
1306
- w-full h-screen
1307
- overflow-hidden
1308
- ${isActive ? "is-active" : ""}
1309
- ${className}
1310
- `,
1313
+ className: `full-view ${isActive ? "is-active" : ""} ${className}`,
1314
+ style: {
1315
+ position: "relative",
1316
+ width: "100%",
1317
+ height: "100vh",
1318
+ overflow: "hidden"
1319
+ },
1311
1320
  "data-view-type": "full",
1312
1321
  "data-view-index": index,
1313
1322
  "data-view-active": isActive,
@@ -1440,20 +1449,35 @@ function ScrollLockedView({
1440
1449
  }
1441
1450
  wasActive.current = isActive;
1442
1451
  }, [isActive, lastNavigationDirection, scrollResetBehavior, scrollDirection]);
1443
- const scrollClasses = scrollDirection === "vertical" ? "overflow-y-auto overflow-x-hidden" : "overflow-x-auto overflow-y-hidden";
1452
+ const scrollStyles = scrollDirection === "vertical" ? { overflowY: "auto", overflowX: "hidden" } : { overflowX: "auto", overflowY: "hidden" };
1444
1453
  return /* @__PURE__ */ jsx(
1445
1454
  "section",
1446
1455
  {
1447
1456
  id,
1448
- className: `relative w-full h-screen ${className}`,
1457
+ className: `scroll-locked-view ${className}`,
1449
1458
  "data-view-type": "scroll-locked",
1450
1459
  "data-active": isActive ? "true" : "false",
1460
+ style: {
1461
+ position: "relative",
1462
+ width: "100%",
1463
+ height: "100vh",
1464
+ overflow: "hidden"
1465
+ },
1451
1466
  children: /* @__PURE__ */ jsx(
1452
1467
  "div",
1453
1468
  {
1454
1469
  ref: scrollRef,
1455
- className: `w-full h-full ${scrollClasses} no-scrollbar`,
1456
- style: { scrollbarWidth: "none" },
1470
+ className: "no-scrollbar",
1471
+ style: {
1472
+ position: "absolute",
1473
+ top: 0,
1474
+ left: 0,
1475
+ right: 0,
1476
+ bottom: 0,
1477
+ scrollbarWidth: "none",
1478
+ touchAction: scrollDirection === "vertical" ? "pan-y" : "pan-x",
1479
+ ...scrollStyles
1480
+ },
1457
1481
  "data-scrollable": "true",
1458
1482
  children
1459
1483
  }
@@ -1505,29 +1529,39 @@ function ControlledView({
1505
1529
  const lockState = canProceed ? "unlocked" : "locked";
1506
1530
  setExplicitLock(id, lockState);
1507
1531
  }, [id, canProceed, setExplicitLock]);
1508
- const overflowClasses = useMemo(() => {
1509
- if (!allowInternalScroll) return "overflow-hidden";
1532
+ const overflowStyles = useMemo(() => {
1533
+ if (!allowInternalScroll) return { overflow: "hidden" };
1510
1534
  switch (scrollDirection) {
1511
1535
  case "vertical":
1512
- return "overflow-y-auto overflow-x-hidden";
1536
+ return { overflowY: "auto", overflowX: "hidden" };
1513
1537
  case "horizontal":
1514
- return "overflow-x-auto overflow-y-hidden";
1538
+ return { overflowX: "auto", overflowY: "hidden" };
1515
1539
  default:
1516
- return "overflow-auto";
1540
+ return { overflow: "auto" };
1517
1541
  }
1518
1542
  }, [allowInternalScroll, scrollDirection]);
1519
1543
  return /* @__PURE__ */ jsx(
1520
1544
  "section",
1521
1545
  {
1522
1546
  id,
1523
- className: `relative w-full h-screen ${isActive ? "z-10" : "z-0"} ${className}`,
1547
+ className: `controlled-view ${className}`,
1524
1548
  "data-view-type": "controlled",
1525
1549
  "data-active": isActive,
1550
+ style: {
1551
+ position: "relative",
1552
+ width: "100%",
1553
+ height: "100vh",
1554
+ zIndex: isActive ? 10 : 0
1555
+ },
1526
1556
  children: /* @__PURE__ */ jsx(
1527
1557
  "div",
1528
1558
  {
1529
1559
  ref: scrollRef,
1530
- className: `w-full h-full ${overflowClasses}`,
1560
+ style: {
1561
+ width: "100%",
1562
+ height: "100%",
1563
+ ...overflowStyles
1564
+ },
1531
1565
  children
1532
1566
  }
1533
1567
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scroll-system",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "description": "TikTok-style vertical scroll system with snap views, touch physics, and accessibility features",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",