ps99-api 2.6.2 → 2.6.4

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.
@@ -480,8 +480,16 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
480
480
  }, [isMobile, collectionName, finalItems.length]); // Re-evaluate on collection change or mobile resize, or items load
481
481
 
482
482
 
483
- // Scroll Direction // Header Logic
484
- const { showHeader, handleScroll, scrollRef, headerRef, headerHeight, contentPadding } = useCollapsibleHeader({ deps: [loading] });
483
+ // Scroll Direction / Header Logic
484
+ // Check if content is short to disable collapsible header (prevents popping)
485
+ const ITEM_HEIGHT = viewMode === 'list' ? 100 : 150; // Approximate
486
+ const estimatedContentHeight = finalItems.length * ITEM_HEIGHT / (viewMode === 'grid' ? 2 : 1); // Rough estimate
487
+ const isShortContent = estimatedContentHeight < window.innerHeight * 1.5;
488
+
489
+ const { showHeader, handleScroll, scrollRef, headerRef, headerHeight, contentPadding } = useCollapsibleHeader({
490
+ deps: [loading, finalItems.length, viewMode],
491
+ disabled: isShortContent // Disable collapsing if content is short
492
+ });
485
493
 
486
494
  // Loading State
487
495
  if (loading) {
@@ -644,7 +652,7 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
644
652
  flexDirection: "column",
645
653
  overflow: "hidden",
646
654
  backgroundColor: "#ffffff",
647
- height: "100%", // ensure it fills parent
655
+ height: "100dvh", // ensure it fills parent with dynamic viewport height
648
656
  position: 'relative' // Context for absolute header
649
657
  }}
650
658
  >
@@ -675,7 +683,7 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
675
683
  fontWeight: "900",
676
684
  color: "#333",
677
685
  textShadow: isMobile ? "2px 2px 0px #eee" : "3px 3px 0px #eee",
678
- fontFamily: "'Fredoka One', cursive, sans-serif",
686
+ fontFamily: "'Fredoka', 'Fredoka One', sans-serif",
679
687
  letterSpacing: "1px",
680
688
  overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap",
681
689
  maxWidth: isMobile ? "60%" : "auto"
@@ -821,6 +829,7 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
821
829
  width={width}
822
830
  initialScrollOffset={initialScrollOffset}
823
831
  onScroll={handleScroll}
832
+ bottomPadding={120} // Account for Android footer/nav
824
833
  itemData={{
825
834
  items: finalItems,
826
835
  navigate,
@@ -854,6 +863,7 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
854
863
  initialScrollOffset={initialScrollOffset}
855
864
  onScroll={handleScroll}
856
865
  style={{ overflowX: "hidden" }}
866
+ bottomPadding={120} // Account for Android footer/nav
857
867
  itemData={{
858
868
  items: finalItems,
859
869
  columnCount: colCount,
@@ -59,7 +59,7 @@ const GridCellRenderer = ({ columnIndex, rowIndex, style, data }: any) => {
59
59
  fontWeight: "900",
60
60
  color: "#333",
61
61
  textAlign: "center",
62
- fontFamily: "'Fredoka One', cursive, sans-serif",
62
+ fontFamily: "'Fredoka', 'Fredoka One', sans-serif",
63
63
  }}>
64
64
  {collection}
65
65
  </span>
@@ -118,7 +118,7 @@ const ListRowRenderer = ({ index, style, data }: any) => {
118
118
  whiteSpace: "nowrap",
119
119
  overflow: "hidden",
120
120
  textOverflow: "ellipsis",
121
- fontFamily: "'Fredoka One', cursive, sans-serif",
121
+ fontFamily: "'Fredoka', 'Fredoka One', sans-serif",
122
122
  }}>
123
123
  {collection}
124
124
  </div>
@@ -246,7 +246,7 @@ const CollectionsIndex: React.FC = () => {
246
246
  fontWeight: "900",
247
247
  color: "#333",
248
248
  textShadow: isMobile ? "1px 1px 0px #eee" : "3px 3px 0px #eee",
249
- fontFamily: "'Fredoka One', cursive, sans-serif",
249
+ fontFamily: "'Fredoka', 'Fredoka One', sans-serif",
250
250
  letterSpacing: "1px",
251
251
  }}>
252
252
  Collections
@@ -85,7 +85,7 @@ const DynamicCollectionConfigData: React.FC<
85
85
  fontWeight: "900",
86
86
  color: "#333",
87
87
  textShadow: "2px 2px 0px #eee",
88
- fontFamily: "'Fredoka One', cursive, sans-serif",
88
+ fontFamily: "'Fredoka', 'Fredoka One', sans-serif",
89
89
  textTransform: "capitalize",
90
90
  }}>
