@mirasen/chessboard 0.1.0 → 0.1.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.
Files changed (226) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/animation/planner.d.ts +3 -3
  3. package/dist/animation/planner.js +4 -4
  4. package/dist/animation/render/fade.d.ts +4 -4
  5. package/dist/animation/render/fade.js +1 -1
  6. package/dist/animation/render/move.d.ts +4 -4
  7. package/dist/animation/render/move.js +1 -1
  8. package/dist/animation/render/plan.d.ts +4 -4
  9. package/dist/animation/render/plan.js +3 -3
  10. package/dist/animation/render/static.d.ts +4 -4
  11. package/dist/animation/render/static.js +1 -1
  12. package/dist/animation/render/types.d.ts +1 -1
  13. package/dist/animation/types.d.ts +1 -1
  14. package/dist/extensions/animation/factory.d.ts +1 -1
  15. package/dist/extensions/animation/factory.js +1 -1
  16. package/dist/extensions/animation/types.d.ts +1 -1
  17. package/dist/extensions/factory/main.d.ts +1 -1
  18. package/dist/extensions/factory/main.js +4 -4
  19. package/dist/extensions/factory/runtime.d.ts +4 -4
  20. package/dist/extensions/first-party/active-target/factory.d.ts +1 -1
  21. package/dist/extensions/first-party/active-target/factory.js +4 -4
  22. package/dist/extensions/first-party/active-target/types.d.ts +2 -2
  23. package/dist/extensions/first-party/board-events/factory.d.ts +1 -1
  24. package/dist/extensions/first-party/board-events/factory.js +6 -4
  25. package/dist/extensions/first-party/board-events/types.d.ts +6 -6
  26. package/dist/extensions/first-party/common/helpers.d.ts +2 -2
  27. package/dist/extensions/first-party/common/helpers.js +1 -1
  28. package/dist/extensions/first-party/common/types.d.ts +1 -1
  29. package/dist/extensions/first-party/last-move/factory.d.ts +1 -1
  30. package/dist/extensions/first-party/last-move/factory.js +4 -4
  31. package/dist/extensions/first-party/last-move/types.d.ts +2 -2
  32. package/dist/extensions/first-party/legal-moves/factory.d.ts +1 -1
  33. package/dist/extensions/first-party/legal-moves/factory.js +6 -6
  34. package/dist/extensions/first-party/legal-moves/types.d.ts +2 -2
  35. package/dist/extensions/first-party/main-renderer/animation/factory.d.ts +3 -3
  36. package/dist/extensions/first-party/main-renderer/animation/factory.js +3 -3
  37. package/dist/extensions/first-party/main-renderer/animation/render.d.ts +3 -3
  38. package/dist/extensions/first-party/main-renderer/animation/render.js +2 -2
  39. package/dist/extensions/first-party/main-renderer/animation/types.d.ts +7 -7
  40. package/dist/extensions/first-party/main-renderer/animation/update.d.ts +2 -2
  41. package/dist/extensions/first-party/main-renderer/animation/update.js +3 -3
  42. package/dist/extensions/first-party/main-renderer/board/factory.d.ts +2 -2
  43. package/dist/extensions/first-party/main-renderer/board/factory.js +2 -2
  44. package/dist/extensions/first-party/main-renderer/board/render.d.ts +2 -2
  45. package/dist/extensions/first-party/main-renderer/board/render.js +3 -3
  46. package/dist/extensions/first-party/main-renderer/board/types.d.ts +3 -3
  47. package/dist/extensions/first-party/main-renderer/board/update.d.ts +2 -2
  48. package/dist/extensions/first-party/main-renderer/board/update.js +3 -3
  49. package/dist/extensions/first-party/main-renderer/coordinates/factory.d.ts +2 -2
  50. package/dist/extensions/first-party/main-renderer/coordinates/factory.js +1 -1
  51. package/dist/extensions/first-party/main-renderer/coordinates/render.d.ts +2 -2
  52. package/dist/extensions/first-party/main-renderer/coordinates/render.js +3 -3
  53. package/dist/extensions/first-party/main-renderer/coordinates/types.d.ts +2 -2
  54. package/dist/extensions/first-party/main-renderer/drag/factory.d.ts +3 -3
  55. package/dist/extensions/first-party/main-renderer/drag/factory.js +2 -2
  56. package/dist/extensions/first-party/main-renderer/drag/render.d.ts +2 -2
  57. package/dist/extensions/first-party/main-renderer/drag/render.js +1 -1
  58. package/dist/extensions/first-party/main-renderer/drag/types.d.ts +4 -4
  59. package/dist/extensions/first-party/main-renderer/drag/update.d.ts +2 -2
  60. package/dist/extensions/first-party/main-renderer/drag/update.js +1 -1
  61. package/dist/extensions/first-party/main-renderer/factory.d.ts +1 -1
  62. package/dist/extensions/first-party/main-renderer/factory.js +9 -9
  63. package/dist/extensions/first-party/main-renderer/normalize.d.ts +2 -2
  64. package/dist/extensions/first-party/main-renderer/normalize.js +3 -3
  65. package/dist/extensions/first-party/main-renderer/pieces/factory.d.ts +2 -2
  66. package/dist/extensions/first-party/main-renderer/pieces/factory.js +2 -2
  67. package/dist/extensions/first-party/main-renderer/pieces/render.d.ts +2 -2
  68. package/dist/extensions/first-party/main-renderer/pieces/render.js +4 -4
  69. package/dist/extensions/first-party/main-renderer/pieces/suppress.d.ts +4 -4
  70. package/dist/extensions/first-party/main-renderer/pieces/types.d.ts +5 -5
  71. package/dist/extensions/first-party/main-renderer/pieces/update.d.ts +4 -4
  72. package/dist/extensions/first-party/main-renderer/pieces/update.js +5 -5
  73. package/dist/extensions/first-party/main-renderer/types/extension.d.ts +2 -2
  74. package/dist/extensions/first-party/main-renderer/types/input.d.ts +2 -2
  75. package/dist/extensions/first-party/main-renderer/types/instance.d.ts +8 -8
  76. package/dist/extensions/first-party/main-renderer/types/internal.d.ts +2 -2
  77. package/dist/extensions/first-party/main-renderer/types/template.d.ts +1 -1
  78. package/dist/extensions/first-party/selected-square/factory.d.ts +1 -1
  79. package/dist/extensions/first-party/selected-square/factory.js +4 -4
  80. package/dist/extensions/first-party/selected-square/types.d.ts +2 -2
  81. package/dist/extensions/index.d.ts +8 -8
  82. package/dist/extensions/index.js +6 -6
  83. package/dist/extensions/invalidation/factory.d.ts +1 -1
  84. package/dist/extensions/types/basic/events.d.ts +2 -2
  85. package/dist/extensions/types/basic/render.d.ts +2 -2
  86. package/dist/extensions/types/basic/transient-visuals.d.ts +1 -1
  87. package/dist/extensions/types/basic/update.d.ts +3 -3
  88. package/dist/extensions/types/context/animation.d.ts +3 -3
  89. package/dist/extensions/types/context/render.d.ts +2 -2
  90. package/dist/extensions/types/context/transient-visuals.d.ts +2 -2
  91. package/dist/extensions/types/context/ui-move.d.ts +2 -2
  92. package/dist/extensions/types/context/update.d.ts +4 -4
  93. package/dist/extensions/types/context/update.js +1 -1
  94. package/dist/extensions/types/extension.d.ts +8 -8
  95. package/dist/extensions/types/main.d.ts +8 -8
  96. package/dist/extensions/types/surface/commands.d.ts +5 -5
  97. package/dist/extensions/types/surface/events.d.ts +1 -1
  98. package/dist/extensions/types/surface/main.d.ts +4 -4
  99. package/dist/extensions/types/wrapper.d.ts +6 -6
  100. package/dist/extensions/update.d.ts +2 -2
  101. package/dist/extensions/update.js +1 -1
  102. package/dist/index.d.ts +4 -4
  103. package/dist/index.js +1 -1
  104. package/dist/layout/factory.d.ts +1 -1
  105. package/dist/layout/factory.js +1 -1
  106. package/dist/layout/geometry/factory.d.ts +2 -2
  107. package/dist/layout/geometry/factory.js +1 -1
  108. package/dist/layout/geometry/types.d.ts +1 -1
  109. package/dist/layout/mutation.d.ts +1 -1
  110. package/dist/layout/reducers.d.ts +1 -1
  111. package/dist/layout/reducers.js +2 -2
  112. package/dist/layout/types.d.ts +3 -3
  113. package/dist/mutation/pipeline.d.ts +1 -1
  114. package/dist/mutation/pipeline.js +1 -1
  115. package/dist/mutation/session.d.ts +1 -1
  116. package/dist/render/factory.d.ts +1 -1
  117. package/dist/render/factory.js +7 -7
  118. package/dist/render/mount.d.ts +1 -1
  119. package/dist/render/mount.js +2 -2
  120. package/dist/render/rendering/animation.d.ts +1 -1
  121. package/dist/render/rendering/animation.js +1 -1
  122. package/dist/render/rendering/helpers.d.ts +1 -1
  123. package/dist/render/rendering/state.d.ts +2 -2
  124. package/dist/render/rendering/state.js +2 -2
  125. package/dist/render/rendering/visuals.d.ts +2 -2
  126. package/dist/render/rendering/visuals.js +1 -1
  127. package/dist/render/scheduler/scheduler.d.ts +1 -1
  128. package/dist/render/svg/factory.d.ts +2 -2
  129. package/dist/render/svg/factory.js +1 -1
  130. package/dist/render/svg/helpers.d.ts +1 -1
  131. package/dist/render/svg/helpers.js +1 -1
  132. package/dist/render/types.d.ts +5 -5
  133. package/dist/runtime/factory/helpers.d.ts +2 -2
  134. package/dist/runtime/factory/helpers.js +3 -3
  135. package/dist/runtime/factory/input.d.ts +2 -2
  136. package/dist/runtime/factory/input.js +3 -3
  137. package/dist/runtime/factory/main.d.ts +1 -1
  138. package/dist/runtime/factory/main.js +12 -12
  139. package/dist/runtime/factory/ui-move.d.ts +3 -3
  140. package/dist/runtime/input/adapter/factory.d.ts +1 -1
  141. package/dist/runtime/input/adapter/factory.js +1 -1
  142. package/dist/runtime/input/adapter/helpers.d.ts +3 -3
  143. package/dist/runtime/input/adapter/pointer.d.ts +2 -2
  144. package/dist/runtime/input/adapter/pointer.js +2 -2
  145. package/dist/runtime/input/adapter/types.d.ts +2 -2
  146. package/dist/runtime/input/controller/factory.d.ts +1 -1
  147. package/dist/runtime/input/controller/factory.js +2 -2
  148. package/dist/runtime/input/controller/helpers.d.ts +2 -2
  149. package/dist/runtime/input/controller/pointer.d.ts +2 -2
  150. package/dist/runtime/input/controller/pointer.js +3 -3
  151. package/dist/runtime/input/controller/transient-visuals.d.ts +2 -2
  152. package/dist/runtime/input/controller/types.d.ts +4 -4
  153. package/dist/runtime/layout.d.ts +1 -1
  154. package/dist/runtime/layout.js +2 -2
  155. package/dist/runtime/lifecycle.d.ts +2 -2
  156. package/dist/runtime/lifecycle.js +2 -2
  157. package/dist/runtime/mutation/extension-update.d.ts +1 -1
  158. package/dist/runtime/mutation/factory.d.ts +1 -1
  159. package/dist/runtime/mutation/factory.js +6 -6
  160. package/dist/runtime/mutation/interaction.d.ts +1 -1
  161. package/dist/runtime/mutation/interaction.js +2 -2
  162. package/dist/runtime/mutation/invalidation.d.ts +1 -0
  163. package/dist/runtime/mutation/invalidation.js +1 -1
  164. package/dist/runtime/mutation/last-move.d.ts +1 -1
  165. package/dist/runtime/mutation/layout.d.ts +1 -1
  166. package/dist/runtime/mutation/pipeline.d.ts +6 -6
  167. package/dist/runtime/mutation/request-render.d.ts +1 -1
  168. package/dist/runtime/mutation/request-render.js +1 -1
  169. package/dist/runtime/mutation/run.d.ts +1 -1
  170. package/dist/runtime/mutation/types.d.ts +6 -6
  171. package/dist/runtime/types/main.d.ts +6 -6
  172. package/dist/runtime/types/ui-move.d.ts +3 -3
  173. package/dist/state/board/check.d.ts +3 -3
  174. package/dist/state/board/check.js +1 -1
  175. package/dist/state/board/coords.d.ts +1 -1
  176. package/dist/state/board/denormalize.d.ts +3 -3
  177. package/dist/state/board/denormalize.js +4 -4
  178. package/dist/state/board/factory.d.ts +2 -2
  179. package/dist/state/board/factory.js +4 -4
  180. package/dist/state/board/mutation.d.ts +2 -2
  181. package/dist/state/board/normalize.d.ts +2 -2
  182. package/dist/state/board/normalize.js +2 -2
  183. package/dist/state/board/piece.d.ts +1 -1
  184. package/dist/state/board/position.d.ts +2 -2
  185. package/dist/state/board/position.js +2 -2
  186. package/dist/state/board/reducers.d.ts +2 -2
  187. package/dist/state/board/reducers.js +3 -3
  188. package/dist/state/board/types/input.d.ts +1 -1
  189. package/dist/state/board/types/internal.d.ts +1 -1
  190. package/dist/state/board/types/main.d.ts +3 -3
  191. package/dist/state/board/types/output.d.ts +2 -2
  192. package/dist/state/change/factory.d.ts +1 -1
  193. package/dist/state/change/factory.js +1 -1
  194. package/dist/state/change/helpers.d.ts +3 -3
  195. package/dist/state/change/helpers.js +1 -1
  196. package/dist/state/change/mutation.d.ts +1 -1
  197. package/dist/state/change/reducers.d.ts +3 -3
  198. package/dist/state/change/reducers.js +1 -1
  199. package/dist/state/change/types.d.ts +3 -3
  200. package/dist/state/factory.d.ts +1 -1
  201. package/dist/state/factory.js +4 -4
  202. package/dist/state/interaction/factory.d.ts +1 -1
  203. package/dist/state/interaction/factory.js +3 -3
  204. package/dist/state/interaction/helpers.d.ts +2 -2
  205. package/dist/state/interaction/helpers.js +2 -2
  206. package/dist/state/interaction/movability.d.ts +3 -3
  207. package/dist/state/interaction/movability.js +2 -2
  208. package/dist/state/interaction/mutation.d.ts +1 -1
  209. package/dist/state/interaction/normalize.d.ts +2 -2
  210. package/dist/state/interaction/normalize.js +2 -2
  211. package/dist/state/interaction/reducers.d.ts +3 -3
  212. package/dist/state/interaction/reducers.js +3 -3
  213. package/dist/state/interaction/types/input.d.ts +1 -1
  214. package/dist/state/interaction/types/internal.d.ts +1 -1
  215. package/dist/state/interaction/types/main.d.ts +4 -4
  216. package/dist/state/types.d.ts +6 -6
  217. package/dist/state/view/factory.d.ts +1 -1
  218. package/dist/state/view/factory.js +2 -2
  219. package/dist/state/view/mutation.d.ts +1 -1
  220. package/dist/state/view/reducers.d.ts +2 -2
  221. package/dist/state/view/types/internal.d.ts +1 -1
  222. package/dist/state/view/types/main.d.ts +4 -4
  223. package/dist/wrapper/factory.d.ts +2 -2
  224. package/dist/wrapper/factory.js +8 -8
  225. package/dist/wrapper/types.d.ts +4 -4
  226. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { ColorShort, PieceString, RolePromotionShort, RoleShort, SquareString } from './types/input';
