@dxos/plugin-chess 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.13.0
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/PLUGIN.mdl +23 -20
- package/dist/lib/Chess.mjs +4 -5
- package/dist/lib/Chess.mjs.map +1 -1
- package/dist/lib/ChessOperation.mjs.map +1 -1
- package/dist/lib/ChessOperationHandlerSet.mjs.map +1 -1
- package/dist/lib/ChessPositionIndex.mjs +2 -3
- package/dist/lib/ChessPositionIndex.mjs.map +1 -1
- package/dist/lib/ChessSkill.mjs.map +1 -1
- package/dist/lib/PlayerReview.mjs +4 -5
- package/dist/lib/PlayerReview.mjs.map +1 -1
- package/dist/lib/capabilities.browser.mjs +32 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +7 -5
- package/dist/lib/capabilities.mjs.map +1 -1
- package/dist/lib/capabilities.node.mjs +5 -1
- package/dist/lib/capabilities.node.mjs.map +1 -1
- package/dist/lib/capabilities.tauri.mjs +32 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs.map +1 -1
- package/dist/lib/chunk-ChessArticle.mjs +22 -22
- package/dist/lib/chunk-ChessArticle.mjs.map +1 -1
- package/dist/lib/chunk-ChessCard.mjs +2 -3
- package/dist/lib/chunk-ChessCard.mjs.map +1 -1
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +1 -1
- package/dist/lib/chunk-rebuild-position-index.mjs.map +1 -1
- package/dist/lib/chunk-skill-definition.mjs +1 -1
- package/dist/lib/components.mjs +32 -15
- package/dist/lib/components.mjs.map +1 -1
- package/dist/lib/containers.mjs.map +1 -1
- package/dist/lib/index.mjs +2 -1
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/translations.mjs.map +1 -1
- package/dist/types/src/capabilities/gen/browser.d.ts +8 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/gen/tauri.d.ts +8 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Chessboard.d.ts +3 -3
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Info.d.ts +4 -4
- package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/index.d.ts +1 -1
- package/dist/types/src/components/Chessboard/index.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/types.d.ts +1 -1
- package/dist/types/src/components/Chessboard/types.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/index.d.ts +1 -1
- package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChessCard/index.d.ts +1 -1
- package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/ChessOperationHandlerSet.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/skills/ChessSkill.d.ts.map +1 -1
- package/dist/types/src/skills/index.d.ts +1 -1
- package/dist/types/src/skills/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/src/types/ChessOperation.d.ts +1 -1
- package/dist/types/src/types/ChessOperation.d.ts.map +1 -1
- package/dist/types/src/types/ChessPositionIndex.d.ts.map +1 -1
- package/dist/types/src/types/PlayerReview.d.ts +1 -1
- package/dist/types/src/types/PlayerReview.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +5 -5
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -30
- package/src/capabilities/gen/browser.ts +43 -0
- package/src/capabilities/gen/node.ts +4 -4
- package/src/capabilities/gen/tauri.ts +43 -0
- package/src/capabilities/gen/workerd.ts +2 -2
- package/src/capabilities/index.ts +6 -6
- package/src/components/Chessboard/Chessboard.stories.tsx +2 -2
- package/src/components/Chessboard/Chessboard.tsx +4 -4
- package/src/components/Chessboard/Info.tsx +27 -18
- package/src/components/Chessboard/index.ts +1 -1
- package/src/components/Chessboard/types.ts +1 -1
- package/src/components/index.ts +1 -1
- package/src/containers/ChessArticle/ChessArticle.stories.tsx +1 -1
- package/src/containers/ChessArticle/ChessArticle.tsx +28 -21
- package/src/containers/ChessArticle/index.ts +1 -1
- package/src/containers/ChessCard/ChessCard.stories.tsx +1 -1
- package/src/containers/ChessCard/ChessCard.tsx +8 -3
- package/src/containers/ChessCard/index.ts +1 -1
- package/src/containers/index.ts +2 -2
- package/src/index.ts +3 -2
- package/src/meta.ts +1 -1
- package/src/operations/ChessOperationHandlerSet.ts +6 -4
- package/src/operations/index.ts +1 -1
- package/src/operations/rebuild-position-index.test.ts +1 -1
- package/src/operations/rebuild-position-index.ts +1 -1
- package/src/plugin.test.ts +5 -5
- package/src/skills/ChessSkill.ts +2 -0
- package/src/skills/index.ts +1 -1
- package/src/translations.ts +2 -2
- package/src/types/Chess.ts +2 -8
- package/src/types/ChessOperation.ts +2 -2
- package/src/types/ChessPositionIndex.ts +2 -3
- package/src/types/PlayerReview.ts +6 -6
- package/src/types/index.ts +5 -5
package/PLUGIN.mdl
CHANGED
|
@@ -15,11 +15,11 @@ Each extension is defined in the Appendix or resolved via its URI.
|
|
|
15
15
|
|-------------|--------------------------------|
|
|
16
16
|
| `type` | `org.dxos.mdl.type@1.0` |
|
|
17
17
|
| `feat` | `org.dxos.mdl.feat@1.0` |
|
|
18
|
-
| `
|
|
18
|
+
| `scenario` | `org.dxos.mdl.scenario@1.0` |
|
|
19
19
|
| `component` | `org.dxos.mdl.component@1.0` |
|
|
20
20
|
| `op` | `org.dxos.mdl.op@1.1` |
|
|
21
21
|
| `service` | `org.dxos.mdl.service@1.0` |
|
|
22
|
-
| `
|
|
22
|
+
| `test` | `org.dxos.mdl.test@1.0` |
|
|
23
23
|
| `step` | `org.dxos.mdl.step@1.0` |
|
|
24
24
|
|
|
25
25
|
## Types
|
|
@@ -389,7 +389,7 @@ feat F-6: Game Persistence
|
|
|
389
389
|
## Acceptance
|
|
390
390
|
|
|
391
391
|
```mdl
|
|
392
|
-
|
|
392
|
+
scenario T-1: New game starting position
|
|
393
393
|
given: a new game is started
|
|
394
394
|
then:
|
|
395
395
|
- Board.turn === white
|
|
@@ -398,14 +398,14 @@ test T-1: New game starting position
|
|
|
398
398
|
```
|
|
399
399
|
|
|
400
400
|
```mdl
|
|
401
|
-
|
|
401
|
+
scenario T-2: Illegal move rejected
|
|
402
402
|
given: it is white's turn
|
|
403
403
|
when: white attempts to move a black piece
|
|
404
404
|
then: WrongTurn error; Board unchanged
|
|
405
405
|
```
|
|
406
406
|
|
|
407
407
|
```mdl
|
|
408
|
-
|
|
408
|
+
scenario T-3: Create and join game
|
|
409
409
|
given: two players are in the Lobby
|
|
410
410
|
when: player A creates a game, player B joins it
|
|
411
411
|
then:
|
|
@@ -416,7 +416,7 @@ test T-3: Create and join game
|
|
|
416
416
|
```
|
|
417
417
|
|
|
418
418
|
```mdl
|
|
419
|
-
|
|
419
|
+
scenario T-4: Legal move highlight
|
|
420
420
|
given: Gameboard is shown, it is white's turn
|
|
421
421
|
when: white selects the e2 pawn
|
|
422
422
|
then:
|
|
@@ -425,7 +425,7 @@ test T-4: Legal move highlight
|
|
|
425
425
|
```
|
|
426
426
|
|
|
427
427
|
```mdl
|
|
428
|
-
|
|
428
|
+
scenario T-5: Pawn promotion
|
|
429
429
|
given: white pawn is on e7, it is white's turn
|
|
430
430
|
when: white moves pawn to e8
|
|
431
431
|
then:
|
|
@@ -435,7 +435,7 @@ test T-5: Pawn promotion
|
|
|
435
435
|
```
|
|
436
436
|
|
|
437
437
|
```mdl
|
|
438
|
-
|
|
438
|
+
scenario T-6: Submit valid move
|
|
439
439
|
given: active game, white's turn, white player logged in
|
|
440
440
|
when: white submits pawn e2→e4
|
|
441
441
|
then:
|
|
@@ -446,7 +446,7 @@ test T-6: Submit valid move
|
|
|
446
446
|
```
|
|
447
447
|
|
|
448
448
|
```mdl
|
|
449
|
-
|
|
449
|
+
scenario T-7: Submit invalid move rejected atomically
|
|
450
450
|
given: active game, white's turn
|
|
451
451
|
when: white submits an illegal move (e2→e5)
|
|
452
452
|
then:
|
|
@@ -456,7 +456,7 @@ test T-7: Submit invalid move rejected atomically
|
|
|
456
456
|
```
|
|
457
457
|
|
|
458
458
|
```mdl
|
|
459
|
-
|
|
459
|
+
scenario T-8: Legal moves highlighted
|
|
460
460
|
given: new game, white's turn, Gameboard shown
|
|
461
461
|
when: player selects e2
|
|
462
462
|
then:
|
|
@@ -467,11 +467,11 @@ test T-8: Legal moves highlighted
|
|
|
467
467
|
|
|
468
468
|
## QA
|
|
469
469
|
|
|
470
|
-
Executable
|
|
471
|
-
invocable operation, an agent binding (`invoke`). Report failures by
|
|
470
|
+
Executable tests. Each step carries a human instruction (`do`) and, where the step maps to an
|
|
471
|
+
invocable operation, an agent binding (`invoke`). Report failures by test and step number.
|
|
472
472
|
|
|
473
473
|
```mdl
|
|
474
|
-
|
|
474
|
+
test QA-1: Start a game and play the opening
|
|
475
475
|
desc: The core chess round-trip — create a game, play the first few moves, read the position back.
|
|
476
476
|
actors: human
|
|
477
477
|
covers: [F-1.1, F-2.1]
|
|
@@ -483,14 +483,17 @@ flow QA-1: Start a game and play the opening
|
|
|
483
483
|
- plugin-chess is enabled — it is OFF by default, and no chess operation is registered until
|
|
484
484
|
it is on. Enabling is a UI action (Settings -> plugin registry); `manager.enable()` returns
|
|
485
485
|
without error from the debug port and does not enable it.
|
|
486
|
-
- no game named "QA Game" exists — ABORT rather than deleting one this
|
|
487
|
-
|
|
486
|
+
- no game named "QA Game" exists — ABORT rather than deleting one this test did not create
|
|
487
|
+
- game: the Game object the human creates in step 1 (named "QA Game"), resolved by the runner
|
|
488
|
+
after that step so later steps can reference it — there is no create operation to `capture`
|
|
489
|
+
it from
|
|
490
|
+
steps:
|
|
488
491
|
- name: Create the game
|
|
489
492
|
do: In the navtree, click + on a collection and choose Chess. Name it "QA Game".
|
|
490
493
|
expect: a Game appears under the collection with pieces in their starting positions, white to move
|
|
491
494
|
note: |
|
|
492
495
|
NO `invoke` — [op:startGame] has no runtime counterpart (see its note), so this step is
|
|
493
|
-
human-only and the
|
|
496
|
+
human-only and the test is `actors: human` until chess gains a create operation. That is
|
|
494
497
|
the finding, not an omission.
|
|
495
498
|
- name: Play 1. e4
|
|
496
499
|
do: Drag the e2 pawn to e4.
|
|
@@ -536,7 +539,7 @@ the core `ext` primitive — the only construct the base language provides.
|
|
|
536
539
|
|
|
537
540
|
```mdl
|
|
538
541
|
ext type
|
|
539
|
-
uri: dxos.
|
|
542
|
+
uri: org.dxos.mdl.type@1.0
|
|
540
543
|
desc: A named data structure with typed fields and optional literals.
|
|
541
544
|
fields:
|
|
542
545
|
desc?: Prose
|
|
@@ -547,7 +550,7 @@ ext type
|
|
|
547
550
|
|
|
548
551
|
```mdl
|
|
549
552
|
ext feat
|
|
550
|
-
uri: dxos.
|
|
553
|
+
uri: org.dxos.mdl.feat@1.0
|
|
551
554
|
desc: A named feature grouping one or more requirements.
|
|
552
555
|
fields:
|
|
553
556
|
desc?: Prose
|
|
@@ -556,8 +559,8 @@ ext feat
|
|
|
556
559
|
```
|
|
557
560
|
|
|
558
561
|
```mdl
|
|
559
|
-
ext
|
|
560
|
-
uri: dxos.
|
|
562
|
+
ext scenario
|
|
563
|
+
uri: org.dxos.mdl.scenario@1.0
|
|
561
564
|
desc: An acceptance scenario expressed as given / when / then steps.
|
|
562
565
|
fields:
|
|
563
566
|
given?: Step | Step[]
|
package/dist/lib/Chess.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import * as Skill from "@dxos/compute/Skill";
|
|
|
3
3
|
import { Annotation, DXN, Obj, Type } from "@dxos/echo";
|
|
4
4
|
import { Chess } from "chess.js";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
|
-
import { FormInputAnnotation, HiddenAnnotation } from "@dxos/echo/Annotation";
|
|
7
6
|
import { log } from "@dxos/log";
|
|
8
7
|
//#region src/types/Chess.ts
|
|
9
8
|
var Chess_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -18,12 +17,12 @@ var SKILL_KEY = "org.dxos.skill.chess";
|
|
|
18
17
|
* Players, name, and other game-shared fields live on the base `Game`.
|
|
19
18
|
*/
|
|
20
19
|
var State = class extends Type.makeObject(DXN.make("org.dxos.type.chess.state", "0.1.0"))(Schema.Struct({
|
|
21
|
-
pgn: Schema.String.annotate({ description: "Portable Game Notation." }).pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
22
|
-
fen: Schema.String.annotate({ description: "Forsyth-Edwards Notation." }).pipe(FormInputAnnotation.set(false), Schema.optional)
|
|
20
|
+
pgn: Schema.String.annotate({ description: "Portable Game Notation." }).pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),
|
|
21
|
+
fen: Schema.String.annotate({ description: "Forsyth-Edwards Notation." }).pipe(Annotation.FormInputAnnotation.set(false), Schema.optional)
|
|
23
22
|
}).pipe(Annotation.IconAnnotation.set({
|
|
24
23
|
icon: "ph--shield-chevron--regular",
|
|
25
24
|
hue: "amber"
|
|
26
|
-
}), Skill.SkillsAnnotation.set([SKILL_KEY])
|
|
25
|
+
}), Skill.SkillsAnnotation.set([SKILL_KEY]))) {};
|
|
27
26
|
var make = ({ pgn, fen } = {}) => {
|
|
28
27
|
const chess = new Chess();
|
|
29
28
|
if (pgn) try {
|
|
@@ -32,7 +31,7 @@ var make = ({ pgn, fen } = {}) => {
|
|
|
32
31
|
log.warn(pgn, void 0, {
|
|
33
32
|
"~LogMeta": "~LogMeta",
|
|
34
33
|
F: __dxlog_file,
|
|
35
|
-
L:
|
|
34
|
+
L: 38,
|
|
36
35
|
S: void 0
|
|
37
36
|
});
|
|
38
37
|
}
|
package/dist/lib/Chess.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chess.mjs","names":[],"sources":["../../src/types/Chess.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Schema from 'effect/Schema';\n\nimport * as Skill from '@dxos/compute/Skill';\nimport { Annotation, DXN, Obj, Type } from '@dxos/echo';\nimport {
|
|
1
|
+
{"version":3,"file":"Chess.mjs","names":[],"sources":["../../src/types/Chess.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Schema from 'effect/Schema';\n\nimport * as Skill from '@dxos/compute/Skill';\nimport { Annotation, DXN, Obj, Type } from '@dxos/echo';\nimport { log } from '@dxos/log';\n\nexport const SKILL_KEY = 'org.dxos.skill.chess';\n\n/**\n * Chess variant state. Referenced by the base `Game` object via `Game.variant`.\n * Players, name, and other game-shared fields live on the base `Game`.\n */\nexport class State extends Type.makeObject<State>(DXN.make('org.dxos.type.chess.state', '0.1.0'))(\n Schema.Struct({\n pgn: Schema.String.annotate({\n description: 'Portable Game Notation.',\n }).pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),\n fen: Schema.String.annotate({\n description: 'Forsyth-Edwards Notation.',\n }).pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),\n }).pipe(\n Annotation.IconAnnotation.set({ icon: 'ph--shield-chevron--regular', hue: 'amber' }),\n Skill.SkillsAnnotation.set([SKILL_KEY]),\n ),\n) {}\n\nexport const make = ({ pgn, fen }: { pgn?: string; fen?: string } = {}): State => {\n const chess = new ChessJS();\n if (pgn) {\n try {\n chess.loadPgn(pgn);\n } catch {\n log.warn(pgn);\n }\n }\n\n return Obj.make(State, {\n pgn,\n fen,\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAa,YAAY;;;;;AAMzB,IAAa,QAAb,cAA2B,KAAK,WAAkB,IAAI,KAAK,6BAA6B,OAAO,CAAC,CAAC,CAC/F,OAAO,OAAO;CACZ,KAAK,OAAO,OAAO,SAAS,EAC1B,aAAa,0BACf,CAAC,CAAC,CAAC,KAAK,WAAW,oBAAoB,IAAI,KAAK,GAAG,OAAO,QAAQ;CAClE,KAAK,OAAO,OAAO,SAAS,EAC1B,aAAa,4BACf,CAAC,CAAC,CAAC,KAAK,WAAW,oBAAoB,IAAI,KAAK,GAAG,OAAO,QAAQ;AACpE,CAAC,CAAC,CAAC,KACD,WAAW,eAAe,IAAI;CAAE,MAAM;CAA+B,KAAK;AAAQ,CAAC,GACnF,MAAM,iBAAiB,IAAI,CAAC,SAAS,CAAC,CACxC,CACF,CAAC,CAAC,CAAC;AAEH,IAAa,QAAQ,EAAE,KAAK,QAAwC,CAAC,MAAa;CAChF,MAAM,QAAQ,IAAI,MAAQ;CAC1B,IAAI,KACF,IAAI;EACF,MAAM,QAAQ,GAAG;CACnB,QAAQ;EACN,IAAI,KAAK,KAAE,KAAA,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;EAAA,CAAC;CACd;CAGF,OAAO,IAAI,KAAK,OAAO;EACrB;EACA;CACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChessOperation.mjs","names":[],"sources":["../../src/types/ChessOperation.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database, DXN, Ref } from '@dxos/echo';\nimport * as Game from '@dxos/plugin-game/Game';\n\nimport * as Chess from './Chess';\nimport * as PlayerReview from './PlayerReview';\n\nexport const Move = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.chess.move'),\n name: 'Move',\n description: 'Makes a move in the given chess game.',\n icon: 'ph--play--regular',\n },\n input: Schema.Struct({\n game: Game.GameRef(Chess.State).annotate({\n description: 'The ID of the game object (variant must be Chess).',\n }),\n move: Schema.String.annotate({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotate({\n description: 'The PGN of the game after the move was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Play = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.chess.play'),\n name: 'Play',\n description: 'Uses the chess engine to play the next move.',\n icon: 'ph--play--regular',\n },\n input: Schema.Struct({\n game: Game.GameRef(Chess.State).annotate({\n description: 'The ID of the game object (variant must be Chess).',\n }),\n side: Schema.optional(Schema.Literals(['white', 'black', 'any'])).annotate({\n description: 'The side to play.',\n defaultValue: 'any',\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotate({\n description: 'The PGN of the game after the move was played.',\n }),\n move: Schema.optional(Schema.String).annotate({\n description: 'The move that was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Print = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.chess.print'),\n name: 'Print game',\n description: 'Prints the chess game to ASCII.',\n icon: 'ph--clipboard-text--regular',\n },\n input: Schema.Struct({\n pgn: Schema.optional(\n Schema.String.annotate({\n description: 'Portable Game Notation.',\n }),\n ),\n fen: Schema.optional(\n Schema.String.annotate({\n description: 'Forsyth-Edwards Notation.',\n }),\n ),\n }),\n output: Schema.Struct({\n ascii: Schema.String,\n }),\n});\n\n/** Rebuilds a player review position index from all chess games in the space. */\nexport const RebuildPositionIndex = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.chess.rebuildPositionIndex'),\n name: 'Rebuild Position Index',\n description: 'Scans chess games and updates the player review position index.',\n icon: 'ph--arrows-clockwise--regular',\n },\n services: [Database.Service],\n input: Schema.Struct({\n review: Ref.Ref(PlayerReview.Review).annotate({\n description: 'Player review whose position index should be rebuilt.',\n }),\n }),\n output: Schema.Struct({\n gamesScanned: Schema.Number,\n positionsUpdated: Schema.Number,\n }),\n}).pipe(Operation.visible);\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAa,OAAO,UAAU,KAAK;CACjC,MAAM;EACJ,KAAK,IAAI,KAAK,+BAA+B;EAC7C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,MAAM,KAAK,QAAQ,KAAW,CAAC,CAAC,SAAS,EACvC,aAAa,qDACf,CAAC;EACD,MAAM,OAAO,OAAO,SAAS;GAC3B,aAAa;GACb,UAAU,CAAC,MAAM,KAAK;EACxB,CAAC;CACH,CAAC;CACD,QAAQ,OAAO,OAAO,EACpB,KAAK,OAAO,OAAO,SAAS,EAC1B,aAAa,iDACf,CAAC,EACH,CAAC;CACD,UAAU,CAAC,SAAS,OAAO;AAC7B,CAAC;AAED,IAAa,OAAO,UAAU,KAAK;CACjC,MAAM;EACJ,KAAK,IAAI,KAAK,+BAA+B;EAC7C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,MAAM,KAAK,QAAQ,KAAW,CAAC,CAAC,SAAS,EACvC,aAAa,qDACf,CAAC;EACD,MAAM,OAAO,SAAS,OAAO,SAAS;GAAC;GAAS;GAAS;EAAK,CAAC,CAAC,CAAC,CAAC,SAAS;GACzE,aAAa;GACb,cAAc;EAChB,CAAC;CACH,CAAC;CACD,QAAQ,OAAO,OAAO;EACpB,KAAK,OAAO,OAAO,SAAS,EAC1B,aAAa,iDACf,CAAC;EACD,MAAM,OAAO,SAAS,OAAO,MAAM,CAAC,CAAC,SAAS,EAC5C,aAAa,4BACf,CAAC;CACH,CAAC;CACD,UAAU,CAAC,SAAS,OAAO;AAC7B,CAAC;AAED,IAAa,QAAQ,UAAU,KAAK;CAClC,MAAM;EACJ,KAAK,IAAI,KAAK,gCAAgC;EAC9C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,KAAK,OAAO,SACV,OAAO,OAAO,SAAS,EACrB,aAAa,0BACf,CAAC,CACH;EACA,KAAK,OAAO,SACV,OAAO,OAAO,SAAS,EACrB,aAAa,4BACf,CAAC,CACH;CACF,CAAC;CACD,QAAQ,OAAO,OAAO,EACpB,OAAO,OAAO,OAChB,CAAC;AACH,CAAC;;AAGD,IAAa,uBAAuB,UAAU,KAAK;CACjD,MAAM;EACJ,KAAK,IAAI,KAAK,+CAA+C;EAC7D,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,UAAU,CAAC,SAAS,OAAO;CAC3B,OAAO,OAAO,OAAO,EACnB,QAAQ,IAAI,IAAI,MAAmB,CAAC,CAAC,SAAS,EAC5C,aAAa,wDACf,CAAC,EACH,CAAC;CACD,QAAQ,OAAO,OAAO;EACpB,cAAc,OAAO;EACrB,kBAAkB,OAAO;CAC3B,CAAC;AACH,CAAC,CAAC,CAAC,KAAK,UAAU,OAAO"}
|
|
1
|
+
{"version":3,"file":"ChessOperation.mjs","names":[],"sources":["../../src/types/ChessOperation.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database, DXN, Ref } from '@dxos/echo';\nimport * as Game from '@dxos/plugin-game/Game';\n\nimport * as Chess from './Chess.ts';\nimport * as PlayerReview from './PlayerReview.ts';\n\nexport const Move = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.chess.move'),\n name: 'Move',\n description: 'Makes a move in the given chess game.',\n icon: 'ph--play--regular',\n },\n input: Schema.Struct({\n game: Game.GameRef(Chess.State).annotate({\n description: 'The ID of the game object (variant must be Chess).',\n }),\n move: Schema.String.annotate({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotate({\n description: 'The PGN of the game after the move was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Play = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.chess.play'),\n name: 'Play',\n description: 'Uses the chess engine to play the next move.',\n icon: 'ph--play--regular',\n },\n input: Schema.Struct({\n game: Game.GameRef(Chess.State).annotate({\n description: 'The ID of the game object (variant must be Chess).',\n }),\n side: Schema.optional(Schema.Literals(['white', 'black', 'any'])).annotate({\n description: 'The side to play.',\n defaultValue: 'any',\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotate({\n description: 'The PGN of the game after the move was played.',\n }),\n move: Schema.optional(Schema.String).annotate({\n description: 'The move that was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Print = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.chess.print'),\n name: 'Print game',\n description: 'Prints the chess game to ASCII.',\n icon: 'ph--clipboard-text--regular',\n },\n input: Schema.Struct({\n pgn: Schema.optional(\n Schema.String.annotate({\n description: 'Portable Game Notation.',\n }),\n ),\n fen: Schema.optional(\n Schema.String.annotate({\n description: 'Forsyth-Edwards Notation.',\n }),\n ),\n }),\n output: Schema.Struct({\n ascii: Schema.String,\n }),\n});\n\n/** Rebuilds a player review position index from all chess games in the space. */\nexport const RebuildPositionIndex = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.chess.rebuildPositionIndex'),\n name: 'Rebuild Position Index',\n description: 'Scans chess games and updates the player review position index.',\n icon: 'ph--arrows-clockwise--regular',\n },\n services: [Database.Service],\n input: Schema.Struct({\n review: Ref.Ref(PlayerReview.Review).annotate({\n description: 'Player review whose position index should be rebuilt.',\n }),\n }),\n output: Schema.Struct({\n gamesScanned: Schema.Number,\n positionsUpdated: Schema.Number,\n }),\n}).pipe(Operation.visible);\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAa,OAAO,UAAU,KAAK;CACjC,MAAM;EACJ,KAAK,IAAI,KAAK,+BAA+B;EAC7C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,MAAM,KAAK,QAAQ,KAAW,CAAC,CAAC,SAAS,EACvC,aAAa,qDACf,CAAC;EACD,MAAM,OAAO,OAAO,SAAS;GAC3B,aAAa;GACb,UAAU,CAAC,MAAM,KAAK;EACxB,CAAC;CACH,CAAC;CACD,QAAQ,OAAO,OAAO,EACpB,KAAK,OAAO,OAAO,SAAS,EAC1B,aAAa,iDACf,CAAC,EACH,CAAC;CACD,UAAU,CAAC,SAAS,OAAO;AAC7B,CAAC;AAED,IAAa,OAAO,UAAU,KAAK;CACjC,MAAM;EACJ,KAAK,IAAI,KAAK,+BAA+B;EAC7C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,MAAM,KAAK,QAAQ,KAAW,CAAC,CAAC,SAAS,EACvC,aAAa,qDACf,CAAC;EACD,MAAM,OAAO,SAAS,OAAO,SAAS;GAAC;GAAS;GAAS;EAAK,CAAC,CAAC,CAAC,CAAC,SAAS;GACzE,aAAa;GACb,cAAc;EAChB,CAAC;CACH,CAAC;CACD,QAAQ,OAAO,OAAO;EACpB,KAAK,OAAO,OAAO,SAAS,EAC1B,aAAa,iDACf,CAAC;EACD,MAAM,OAAO,SAAS,OAAO,MAAM,CAAC,CAAC,SAAS,EAC5C,aAAa,4BACf,CAAC;CACH,CAAC;CACD,UAAU,CAAC,SAAS,OAAO;AAC7B,CAAC;AAED,IAAa,QAAQ,UAAU,KAAK;CAClC,MAAM;EACJ,KAAK,IAAI,KAAK,gCAAgC;EAC9C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,KAAK,OAAO,SACV,OAAO,OAAO,SAAS,EACrB,aAAa,0BACf,CAAC,CACH;EACA,KAAK,OAAO,SACV,OAAO,OAAO,SAAS,EACrB,aAAa,4BACf,CAAC,CACH;CACF,CAAC;CACD,QAAQ,OAAO,OAAO,EACpB,OAAO,OAAO,OAChB,CAAC;AACH,CAAC;;AAGD,IAAa,uBAAuB,UAAU,KAAK;CACjD,MAAM;EACJ,KAAK,IAAI,KAAK,+CAA+C;EAC7D,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,UAAU,CAAC,SAAS,OAAO;CAC3B,OAAO,OAAO,OAAO,EACnB,QAAQ,IAAI,IAAI,MAAmB,CAAC,CAAC,SAAS,EAC5C,aAAa,wDACf,CAAC,EACH,CAAC;CACD,QAAQ,OAAO,OAAO;EACpB,cAAc,OAAO;EACrB,kBAAkB,OAAO;CAC3B,CAAC;AACH,CAAC,CAAC,CAAC,KAAK,UAAU,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChessOperationHandlerSet.mjs","names":[],"sources":["../../src/operations/ChessOperationHandlerSet.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Operation from '@dxos/compute/Operation';\nimport * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';\n\nimport { ChessOperation } from '#types';\n\nexport const handlers = OperationHandlerSet.lazy([\n ChessOperation.Move.pipe(Operation.lazyHandler(() => import('./move'))),\n ChessOperation.Play.pipe(Operation.lazyHandler(() => import('./play'))),\n ChessOperation.Print.pipe(Operation.lazyHandler(() => import('./print'))),\n ChessOperation.RebuildPositionIndex.pipe(Operation.lazyHandler(() => import('./rebuild-position-index'))),\n]);\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ChessOperationHandlerSet.mjs","names":[],"sources":["../../src/operations/ChessOperationHandlerSet.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Operation from '@dxos/compute/Operation';\nimport * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';\n\nimport { ChessOperation } from '#types';\n\nexport const handlers = OperationHandlerSet.lazy([\n ChessOperation.Move.pipe(Operation.lazyHandler(() => import('./move.ts'))),\n ChessOperation.Play.pipe(Operation.lazyHandler(() => import('./play.ts'))),\n ChessOperation.Print.pipe(Operation.lazyHandler(() => import('./print.ts'))),\n ChessOperation.RebuildPositionIndex.pipe(Operation.lazyHandler(() => import('./rebuild-position-index.ts'))),\n]);\n"],"mappings":";;;;;;AAWA,IAAa,WAAW,oBAAoB,KAAK;CAC/C,eAAe,KAAK,KAAK,UAAU,kBAAkB,OAAO,mBAAY,CAAC;CACzE,eAAe,KAAK,KAAK,UAAU,kBAAkB,OAAO,mBAAY,CAAC;CACzE,eAAe,MAAM,KAAK,UAAU,kBAAkB,OAAO,oBAAa,CAAC;CAC3E,eAAe,qBAAqB,KAAK,UAAU,kBAAkB,OAAO,qCAA8B,CAAC;AAC7G,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
|
|
2
2
|
import { Annotation, DXN, Obj, Ref, Type } from "@dxos/echo";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
|
-
import { FormInputAnnotation } from "@dxos/echo/Annotation";
|
|
5
4
|
import * as Game from "@dxos/plugin-game/Game";
|
|
6
5
|
//#region src/types/ChessPositionIndex.ts
|
|
7
6
|
var ChessPositionIndex_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -15,7 +14,7 @@ var ChessPositionIndex_exports = /* @__PURE__ */ __exportAll({
|
|
|
15
14
|
/** Side the reviewed player may play in indexed games. */
|
|
16
15
|
var Side = Schema.Literals(["white", "black"]);
|
|
17
16
|
/** Games that reached a normalized FEN while the reviewed player was on this side. */
|
|
18
|
-
var PositionEntry = Schema.Struct({ games: Schema.mutable(Schema.Array(Ref.Ref(Game.Game))).pipe(FormInputAnnotation.set(false)) });
|
|
17
|
+
var PositionEntry = Schema.Struct({ games: Schema.mutable(Schema.Array(Ref.Ref(Game.Game))).pipe(Annotation.FormInputAnnotation.set(false)) });
|
|
19
18
|
/** FEN-keyed lookup of {@link PositionEntry} for one side. */
|
|
20
19
|
var SideIndex = Schema.Record(Schema.String, PositionEntry);
|
|
21
20
|
/** Per-side position reach counts for a player review. */
|
|
@@ -27,7 +26,7 @@ var Index = Schema.Struct({
|
|
|
27
26
|
* Aggregated chess positions reached by a player across indexed games.
|
|
28
27
|
* Stored as a child of {@link PlayerReview}.
|
|
29
28
|
*/
|
|
30
|
-
var PositionIndex = class extends Type.makeObject(DXN.make("org.dxos.type.chess.positionIndex", "0.1.0"))(Schema.Struct({ index: Index.pipe(FormInputAnnotation.set(false)) }).pipe(Annotation.IconAnnotation.set({
|
|
29
|
+
var PositionIndex = class extends Type.makeObject(DXN.make("org.dxos.type.chess.positionIndex", "0.1.0"))(Schema.Struct({ index: Index.pipe(Annotation.FormInputAnnotation.set(false)) }).pipe(Annotation.IconAnnotation.set({
|
|
31
30
|
icon: "ph--map-trifold--regular",
|
|
32
31
|
hue: "amber"
|
|
33
32
|
}))) {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChessPositionIndex.mjs","names":[],"sources":["../../src/types/ChessPositionIndex.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport
|
|
1
|
+
{"version":3,"file":"ChessPositionIndex.mjs","names":[],"sources":["../../src/types/ChessPositionIndex.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport * as Game from '@dxos/plugin-game/Game';\n\n/** Side the reviewed player may play in indexed games. */\nexport const Side = Schema.Literals(['white', 'black']);\nexport type Side = Schema.Schema.Type<typeof Side>;\n\n/** Games that reached a normalized FEN while the reviewed player was on this side. */\nexport const PositionEntry = Schema.Struct({\n games: Schema.mutable(Schema.Array(Ref.Ref(Game.Game))).pipe(Annotation.FormInputAnnotation.set(false)),\n});\n\nexport type PositionEntry = Schema.Schema.Type<typeof PositionEntry>;\n\n/** FEN-keyed lookup of {@link PositionEntry} for one side. */\nexport const SideIndex = Schema.Record(Schema.String, PositionEntry);\n\nexport type SideIndex = Schema.Schema.Type<typeof SideIndex>;\n\n/** Per-side position reach counts for a player review. */\nexport const Index = Schema.Struct({\n white: SideIndex,\n black: SideIndex,\n});\n\nexport type Index = Schema.Schema.Type<typeof Index>;\n\n/**\n * Aggregated chess positions reached by a player across indexed games.\n * Stored as a child of {@link PlayerReview}.\n */\nexport class PositionIndex extends Type.makeObject<PositionIndex>(\n DXN.make('org.dxos.type.chess.positionIndex', '0.1.0'),\n)(\n Schema.Struct({\n index: Index.pipe(Annotation.FormInputAnnotation.set(false)),\n }).pipe(Annotation.IconAnnotation.set({ icon: 'ph--map-trifold--regular', hue: 'amber' })),\n) {}\n\n/** Creates an empty position index. */\nexport const make = (): PositionIndex =>\n Obj.make(PositionIndex, {\n index: { white: {}, black: {} },\n });\n"],"mappings":";;;;;;;;;;;;;;AAYA,IAAa,OAAO,OAAO,SAAS,CAAC,SAAS,OAAO,CAAC;;AAItD,IAAa,gBAAgB,OAAO,OAAO,EACzC,OAAO,OAAO,QAAQ,OAAO,MAAM,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,WAAW,oBAAoB,IAAI,KAAK,CAAC,EACxG,CAAC;;AAKD,IAAa,YAAY,OAAO,OAAO,OAAO,QAAQ,aAAa;;AAKnE,IAAa,QAAQ,OAAO,OAAO;CACjC,OAAO;CACP,OAAO;AACT,CAAC;;;;;AAQD,IAAa,gBAAb,cAAmC,KAAK,WACtC,IAAI,KAAK,qCAAqC,OAAO,CACvD,CAAC,CACC,OAAO,OAAO,EACZ,OAAO,MAAM,KAAK,WAAW,oBAAoB,IAAI,KAAK,CAAC,EAC7D,CAAC,CAAC,CAAC,KAAK,WAAW,eAAe,IAAI;CAAE,MAAM;CAA4B,KAAK;AAAQ,CAAC,CAAC,CAC3F,CAAC,CAAC,CAAC;;AAGH,IAAa,aACX,IAAI,KAAK,eAAe,EACtB,OAAO;CAAE,OAAO,CAAC;CAAG,OAAO,CAAC;AAAE,EAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChessSkill.mjs","names":[],"sources":["../../src/skills/ChessSkill.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Skill from '@dxos/compute/Skill';\nimport * as Template from '@dxos/compute/Template';\nimport { trim } from '@dxos/util';\n\nimport { Chess, ChessOperation } from '#types';\n\nconst operations = [ChessOperation.Move, ChessOperation.Play, ChessOperation.Print];\n\nexport const key = Chess.SKILL_KEY;\n\nexport const make = (): Skill.Skill =>\n Skill.make({\n key: Chess.SKILL_KEY,\n name: 'Chess',\n tools: Skill.toolDefinitions({ operations }),\n instructions: Template.make({\n source: trim`\n You are an expert chess player.\n To analyze a game you can access the \"pgn\" property by loading the context object that represents the current game.\n You could suggest a good next move or offer to play a move.\n Don't actually make a move unless you are asked to.\n\n When setting a chess position, always set the \"pgn\" field (move list in standard PGN notation) on the org.dxos.type.chess.state object.\n The \"fen\" field is not used by the UI for display — the board is driven exclusively from \"pgn\".\n Setting \"fen\" alone or leaving \"pgn\" empty will result in the initial position being shown.\n `,\n }),\n });\n"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ChessSkill.mjs","names":[],"sources":["../../src/skills/ChessSkill.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Skill from '@dxos/compute/Skill';\nimport * as Template from '@dxos/compute/Template';\nimport { trim } from '@dxos/util';\n\nimport { Chess, ChessOperation } from '#types';\n\nconst operations = [ChessOperation.Move, ChessOperation.Play, ChessOperation.Print];\n\nexport const key = Chess.SKILL_KEY;\n\nexport const make = (): Skill.Skill =>\n Skill.make({\n key: Chess.SKILL_KEY,\n name: 'Chess',\n tools: Skill.toolDefinitions({ operations }),\n instructions: Template.make({\n source: trim`\n You are an expert chess player.\n To analyze a game you can access the \"pgn\" property by loading the context object that represents the current game.\n You could suggest a good next move or offer to play a move.\n Don't actually make a move unless you are asked to.\n\n When setting a chess position, always set the \"pgn\" field (move list in standard PGN notation) on the org.dxos.type.chess.state object.\n The \"fen\" field is not used by the UI for display — the board is driven exclusively from \"pgn\".\n Setting \"fen\" alone or leaving \"pgn\" empty will result in the initial position being shown.\n `,\n }),\n });\n"],"mappings":";;;;;;;;;;AAYA,IAAM,aAAa;CAAC,eAAe;CAAM,eAAe;CAAM,eAAe;AAAK;AAElF,IAAa,MAAM,MAAM;AAEzB,IAAa,aACX,MAAM,KAAK;CACT,KAAK,MAAM;CACX,MAAM;CACN,OAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC;CAC3C,cAAc,SAAS,KAAK,EAC1B,QAAQ,IAAI;;;;;;;;;QAUd,CAAC;AACH,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
|
|
|
2
2
|
import { PositionIndex, make } from "./ChessPositionIndex.mjs";
|
|
3
3
|
import { Annotation, DXN, Obj, Ref, Type } from "@dxos/echo";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
|
-
import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/Annotation";
|
|
6
5
|
//#region src/types/PlayerReview.ts
|
|
7
6
|
var PlayerReview_exports = /* @__PURE__ */ __exportAll({
|
|
8
7
|
Review: () => Review,
|
|
@@ -15,15 +14,15 @@ var PlayerReview_exports = /* @__PURE__ */ __exportAll({
|
|
|
15
14
|
var Review = class extends Type.makeObject(DXN.make("org.dxos.type.chess.playerReview", "0.1.0"))(Schema.Struct({
|
|
16
15
|
name: Schema.optional(Schema.String),
|
|
17
16
|
/** DID of the reviewed player; matched against {@link org.dxos.type.game} players. */
|
|
18
|
-
playerIdentity: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
17
|
+
playerIdentity: Schema.String.pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),
|
|
19
18
|
/** Display name fallback when identity is absent (e.g. Chess.com username). */
|
|
20
19
|
playerName: Schema.String.pipe(Schema.optional),
|
|
21
20
|
/** Owned index: `SetParent` cascades it with the review. */
|
|
22
|
-
positionIndex: Ref.Ref(PositionIndex).pipe(Annotation.SetParent.set(
|
|
23
|
-
}).pipe(LabelAnnotation.set(["name"]), Annotation.IconAnnotation.set({
|
|
21
|
+
positionIndex: Ref.Ref(PositionIndex).pipe(Annotation.SetParent.set(), Annotation.FormInputAnnotation.set(false))
|
|
22
|
+
}).pipe(Annotation.LabelAnnotation.set(["name"]), Annotation.IconAnnotation.set({
|
|
24
23
|
icon: "ph--chart-polar--regular",
|
|
25
24
|
hue: "amber"
|
|
26
|
-
}))) {};
|
|
25
|
+
}), Annotation.UserType.set())) {};
|
|
27
26
|
/** Creates a player review with an empty child position index. */
|
|
28
27
|
var makeReview = (props = {}) => {
|
|
29
28
|
const positionIndex = make();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerReview.mjs","names":[],"sources":["../../src/types/PlayerReview.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\
|
|
1
|
+
{"version":3,"file":"PlayerReview.mjs","names":[],"sources":["../../src/types/PlayerReview.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\n\nimport * as ChessPositionIndex from './ChessPositionIndex.ts';\n\n/**\n * Personal chess opening/position review for a single player.\n * Indexes all reachable positions (by side) across games in the space.\n */\nexport class Review extends Type.makeObject<Review>(DXN.make('org.dxos.type.chess.playerReview', '0.1.0'))(\n Schema.Struct({\n name: Schema.optional(Schema.String),\n /** DID of the reviewed player; matched against {@link org.dxos.type.game} players. */\n playerIdentity: Schema.String.pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),\n /** Display name fallback when identity is absent (e.g. Chess.com username). */\n playerName: Schema.String.pipe(Schema.optional),\n /** Owned index: `SetParent` cascades it with the review. */\n positionIndex: Ref.Ref(ChessPositionIndex.PositionIndex).pipe(\n Annotation.SetParent.set(),\n Annotation.FormInputAnnotation.set(false),\n ),\n }).pipe(\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--chart-polar--regular', hue: 'amber' }),\n Annotation.UserType.set(),\n ),\n) {}\n\nexport type MakeReviewProps = {\n name?: string;\n playerIdentity?: string;\n playerName?: string;\n};\n\n/** Creates a player review with an empty child position index. */\nexport const makeReview = (props: MakeReviewProps = {}): Review => {\n const positionIndex = ChessPositionIndex.make();\n return Obj.make(Review, {\n ...props,\n name: props.name ?? props.playerName ?? 'Player review',\n positionIndex: Ref.make(positionIndex),\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,IAAa,SAAb,cAA4B,KAAK,WAAmB,IAAI,KAAK,oCAAoC,OAAO,CAAC,CAAC,CACxG,OAAO,OAAO;CACZ,MAAM,OAAO,SAAS,OAAO,MAAM;;CAEnC,gBAAgB,OAAO,OAAO,KAAK,WAAW,oBAAoB,IAAI,KAAK,GAAG,OAAO,QAAQ;;CAE7F,YAAY,OAAO,OAAO,KAAK,OAAO,QAAQ;;CAE9C,eAAe,IAAI,IAAI,aAAgC,CAAC,CAAC,KACvD,WAAW,UAAU,IAAI,GACzB,WAAW,oBAAoB,IAAI,KAAK,CAC1C;AACF,CAAC,CAAC,CAAC,KACD,WAAW,gBAAgB,IAAI,CAAC,MAAM,CAAC,GACvC,WAAW,eAAe,IAAI;CAAE,MAAM;CAA4B,KAAK;AAAQ,CAAC,GAChF,WAAW,SAAS,IAAI,CAC1B,CACF,CAAC,CAAC,CAAC;;AASH,IAAa,cAAc,QAAyB,CAAC,MAAc;CACjE,MAAM,gBAAgB,KAAwB;CAC9C,OAAO,IAAI,KAAK,QAAQ;EACtB,GAAG;EACH,MAAM,MAAM,QAAQ,MAAM,cAAc;EACxC,eAAe,IAAI,KAAK,aAAa;CACvC,CAAC;AACH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as PLUGIN_default } from "./chunk-PLUGIN.mjs";
|
|
2
|
+
import * as ActivationEvents from "@dxos/app-framework/ActivationEvents";
|
|
3
|
+
import * as AppCapability from "@dxos/app-toolkit/AppCapability";
|
|
4
|
+
import { translations } from "#translations";
|
|
5
|
+
import * as Capability from "@dxos/app-framework/Capability";
|
|
6
|
+
import * as GameCapabilities from "@dxos/plugin-game/GameCapabilities";
|
|
7
|
+
import * as GameEvents from "@dxos/plugin-game/GameEvents";
|
|
8
|
+
import { meta } from "#meta";
|
|
9
|
+
//#region src/capabilities/gen/browser.ts
|
|
10
|
+
var Schema = AppCapability.schema(() => import("./chunk-schema.mjs"));
|
|
11
|
+
var SkillDefinition = AppCapability.skillDefinition(() => import("./chunk-skill-definition.mjs"), { environments: [
|
|
12
|
+
"browser",
|
|
13
|
+
"node",
|
|
14
|
+
"tauri"
|
|
15
|
+
] });
|
|
16
|
+
var GameVariant = Capability.lazyModule("GameVariant", {
|
|
17
|
+
provides: [GameCapabilities.VariantProvider],
|
|
18
|
+
activatesOn: GameEvents.Start,
|
|
19
|
+
environments: ["browser", "tauri"]
|
|
20
|
+
}, () => import("./chunk-game-variant.mjs"));
|
|
21
|
+
var OperationHandler = AppCapability.operationHandler(() => import("./chunk-operation-handler.mjs"), { activatesOn: ActivationEvents.Idle });
|
|
22
|
+
var PluginAsset = AppCapability.pluginAsset({
|
|
23
|
+
pluginId: meta.profile.key,
|
|
24
|
+
path: "PLUGIN.mdl",
|
|
25
|
+
content: PLUGIN_default,
|
|
26
|
+
mimeType: "application/x-mdl"
|
|
27
|
+
});
|
|
28
|
+
var Translations = AppCapability.translations(translations);
|
|
29
|
+
//#endregion
|
|
30
|
+
export { GameVariant, OperationHandler, PluginAsset, Schema, SkillDefinition, Translations };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=capabilities.browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.browser.mjs","names":[],"sources":["../../src/capabilities/gen/browser.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'browser' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\nimport * as GameCapabilities from '@dxos/plugin-game/GameCapabilities';\nimport * as GameEvents from '@dxos/plugin-game/GameEvents';\n\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\nimport pluginSpec from '../../../PLUGIN.mdl?raw';\n\nexport const Schema = AppCapability.schema(() => import('../schema.ts'));\n\nexport const SkillDefinition = AppCapability.skillDefinition(() => import('../skill-definition.ts'), {\n environments: ['browser', 'node', 'tauri'],\n});\n\n// Browser-only: the variant descriptor carries the `card`/`article` React components the game\n// host renders, so the module cannot load without a DOM.\nexport const GameVariant = Capability.lazyModule(\n 'GameVariant',\n { provides: [GameCapabilities.VariantProvider], activatesOn: GameEvents.Start, environments: ['browser', 'tauri'] },\n () => import('../game-variant.ts'),\n);\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler.ts'), {\n activatesOn: ActivationEvents.Idle,\n});\n\nexport const PluginAsset = AppCapability.pluginAsset({\n pluginId: meta.profile.key,\n path: 'PLUGIN.mdl',\n content: pluginSpec,\n mimeType: 'application/x-mdl',\n});\n\nexport const Translations = AppCapability.translations(translations);\n"],"mappings":";;;;;;;;;AAiBA,IAAa,SAAS,cAAc,aAAa,OAAO,qBAAe;AAEvE,IAAa,kBAAkB,cAAc,sBAAsB,OAAO,iCAA2B,EACnG,cAAc;CAAC;CAAW;CAAQ;AAAO,EAC3C,CAAC;AAID,IAAa,cAAc,WAAW,WACpC,eACA;CAAE,UAAU,CAAC,iBAAiB,eAAe;CAAG,aAAa,WAAW;CAAO,cAAc,CAAC,WAAW,OAAO;AAAE,SAC5G,OAAO,2BACf;AAEA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,kCAA4B,EACtG,aAAa,iBAAiB,KAChC,CAAC;AAED,IAAa,cAAc,cAAc,YAAY;CACnD,UAAU,KAAK,QAAQ;CACvB,MAAM;CACN,SAAS;CACT,UAAU;AACZ,CAAC;AAED,IAAa,eAAe,cAAc,aAAa,YAAY"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as PLUGIN_default } from "./chunk-PLUGIN.mjs";
|
|
1
2
|
import * as ActivationEvents from "@dxos/app-framework/ActivationEvents";
|
|
2
3
|
import * as AppCapability from "@dxos/app-toolkit/AppCapability";
|
|
3
4
|
import { translations } from "#translations";
|
|
@@ -5,16 +6,17 @@ import * as Capability from "@dxos/app-framework/Capability";
|
|
|
5
6
|
import * as GameCapabilities from "@dxos/plugin-game/GameCapabilities";
|
|
6
7
|
import * as GameEvents from "@dxos/plugin-game/GameEvents";
|
|
7
8
|
import { meta } from "#meta";
|
|
8
|
-
//#region PLUGIN.mdl?raw
|
|
9
|
-
var PLUGIN_default = "---\nid: org.dxos.plugin.chess\nname: ChessPlugin\nversion: 0.1.0\n---\n\nA two-player chess game plugin for `DXOS` Composer.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.1` |\n| `service` | `org.dxos.mdl.service@1.0` |\n| `flow` | `org.dxos.mdl.flow@1.0` |\n| `step` | `org.dxos.mdl.step@1.0` |\n\n## Types\n\n```mdl\ntype Color\n literals: white | black\n```\n\n```mdl\ntype PieceKind\n literals: pawn | rook | knight | bishop | queen | king\n```\n\n```mdl\ntype Piece\n fields:\n kind: PieceKind\n color: Color\n```\n\n```mdl\ntype Square\n fields:\n file: a | b | c | d | e | f | g | h\n rank: 1..8\n piece?: Piece\n```\n\n```mdl\ntype Move\n fields:\n from: Square\n to: Square\n promotion?: PieceKind # only valid for pawn reaching back rank\n```\n\n```mdl\ntype Board\n fields:\n squares: Square[8][8]\n turn: Color\n status: playing | check | checkmate | stalemate\n moves: Move[] # full move history\n```\n\n```mdl\ntype Player\n fields:\n id: string\n name: string\n color: Color\n```\n\n```mdl\ntype GameStatus\n literals: waiting | active | finished\n```\n\n```mdl\ntype Game\n fields:\n id: string\n players: Player[2]\n board: Board\n status: GameStatus\n winner?: Player\n```\n\n## Components\n\n```mdl\ncomponent Lobby\n desc: Entry point where players create or join a game.\n props:\n playerId: string\n state:\n games: Game[] # list of open/active games\n selected?: Game\n slots:\n header?: ReactNode\n empty?: ReactNode # shown when games list is empty\n actions:\n createGame() → Game\n joinGame(game: Game) → Game\n spectate(game: Game)\n emits:\n onJoin(game: Game)\n layout: |\n ┌─────────────────────────┐\n │ [header slot] │\n ├─────────────────────────┤\n │ Game list │\n │ ┌───────────────────┐ │\n │ │ game row │ │\n │ └───────────────────┘ │\n │ [empty slot] │\n ├─────────────────────────┤\n │ [Create Game] │\n └─────────────────────────┘\n```\n\n```mdl\ncomponent Gameboard\n desc: Interactive chess board for an active game.\n props:\n game: Game\n playerId: string # identifies which side the viewer plays\n state:\n selected?: Square # currently selected square\n highlights: Square[] # legal move targets for selected piece\n perspective: Color # which side is at the bottom (default: player's color)\n slots:\n toolbar?: ReactNode\n sidebar?: ReactNode\n overlay?: ReactNode # e.g. checkmate / promotion dialogs\n actions:\n selectSquare(square: Square)\n submitMove(move: Move)\n flipBoard()\n emits:\n onMove(move: Move)\n onResign()\n layout: |\n ┌─────────────────────────┐\n │ [toolbar slot] │\n ├──────────┬──────────────┤\n │ │ [sidebar] │\n │ 8×8 │ │\n │ board │ move history │\n │ │ │\n ├──────────┴──────────────┤\n │ [overlay slot] │\n └─────────────────────────┘\n```\n\n## Services\n\n```mdl\nservice ChessEngine\n desc: Validates moves and computes game state. May be local (WASM) or remote.\n loading: lazy\n ops:\n validate(board: Board, move: Move) → Move\n legalMoves(board: Board, square: Square) → Square[]\n applyMove(board: Board, move: Move) → Board\n errors:\n EngineNotReady: engine has not finished loading\n```\n\n```mdl\nservice GameStore\n desc: Persists and replicates Game state via ECHO.\n ops:\n create(white: Player, black: Player) → Game\n load(id: string) → Game\n save(game: Game) → Game\n list() → Game[]\n effects: [echo:write, echo:read]\n```\n\n## Operations\n\nPure operations (no effects, no service dependencies) — safe to call anywhere.\n\n```mdl\nop getLegalMoves\n desc: Returns legal target squares for the piece on the given square.\n input:\n board: Board\n square: Square\n output: Square[]\n errors:\n EmptySquare: no piece on square\n WrongSide: piece does not belong to the active side\n requires: [ChessEngine]\n```\n\n```mdl\nop validateMove\n desc: Checks a move against chess rules without mutating state.\n input:\n board: Board\n move: Move\n output: Move\n errors:\n IllegalMove: move violates chess rules\n WrongTurn: piece does not belong to the active side\n GameOver: game has already ended\n requires: [ChessEngine]\n```\n\n```mdl\nop applyMove\n desc: Applies a validated move and returns the next board state.\n input:\n board: Board\n move: Move # must be pre-validated\n output: Board\n requires: [ChessEngine]\n note: does not persist; use submitMove for the full transactional flow\n```\n\nEffectful operations — mutate persistent state.\n\n```mdl\nop startGame\n desc: Creates a new Game with two players and an initial Board.\n input:\n white: Player\n black: Player\n output: Game\n effects: [echo:write]\n requires: [GameStore]\n note: |\n NO `key` — this operation does not exist at runtime. A game is constructed with `Game.make`\n and placed with `space.addObject`; the UI route is the navtree's create action, which opens\n the generic object form. An agent therefore cannot start a game through an operation, which is\n what [QA-1] step 1 records.\n```\n\n```mdl\nop playEngineMove\n key: org.dxos.operation.chess.play\n desc: Uses the chess engine to play the next move for a side.\n input:\n game: Ref<Game>\n side?: white | black | any\n output: { pgn: string, move?: string }\n effects: [echo:write]\n requires: [Database.Service]\n```\n\n```mdl\nop submitMove\n key: org.dxos.operation.chess.move\n desc: Validates and applies a move, then persists the updated Game.\n input:\n game: Game\n player: Player\n move: Move\n output: Game\n errors:\n WrongTurn: player is not the active side\n IllegalMove: move violates chess rules\n GameOver: game has already ended\n effects: [echo:write]\n requires: [ChessEngine, GameStore]\n note: |\n Composes validateMove → applyMove → GameStore.save.\n Atomic: Game is not persisted if validation fails.\n```\n\n```mdl\nop resignGame\n desc: Player forfeits; opponent wins.\n input:\n game: Game\n player: Player\n output: Game # Game.status === finished, Game.winner set\n errors:\n GameOver: game has already ended\n effects: [echo:write]\n requires: [GameStore]\n```\n\n## Features\n\n```mdl\nfeat F-1: Start Game\n\n req F-1.1: New Board created with pieces in standard starting positions.\n req F-1.2: White moves first.\n```\n\n```mdl\nfeat F-2: Make Move\n\n req F-2.1:\n when: player submits a Move on their turn\n then: Move validated against chess rules\n errors: [InvalidMove, WrongTurn, GameOver]\n\n req F-2.2:\n when: Move is valid\n then: Board updated; turn advances to opponent\n\n req F-2.3:\n when: resulting position leaves opponent's king in check\n then: Board.status set to check\n\n req F-2.4:\n when: no legal moves remain for the side to move\n then: Board.status set to checkmate (if in check) or stalemate\n```\n\n```mdl\nfeat F-3: Lobby\n\n req F-3.1: Player sees list of open games on entering the Lobby.\n req F-3.2:\n when: player creates a game\n then: new Game created with status waiting; player assigned white\n\n req F-3.3:\n when: second player joins an open game\n then: Game.status transitions to active; joining player assigned black\n\n req F-3.4:\n when: Game.status becomes active\n then: both players navigated to Gameboard\n```\n\n```mdl\nfeat F-4: Gameboard\n\n req F-4.1:\n when: player selects a square containing their piece\n then: legal move targets highlighted on board\n\n req F-4.2:\n when: player selects a highlighted target square\n then: Move submitted via submitMove(); board updated on success\n\n req F-4.3:\n when: pawn reaches the back rank\n then: promotion dialog shown via overlay slot; player selects piece kind\n\n req F-4.4:\n when: Game.status is finished\n then: result overlay shown (winner or draw); further moves disabled\n```\n\n```mdl\nfeat F-5: Move Validation\n\n req F-5.1:\n when: Gameboard calls submitMove\n then: op:validateMove runs before any state change\n\n req F-5.2:\n when: validation fails\n then: error returned to caller; Game state unchanged\n\n req F-5.3:\n when: square is selected on Gameboard\n then: op:getLegalMoves called; results drive component:Gameboard.highlights\n```\n\n```mdl\nfeat F-6: Game Persistence\n\n req F-6.1:\n when: op:startGame completes\n then: Game written to ECHO and visible in component:Lobby game list\n\n req F-6.2:\n when: op:submitMove completes\n then: updated Game replicated to all peers via ECHO\n\n req F-6.3:\n when: peer receives a Game update\n then: component:Gameboard re-renders with new Board state\n tags: [collaborative]\n```\n\n## Acceptance\n\n```mdl\ntest T-1: New game starting position\n given: a new game is started\n then:\n - Board.turn === white\n - Board.status === playing\n - each player has 16 pieces in standard positions\n```\n\n```mdl\ntest T-2: Illegal move rejected\n given: it is white's turn\n when: white attempts to move a black piece\n then: WrongTurn error; Board unchanged\n```\n\n```mdl\ntest T-3: Create and join game\n given: two players are in the Lobby\n when: player A creates a game, player B joins it\n then:\n - Game.status === active\n - Game.players[0].color === white # creator\n - Game.players[1].color === black # joiner\n - both players see the Gameboard\n```\n\n```mdl\ntest T-4: Legal move highlight\n given: Gameboard is shown, it is white's turn\n when: white selects the e2 pawn\n then:\n - squares e3 and e4 are highlighted\n - no other squares are highlighted\n```\n\n```mdl\ntest T-5: Pawn promotion\n given: white pawn is on e7, it is white's turn\n when: white moves pawn to e8\n then:\n - promotion overlay appears\n - after player selects queen, Move recorded with promotion: queen\n - board shows white queen on e8\n```\n\n```mdl\ntest T-6: Submit valid move\n given: active game, white's turn, white player logged in\n when: white submits pawn e2→e4\n then:\n - op:validateMove returns move without error\n - Board updated: e4 occupied by white pawn, e2 empty\n - Game.board.turn === black\n - Game persisted to ECHO\n```\n\n```mdl\ntest T-7: Submit invalid move rejected atomically\n given: active game, white's turn\n when: white submits an illegal move (e2→e5)\n then:\n - IllegalMove error returned\n - Game.board unchanged\n - no ECHO write occurs\n```\n\n```mdl\ntest T-8: Legal moves highlighted\n given: new game, white's turn, Gameboard shown\n when: player selects e2\n then:\n - op:getLegalMoves returns [e3, e4]\n - Gameboard.highlights === [e3, e4]\n```\n\n\n## QA\n\nExecutable flows. Each step carries a human instruction (`do`) and, where the step maps to an\ninvocable operation, an agent binding (`invoke`). Report failures by flow and step number.\n\n```mdl\nflow QA-1: Start a game and play the opening\n desc: The core chess round-trip — create a game, play the first few moves, read the position back.\n actors: human\n covers: [F-1.1, F-2.1]\n status: passing # 2026-08-23; step 1 performed by a human (no create operation exists)\n given:\n - an identity exists\n - space: a space is open\n - collection: a collection in that space, to create into\n - plugin-chess is enabled — it is OFF by default, and no chess operation is registered until\n it is on. Enabling is a UI action (Settings -> plugin registry); `manager.enable()` returns\n without error from the debug port and does not enable it.\n - no game named \"QA Game\" exists — ABORT rather than deleting one this flow did not create\n test:\n - name: Create the game\n do: In the navtree, click + on a collection and choose Chess. Name it \"QA Game\".\n expect: a Game appears under the collection with pieces in their starting positions, white to move\n note: |\n NO `invoke` — [op:startGame] has no runtime counterpart (see its note), so this step is\n human-only and the flow is `actors: human` until chess gains a create operation. That is\n the finding, not an omission.\n - name: Play 1. e4\n do: Drag the e2 pawn to e4.\n invoke: [op:submitMove] { game: $given.game, move: \"e4\" }\n capture: afterE4\n expect: the pawn stands on e4, the move list reads \"1. e4\", and it is black's turn\n assert: return $result.pgn.includes('1. e4');\n - name: Play 1... e5\n do: Drag the black e7 pawn to e5.\n invoke: [op:submitMove] { game: $given.game, move: \"e5\" }\n expect: the move list reads \"1. e4 e5\" and it is white's turn again\n assert: return $result.pgn.includes('e5');\n - name: Play 2. Nf3\n do: Drag the g1 knight to f3.\n invoke: [op:submitMove] { game: $given.game, move: \"Nf3\" }\n expect: the knight stands on f3 and the move list reads \"1. e4 e5 2. Nf3\"\n assert: return $result.pgn.includes('Nf3');\n - name: Reject an illegal move\n do: Try to drag the a8 rook two squares up the a-file, onto a6 — its own pawn is in the way.\n invoke: [op:submitMove] { game: $given.game, move: \"Ra6\" }\n expect: the move is refused, the board is unchanged, and the game reports an invalid move\n assert: |\n // Passes when the invocation FAILS — an accepted illegal move is the defect.\n return /Invalid move/.test($error?.message ?? '');\n note: |\n SAN is side-relative, so the move in `do` and the move in `invoke` must denote the same one.\n This step first read \"drag the f3 knight to f6\" against `Nf6`, which after 1. e4 e5 2. Nf3 is\n BLACK's knight and perfectly legal (Petrov) — the human and agent paths described different\n moves and the step failed against a correct engine.\n after:\n - name: Delete the game\n do: Right-click \"QA Game\" in the navtree and choose Delete.\n invoke: org.dxos.operation.space.removeObjects { objects: [$given.game], target: $given.collection }\n expect: the row leaves the navtree and its plank closes\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive — the only construct the base language provides.\n\n```mdl\next type\n uri: dxos.spec/ext/type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap # name[?]: TypeExpr (# inline comment)\n literals?: UnionList # a | b | c\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: dxos.spec/ext/feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self # feat blocks may contain feat blocks\n```\n\n```mdl\next test\n uri: dxos.spec/ext/test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap # external inputs (immutable inside component)\n state?: FieldMap # internal reactive state\n slots?: FieldMap # named ReactNode injection points\n actions?: ActionMap # methods the component exposes or handles\n emits?: EventMap # events the component raises to its parent\n layout?: CodeBlock # ASCII sketch of visual structure (non-normative)\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap # named input parameters\n output?: TypeExpr # return type\n errors?: ErrorMap # name: Prose (when this error occurs)\n effects?: EffectList # echo:read | echo:write | http | fs | ...\n requires?: ServiceList # injected service dependencies\n note?: Prose # implementation guidance (non-normative)\n```\n\n```mdl\next service\n uri: org.dxos.mdl.service@1.0\n desc: An external or system-level dependency providing named operations.\n fields:\n desc?: Prose\n loading?: eager | lazy\n ops?: OpMap # name(params) → ReturnType\n errors?: ErrorMap\n note?: Prose\n```\n";
|
|
10
|
-
//#endregion
|
|
11
9
|
//#region src/capabilities/index.ts
|
|
12
10
|
var Schema = AppCapability.schema(() => import("./chunk-schema.mjs"));
|
|
13
|
-
var SkillDefinition = AppCapability.skillDefinition(() => import("./chunk-skill-definition.mjs"), { environments: [
|
|
11
|
+
var SkillDefinition = AppCapability.skillDefinition(() => import("./chunk-skill-definition.mjs"), { environments: [
|
|
12
|
+
"browser",
|
|
13
|
+
"node",
|
|
14
|
+
"tauri"
|
|
15
|
+
] });
|
|
14
16
|
var GameVariant = Capability.lazyModule("GameVariant", {
|
|
15
17
|
provides: [GameCapabilities.VariantProvider],
|
|
16
18
|
activatesOn: GameEvents.Start,
|
|
17
|
-
environments: []
|
|
19
|
+
environments: ["browser", "tauri"]
|
|
18
20
|
}, () => import("./chunk-game-variant.mjs"));
|
|
19
21
|
var OperationHandler = AppCapability.operationHandler(() => import("./chunk-operation-handler.mjs"), { activatesOn: ActivationEvents.Idle });
|
|
20
22
|
var PluginAsset = AppCapability.pluginAsset({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\nimport * as GameCapabilities from '@dxos/plugin-game/GameCapabilities';\nimport * as GameEvents from '@dxos/plugin-game/GameEvents';\n\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../../PLUGIN.mdl?raw';\n\nexport const Schema = AppCapability.schema(() => import('./schema'));\nexport const SkillDefinition = AppCapability.skillDefinition(() => import('./skill-definition'), {\n environments: ['node'],\n});\n// Browser-only: the variant descriptor carries the `card`/`article` React components the game\n// host renders, so the module cannot load without a DOM.\nexport const GameVariant = Capability.lazyModule(\n 'GameVariant',\n { provides: [GameCapabilities.VariantProvider], activatesOn: GameEvents.Start, environments: [] },\n () => import('./game-variant'),\n);\nexport const OperationHandler = AppCapability.operationHandler(() => import('./operation-handler'), {\n activatesOn: ActivationEvents.Idle,\n});\nexport const PluginAsset = AppCapability.pluginAsset({\n pluginId: meta.profile.key,\n path: 'PLUGIN.mdl',\n content: pluginSpec,\n mimeType: 'application/x-mdl',\n});\nexport const Translations = AppCapability.translations(translations);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\nimport * as GameCapabilities from '@dxos/plugin-game/GameCapabilities';\nimport * as GameEvents from '@dxos/plugin-game/GameEvents';\n\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../../PLUGIN.mdl?raw';\n\nexport const Schema = AppCapability.schema(() => import('./schema.ts'));\nexport const SkillDefinition = AppCapability.skillDefinition(() => import('./skill-definition.ts'), {\n environments: ['browser', 'node', 'tauri'],\n});\n// Browser-only: the variant descriptor carries the `card`/`article` React components the game\n// host renders, so the module cannot load without a DOM.\nexport const GameVariant = Capability.lazyModule(\n 'GameVariant',\n { provides: [GameCapabilities.VariantProvider], activatesOn: GameEvents.Start, environments: ['browser', 'tauri'] },\n () => import('./game-variant.ts'),\n);\nexport const OperationHandler = AppCapability.operationHandler(() => import('./operation-handler.ts'), {\n activatesOn: ActivationEvents.Idle,\n});\nexport const PluginAsset = AppCapability.pluginAsset({\n pluginId: meta.profile.key,\n path: 'PLUGIN.mdl',\n content: pluginSpec,\n mimeType: 'application/x-mdl',\n});\nexport const Translations = AppCapability.translations(translations);\n"],"mappings":";;;;;;;;;AAgBA,IAAa,SAAS,cAAc,aAAa,OAAO,qBAAc;AACtE,IAAa,kBAAkB,cAAc,sBAAsB,OAAO,iCAA0B,EAClG,cAAc;CAAC;CAAW;CAAQ;AAAO,EAC3C,CAAC;AAGD,IAAa,cAAc,WAAW,WACpC,eACA;CAAE,UAAU,CAAC,iBAAiB,eAAe;CAAG,aAAa,WAAW;CAAO,cAAc,CAAC,WAAW,OAAO;AAAE,SAC5G,OAAO,2BACf;AACA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,kCAA2B,EACrG,aAAa,iBAAiB,KAChC,CAAC;AACD,IAAa,cAAc,cAAc,YAAY;CACnD,UAAU,KAAK,QAAQ;CACvB,MAAM;CACN,SAAS;CACT,UAAU;AACZ,CAAC;AACD,IAAa,eAAe,cAAc,aAAa,YAAY"}
|
|
@@ -3,7 +3,11 @@ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
|
|
|
3
3
|
import { translations } from "#translations";
|
|
4
4
|
//#region src/capabilities/gen/node.ts
|
|
5
5
|
var Schema = AppCapability.schema(() => import("./chunk-schema.mjs"));
|
|
6
|
-
var SkillDefinition = AppCapability.skillDefinition(() => import("./chunk-skill-definition.mjs"), { environments: [
|
|
6
|
+
var SkillDefinition = AppCapability.skillDefinition(() => import("./chunk-skill-definition.mjs"), { environments: [
|
|
7
|
+
"browser",
|
|
8
|
+
"node",
|
|
9
|
+
"tauri"
|
|
10
|
+
] });
|
|
7
11
|
var OperationHandler = AppCapability.operationHandler(() => import("./chunk-operation-handler.mjs"), { activatesOn: ActivationEvents.Idle });
|
|
8
12
|
var Translations = AppCapability.translations(translations);
|
|
9
13
|
var GameVariant = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.node.mjs","names":[],"sources":["../../src/capabilities/gen/node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'node' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { translations } from '#translations';\n\nexport const Schema = AppCapability.schema(() => import('../schema'));\n\nexport const SkillDefinition = AppCapability.skillDefinition(() => import('../skill-definition'), {\n environments: ['node'],\n});\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler'), {\n activatesOn: ActivationEvents.Idle,\n});\n\nexport const Translations = AppCapability.translations(translations);\n\nexport const GameVariant = undefined;\nexport const PluginAsset = undefined;\n"],"mappings":";;;;AAWA,IAAa,SAAS,cAAc,aAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"capabilities.node.mjs","names":[],"sources":["../../src/capabilities/gen/node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'node' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { translations } from '#translations';\n\nexport const Schema = AppCapability.schema(() => import('../schema.ts'));\n\nexport const SkillDefinition = AppCapability.skillDefinition(() => import('../skill-definition.ts'), {\n environments: ['browser', 'node', 'tauri'],\n});\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler.ts'), {\n activatesOn: ActivationEvents.Idle,\n});\n\nexport const Translations = AppCapability.translations(translations);\n\nexport const GameVariant = undefined;\nexport const PluginAsset = undefined;\n"],"mappings":";;;;AAWA,IAAa,SAAS,cAAc,aAAa,OAAO,qBAAe;AAEvE,IAAa,kBAAkB,cAAc,sBAAsB,OAAO,iCAA2B,EACnG,cAAc;CAAC;CAAW;CAAQ;AAAO,EAC3C,CAAC;AAED,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,kCAA4B,EACtG,aAAa,iBAAiB,KAChC,CAAC;AAED,IAAa,eAAe,cAAc,aAAa,YAAY;AAEnE,IAAa,cAAc,KAAA;AAC3B,IAAa,cAAc,KAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as PLUGIN_default } from "./chunk-PLUGIN.mjs";
|
|
2
|
+
import * as ActivationEvents from "@dxos/app-framework/ActivationEvents";
|
|
3
|
+
import * as AppCapability from "@dxos/app-toolkit/AppCapability";
|
|
4
|
+
import { translations } from "#translations";
|
|
5
|
+
import * as Capability from "@dxos/app-framework/Capability";
|
|
6
|
+
import * as GameCapabilities from "@dxos/plugin-game/GameCapabilities";
|
|
7
|
+
import * as GameEvents from "@dxos/plugin-game/GameEvents";
|
|
8
|
+
import { meta } from "#meta";
|
|
9
|
+
//#region src/capabilities/gen/tauri.ts
|
|
10
|
+
var Schema = AppCapability.schema(() => import("./chunk-schema.mjs"));
|
|
11
|
+
var SkillDefinition = AppCapability.skillDefinition(() => import("./chunk-skill-definition.mjs"), { environments: [
|
|
12
|
+
"browser",
|
|
13
|
+
"node",
|
|
14
|
+
"tauri"
|
|
15
|
+
] });
|
|
16
|
+
var GameVariant = Capability.lazyModule("GameVariant", {
|
|
17
|
+
provides: [GameCapabilities.VariantProvider],
|
|
18
|
+
activatesOn: GameEvents.Start,
|
|
19
|
+
environments: ["browser", "tauri"]
|
|
20
|
+
}, () => import("./chunk-game-variant.mjs"));
|
|
21
|
+
var OperationHandler = AppCapability.operationHandler(() => import("./chunk-operation-handler.mjs"), { activatesOn: ActivationEvents.Idle });
|
|
22
|
+
var PluginAsset = AppCapability.pluginAsset({
|
|
23
|
+
pluginId: meta.profile.key,
|
|
24
|
+
path: "PLUGIN.mdl",
|
|
25
|
+
content: PLUGIN_default,
|
|
26
|
+
mimeType: "application/x-mdl"
|
|
27
|
+
});
|
|
28
|
+
var Translations = AppCapability.translations(translations);
|
|
29
|
+
//#endregion
|
|
30
|
+
export { GameVariant, OperationHandler, PluginAsset, Schema, SkillDefinition, Translations };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=capabilities.tauri.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.tauri.mjs","names":[],"sources":["../../src/capabilities/gen/tauri.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'tauri' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\nimport * as GameCapabilities from '@dxos/plugin-game/GameCapabilities';\nimport * as GameEvents from '@dxos/plugin-game/GameEvents';\n\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\nimport pluginSpec from '../../../PLUGIN.mdl?raw';\n\nexport const Schema = AppCapability.schema(() => import('../schema.ts'));\n\nexport const SkillDefinition = AppCapability.skillDefinition(() => import('../skill-definition.ts'), {\n environments: ['browser', 'node', 'tauri'],\n});\n\n// Browser-only: the variant descriptor carries the `card`/`article` React components the game\n// host renders, so the module cannot load without a DOM.\nexport const GameVariant = Capability.lazyModule(\n 'GameVariant',\n { provides: [GameCapabilities.VariantProvider], activatesOn: GameEvents.Start, environments: ['browser', 'tauri'] },\n () => import('../game-variant.ts'),\n);\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler.ts'), {\n activatesOn: ActivationEvents.Idle,\n});\n\nexport const PluginAsset = AppCapability.pluginAsset({\n pluginId: meta.profile.key,\n path: 'PLUGIN.mdl',\n content: pluginSpec,\n mimeType: 'application/x-mdl',\n});\n\nexport const Translations = AppCapability.translations(translations);\n"],"mappings":";;;;;;;;;AAiBA,IAAa,SAAS,cAAc,aAAa,OAAO,qBAAe;AAEvE,IAAa,kBAAkB,cAAc,sBAAsB,OAAO,iCAA2B,EACnG,cAAc;CAAC;CAAW;CAAQ;AAAO,EAC3C,CAAC;AAID,IAAa,cAAc,WAAW,WACpC,eACA;CAAE,UAAU,CAAC,iBAAiB,eAAe;CAAG,aAAa,WAAW;CAAO,cAAc,CAAC,WAAW,OAAO;AAAE,SAC5G,OAAO,2BACf;AAEA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,kCAA4B,EACtG,aAAa,iBAAiB,KAChC,CAAC;AAED,IAAa,cAAc,cAAc,YAAY;CACnD,UAAU,KAAK,QAAQ;CACvB,MAAM;CACN,SAAS;CACT,UAAU;AACZ,CAAC;AAED,IAAa,eAAe,cAAc,aAAa,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.workerd.mjs","names":[],"sources":["../../src/capabilities/gen/workerd.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'workerd' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { translations } from '#translations';\n\nexport const Schema = AppCapability.schema(() => import('../schema'));\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler'), {\n activatesOn: ActivationEvents.Idle,\n});\n\nexport const Translations = AppCapability.translations(translations);\n\nexport const GameVariant = undefined;\nexport const PluginAsset = undefined;\nexport const SkillDefinition = undefined;\n"],"mappings":";;;;AAWA,IAAa,SAAS,cAAc,aAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"capabilities.workerd.mjs","names":[],"sources":["../../src/capabilities/gen/workerd.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'workerd' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { translations } from '#translations';\n\nexport const Schema = AppCapability.schema(() => import('../schema.ts'));\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler.ts'), {\n activatesOn: ActivationEvents.Idle,\n});\n\nexport const Translations = AppCapability.translations(translations);\n\nexport const GameVariant = undefined;\nexport const PluginAsset = undefined;\nexport const SkillDefinition = undefined;\n"],"mappings":";;;;AAWA,IAAa,SAAS,cAAc,aAAa,OAAO,qBAAe;AAEvE,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,kCAA4B,EACtG,aAAa,iBAAiB,KAChC,CAAC;AAED,IAAa,eAAe,cAAc,aAAa,YAAY;AAEnE,IAAa,cAAc,KAAA;AAC3B,IAAa,cAAc,KAAA;AAC3B,IAAa,kBAAkB,KAAA"}
|
|
@@ -2,16 +2,19 @@ import { meta } from "#meta";
|
|
|
2
2
|
import { Chess } from "#types";
|
|
3
3
|
import { useCallback, useRef, useState } from "react";
|
|
4
4
|
import { useObject } from "@dxos/echo-react";
|
|
5
|
-
import
|
|
5
|
+
import * as Button from "@dxos/react-ui/Button";
|
|
6
|
+
import * as Hooks from "@dxos/react-ui/Hooks";
|
|
6
7
|
import { mx } from "@dxos/ui-theme";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { Obj } from "@dxos/echo";
|
|
9
10
|
import { Chess as Chess$1 } from "chess.js";
|
|
10
|
-
import
|
|
11
|
+
import * as AppSurface from "@dxos/app-toolkit/AppSurface";
|
|
12
|
+
import * as Panel from "@dxos/react-ui/Panel";
|
|
13
|
+
import * as Toolbar from "@dxos/react-ui/Toolbar";
|
|
11
14
|
import { Chessboard } from "#components";
|
|
12
15
|
//#region src/containers/ChessArticle/ChessArticle.tsx
|
|
13
16
|
var ChessArticle = ({ role, variant }) => {
|
|
14
|
-
const { t } = useTranslation(meta.profile.key);
|
|
17
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
15
18
|
const [orientation, setOrientation] = useState("white");
|
|
16
19
|
const [showInfo, setShowInfo] = useState(true);
|
|
17
20
|
const controller = useRef(null);
|
|
@@ -46,24 +49,21 @@ var ChessArticle = ({ role, variant }) => {
|
|
|
46
49
|
children: /* @__PURE__ */ jsxs(Panel.Root, {
|
|
47
50
|
role,
|
|
48
51
|
classNames: "@container",
|
|
49
|
-
children: [/* @__PURE__ */ jsx(Panel.Toolbar, {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
] })
|
|
65
|
-
}), /* @__PURE__ */ jsx(Panel.Content, { children: /* @__PURE__ */ jsxs("div", {
|
|
66
|
-
className: mx("grid h-full w-full", showInfo && "@4xl:grid-cols-[1fr_320px] gap-8", role === AppSurface.Article.role && "p-4", role === AppSurface.Section.role && "aspect-square", role === AppSurface.Section.role && showInfo && "@4xl:aspect-auto"),
|
|
52
|
+
children: [role === AppSurface.Article.role && /* @__PURE__ */ jsx(Panel.Header, { children: /* @__PURE__ */ jsxs(Toolbar.Root, { children: [
|
|
53
|
+
isGameOver && /* @__PURE__ */ jsx(Button.Root, {
|
|
54
|
+
onClick: handleNewGame,
|
|
55
|
+
children: t("new-game.button")
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx("div", { className: "grow" }),
|
|
58
|
+
/* @__PURE__ */ jsx(Button.Root, {
|
|
59
|
+
icon: "ph--info--regular",
|
|
60
|
+
iconOnly: true,
|
|
61
|
+
label: t("toggle-info.button"),
|
|
62
|
+
classNames: mx("invisible @4xl:visible"),
|
|
63
|
+
onClick: () => setShowInfo((open) => !open)
|
|
64
|
+
})
|
|
65
|
+
] }) }), /* @__PURE__ */ jsx(Panel.Body, { children: /* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: mx("grid dx-fill", showInfo && "@4xl:grid-cols-[1fr_320px] gap-8", role === AppSurface.Article.role && "p-4", role === AppSurface.Section.role && "aspect-square w-full max-h-full min-h-0", role === AppSurface.Section.role && showInfo && "@4xl:aspect-auto"),
|
|
67
67
|
children: [/* @__PURE__ */ jsx(Chessboard.Content, { children: /* @__PURE__ */ jsx(Chessboard.Board, {
|
|
68
68
|
classNames: "border rounded-xs",
|
|
69
69
|
orientation
|
|
@@ -74,7 +74,7 @@ var ChessArticle = ({ role, variant }) => {
|
|
|
74
74
|
min: 8,
|
|
75
75
|
max: 8,
|
|
76
76
|
onOrientationChange: setOrientation,
|
|
77
|
-
onClose: () => setShowInfo(false),
|
|
77
|
+
onClose: role === AppSurface.Article.role ? () => setShowInfo(false) : void 0,
|
|
78
78
|
onSelect: handleSelect
|
|
79
79
|
})
|
|
80
80
|
})]
|