@johnmorrisdotca/kumimoji 1.2.2 → 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.
Files changed (83) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/CONTRIBUTING.md +11 -2
  3. package/README.md +80 -39
  4. package/dist/check.d.ts +26 -1
  5. package/dist/check.js +30 -3
  6. package/dist/computer.types.d.ts +24 -2
  7. package/dist/computerPlay.d.ts +45 -2
  8. package/dist/computerPlay.js +56 -6
  9. package/dist/computerTurn.d.ts +42 -3
  10. package/dist/computerTurn.js +47 -5
  11. package/dist/daily.d.ts +22 -2
  12. package/dist/daily.js +23 -3
  13. package/dist/element-define.d.ts +1 -1
  14. package/dist/element-define.js +3 -13
  15. package/dist/element.d.ts +85 -4
  16. package/dist/element.js +359 -77
  17. package/dist/embed-day.d.ts +4 -0
  18. package/dist/embed-day.js +23 -0
  19. package/dist/export.d.ts +123 -6
  20. package/dist/export.js +109 -9
  21. package/dist/generate.d.ts +14 -0
  22. package/dist/generate.js +32 -5
  23. package/dist/grid.d.ts +181 -10
  24. package/dist/grid.js +148 -11
  25. package/dist/help.d.ts +36 -3
  26. package/dist/help.js +36 -3
  27. package/dist/index.d.ts +22 -22
  28. package/dist/index.js +22 -22
  29. package/dist/judge.d.ts +14 -0
  30. package/dist/judge.js +14 -0
  31. package/dist/kana.d.ts +23 -1
  32. package/dist/kana.js +62 -7
  33. package/dist/kumimoji.types.d.ts +70 -5
  34. package/dist/party.d.ts +268 -14
  35. package/dist/party.js +296 -19
  36. package/dist/party.types.d.ts +50 -2
  37. package/dist/partyKept.d.ts +74 -4
  38. package/dist/partyKept.js +127 -12
  39. package/dist/partySeats.d.ts +92 -6
  40. package/dist/partySeats.js +83 -8
  41. package/dist/partyTurns.d.ts +171 -5
  42. package/dist/partyTurns.js +187 -8
  43. package/dist/placement.d.ts +50 -2
  44. package/dist/placement.js +35 -2
  45. package/dist/play.d.ts +247 -15
  46. package/dist/play.js +251 -18
  47. package/dist/random.d.ts +34 -3
  48. package/dist/random.js +23 -2
  49. package/dist/react.d.ts +42 -4
  50. package/dist/react.js +54 -7
  51. package/dist/showcase.d.ts +83 -7
  52. package/dist/showcase.js +61 -7
  53. package/dist/strings.d.ts +54 -5
  54. package/dist/strings.js +34 -3
  55. package/dist/tableView.d.ts +151 -8
  56. package/dist/tableView.js +129 -6
  57. package/dist/tileFace.d.ts +59 -5
  58. package/dist/tileFace.js +48 -4
  59. package/dist/tileFamily.d.ts +9 -0
  60. package/dist/tileFamily.js +9 -0
  61. package/dist/tileWords.d.ts +93 -6
  62. package/dist/tileWords.js +94 -12
  63. package/dist/tileWordsModule.d.ts +12 -2
  64. package/dist/tileWordsModule.js +14 -2
  65. package/dist/tiles.constants.d.ts +99 -5
  66. package/dist/tiles.constants.js +171 -13
  67. package/dist/turn.d.ts +82 -4
  68. package/dist/turn.js +88 -5
  69. package/dist/ui/board.d.ts +60 -5
  70. package/dist/ui/board.js +44 -4
  71. package/dist/ui/draw.d.ts +62 -0
  72. package/dist/ui/draw.js +229 -0
  73. package/dist/ui/mount.d.ts +41 -2
  74. package/dist/ui/mount.js +190 -265
  75. package/dist/ui/style.d.ts +6 -1
  76. package/dist/ui/style.js +6 -0
  77. package/dist/ui.d.ts +3 -3
  78. package/dist/ui.js +2 -2
  79. package/dist/version.d.ts +9 -2
  80. package/dist/version.js +9 -2
  81. package/dist/wilds.d.ts +22 -1
  82. package/dist/wilds.js +25 -3
  83. package/package.json +68 -61
package/dist/ui.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * (`mountKumimoji`), and the window a board shows the grid through
4
4
  * (`boardModel`). Its own entry, so the rules never carry a stylesheet.
5
5
  */
