minecraft-inventory 0.1.13 → 0.1.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecraft-inventory",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "release": {
@@ -24,6 +24,8 @@ export interface InventoryGUIProps {
24
24
  textureBaseUrl?: string
25
25
  textureConfig?: Partial<TextureConfig>
26
26
  enableKeyboardShortcuts?: boolean
27
+ /** Hide empty slot labels like Head, Chest, Legs, Feet */
28
+ noPlaceholders?: boolean
27
29
  onClose?: () => void
28
30
  className?: string
29
31
  style?: React.CSSProperties
@@ -42,6 +44,7 @@ export function InventoryGUI({
42
44
  textureBaseUrl,
43
45
  textureConfig,
44
46
  enableKeyboardShortcuts = true,
47
+ noPlaceholders = false,
45
48
  onClose,
46
49
  className,
47
50
  style,
@@ -64,7 +67,7 @@ export function InventoryGUI({
64
67
  return (
65
68
  <TextureProvider baseUrl={textureBaseUrl} config={textureConfig}>
66
69
  <ScaleProvider scale={scale}>
67
- <InventoryProvider connector={connector}>
70
+ <InventoryProvider connector={connector} noPlaceholders={noPlaceholders}>
68
71
  <div
69
72
  ref={containerRef}
70
73
  className={className}
@@ -298,7 +298,7 @@ export function InventoryOverlay({
298
298
  lineHeight: 1,
299
299
  }}
300
300
  >
301
- INV 0.1.13
301
+ INV 0.1.14
302
302
  </a>
303
303
  )}
304
304
 
@@ -55,6 +55,7 @@ export function Slot({
55
55
  focusedSlot,
56
56
  setFocusedSlot,
57
57
  dragEndedRef,
58
+ noPlaceholders,
58
59
  } = useInventoryContext()
59
60
 
60
61
  const { contentSize } = useScale()
@@ -377,7 +378,7 @@ export function Slot({
377
378
  />
378
379
  )}
379
380
 
380
- {!item && label && (
381
+ {!item && label && !noPlaceholders && (
381
382
  <div
382
383
  ref={labelRef}
383
384
  className={styles.emptyLabel}
@@ -45,6 +45,8 @@ export interface InventoryContextValue {
45
45
  /** Ref set to true when a drag just ended; cleared on next mouseDown.
46
46
  * Used by Slot to suppress spurious click events that fire after endDrag. */
47
47
  dragEndedRef: React.MutableRefObject<boolean>
48
+ /** When true, empty slot labels (Head, Chest, Legs, etc.) are not rendered */
49
+ noPlaceholders: boolean
48
50
  }
49
51
 
50
52
  const InventoryContext = createContext<InventoryContextValue | null>(null)
@@ -59,9 +61,10 @@ interface InventoryProviderProps {
59
61
  connector: InventoryConnector | null
60
62
  children: React.ReactNode
61
63
  noDragSpread?: boolean
64
+ noPlaceholders?: boolean
62
65
  }
63
66
 
64
- export function InventoryProvider({ connector, children, noDragSpread = false }: InventoryProviderProps) {
67
+ export function InventoryProvider({ connector, children, noDragSpread = false, noPlaceholders = false }: InventoryProviderProps) {
65
68
  const [windowState, setWindowState] = useState<InventoryWindowState | null>(
66
69
  () => connector?.getWindowState() ?? null,
67
70
  )
@@ -304,6 +307,7 @@ export function InventoryProvider({ connector, children, noDragSpread = false }:
304
307
  grabOffset,
305
308
  setGrabOffset,
306
309
  noDragSpread,
310
+ noPlaceholders,
307
311
  pKeyActive,
308
312
  setPKeyActive,
309
313
  focusedSlot,