91
91
  {configName}
@@ -1,6 +1,6 @@
1
1
  import React, { useRef, useEffect } from 'react';
2
2
 
3
- export const FixedSizeList = ({ children, itemCount, itemSize, height, width, onScroll, initialScrollOffset, itemData }: any) => {
3
+ export const FixedSizeList = ({ children, itemCount, itemSize, height, width, onScroll, initialScrollOffset, itemData, bottomPadding = 0 }: any) => {
4
4
  const items = [];
5
5
  for (let i = 0; i < itemCount; i++) {
6
6
  items.push(
@@ -25,11 +25,12 @@ export const FixedSizeList = ({ children, itemCount, itemSize, height, width, on
25
25
  onScroll={(e) => onScroll && onScroll({ scrollOffset: e.currentTarget.scrollTop })}
26
26
  >
27
27
  {items}
28
+ {bottomPadding > 0 && <div style={{ height: bottomPadding }} />}
28
29
  </div>
29
30
  );
30
31
  };
31
32
 
32
- export const FixedSizeGrid = ({ children, columnCount, rowCount, columnWidth, rowHeight, height, width, onScroll, initialScrollOffset, itemData, style }: any) => {
33
+ export const FixedSizeGrid = ({ children, columnCount, rowCount, columnWidth, rowHeight, height, width, onScroll, initialScrollOffset, itemData, style, bottomPadding = 0 }: any) => {
33
34
  const items = [];
34
35
  for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
35
36
  for (let columnIndex = 0; columnIndex < columnCount; columnIndex++) {
@@ -65,7 +66,7 @@ export const FixedSizeGrid = ({ children, columnCount, rowCount, columnWidth, ro
65
66
  style={{ height, width, overflowY: "auto", overflowX: "hidden", position: 'relative', ...style }}
66
67
  onScroll={(e) => onScroll && onScroll({ scrollTop: e.currentTarget.scrollTop })}
67
68
  >
68
- <div style={{ height: rowCount * rowHeight, width: columnWidth * columnCount }}>
69
+ <div style={{ height: rowCount * rowHeight + bottomPadding, width: columnWidth * columnCount }}>
69
70
  {items}
70
71
  </div>
71
72
  </div>
@@ -44,7 +44,7 @@ const Sidebar: React.FC<SidebarProps> = ({ currentCollection }) => {
44
44
  fontSize: "1.5rem",
45
45
  fontWeight: "900",
46
46
  textShadow: "2px 2px 0px #eee",
47
- fontFamily: "'Fredoka One', cursive, sans-serif", // Assuming font availability or fallback
47
+ fontFamily: "'Fredoka', 'Fredoka One', sans-serif", // Assuming font availability or fallback
48
48
  }}>
49
49
  Terminal!
50
50
  </h3>
@@ -5,10 +5,11 @@ interface UseCollapsibleHeaderOptions {
5
5
  triggerStart?: number; // Scroll position to start checking
6
6
  threshold?: number; // Scroll delta threshold
7
7
  deps?: any[]; // Dependencies to re-run the ResizeObserver effect
8
+ disabled?: boolean; // Disable collapsing behavior
8
9
  }
9
10
 
10
11
  export const useCollapsibleHeader = (options: UseCollapsibleHeaderOptions = {}) => {
11
- const { defaultHeight = 120, triggerStart = 50, threshold = 10, deps = [] } = options;
12
+ const { defaultHeight = 120, triggerStart = 50, threshold = 10, deps = [], disabled = false } = options;
12
13
 
13
14
  // Header Visibility Logic
14
15
  const [showHeader, setShowHeader] = useState(true);
@@ -16,6 +17,11 @@ export const useCollapsibleHeader = (options: UseCollapsibleHeaderOptions = {})
16
17
  const scrollRef = useRef<number>(0);
17
18
 
18
19
  const handleScroll = ({ scrollOffset, scrollTop }: { scrollOffset?: number, scrollTop?: number }) => {
20
+ if (disabled) {
21
+ setShowHeader(true);
22
+ return;
23
+ }
24
+
19
25
  const currentScrollTop = scrollTop ?? scrollOffset ?? 0;
20
26
  const scrollDelta = currentScrollTop - lastScrollTop.current;
21
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ps99-api",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "description": "Pet Simulator Public API wrapper written in Typescript.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",