6
- export { mountKumimoji, type KumimojiTableHandle, type KumimojiTableOptions } from "./ui/mount.ts";
7
- export { BOARD_LEAST, BOARD_MARGIN, boardModel, type BoardModel, type BoardSquare, type TileMark } from "./ui/board.ts";
6
+ export { KUMIMOJI_STRINGS, type KumimojiLocale, type KumimojiStrings, kumimojiSay, kumimojiStrings, } from "./strings.ts";
7
+ export { BOARD_LEAST, BOARD_MARGIN, type BoardModel, type BoardSquare, boardModel, type TileMark } from "./ui/board.ts";
8
+ export { type KumimojiTableHandle, type KumimojiTableOptions, mountKumimoji } from "./ui/mount.ts";
8
9
  export { KUMIMOJI_STYLE } from "./ui/style.ts";
9
- export { KUMIMOJI_STRINGS, kumimojiSay, kumimojiStrings, type KumimojiLocale, type KumimojiStrings } from "./strings.ts";
package/dist/ui.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * (`mountKumimoji`), and the window a board shows the grid through
4
4
  * (`boardModel`). Its own entry, so the rules never carry a stylesheet.
5
5
  */
6
- export { mountKumimoji } from "./ui/mount.js";
6
+ export { KUMIMOJI_STRINGS, kumimojiSay, kumimojiStrings, } from "./strings.js";
7
7
  export { BOARD_LEAST, BOARD_MARGIN, boardModel } from "./ui/board.js";
8
+ export { mountKumimoji } from "./ui/mount.js";
8
9
  export { KUMIMOJI_STYLE } from "./ui/style.js";
9
- export { KUMIMOJI_STRINGS, kumimojiSay, kumimojiStrings } from "./strings.js";
package/dist/version.d.ts CHANGED
@@ -1,2 +1,9 @@
1
- /** The version of this package, as `package.json` has it. A test holds the two together. */
2
- export declare const KUMIMOJI_VERSION = "1.2.2";
1
+ /** The version of this package, as `package.json` has it. A test holds the two together.
2
+ *
3
+ * @example
4
+ * ```ts
5
+ * import { KUMIMOJI_VERSION } from "@johnmorrisdotca/kumimoji";
6
+ * console.log(KUMIMOJI_VERSION);
7
+ * ```
8
+ */
9
+ export declare const KUMIMOJI_VERSION = "1.3.1";
package/dist/version.js CHANGED
@@ -1,2 +1,9 @@
1
- /** The version of this package, as `package.json` has it. A test holds the two together. */
2
- export const KUMIMOJI_VERSION = "1.2.2";
1
+ /** The version of this package, as `package.json` has it. A test holds the two together.
2
+ *
3
+ * @example
4
+ * ```ts
5
+ * import { KUMIMOJI_VERSION } from "@johnmorrisdotca/kumimoji";
6
+ * console.log(KUMIMOJI_VERSION);
7
+ * ```
8
+ */
9
+ export const KUMIMOJI_VERSION = "1.3.1";
package/dist/wilds.d.ts CHANGED
@@ -21,7 +21,28 @@ import type { TileWords } from "./tileWords.ts";
21
21
  * table names the run as the player spelled it. It gives up, answering null,
22
22
  * past `WILD_SEARCH_MOST` steps: a grid it could not settle is not called
23
23
  * sound.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { WILD_SEARCH_MOST } from "@johnmorrisdotca/kumimoji";
