gigaboard 1.5.0 → 1.5.2

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/index.cjs CHANGED
@@ -347,9 +347,12 @@ function BoardEditor({
347
347
  getSquareAriaLabel,
348
348
  focusedSquare: propFocusedSquare,
349
349
  onSquareFocus,
350
+ id,
350
351
  onClear,
351
352
  onSetStartingPosition,
352
- onToggleSideToMove
353
+ onToggleSideToMove,
354
+ onFocus,
355
+ onBlur
353
356
  }) {
354
357
  const containerRef = react.useRef(null);
355
358
  const liveRegionRef = react.useRef(null);
@@ -635,6 +638,7 @@ function BoardEditor({
635
638
  "div",
636
639
  {
637
640
  ref: containerRef,
641
+ id,
638
642
  role: "application",
639
643
  tabIndex: 0,
640
644
  "aria-label": ariaLabel,
@@ -645,8 +649,14 @@ function BoardEditor({
645
649
  setHasKeyboardFocus(true);
646
650
  announceSquare(focusedSquare);
647
651
  }
652
+ onFocus?.(e);
653
+ },
654
+ onBlur: (e) => {
655
+ if (e.target === e.currentTarget) {
656
+ setHasKeyboardFocus(false);
657
+ }
658
+ onBlur?.(e);
648
659
  },
649
- onBlur: () => setHasKeyboardFocus(false),
650
660
  onPointerDown: handlePointerDown,
651
661
  onPointerMove: handlePointerMove,
652
662
  onPointerUp: handlePointerUp,
@@ -728,6 +738,39 @@ function BoardEditor({
728
738
  })
729
739
  }
730
740
  ),
741
+ hasKeyboardFocus && /* @__PURE__ */ jsxRuntime.jsx(
742
+ "div",
743
+ {
744
+ "aria-hidden": "true",
745
+ style: {
746
+ position: "absolute",
747
+ inset: 0,
748
+ display: "grid",
749
+ gridTemplateColumns: "repeat(8, 1fr)",
750
+ gridTemplateRows: "repeat(8, 1fr)",
751
+ pointerEvents: "none",
752
+ zIndex: 10
753
+ },
754
+ children: (() => {
755
+ const { col, row } = gridCoord(focusedSquare, orientation);
756
+ return /* @__PURE__ */ jsxRuntime.jsx(
757
+ "div",
758
+ {
759
+ "data-gb-editor-focus-square": algebraicOf2(focusedSquare),
760
+ style: {
761
+ gridColumnStart: col,
762
+ gridRowStart: row,
763
+ outline: "3px solid var(--gb-editor-sq-focus, #f59e0b)",
764
+ outlineOffset: "-3px",
765
+ boxShadow: "inset 0 0 0 1.5px rgba(0, 0, 0, 0.75), 0 0 8px rgba(245, 158, 11, 0.7)",
766
+ borderRadius: "2px",
767
+ pointerEvents: "none"
768
+ }
769
+ }
770
+ );
771
+ })()
772
+ }
773
+ ),
731
774
  dragging && containerRef.current ? /* @__PURE__ */ jsxRuntime.jsx(
732
775
  "div",
733
776
  {
@@ -3088,16 +3131,19 @@ function injectSelectionStyles() {
3088
3131
  background: var(--gb-selected);
3089
3132
  }
3090
3133
  [data-gb-square][data-gb-selection="legal-quiet"]::before {
3091
- background-image: radial-gradient(var(--gb-legal-target) 22%, transparent 24%);
3134
+ background-image: radial-gradient(var(--gb-legal-target) 19%, transparent 21%);
3092
3135
  }
3093
3136
  [data-gb-square][data-gb-selection="legal-capture"]::before {
3094
- background-image: radial-gradient(transparent 0 75%, var(--gb-legal-target-capture) 77% 83%, transparent 85%);
3137
+ background-image: radial-gradient(transparent 0 78%, var(--gb-legal-target-capture) 80%);
3138
+ }
3139
+ [data-gb-target-style="rings"] [data-gb-square][data-gb-selection="legal-capture"]::before {
3140
+ background-image: radial-gradient(transparent 0 70%, var(--gb-legal-target-capture) 72% 84%, transparent 86%);
3095
3141
  }
3096
3142
  [data-gb-target-style="dots"] [data-gb-square][data-gb-selection="legal-quiet"]::before {
3097
- background-image: radial-gradient(var(--gb-legal-target) 14%, transparent 16%);
3143
+ background-image: radial-gradient(var(--gb-legal-target) 19%, transparent 21%);
3098
3144
  }
3099
3145
  [data-gb-target-style="dots"] [data-gb-square][data-gb-selection="legal-capture"]::before {
3100
- background-image: radial-gradient(var(--gb-legal-target-capture) 20%, transparent 22%);
3146
+ background-image: radial-gradient(transparent 0 78%, var(--gb-legal-target-capture) 80%);
3101
3147
  }
3102
3148
  `;
3103
3149
  document.head.appendChild(style);