2
- import { ColorCode, Move, MoveBase, MoveCaptured, NonEmptyPieceCode, RoleCode, RolePromotionCode, Square } from './types/internal';
3
- import { MoveBaseOutput, MoveCapturedOutput, MoveOutput } from './types/output';
1
+ import { ColorShort, PieceString, RolePromotionShort, RoleShort, SquareString } from './types/input.js';
2
+ import { ColorCode, Move, MoveBase, MoveCaptured, NonEmptyPieceCode, RoleCode, RolePromotionCode, Square } from './types/internal.js';
3
+ import { MoveBaseOutput, MoveCapturedOutput, MoveOutput } from './types/output.js';
4
4
  export declare function denormalizeSquare(sq: Square): SquareString;
5
5
  export declare function denormalizeColorShort(color: ColorCode): ColorShort;
6
6
  export declare function denormalizeRoleShort(role: RoleCode): RoleShort;
@@ -1,7 +1,7 @@
1
- import { isValidSquare } from './check';
2
- import { fileOf, rankOf } from './coords';
3
- import { fromPieceCode } from './piece';
4
- import { FILE_START, RANK_START } from './types/internal';
1
+ import { isValidSquare } from './check.js';
2
+ import { fileOf, rankOf } from './coords.js';
3
+ import { fromPieceCode } from './piece.js';
4
+ import { FILE_START, RANK_START } from './types/internal.js';
5
5
  export function denormalizeSquare(sq) {
6
6
  if (!isValidSquare(sq)) {
7
7
  throw new RangeError(`Invalid square index: ${sq}`);
@@ -1,3 +1,3 @@
1
- import { PositionInput } from './types/input';
2
- import { BoardState } from './types/main';
1
+ import { PositionInput } from './types/input.js';
2
+ import { BoardState } from './types/main.js';
3
3
  export declare function createBoardState(position?: PositionInput): BoardState;
@@ -1,8 +1,8 @@
1
1
  import { cloneDeep } from 'es-toolkit/object';
2
- import { isNormalizedMoveRequest } from './check';
3
- import { normalizeColor, normalizeMoveRequest } from './normalize';
4
- import { boardParsePiecePositionInput, boardParsePosition } from './position';
5
- import { boardMove, boardSetPosition, boardSetTurn } from './reducers';
2
+ import { isNormalizedMoveRequest } from './check.js';
3
+ import { normalizeColor, normalizeMoveRequest } from './normalize.js';
4
+ import { boardParsePiecePositionInput, boardParsePosition } from './position.js';
5
+ import { boardMove, boardSetPosition, boardSetTurn } from './reducers.js';
6
6
  function createBoardStateInternal(position) {
7
7
  const parsedPosition = boardParsePosition(position);
8
8
  return {
@@ -1,5 +1,5 @@
1
- import type { MutationSession } from '../../mutation/types';
2
- import type { MoveSnapshot } from './types/internal';
1
+ import type { MutationSession } from '../../mutation/types.js';
2
+ import type { MoveSnapshot } from './types/internal.js';
3
3
  export type BoardStateMutationPayloadByCause = {
4
4
  'state.board.setPosition': undefined;
5
5
  'state.board.setPiecePosition': undefined;
@@ -1,5 +1,5 @@
1
- import { ColorInput, MoveRequestInput, PieceInput, RoleInput, RolePromotionInput, SquareString } from './types/input';
2
- import { ColorCode, MoveRequest, PieceCode, RoleCode, RolePromotionCode, Square } from './types/internal';
1
+ import { ColorInput, MoveRequestInput, PieceInput, RoleInput, RolePromotionInput, SquareString } from './types/input.js';
2
+ import { ColorCode, MoveRequest, PieceCode, RoleCode, RolePromotionCode, Square } from './types/internal.js';
3
3
  export declare function normalizeColor(input: ColorInput): ColorCode;
4
4
  export declare function normalizeRole(input: RoleInput): RoleCode;
5
5
  export declare function normalizePiece(input: PieceInput): PieceCode;
@@ -1,5 +1,5 @@
1
- import { isPieceString, isRolePromotionCode, isValidSquare } from './check';
2
- import { FILE_START, RANK_START } from './types/internal';
1
+ import { isPieceString, isRolePromotionCode, isValidSquare } from './check.js';
2
+ import { FILE_START, RANK_START } from './types/internal.js';
3
3
  export function normalizeColor(input) {
4
4
  switch (input) {
5
5
  case 'white':
@@ -1,3 +1,3 @@
1
- import { ColorCode, NonEmptyPieceCode, PieceCode, PieceCoded, RoleCode } from './types/internal';
1
+ import { ColorCode, NonEmptyPieceCode, PieceCode, PieceCoded, RoleCode } from './types/internal.js';
2
2
  export declare function toPieceCode(role: RoleCode, color: ColorCode): PieceCode;
3
3
  export declare function fromPieceCode(code: NonEmptyPieceCode): PieceCoded;
@@ -1,4 +1,4 @@
1
- import { PiecePositionInput, PositionInput } from './types/input';
2
- import { ParsedPosition } from './types/internal';
1
+ import { PiecePositionInput, PositionInput } from './types/input.js';
2
+ import { ParsedPosition } from './types/internal.js';
3
3
  export declare function boardParsePiecePositionInput(input: PiecePositionInput): Uint8Array;
4
4
  export declare function boardParsePosition(input: PositionInput): ParsedPosition;
@@ -1,6 +1,6 @@
1
1
  import { parse } from '@echecs/fen';
2
- import { normalizeColor, normalizePiece, normalizeSquare } from './normalize';
3
- import { SQUARE_COUNT } from './types/internal';
2
+ import { normalizeColor, normalizePiece, normalizeSquare } from './normalize.js';
3
+ import { SQUARE_COUNT } from './types/internal.js';
4
4
  const START_POSITION_RECORD_STRING = {
5
5
  a1: 'wR',
6
6
  b1: 'wN',
@@ -1,5 +1,5 @@
1
- import { ColorCode, Move, MoveRequest } from './types/internal';
2
- import { BoardStateInternal } from './types/main';
1
+ import { ColorCode, Move, MoveRequest } from './types/internal.js';
2
+ import { BoardStateInternal } from './types/main.js';
3
3
  export declare function boardSetPosition(state: BoardStateInternal, pieces: Uint8Array): boolean;
4
4
  /**
5
5
  * Set active color turn.
@@ -1,6 +1,6 @@
1
- import { isEmptyPieceCode } from './check';
2
- import { denormalizeSquare } from './denormalize';
3
- import { fromPieceCode, toPieceCode } from './piece';
1
+ import { isEmptyPieceCode } from './check.js';
2
+ import { denormalizeSquare } from './denormalize.js';
3
+ import { fromPieceCode, toPieceCode } from './piece.js';
4
4
  export function boardSetPosition(state, pieces) {
5
5
  state.pieces = new Uint8Array(pieces);
6
6
  // Increment position epoch to prevent false animation across position resets
@@ -1,4 +1,4 @@
1
- import { TMoveRequest } from './template';
1
+ import { TMoveRequest } from './template.js';
2
2
  export type Color = 'white' | 'black';
3
3
  export type ColorShort = 'w' | 'b';
4
4
  export type ColorInput = Color | ColorShort;
@@ -1,5 +1,5 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import { TMove, TMoveBase, TMoveCaptured, TMoveRequest, TMoveRequestBase } from './template';
2
+ import { TMove, TMoveBase, TMoveCaptured, TMoveRequest, TMoveRequestBase } from './template.js';
3
3
  export type Square = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63;
4
4
  export declare const SQUARE_COUNT = 64;
5
5
  export type SquareFile = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
@@ -1,7 +1,7 @@
1
1
  import { ReadonlyDeep } from 'type-fest';
2
- import { BoardStateMutationSession } from '../mutation';
3
- import { ColorInput, MoveRequestInput, PiecePositionInput, PositionInput } from './input';
4
- import { ColorCode, Move, MoveRequest, PieceCode, Square } from './internal';
2
+ import { BoardStateMutationSession } from '../mutation.js';
3
+ import { ColorInput, MoveRequestInput, PiecePositionInput, PositionInput } from './input.js';
4
+ import { ColorCode, Move, MoveRequest, PieceCode, Square } from './internal.js';
5
5
  export interface BoardStateInternal {
6
6
  pieces: Uint8Array;
7
7
  turn: ColorCode;
@@ -1,5 +1,5 @@
1
- import { PieceString, RolePromotionShort, SquareString } from './input';
2
- import { TMove, TMoveBase, TMoveCaptured } from './template';
1
+ import { PieceString, RolePromotionShort, SquareString } from './input.js';
2
+ import { TMove, TMoveBase, TMoveCaptured } from './template.js';
3
3
  export type MoveBaseOutput = TMoveBase<SquareString, PieceString>;
4
4
  export type MoveCapturedOutput = TMoveCaptured<SquareString, PieceString>;
5
5
  export type MoveOutput = TMove<SquareString, PieceString, RolePromotionShort>;
@@ -1,2 +1,2 @@
1
- import type { ChangeState } from './types';
1
+ import type { ChangeState } from './types.js';
2
2
  export declare function createChangeState(): ChangeState;
@@ -1,5 +1,5 @@
1
1
  import { cloneDeep } from 'es-toolkit/object';
2
- import { changeStateSetDeferredUIMoveRequestContext, changeStateSetLastMove } from './reducers';
2
+ import { changeStateSetDeferredUIMoveRequestContext, changeStateSetLastMove } from './reducers.js';
3
3
  function createChangeStateInternal() {
4
4
  return {
5
5
  lastMove: null,
@@ -1,6 +1,6 @@
1
- import { ExtensionUIMoveRequestContextSnapshot } from '../../extensions/types/context/ui-move';
2
- import type { MoveRequest, MoveRequestBase, MoveSnapshot } from '../board/types/internal';
3
- import { MoveDestinationSnapshot } from '../interaction/types/internal';
1
+ import { ExtensionUIMoveRequestContextSnapshot } from '../../extensions/types/context/ui-move.js';
2
+ import type { MoveRequest, MoveRequestBase, MoveSnapshot } from '../board/types/internal.js';
3
+ import { MoveDestinationSnapshot } from '../interaction/types/internal.js';
4
4
  export declare function movesEqual(moveA: MoveSnapshot | null, moveB: MoveSnapshot | null): boolean;
5
5
  export declare function moveRequestBasesEqual(requestA: MoveRequestBase | null, requestB: MoveRequestBase | null): boolean;
6
6
  export declare function moveRequestsEqual(requestA: MoveRequest | null, requestB: MoveRequest | null): boolean;
@@ -1,4 +1,4 @@
1
- import { setsEqual } from '../../helpers/util';
1
+ import { setsEqual } from '../../helpers/util.js';
2
2
  function baseMovesEqual(moveA, moveB) {
3
3
  const diffs = [
4
4
  moveA.from !== moveB.from,
@@ -1,4 +1,4 @@
1
- import type { MutationSession } from '../../mutation/types';
1
+ import type { MutationSession } from '../../mutation/types.js';
2
2
  export type ChangeStateMutationPayloadByCause = {
3
3
  'state.change.setLastMove': undefined;
4
4
  'state.change.setDeferredUIMoveRequestContext': undefined;
@@ -1,5 +1,5 @@
1
- import { ExtensionUIMoveRequestContext } from '../../extensions/types/context/ui-move';
2
- import type { MoveSnapshot } from '../board/types/internal';
3
- import type { ChangeStateInternal } from './types';
1
+ import { ExtensionUIMoveRequestContext } from '../../extensions/types/context/ui-move.js';
2
+ import type { MoveSnapshot } from '../board/types/internal.js';
3
+ import type { ChangeStateInternal } from './types.js';
4
4
  export declare function changeStateSetLastMove(state: ChangeStateInternal, move: MoveSnapshot | null): boolean;
5
5
  export declare function changeStateSetDeferredUIMoveRequestContext(state: ChangeStateInternal, context: ExtensionUIMoveRequestContext): boolean;
@@ -1,5 +1,5 @@
1
1
  import { cloneDeep } from 'es-toolkit/object';
2
- import { movesEqual, uiMoveRequestContextsEqual } from './helpers';
2
+ import { movesEqual, uiMoveRequestContextsEqual } from './helpers.js';
3
3
  export function changeStateSetLastMove(state, move) {
4
4
  if (movesEqual(state.lastMove, move)) {
5
5
  return false; // No change
@@ -1,7 +1,7 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import { ExtensionUIMoveRequestContext, ExtensionUIMoveRequestContextSnapshot } from '../../extensions/types/context/ui-move';
3
- import type { MoveSnapshot } from '../board/types/internal';
4
- import type { ChangeStateMutationSession } from './mutation';
2
+ import { ExtensionUIMoveRequestContext, ExtensionUIMoveRequestContextSnapshot } from '../../extensions/types/context/ui-move.js';
3
+ import type { MoveSnapshot } from '../board/types/internal.js';
4
+ import type { ChangeStateMutationSession } from './mutation.js';
5
5
  export interface ChangeStateInternal {
6
6
  lastMove: MoveSnapshot | null;
7
7
  deferredUIMoveRequestContext: ExtensionUIMoveRequestContext | null;
@@ -1,2 +1,2 @@
1
- import type { RuntimeState, RuntimeStateInitOptions } from './types';
1
+ import type { RuntimeState, RuntimeStateInitOptions } from './types.js';
2
2
  export declare function createRuntimeState(options: RuntimeStateInitOptions): RuntimeState;
@@ -1,7 +1,7 @@
1
- import { createBoardState } from './board/factory';
2
- import { createChangeState } from './change/factory';
3
- import { createInteractionState } from './interaction/factory';
4
- import { createViewState } from './view/factory';
1
+ import { createBoardState } from './board/factory.js';
2
+ import { createChangeState } from './change/factory.js';
3
+ import { createInteractionState } from './interaction/factory.js';
4
+ import { createViewState } from './view/factory.js';
5
5
  function createRuntimeStateInternal(options) {
6
6
  return {
7
7
  board: createBoardState(options.board ?? {}),
@@ -1,2 +1,2 @@
1
- import { InteractionState, InteractionStateInitOptions } from './types/main';
1
+ import { InteractionState, InteractionStateInitOptions } from './types/main.js';
2
2
  export declare function createInteractionState(options: InteractionStateInitOptions): InteractionState;
@@ -1,8 +1,8 @@
1
1
  import assert from '@ktarmyshov/assert';
2
2
  import { cloneDeep } from 'es-toolkit';
3
- import { updateActiveDestinations } from './helpers';
4
- import { normalizeMovability } from './normalize';
5
- import { interactionClear, interactionClearActive, interactionSetDragSession, interactionSetMovability, interactionSetSelected, interactionUpdateDragSessionCurrentTarget } from './reducers';
3
+ import { updateActiveDestinations } from './helpers.js';
4
+ import { normalizeMovability } from './normalize.js';
5
+ import { interactionClear, interactionClearActive, interactionSetDragSession, interactionSetMovability, interactionSetSelected, interactionUpdateDragSessionCurrentTarget } from './reducers.js';
6
6
  const DefaultMovabilityDisabled = { mode: 0 /* MovabilityModeCode.Disabled */ };
7
7
  /**
8
8
  * Create a fresh interaction state with all fields set to null or false.
@@ -1,4 +1,4 @@
1
- import { InteractionStateMutationSession } from './mutation';
2
- import { InteractionStateInternal, InteractionStateSelected } from './types/main';
1
+ import { InteractionStateMutationSession } from './mutation.js';
2
+ import { InteractionStateInternal, InteractionStateSelected } from './types/main.js';
3
3
  export declare function selectedEqual(a: InteractionStateSelected | null, b: InteractionStateSelected | null): boolean;
4
4
  export declare function updateActiveDestinations(state: InteractionStateInternal, mutationSession: InteractionStateMutationSession): boolean;
@@ -1,5 +1,5 @@
1
- import { getActiveDestinations } from './movability';
2
- import { interactionSetActiveDestinations } from './reducers';
1
+ import { getActiveDestinations } from './movability.js';
2
+ import { interactionSetActiveDestinations } from './reducers.js';
3
3
  export function selectedEqual(a, b) {
4
4
  if (a === b)
5
5
  return true;
@@ -1,5 +1,5 @@
1
- import type { Square } from '../board/types/internal';
2
- import { MoveDestinationSnapshot, type MovabilitySnapshot } from './types/internal';
3
- import { InteractionStateInternal } from './types/main';
1
+ import type { Square } from '../board/types/internal.js';
2
+ import { MoveDestinationSnapshot, type MovabilitySnapshot } from './types/internal.js';
3
+ import { InteractionStateInternal } from './types/main.js';
4
4
  export declare function movabilitiesEqual(a: MovabilitySnapshot, b: MovabilitySnapshot): boolean;
5
5
  export declare function getActiveDestinations(state: InteractionStateInternal, from: Square): ReadonlyMap<Square, MoveDestinationSnapshot>;
@@ -1,5 +1,5 @@
1
- import { setsEqual } from '../../helpers/util';
2
- import { assertValidSquare } from '../board/check';
1
+ import { setsEqual } from '../../helpers/util.js';
2
+ import { assertValidSquare } from '../board/check.js';
3
3
  function moveDestinationsEqual(a, b) {
4
4
  if (a === b)
5
5
  return true;
@@ -1,4 +1,4 @@
1
- import type { MutationSession } from '../../mutation/types';
1
+ import type { MutationSession } from '../../mutation/types.js';
2
2
  export type InteractionStateMutationPayloadByCause = {
3
3
  'state.interaction.setSelectedSquare': undefined;
4
4
  'state.interaction.setDragSession': undefined;
@@ -1,5 +1,5 @@
1
1
  import { ReadonlyDeep } from 'type-fest';
2
- import { MovabilityInput, MoveDestinationInput } from './types/input';
3
- import { Movability, MoveDestination } from './types/internal';
2
+ import { MovabilityInput, MoveDestinationInput } from './types/input.js';
3
+ import { Movability, MoveDestination } from './types/internal.js';
4
4
  export declare function normalizeMoveDestinationInput(destination: ReadonlyDeep<MoveDestinationInput>): MoveDestination;
5
5
  export declare function normalizeMovability(movability: MovabilityInput): Movability;
@@ -1,5 +1,5 @@
1
- import { denormalizeSquare } from '../board/denormalize';
2
- import { normalizeRolePromotion, normalizeSquare } from '../board/normalize';
1
+ import { denormalizeSquare } from '../board/denormalize.js';
2
+ import { normalizeRolePromotion, normalizeSquare } from '../board/normalize.js';
3
3
  export function normalizeMoveDestinationInput(destination) {
4
4
  return {
5
5
  to: normalizeSquare(destination.to),
@@ -1,7 +1,7 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import type { Square } from '../board/types/internal';
3
- import { Movability, type DragSessionSnapshot, type MoveDestination } from './types/internal';
4
- import { InteractionStateInternal, InteractionStateSelected } from './types/main';
2
+ import type { Square } from '../board/types/internal.js';
3
+ import { Movability, type DragSessionSnapshot, type MoveDestination } from './types/internal.js';
4
+ import { InteractionStateInternal, InteractionStateSelected } from './types/main.js';
5
5
  export declare function interactionSetSelected(state: InteractionStateInternal, selected: InteractionStateSelected | null): boolean;
6
6
  export declare function interactionSetMovability(state: InteractionStateInternal, m: Movability): boolean;
7
7
  export declare function interactionSetActiveDestinations(state: InteractionStateInternal, dests: ReadonlyMap<Square, ReadonlyDeep<MoveDestination>>): boolean;
@@ -1,8 +1,8 @@
1
1
  import assert from '@ktarmyshov/assert';
2
2
  import { cloneDeep } from 'es-toolkit/object';
3
- import { setsEqual } from '../../helpers/util';
4
- import { selectedEqual } from './helpers';
5
- import { movabilitiesEqual } from './movability';
3
+ import { setsEqual } from '../../helpers/util.js';
4
+ import { selectedEqual } from './helpers.js';
5
+ import { movabilitiesEqual } from './movability.js';
6
6
  export function interactionSetSelected(state, selected) {
7
7
  const notChanged = selectedEqual(state.selected, selected);
8
8
  if (notChanged)
@@ -1,4 +1,4 @@
1
- import { MoveRequestInput, RolePromotionInput, SquareString } from '../../board/types/input';
1
+ import { MoveRequestInput, RolePromotionInput, SquareString } from '../../board/types/input.js';
2
2
  export interface MoveDestinationInput extends Omit<MoveRequestInput, 'from' | 'promotedTo'> {
3
3
  promotedTo?: RolePromotionInput[];
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import type { MoveRequest, PieceCode, RolePromotionCode, Square } from '../../board/types/internal';
2
+ import type { MoveRequest, PieceCode, RolePromotionCode, Square } from '../../board/types/internal.js';
3
3
  export interface DragSession {
4
4
  type: 'lifted-piece-drag' | 'release-targeting';
5
5
  sourceSquare: Square;
@@ -1,8 +1,8 @@
1
1
  import { ReadonlyDeep } from 'type-fest';
2
- import { NonEmptyPieceCode, Square } from '../../board/types/internal';
3
- import { InteractionStateMutationSession } from '../mutation';
4
- import { MovabilityInput } from './input';
5
- import { DragSession, DragSessionSnapshot, Movability, MovabilitySnapshot, MoveDestinationSnapshot } from './internal';
2
+ import { NonEmptyPieceCode, Square } from '../../board/types/internal.js';
3
+ import { InteractionStateMutationSession } from '../mutation.js';
4
+ import { MovabilityInput } from './input.js';
5
+ import { DragSession, DragSessionSnapshot, Movability, MovabilitySnapshot, MoveDestinationSnapshot } from './internal.js';
6
6
  export interface InteractionStateSelected {
7
7
  square: Square;
8
8
  pieceCode: NonEmptyPieceCode;
@@ -1,9 +1,9 @@
1
- import { PositionInput } from './board/types/input';
2
- import { BoardState, BoardStateSnapshot } from './board/types/main';
3
- import type { ChangeState, ChangeStateSnapshot } from './change/types';
4
- import { InteractionState, InteractionStateInitOptions, InteractionStateSnapshot } from './interaction/types/main';
5
- import { ViewStateSnapshot } from './view/types/internal';
6
- import { ViewState, ViewStateInitOptions } from './view/types/main';
1
+ import { PositionInput } from './board/types/input.js';
2
+ import { BoardState, BoardStateSnapshot } from './board/types/main.js';
3
+ import type { ChangeState, ChangeStateSnapshot } from './change/types.js';
4
+ import { InteractionState, InteractionStateInitOptions, InteractionStateSnapshot } from './interaction/types/main.js';
5
+ import { ViewStateSnapshot } from './view/types/internal.js';
6
+ import { ViewState, ViewStateInitOptions } from './view/types/main.js';
7
7
  export interface RuntimeStateInternal {
8
8
  readonly board: BoardState;
9
9
  readonly view: ViewState;
@@ -1,2 +1,2 @@
1
- import { ViewState, ViewStateInitOptions } from './types/main';
1
+ import { ViewState, ViewStateInitOptions } from './types/main.js';
2
2
  export declare function createViewState(options: ViewStateInitOptions): ViewState;
@@ -1,6 +1,6 @@
1
1
  import { cloneDeep } from 'es-toolkit/object';
2
- import { normalizeColor } from '../board/normalize';
3
- import { viewSetOrientation } from './reducers';
2
+ import { normalizeColor } from '../board/normalize.js';
3
+ import { viewSetOrientation } from './reducers.js';
4
4
  function createViewStateInternal(opts) {
5
5
  const orientation = opts.orientation ? normalizeColor(opts.orientation) : 0 /* ColorCode.White */;
6
6
  return {
@@ -1,4 +1,4 @@
1
- import type { MutationSession } from '../../mutation/types';
1
+ import type { MutationSession } from '../../mutation/types.js';
2
2
  export type ViewStateMutationPayloadByCause = {
3
3
  'state.view.setOrientation': undefined;
4
4
  };
@@ -1,3 +1,3 @@
1
- import { ColorCode } from '../board/types/internal';
2
- import type { ViewStateInternal } from './types/internal';
1
+ import { ColorCode } from '../board/types/internal.js';
2
+ import type { ViewStateInternal } from './types/internal.js';
3
3
  export declare function viewSetOrientation(state: ViewStateInternal, orientation: ColorCode): boolean;
@@ -1,5 +1,5 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import { ColorCode } from '../../board/types/internal';
2
+ import { ColorCode } from '../../board/types/internal.js';
3
3
  export interface ViewStateInternal {
4
4
  orientation: ColorCode;
5
5
  }
@@ -1,7 +1,7 @@
1
- import { ColorInput } from '../../board/types/input';
2
- import { ColorCode } from '../../board/types/internal';
3
- import { ViewStateMutationSession } from '../mutation';
4
- import { ViewStateSnapshot } from './internal';
1
+ import { ColorInput } from '../../board/types/input.js';
2
+ import { ColorCode } from '../../board/types/internal.js';
3
+ import { ViewStateMutationSession } from '../mutation.js';
4
+ import { ViewStateSnapshot } from './internal.js';
5
5
  export interface ViewStateInitOptions {
6
6
  orientation?: ColorInput;
7
7
  }
@@ -1,3 +1,3 @@
1
- import { DefaultBuiltinChessboardExtensions } from '../extensions/types/wrapper';
2
- import { Chessboard, ChessboardExtensionInput, ChessboardInitOptions } from './types';
1
+ import { DefaultBuiltinChessboardExtensions } from '../extensions/types/wrapper.js';
2
+ import { Chessboard, ChessboardExtensionInput, ChessboardInitOptions } from './types.js';
3
3
  export declare function createBoard<TExtensions extends readonly ChessboardExtensionInput[] = DefaultBuiltinChessboardExtensions>(options: ChessboardInitOptions<TExtensions>): Chessboard<TExtensions>;
@@ -1,11 +1,11 @@
1
- import { createActiveTarget } from '../extensions/first-party/active-target/factory';
2
- import { createBoardEvents } from '../extensions/first-party/board-events/factory';
3
- import { createLastMove } from '../extensions/first-party/last-move/factory';
4
- import { createLegalMoves } from '../extensions/first-party/legal-moves/factory';
5
- import { createMainRenderer } from '../extensions/first-party/main-renderer/factory';
6
- import { createSelectedSquare } from '../extensions/first-party/selected-square/factory';
7
- import { DefaultBuiltinChessboardExtensions } from '../extensions/types/wrapper';
8
- import { createRuntime } from '../runtime/factory/main';
1
+ import { createActiveTarget } from '../extensions/first-party/active-target/factory.js';
2
+ import { createBoardEvents } from '../extensions/first-party/board-events/factory.js';
3
+ import { createLastMove } from '../extensions/first-party/last-move/factory.js';
4
+ import { createLegalMoves } from '../extensions/first-party/legal-moves/factory.js';
5
+ import { createMainRenderer } from '../extensions/first-party/main-renderer/factory.js';
6
+ import { createSelectedSquare } from '../extensions/first-party/selected-square/factory.js';
7
+ import { DefaultBuiltinChessboardExtensions } from '../extensions/types/wrapper.js';
8
+ import { createRuntime } from '../runtime/factory/main.js';
9
9
  function createBuiltInExtensionDefinition(id) {
10
10
  switch (id) {
11
11
  case 'mainRenderer':
@@ -1,7 +1,7 @@
1
- import type { AnyExtensionDefinition, ExtensionDefinitionId, ExtensionDefinitionPublicApi } from '../extensions/types/extension';
2
- import { BuiltInExtensionDefinitionMap, BuiltInExtensionId, DefaultBuiltinChessboardExtensions } from '../extensions/types/wrapper';
3
- import { Runtime } from '../runtime/types/main';
4
- import { RuntimeStateInitOptions } from '../state/types';
1
+ import type { AnyExtensionDefinition, ExtensionDefinitionId, ExtensionDefinitionPublicApi } from '../extensions/types/extension.js';
2
+ import { BuiltInExtensionDefinitionMap, BuiltInExtensionId, DefaultBuiltinChessboardExtensions } from '../extensions/types/wrapper.js';
3
+ import { Runtime } from '../runtime/types/main.js';
4
+ import { RuntimeStateInitOptions } from '../state/types.js';
5
5
  /**
6
6
  * What createBoard accepts in options.extensions
7
7
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mirasen/chessboard",
3
3
  "description": "Mirasen Chessboard — open-source chessboard UI library.",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Mirasen",