28
+ * console.log(WILD_SEARCH_MOST);
29
+ * ```
24
30
  */
25
31
  export declare const WILD_SEARCH_MOST = 20000;
26
- /** The grid with every blank wild read as a letter that makes all its runs words, or null for none; the grid itself when it holds no blank. */
32
+ /** The grid with every blank wild read as a letter that makes all its runs words, or null for none; the grid itself when it holds no blank.
33
+ *
34
+ * @param tiles - The map from row,column square names to internal tile codes.
35
+ * @param words - The loaded native language word list and tile mappings.
36
+ * @param rules - Whether diagonal runs are also judged.
37
+ * @returns The grid with every blank wild read as a letter that makes all its runs words, or null for none; the grid itself when it holds no blank.
38
+ * @example
39
+ * ```ts
40
+ * import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";
41
+ * import { readWilds } from "@johnmorrisdotca/kumimoji";
42
+ *
43
+ * const words = await loadTileWordsFromModule("english");
44
+ * const tiles = new Map([["0,0","c"],["0,1","a"],["0,2","t"]]);
45
+ * console.log(readWilds(tiles,words));
46
+ * ```
47
+ */
27
48
  export declare function readWilds(tiles: Tiles, words: TileWords, rules?: GridRules): Tiles | null;
package/dist/wilds.js CHANGED
@@ -20,9 +20,30 @@ import { runsOf } from "./grid.js";
20
20
  * table names the run as the player spelled it. It gives up, answering null,
21
21
  * past `WILD_SEARCH_MOST` steps: a grid it could not settle is not called
22
22
  * sound.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { WILD_SEARCH_MOST } from "@johnmorrisdotca/kumimoji";
27
+ * console.log(WILD_SEARCH_MOST);
28
+ * ```
29
+ */
30
+ export const WILD_SEARCH_MOST = 20_000;
31
+ /** The grid with every blank wild read as a letter that makes all its runs words, or null for none; the grid itself when it holds no blank.
32
+ *
33
+ * @param tiles - The map from row,column square names to internal tile codes.
34
+ * @param words - The loaded native language word list and tile mappings.
35
+ * @param rules - Whether diagonal runs are also judged.
36
+ * @returns The grid with every blank wild read as a letter that makes all its runs words, or null for none; the grid itself when it holds no blank.
37
+ * @example
38
+ * ```ts
39
+ * import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";
40
+ * import { readWilds } from "@johnmorrisdotca/kumimoji";
41
+ *
42
+ * const words = await loadTileWordsFromModule("english");
43
+ * const tiles = new Map([["0,0","c"],["0,1","a"],["0,2","t"]]);
44
+ * console.log(readWilds(tiles,words));
45
+ * ```
23
46
  */
24
- export const WILD_SEARCH_MOST = 20000;
25
- /** The grid with every blank wild read as a letter that makes all its runs words, or null for none; the grid itself when it holds no blank. */
26
47
  export function readWilds(tiles, words, rules = {}) {
27
48
  const blanks = [...tiles].filter(([, tile]) => tile === "*").map(([square]) => square);
28
49
  if (blanks.length === 0)
@@ -103,7 +124,8 @@ function patternFits(words) {
103
124
  return already;
104
125
  const found = (words.byLength.get(sounds.length) ?? []).some((word) => {
105
126
  const letters = [...word];
106
- return letters.length === sounds.length && sounds.every((sound, at) => sound === null || words.soundOf(letters[at]) === sound);
127
+ return (letters.length === sounds.length &&
128
+ sounds.every((sound, at) => sound === null || words.soundOf(letters[at]) === sound));
107
129
  });
108
130
  known.set(key, found);
109
131
  return found;
package/package.json CHANGED
@@ -1,73 +1,74 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/kumimoji",
3
- "version": "1.2.2",
4
- "description": "Crossword tile race: each player builds a crossword from a bag of letter tiles, in English or Japanese kana, alone against the clock or at a table of two to eight. Seeded deals, a computer player and a playable table. Zero dependencies.",
3
+ "version": "1.3.1",
4
+ "description": "Kumimoji 組み文字 — Crossword tile game in English and Japanese: seeded bags, solo races, two-to-eight-player tables, word lists and a playable table for React, Vue, Svelte, Angular or plain HTML. Zero dependencies.",
5
5
  "keywords": [
6
- "word-game",
7
- "custom-element",
8
- "web-component",
9
- "word-puzzle",
10
- "crossword",
11
- "crossword-game",
12
- "crossword-builder",
13
- "tile-game",
14
- "letter-tiles",
15
- "tiles",
16
- "word-tiles",
6
+ "ai",
17
7
  "anagram",
18
8
  "anagrams",
19
- "word-race",
20
- "spelling",
21
- "vocabulary",
9
+ "angular",
10
+ "blank-tiles",
11
+ "bot",
12
+ "browser-game",
13
+ "computer-player",
14
+ "crossword",
15
+ "crossword-builder",
16
+ "crossword-game",
17
+ "custom-element",
18
+ "dark-mode",
19
+ "deterministic",
22
20
  "dictionary",
23
- "word-list",
24
- "word-check",
25
- "word-validation",
21
+ "dom",
26
22
  "english",
27
- "japanese",
28
- "kana",
29
- "hiragana",
30
- "nihongo",
31
- "language-learning",
32
- "scowl",
33
- "jmdict",
34
- "wild-tiles",
35
- "blank-tiles",
23
+ "esm",
24
+ "export",
36
25
  "game",
37
26
  "game-engine",
38
- "rules-engine",
39
27
  "game-logic",
40
- "puzzle",
41
- "puzzle-generator",
42
- "seeded",
43
- "deterministic",
44
- "prng",
45
- "ai",
46
- "computer-player",
47
- "bot",
48
- "multiplayer",
49
- "pass-and-play",
28
+ "hiragana",
50
29
  "hotseat",
51
- "party-game",
52
- "save-game",
53
- "json",
54
- "export",
55
- "import",
56
- "browser-game",
57
30
  "html5-game",
58
- "typescript",
31
+ "i18n",
32
+ "import",
33
+ "japanese",
59
34
  "javascript",
60
- "esm",
35
+ "jmdict",
36
+ "json",
37
+ "kana",
38
+ "language-learning",
39
+ "letter-tiles",
40
+ "multiplayer",
41
+ "nihongo",
42
+ "party-game",
43
+ "pass-and-play",
44
+ "prng",
45
+ "puzzle",
46
+ "puzzle-generator",
61
47
  "react",
62
48
  "react-component",
63
- "vue",
49
+ "rules-engine",
50
+ "save-game",
51
+ "scowl",
52
+ "scrabble-like",
53
+ "seeded",
54
+ "spelling",
64
55
  "svelte",
65
- "angular",
66
- "vanilla-js",
67
- "dom",
68
- "i18n",
69
56
  "theming",
70
- "dark-mode",
57
+ "tile-game",
58
+ "tiles",
59
+ "typescript",
60
+ "vanilla-js",
61
+ "vocabulary",
62
+ "vue",
63
+ "web-component",
64
+ "wild-tiles",
65
+ "word-check",
66
+ "word-game",
67
+ "word-list",
68
+ "word-puzzle",
69
+ "word-race",
70
+ "word-tiles",
71
+ "word-validation",
71
72
  "zero-dependencies"
72
73
  ],
73
74
  "homepage": "https://johnmorrisdotca.github.io/kumimoji/",
@@ -134,19 +135,25 @@
134
135
  },
135
136
  "scripts": {
136
137
  "build": "tsc -p tsconfig.json",
137
- "lint": "eslint .",
138
+ "lint": "biome check .",
138
139
  "typecheck": "tsc -p tsconfig.json --noEmit",
139
140
  "test": "vitest run",
140
- "test:table": "pnpm site && playwright test",
141
+ "test:table": "pnpm test:demo",
141
142
  "test:package": "pnpm build && node scripts/check-package.mjs",
142
143
  "family:readme": "node scripts/family-readme.mjs",
143
144
  "test:frameworks": "pnpm build && node scripts/check-frameworks.mjs",
144
- "check": "pnpm lint && pnpm typecheck && pnpm test",
145
+ "check:size": "node scripts/check-size.mjs",
146
+ "check": "pnpm lint && pnpm typecheck && pnpm test && pnpm check:size",
145
147
  "site": "pnpm build && node scripts/site.mjs",
146
148
  "docs:make": "node scripts/docs.mjs",
147
149
  "prepublishOnly": "pnpm check && pnpm build",
148
150
  "screenshots:readme": "pnpm site && node scripts/readme-pictures.mjs",
149
- "test:readme": "pnpm build && node scripts/check-readme-examples.mjs"
151
+ "test:readme": "pnpm build && node scripts/check-readme-examples.mjs",
152
+ "docs:site": "pnpm build && node scripts/docs-site.mjs build",
153
+ "docs:check": "pnpm build && node scripts/docs-site.mjs check",
154
+ "size": "node scripts/docs-site.mjs size",
155
+ "test:demo": "pnpm site && node scripts/docs-site.mjs build && playwright test",
156
+ "format": "biome check --write ."
150
157
  },
151
158
  "peerDependencies": {
152
159
  "react": ">=18"
@@ -157,16 +164,16 @@
157
164
  }
158
165
  },
159
166
  "devDependencies": {
160
- "@eslint/js": "^9.0.0",
167
+ "@biomejs/biome": "2.6.4",
161
168
  "@playwright/test": "^1.63.0",
162
169
  "@types/node": "^24.0.0",
163
170
  "@types/react": "^19.0.0",
164
- "eslint": "^9.0.0",
171
+ "esbuild": "^0.28.0",
165
172
  "eslint-plugin-react-hooks": "^5.0.0",
166
- "globals": "^16.0.0",
173
+ "marked": "^18.0.0",
174
+ "pagefind": "^1.5.2",
167
175
  "react": "^19.0.0",
168
176
  "typescript": "^5.9.0",
169
- "typescript-eslint": "^8.0.0",
170
177
  "vitest": "^5.0.0"
171
178
  },
172
179
  "publishConfig": {