@dxos/plugin-chess 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/blueprints/index.mjs +4 -4
- package/dist/lib/browser/{chunk-JZMN24DY.mjs → chunk-H6SON7WG.mjs} +4 -4
- package/dist/lib/browser/chunk-H6SON7WG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2TJN26DN.mjs → chunk-IN3LZ2OO.mjs} +2 -7
- package/dist/lib/browser/{chunk-2TJN26DN.mjs.map → chunk-IN3LZ2OO.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-MC7L6JNC.mjs → chunk-JYP24G6K.mjs} +2 -2
- package/dist/lib/browser/chunk-JYP24G6K.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XAJZK6Z2.mjs → chunk-OBKYFOJA.mjs} +3 -3
- package/dist/lib/browser/chunk-OBKYFOJA.mjs.map +7 -0
- package/dist/lib/browser/{create-AJHN4QT4.mjs → create-2ME3FNBX.mjs} +4 -4
- package/dist/lib/browser/create-2ME3FNBX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +10 -357
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{move-T2NLRBR4.mjs → move-TTMIPD5J.mjs} +5 -5
- package/dist/lib/browser/move-TTMIPD5J.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +3 -3
- package/dist/lib/browser/{play-7VTMD3SJ.mjs → play-GHXPV2T2.mjs} +5 -5
- package/dist/lib/browser/play-GHXPV2T2.mjs.map +7 -0
- package/dist/lib/browser/{print-EW7LPW4D.mjs → print-RNAGAOM7.mjs} +4 -4
- package/dist/lib/browser/{print-EW7LPW4D.mjs.map → print-RNAGAOM7.mjs.map} +1 -1
- package/dist/lib/browser/translations.mjs +38 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/blueprints/index.mjs +4 -4
- package/dist/lib/node-esm/{chunk-LQEDIKCV.mjs → chunk-4C4GPZTA.mjs} +4 -4
- package/dist/lib/node-esm/chunk-4C4GPZTA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NYU5JVXP.mjs → chunk-G2EHRXHX.mjs} +3 -3
- package/dist/lib/node-esm/chunk-G2EHRXHX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4HZWCKMR.mjs → chunk-NSFPC4IO.mjs} +2 -2
- package/dist/lib/node-esm/chunk-NSFPC4IO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OIRJVY2R.mjs → chunk-OHBKSL2Q.mjs} +2 -7
- package/dist/lib/node-esm/{chunk-OIRJVY2R.mjs.map → chunk-OHBKSL2Q.mjs.map} +2 -2
- package/dist/lib/node-esm/{create-QSETDT4N.mjs → create-CC2P7GPT.mjs} +4 -4
- package/dist/lib/node-esm/create-CC2P7GPT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +10 -357
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{move-5F2ANDTE.mjs → move-CYHXWHHM.mjs} +5 -5
- package/dist/lib/node-esm/move-CYHXWHHM.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +3 -3
- package/dist/lib/node-esm/{play-W4DQCQRX.mjs → play-KTNK2PBL.mjs} +5 -5
- package/dist/lib/node-esm/play-KTNK2PBL.mjs.map +7 -0
- package/dist/lib/node-esm/{print-UJHXAXMS.mjs → print-P23VKVNU.mjs} +4 -4
- package/dist/lib/node-esm/{print-UJHXAXMS.mjs.map → print-P23VKVNU.mjs.map} +1 -1
- package/dist/lib/node-esm/translations.mjs +39 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/ChessPlugin.d.ts +1 -0
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/{cli/plugin.d.ts → ChessPlugin.node.d.ts} +2 -1
- package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ChessPlugin.test.d.ts +2 -0
- package/dist/types/src/ChessPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +2 -2
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +5 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Chessboard.d.ts +4 -0
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +40 -23
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Info.d.ts +4 -5
- package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/types.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +40 -23
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -1
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +1 -1
- package/dist/types/src/operations/create.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +2 -2
- package/dist/types/src/operations/definitions.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/operations/move.d.ts +1 -1
- package/dist/types/src/operations/move.d.ts.map +1 -1
- package/dist/types/src/operations/play.d.ts +1 -1
- package/dist/types/src/operations/play.d.ts.map +1 -1
- package/dist/types/src/operations/print.d.ts +1 -1
- package/dist/types/src/operations/print.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +40 -24
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +50 -48
- package/src/{cli/plugin.ts → ChessPlugin.node.ts} +11 -3
- package/src/ChessPlugin.test.ts +49 -0
- package/src/ChessPlugin.tsx +4 -3
- package/src/blueprints/chess-blueprint.ts +2 -3
- package/src/capabilities/artifact-definition.ts +2 -2
- package/src/capabilities/blueprint-definition.ts +2 -0
- package/src/capabilities/index.ts +2 -1
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +5 -5
- package/src/components/Chessboard/Chessboard.stories.tsx +1 -1
- package/src/components/Chessboard/Info.tsx +2 -2
- package/src/containers/ChessArticle/ChessArticle.stories.tsx +1 -1
- package/src/index.ts +5 -2
- package/src/operations/create.ts +1 -1
- package/src/operations/definitions.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/operations/move.ts +2 -2
- package/src/operations/play.ts +2 -2
- package/src/operations/print.ts +1 -1
- package/dist/lib/browser/chunk-JZMN24DY.mjs.map +0 -7
- package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAJZK6Z2.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -34
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/create-AJHN4QT4.mjs.map +0 -7
- package/dist/lib/browser/move-T2NLRBR4.mjs.map +0 -7
- package/dist/lib/browser/play-7VTMD3SJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4HZWCKMR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LQEDIKCV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NYU5JVXP.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -35
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/create-QSETDT4N.mjs.map +0 -7
- package/dist/lib/node-esm/move-5F2ANDTE.mjs.map +0 -7
- package/dist/lib/node-esm/play-W4DQCQRX.mjs.map +0 -7
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/src/cli/index.ts +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport React, {\n type PropsWithChildren,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\n\nimport { addEventListener } from '@dxos/async';\nimport { useObject } from '@dxos/echo-react';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport {\n type ChessModel,\n Gameboard,\n type GameboardRootProps,\n Chessboard as NaturalChessboard,\n type ChessboardProps as NaturalChessboardProps,\n getRawPgn,\n useGameboardContext,\n} from '@dxos/react-ui-gameboard';\nimport { useSoundEffect } from '@dxos/react-ui-sfx';\n\nimport { type Chess } from '#types';\n\nimport { Info, type InfoProps } from './Info';\nimport { ExtendedChessModel } from './types';\n\nexport interface ChessboardController {\n setMoveNumber(index: number): void;\n}\n\n//\n// Root\n//\n\ntype RootProps = PropsWithChildren<{\n game: Chess.Game;\n}>;\n\nconst Root = forwardRef<ChessboardController, RootProps>(({ game, children }, forwardedRef) => {\n const registry = useContext(RegistryContext);\n const model = useMemo(() => new ExtendedChessModel(registry, game), [registry]);\n const click = useSoundEffect('Click');\n const [pgn, updatePgn] = useObject(game, 'pgn');\n\n // Controller.\n useImperativeHandle(forwardedRef, () => {\n return {\n setMoveNumber: (index) => model.setMoveIndex(index),\n };\n }, [model]);\n\n // TODO(wittjosiah): Rather than useEffect to sync ECHO object to model, create an alternative model implementation.\n // This model would take the ECHO object and derive game state directly from that.\n // Mutation methods would mutate the ECHO object and other state would be derived from that.\n\n // External change.\n // NOTE: Warning if user has not interacted with the board.\n useEffect(() => {\n if (model.pgn !== getRawPgn(pgn ?? '')) {\n const silent = model.pgn === '*';\n model.update(pgn);\n if (!silent) {\n void click.play();\n }\n }\n }, [pgn]);\n\n // Move.\n const handleDrop = useCallback<NonNullable<GameboardRootProps<ChessModel>['onDrop']>>(\n (move) => {\n if (!model.makeMove(move)) {\n return false;\n }\n\n void click.play();\n updatePgn(() => model.pgn);\n return true;\n },\n [model],\n );\n\n return (\n <Gameboard.Root model={model} onDrop={handleDrop}>\n {children}\n </Gameboard.Root>\n );\n});\n\n//\n// Content\n//\n\ntype Role = 'card--content';\n\ntype ContentProps = ThemedClassName<PropsWithChildren<{ role?: Role }>>;\n\nconst Content = ({ classNames, children }: ContentProps) => {\n return (\n <Gameboard.Content grow contain classNames={classNames}>\n {children}\n </Gameboard.Content>\n );\n};\n\n//\n// Board\n//\n\nconst BOARD_NAME = 'Chessboard.Board';\n\ntype BoardProps = NaturalChessboardProps;\n\nconst Board = (props: BoardProps) => {\n const registry = useContext(RegistryContext);\n const { model } = useGameboardContext<ChessModel>(BOARD_NAME);\n\n // Keyboard navigation.\n const ref = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n // Participate in keyboard navigation (set tabIndex={0})\n ref.current.setAttribute('data-arrow-keys', 'all');\n\n return addEventListener(ref.current, 'keydown', (ev) => {\n const moveIndex = registry.get(model.moveIndex);\n switch (ev.key) {\n case 'ArrowUp':\n model.setMoveIndex(0);\n break;\n case 'ArrowDown':\n model.setMoveIndex(model.game.history().length);\n break;\n case 'ArrowLeft':\n if (moveIndex > 0) {\n model.setMoveIndex(moveIndex - 1);\n }\n break;\n case 'ArrowRight':\n if (moveIndex < model.game.history().length) {\n model.setMoveIndex(moveIndex + 1);\n }\n break;\n }\n });\n }, [registry, model]);\n\n return <NaturalChessboard {...props} ref={ref} />;\n};\n\nBoard.displayName = BOARD_NAME;\n\n//\n// Chessboard\n//\n\nexport const Chessboard = {\n Root: Root,\n Content: Content,\n Board: Board,\n Info: Info,\n};\n\nexport type {\n RootProps as ChessboardRootProps,\n ContentProps as ChessboardContentProps,\n BoardProps as ChessboardBoardProps,\n InfoProps as ChessboardInfoProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport React, { type JSX, type PropsWithChildren, useEffect, useMemo, useRef } from 'react';\n\nimport { generateName } from '@dxos/display-name';\nimport { Obj } from '@dxos/echo';\nimport { type SpaceMember, useMembers } from '@dxos/react-client/echo';\nimport { Icon, IconButton, Select, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { type Player, useGameboardContext } from '@dxos/react-ui-gameboard';\nimport { mx } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\n\nimport { type ExtendedChessModel } from './types';\n\nconst INFO_NAME = 'Chessboard.Info';\n\nexport type InfoProps = ThemedClassName<\n {\n orientation?: Player;\n onOrientationChange?: (orientation: Player) => void;\n onClose?: () => void;\n } & Pick<HistoryProps, 'min' | 'max' | 'onSelect'>\n>;\n\nexport const Info = ({ classNames, orientation = 'white', onOrientationChange, onClose, ...props }: InfoProps) => {\n const { t } = useTranslation(meta.id);\n const { model } = useGameboardContext<ExtendedChessModel>(INFO_NAME);\n const db = Obj.getDatabase(model.object);\n const members = useMembers(db?.spaceId);\n\n return (\n <div\n className={mx(\n 'grid grid-rows-[min-content_1fr_min-content] w-full min-w-[18rem] p-2 overflow-hidden bg-group-surface rounded-xs',\n classNames,\n )}\n >\n <PlayerIndicator\n model={model}\n player={orientation === 'white' ? 'black' : 'white'}\n icon={\n onClose && (\n <IconButton\n variant='ghost'\n icon='ph--x--regular'\n iconOnly\n label={t('close-info.button')}\n size={4}\n onClick={onClose}\n />\n )\n }\n >\n <PlayerSelector\n value={model.object.players?.[orientation === 'white' ? 'black' : 'white']}\n onValueChange={(value) => {\n Obj.change(model.object, (obj) => {\n obj.players![orientation === 'white' ? 'black' : 'white'] = value;\n });\n }}\n members={members}\n />\n </PlayerIndicator>\n\n <History model={model} {...props} />\n\n <PlayerIndicator\n model={model}\n player={orientation}\n icon={\n onOrientationChange && (\n <IconButton\n classNames={mx('transition duration-200 ease-linear', orientation === 'white' && 'rotate-180')}\n icon='ph--arrows-clockwise--regular'\n iconOnly\n label={t('flip-board.button')}\n size={4}\n onClick={() => onOrientationChange(orientation === 'white' ? 'black' : 'white')}\n />\n )\n }\n >\n <PlayerSelector\n value={model.object.players?.[orientation]}\n onValueChange={(value) => {\n Obj.change(model.object, (obj) => {\n obj.players![orientation] = value;\n });\n }}\n members={members}\n />\n </PlayerIndicator>\n </div>\n );\n};\n\nInfo.displayName = INFO_NAME;\n\n//\n// History\n//\n\ntype HistoryProps = ThemedClassName<{\n model: ExtendedChessModel;\n min?: number;\n max?: number;\n onSelect?: (index: number) => void;\n}>;\n\nconst History = ({ classNames, model, min, max, onSelect }: HistoryProps) => {\n const { t } = useTranslation(meta.id);\n const moveIndex = useAtomValue(model.moveIndex);\n const label = model.game.isGameOver()\n ? model.game.isCheckmate()\n ? t('game.checkmate.label')\n : model.game.isStalemate()\n ? t('game.stalemate.label')\n : t('game.draw.label')\n : model.game.isCheck()\n ? t('game.check.label')\n : undefined;\n\n const history = model.game.history();\n const moves = useMemo(\n () =>\n history.reduce(\n (acc, move, index) => {\n if (index % 2 === 0) {\n acc.push([{ index, move }]);\n } else {\n acc[acc.length - 1].push({ index, move });\n }\n return acc;\n },\n [] as { index: number; move: string }[][],\n ),\n [history.length],\n );\n\n const scrollerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n scrollerRef.current?.scrollTo({ top: scrollerRef.current.scrollHeight });\n }, [history.length]);\n\n useEffect(() => {\n const div = scrollerRef.current?.querySelector(`[data-index=\"${moveIndex - 1}\"]`);\n scrollerRef.current?.classList.add('scrollbar-none');\n div?.scrollIntoView({ behavior: 'smooth' });\n scrollerRef.current?.classList.remove('scrollbar-none');\n }, [moveIndex]);\n\n return (\n <div\n ref={scrollerRef}\n className={mx('overflow-y-auto', classNames)}\n style={{\n minHeight: min === undefined ? 'auto' : `${min * 24}px`,\n maxHeight: max === undefined ? 'auto' : `${max * 24}px`,\n }}\n >\n {moves.map(([a, b], index) => (\n <div key={index} className='grid grid-cols-[3rem_1fr_1fr_1rem] gap-2 ps-4'>\n <div className='content-center text-xs text-subdued'>{index + 1}</div>\n {a && (\n <div\n data-index={a.index}\n className={mx('ps-2 text-sm cursor-pointer', a.index === moveIndex - 1 && 'bg-primary-500')}\n onClick={() => onSelect?.(a.index + 1)}\n >\n {a.move}\n </div>\n )}\n {b && (\n <div\n data-index={b.index}\n className={mx('ps-2 text-sm cursor-pointer', b.index === moveIndex - 1 && 'bg-primary-500')}\n onClick={() => onSelect?.(b.index + 1)}\n >\n {b.move}\n </div>\n )}\n </div>\n ))}\n {label && <div className='text-center'>{label}</div>}\n </div>\n );\n};\n\n//\n// PlayerIndicator\n//\n\ntype PlayerIndicatorProps = PropsWithChildren<{\n model: ExtendedChessModel;\n player: Player;\n icon?: JSX.Element;\n}>;\n\nconst PlayerIndicator = ({ children, model, player, icon }: PlayerIndicatorProps) => {\n const turn = player === (model.game.turn() === 'w' ? 'white' : 'black');\n return (\n <div className='grid grid-cols-[2rem_1fr_2rem] gap-2 h-(--dx-rail-size) px-1 flex items-center overflow-hidden'>\n <div className='place-items-center'>\n <Icon\n icon={turn ? 'ph--circle--fill' : 'ph--circle--thin'}\n size={6}\n classNames={mx(turn && (model.game.isCheckmate() ? 'text-error-500' : 'text-success-text'))}\n />\n </div>\n <div className='truncate overflow-hidden items-center'>{children}</div>\n {icon}\n </div>\n );\n};\n\n//\n// PlayerSelector\n//\n\ntype PlayerSelectorProps = {\n value?: string;\n onValueChange: (player: string) => void;\n members: SpaceMember[];\n};\n\nconst PlayerSelector = ({ value, onValueChange, members }: PlayerSelectorProps) => {\n const { t } = useTranslation(meta.id);\n return (\n <Select.Root value={value} onValueChange={onValueChange}>\n <Select.TriggerButton placeholder={t('select-player.button')} />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n {members.map((member) => {\n const memberKey = member.identity.identityKey.toHex();\n const displayName = member.identity?.profile?.displayName || generateName(memberKey);\n return (\n <Select.Option key={memberKey} value={memberKey}>\n {displayName}\n </Select.Option>\n );\n })}\n </Select.Viewport>\n <Select.Arrow />\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Registry } from '@effect-atom/atom-react';\n\nimport { ChessModel } from '@dxos/react-ui-gameboard';\n\nimport { type Chess } from '#types';\n\nexport class ExtendedChessModel extends ChessModel {\n constructor(\n registry: Registry.Registry,\n readonly object: Chess.Game,\n ) {\n super(registry);\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.chess',\n name: 'Chess',\n description: trim`\n Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.\n Track game history and analyze moves in real-time.\n `,\n icon: 'ph--shield-chevron--regular',\n iconHue: 'amber',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',\n screenshots: ['https://dxos.network/plugin-details-chess-dark.png'],\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Annotation } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\nimport { SpaceOperation } from '@dxos/plugin-space/operations';\nimport { type CreateObject } from '@dxos/plugin-space/types';\n\nimport { ChessBlueprint } from '#blueprints';\nimport { BlueprintDefinition, OperationHandler, ReactSurface } from '#capabilities';\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\nimport { translations } from './translations';\n\nexport const ChessPlugin = Plugin.define(meta).pipe(\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addMetadataModule({\n metadata: {\n id: Chess.Game.typename,\n metadata: {\n icon: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).icon,\n iconHue: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).hue ?? 'white',\n blueprints: [ChessBlueprint.key],\n createObject: ((props, options) =>\n Effect.gen(function* () {\n const object = Chess.make(props);\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object,\n target: options.target,\n hidden: true,\n targetNodeId: options.targetNodeId,\n });\n })) satisfies CreateObject,\n },\n },\n }),\n AppPlugin.addSchemaModule({ schema: [Chess.Game] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\nexport const translations = [\n {\n 'en-US': {\n [Chess.Game.typename]: {\n 'typename.label': 'Game',\n 'typename.label_zero': 'Games',\n 'typename.label_one': 'Game',\n 'typename.label_other': 'Games',\n 'object-name.placeholder': 'New game',\n 'add-object.label': 'Add game',\n 'rename-object.label': 'Rename game',\n 'delete-object.label': 'Delete game',\n 'object-deleted.label': 'Game deleted',\n },\n [meta.id]: {\n 'plugin.name': 'Chess',\n 'delete-game.label': 'Delete',\n 'game.checkmate.label': 'Checkmate',\n 'game.stalemate.label': 'Stalemate',\n 'game.draw.label': 'Draw',\n 'game.check.label': 'Check',\n 'select-player.button': 'Select player',\n 'toggle-info.button': 'Toggle info',\n 'close-info.button': 'Close info',\n 'flip-board.button': 'Flip board',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAIA,SAASA,
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/index.ts", "../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport * from './blueprints';\nexport * from './meta';\nexport * from './types';\n\nexport const ChessPlugin = Plugin.lazy(meta, () => import('#plugin'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.chess',\n name: 'Chess',\n description: trim`\n Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.\n Track game history and analyze moves in real-time.\n `,\n icon: 'ph--shield-chevron--regular',\n iconHue: 'amber',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',\n screenshots: ['https://dxos.network/plugin-details-chess-dark.png'],\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAIA,SAASA,cAAc;;;ACCvB,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;EAIbK,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,aAAa;IAAC;;AAChB;;;ADNO,IAAMC,cAAcC,OAAOC,KAAKC,MAAM,MAAM,OAAO,SAAA,CAAA;",
|
|
6
|
+
"names": ["Plugin", "trim", "meta", "id", "name", "description", "icon", "iconHue", "source", "screenshots", "ChessPlugin", "Plugin", "lazy", "meta"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/blueprints/chess-blueprint.ts":{"bytes":3377,"imports":[{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#operations","kind":"import-statement","external":true}],"format":"esm"},"src/types/Chess.ts":{"bytes":6097,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":508,"imports":[{"path":"src/types/Chess.ts","kind":"import-statement","original":"./Chess"}],"format":"esm"},"src/operations/definitions.ts":{"bytes":9864,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/operations/create.ts":{"bytes":2029,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/move.ts":{"bytes":3439,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/play.ts":{"bytes":4736,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/print.ts":{"bytes":2383,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/index.ts":{"bytes":1522,"imports":[{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"},{"path":"src/operations/create.ts","kind":"dynamic-import","original":"./create"},{"path":"src/operations/move.ts","kind":"dynamic-import","original":"./move"},{"path":"src/operations/play.ts","kind":"dynamic-import","original":"./play"},{"path":"src/operations/print.ts","kind":"dynamic-import","original":"./print"}],"format":"esm"},"src/blueprints/index.ts":{"bytes":795,"imports":[{"path":"src/blueprints/chess-blueprint.ts","kind":"import-statement","original":"./chess-blueprint"},{"path":"src/operations/index.ts","kind":"import-statement","original":"../operations"}],"format":"esm"},"src/components/Chessboard/Info.tsx":{"bytes":24900,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/components/Chessboard/types.ts":{"bytes":1296,"imports":[{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true}],"format":"esm"},"src/components/Chessboard/Chessboard.tsx":{"bytes":13978,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui-sfx","kind":"import-statement","external":true},{"path":"src/components/Chessboard/Info.tsx","kind":"import-statement","original":"./Info"},{"path":"src/components/Chessboard/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/components/Chessboard/index.ts":{"bytes":484,"imports":[{"path":"src/components/Chessboard/Chessboard.tsx","kind":"import-statement","original":"./Chessboard"}],"format":"esm"},"src/meta.ts":{"bytes":2043,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/translations.ts":{"bytes":3709,"imports":[{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"format":"esm"},"src/ChessPlugin.tsx":{"bytes":6970,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/operations","kind":"import-statement","external":true},{"path":"#blueprints","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":843,"imports":[{"path":"src/blueprints/index.ts","kind":"import-statement","original":"./blueprints"},{"path":"src/components/Chessboard/index.ts","kind":"import-statement","original":"./components/Chessboard"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"src/ChessPlugin.tsx","kind":"import-statement","original":"./ChessPlugin"}],"format":"esm"},"src/cli/plugin.ts":{"bytes":4124,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/operations","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"format":"esm"},"src/cli/index.ts":{"bytes":458,"imports":[{"path":"src/cli/plugin.ts","kind":"import-statement","original":"./plugin"}],"format":"esm"}},"outputs":{"dist/lib/browser/print-EW7LPW4D.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1250},"dist/lib/browser/print-EW7LPW4D.mjs":{"imports":[{"path":"dist/lib/browser/chunk-XAJZK6Z2.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/print.ts","inputs":{"src/operations/print.ts":{"bytesInOutput":440}},"bytes":661},"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27654},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-MC7L6JNC.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-JZMN24DY.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-XAJZK6Z2.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui-sfx","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/operations","kind":"import-statement","external":true},{"path":"#blueprints","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"exports":["Chess","ChessBlueprint","ChessFunctions","ChessPlugin","Chessboard","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/components/Chessboard/Chessboard.tsx":{"bytesInOutput":2837},"src/components/Chessboard/Info.tsx":{"bytesInOutput":6441},"src/components/Chessboard/types.ts":{"bytesInOutput":201},"src/components/Chessboard/index.ts":{"bytesInOutput":0},"src/meta.ts":{"bytesInOutput":516},"src/ChessPlugin.tsx":{"bytesInOutput":1579},"src/translations.ts":{"bytesInOutput":983}},"bytes":13261},"dist/lib/browser/blueprints/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/blueprints/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-MC7L6JNC.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-JZMN24DY.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-XAJZK6Z2.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"}],"exports":["ChessBlueprint","ChessFunctions"],"entryPoint":"src/blueprints/index.ts","inputs":{},"bytes":356},"dist/lib/browser/chunk-MC7L6JNC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1751},"dist/lib/browser/chunk-MC7L6JNC.mjs":{"imports":[{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#operations","kind":"import-statement","external":true}],"exports":["chess_blueprint_default"],"inputs":{"src/blueprints/chess-blueprint.ts":{"bytesInOutput":833},"src/blueprints/index.ts":{"bytesInOutput":0}},"bytes":953},"dist/lib/browser/cli/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2159},"dist/lib/browser/cli/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/operations","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"exports":["ChessPlugin"],"entryPoint":"src/cli/index.ts","inputs":{"src/cli/plugin.ts":{"bytesInOutput":845},"src/cli/index.ts":{"bytesInOutput":0}},"bytes":960},"dist/lib/browser/operations/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/operations/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-JZMN24DY.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-XAJZK6Z2.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"}],"exports":["ChessHandlers","Create","Move","Play","Print"],"entryPoint":"src/operations/index.ts","inputs":{},"bytes":294},"dist/lib/browser/chunk-JZMN24DY.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":745},"dist/lib/browser/chunk-JZMN24DY.mjs":{"imports":[{"path":"dist/lib/browser/chunk-XAJZK6Z2.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"dist/lib/browser/create-AJHN4QT4.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/move-T2NLRBR4.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/play-7VTMD3SJ.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/print-EW7LPW4D.mjs","kind":"dynamic-import"}],"exports":["ChessHandlers","operations_exports"],"inputs":{"src/operations/index.ts":{"bytesInOutput":464}},"bytes":712},"dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"}],"exports":["Chess"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":161},"dist/lib/browser/create-AJHN4QT4.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1043},"dist/lib/browser/create-AJHN4QT4.mjs":{"imports":[{"path":"dist/lib/browser/chunk-XAJZK6Z2.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/create.ts","inputs":{"src/operations/create.ts":{"bytesInOutput":336}},"bytes":586},"dist/lib/browser/move-T2NLRBR4.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1881},"dist/lib/browser/move-T2NLRBR4.mjs":{"imports":[{"path":"dist/lib/browser/chunk-XAJZK6Z2.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/move.ts","inputs":{"src/operations/move.ts":{"bytesInOutput":654}},"bytes":871},"dist/lib/browser/play-7VTMD3SJ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2574},"dist/lib/browser/play-7VTMD3SJ.mjs":{"imports":[{"path":"dist/lib/browser/chunk-XAJZK6Z2.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/play.ts","inputs":{"src/operations/play.ts":{"bytesInOutput":972}},"bytes":1189},"dist/lib/browser/chunk-XAJZK6Z2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4774},"dist/lib/browser/chunk-XAJZK6Z2.mjs":{"imports":[{"path":"dist/lib/browser/chunk-2TJN26DN.mjs","kind":"import-statement"},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["Create","Move","Play","Print"],"inputs":{"src/operations/definitions.ts":{"bytesInOutput":2577}},"bytes":2758},"dist/lib/browser/chunk-2TJN26DN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3074},"dist/lib/browser/chunk-2TJN26DN.mjs":{"imports":[{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Chess_exports"],"inputs":{"src/types/Chess.ts":{"bytesInOutput":1625},"src/types/index.ts":{"bytesInOutput":0}},"bytes":1772},"dist/lib/browser/chunk-J5LGTIGS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/chunk-J5LGTIGS.mjs":{"imports":[],"exports":["__export"],"inputs":{},"bytes":235}}}
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":1964,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/blueprints/chess-blueprint.ts":{"bytes":3169,"imports":[{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#operations","kind":"import-statement","external":true}],"format":"esm"},"src/types/Chess.ts":{"bytes":6005,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":422,"imports":[{"path":"src/types/Chess.ts","kind":"import-statement","original":"./Chess"}],"format":"esm"},"src/operations/definitions.ts":{"bytes":9761,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/operations/create.ts":{"bytes":1931,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/move.ts":{"bytes":3339,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/play.ts":{"bytes":4640,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/print.ts":{"bytes":2286,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/index.ts":{"bytes":1425,"imports":[{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"},{"path":"src/operations/create.ts","kind":"dynamic-import","original":"./create"},{"path":"src/operations/move.ts","kind":"dynamic-import","original":"./move"},{"path":"src/operations/play.ts","kind":"dynamic-import","original":"./play"},{"path":"src/operations/print.ts","kind":"dynamic-import","original":"./print"}],"format":"esm"},"src/blueprints/index.ts":{"bytes":700,"imports":[{"path":"src/blueprints/chess-blueprint.ts","kind":"import-statement","original":"./chess-blueprint"},{"path":"src/operations/index.ts","kind":"import-statement","original":"../operations"}],"format":"esm"},"src/index.ts":{"bytes":1105,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/blueprints/index.ts","kind":"import-statement","original":"./blueprints"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"#plugin","kind":"dynamic-import","external":true}],"format":"esm"},"src/translations.ts":{"bytes":3622,"imports":[{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/lib/browser/print-RNAGAOM7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1248},"dist/lib/browser/print-RNAGAOM7.mjs":{"imports":[{"path":"dist/lib/browser/chunk-OBKYFOJA.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/print.ts","inputs":{"src/operations/print.ts":{"bytesInOutput":438}},"bytes":659},"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1411},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-JYP24G6K.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-H6SON7WG.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-OBKYFOJA.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#plugin","kind":"dynamic-import","external":true}],"exports":["Chess","ChessBlueprint","ChessFunctions","ChessPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":108},"src/meta.ts":{"bytesInOutput":515}},"bytes":1098},"dist/lib/browser/blueprints/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/blueprints/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-JYP24G6K.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-H6SON7WG.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-OBKYFOJA.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"}],"exports":["ChessBlueprint","ChessFunctions"],"entryPoint":"src/blueprints/index.ts","inputs":{},"bytes":356},"dist/lib/browser/chunk-JYP24G6K.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1606},"dist/lib/browser/chunk-JYP24G6K.mjs":{"imports":[{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#operations","kind":"import-statement","external":true}],"exports":["chess_blueprint_default"],"inputs":{"src/blueprints/chess-blueprint.ts":{"bytesInOutput":830},"src/blueprints/index.ts":{"bytesInOutput":0}},"bytes":950},"dist/lib/browser/operations/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/operations/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-H6SON7WG.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-OBKYFOJA.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"}],"exports":["ChessHandlers","Create","Move","Play","Print"],"entryPoint":"src/operations/index.ts","inputs":{},"bytes":294},"dist/lib/browser/chunk-H6SON7WG.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":720},"dist/lib/browser/chunk-H6SON7WG.mjs":{"imports":[{"path":"dist/lib/browser/chunk-OBKYFOJA.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"dist/lib/browser/create-2ME3FNBX.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/move-TTMIPD5J.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/play-GHXPV2T2.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/print-RNAGAOM7.mjs","kind":"dynamic-import"}],"exports":["ChessHandlers","operations_exports"],"inputs":{"src/operations/index.ts":{"bytesInOutput":462}},"bytes":710},"dist/lib/browser/translations.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1715},"dist/lib/browser/translations.mjs":{"imports":[{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"exports":["translations"],"entryPoint":"src/translations.ts","inputs":{"src/translations.ts":{"bytesInOutput":973}},"bytes":1097},"dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"}],"exports":["Chess"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":161},"dist/lib/browser/create-2ME3FNBX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1041},"dist/lib/browser/create-2ME3FNBX.mjs":{"imports":[{"path":"dist/lib/browser/chunk-OBKYFOJA.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/create.ts","inputs":{"src/operations/create.ts":{"bytesInOutput":334}},"bytes":584},"dist/lib/browser/move-TTMIPD5J.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1879},"dist/lib/browser/move-TTMIPD5J.mjs":{"imports":[{"path":"dist/lib/browser/chunk-OBKYFOJA.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/move.ts","inputs":{"src/operations/move.ts":{"bytesInOutput":652}},"bytes":869},"dist/lib/browser/play-GHXPV2T2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2572},"dist/lib/browser/play-GHXPV2T2.mjs":{"imports":[{"path":"dist/lib/browser/chunk-OBKYFOJA.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/play.ts","inputs":{"src/operations/play.ts":{"bytesInOutput":970}},"bytes":1187},"dist/lib/browser/chunk-OBKYFOJA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4772},"dist/lib/browser/chunk-OBKYFOJA.mjs":{"imports":[{"path":"dist/lib/browser/chunk-IN3LZ2OO.mjs","kind":"import-statement"},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/compute","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["Create","Move","Play","Print"],"inputs":{"src/operations/definitions.ts":{"bytesInOutput":2575}},"bytes":2756},"dist/lib/browser/chunk-IN3LZ2OO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2864},"dist/lib/browser/chunk-IN3LZ2OO.mjs":{"imports":[{"path":"dist/lib/browser/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Chess_exports"],"inputs":{"src/types/Chess.ts":{"bytesInOutput":1589},"src/types/index.ts":{"bytesInOutput":0}},"bytes":1736},"dist/lib/browser/chunk-J5LGTIGS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/chunk-J5LGTIGS.mjs":{"imports":[],"exports":["__export"],"inputs":{},"bytes":235}}}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Move
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-OBKYFOJA.mjs";
|
|
4
|
+
import "./chunk-IN3LZ2OO.mjs";
|
|
5
5
|
import "./chunk-J5LGTIGS.mjs";
|
|
6
6
|
|
|
7
7
|
// src/operations/move.ts
|
|
8
8
|
import { Chess as ChessJS } from "chess.js";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
+
import { Operation } from "@dxos/compute";
|
|
10
11
|
import { Database, Obj } from "@dxos/echo";
|
|
11
|
-
import { Operation } from "@dxos/operation";
|
|
12
12
|
var handler = Move.pipe(Operation.withHandler(Effect.fn(function* ({ game, move }) {
|
|
13
13
|
const obj = yield* Database.load(game);
|
|
14
14
|
const chess = new ChessJS();
|
|
@@ -21,7 +21,7 @@ var handler = Move.pipe(Operation.withHandler(Effect.fn(function* ({ game, move
|
|
|
21
21
|
strict: false
|
|
22
22
|
});
|
|
23
23
|
const pgn = chess.pgn();
|
|
24
|
-
Obj.
|
|
24
|
+
Obj.update(obj, (obj2) => {
|
|
25
25
|
const mutableGame = obj2;
|
|
26
26
|
mutableGame.pgn = pgn;
|
|
27
27
|
});
|
|
@@ -33,4 +33,4 @@ var move_default = handler;
|
|
|
33
33
|
export {
|
|
34
34
|
move_default as default
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=move-
|
|
36
|
+
//# sourceMappingURL=move-TTMIPD5J.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/move.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\nimport { Database, Obj } from '@dxos/echo';\n\nimport { type Chess } from '../types';\nimport { Move } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Move> = Move.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ game, move }) {\n const obj = (yield* Database.load(game)) as Chess.Game;\n const chess = new ChessJS();\n if (obj.pgn) {\n chess.loadPgn(obj.pgn);\n } else if (obj.fen) {\n chess.load(obj.fen);\n }\n\n chess.move(move, { strict: false });\n const pgn = chess.pgn();\n Obj.update(obj, (obj) => {\n const mutableGame = obj as Obj.Mutable<typeof obj>;\n mutableGame.pgn = pgn;\n });\n return { pgn };\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,WAAW;AAK9B,IAAMC,UAA8CC,KAAKC,KACvDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,KAAI,GAAE;AACjC,QAAMC,MAAO,OAAOC,SAASC,KAAKJ,IAAAA;AAClC,QAAMK,QAAQ,IAAIC,QAAAA;AAClB,MAAIJ,IAAIK,KAAK;AACXF,UAAMG,QAAQN,IAAIK,GAAG;EACvB,WAAWL,IAAIO,KAAK;AAClBJ,UAAMD,KAAKF,IAAIO,GAAG;EACpB;AAEAJ,QAAMJ,KAAKA,MAAM;IAAES,QAAQ;EAAM,CAAA;AACjC,QAAMH,MAAMF,MAAME,IAAG;AACrBI,MAAIC,OAAOV,KAAK,CAACA,SAAAA;AACf,UAAMW,cAAcX;AACpBW,gBAAYN,MAAMA;EACpB,CAAA;AACA,SAAO;IAAEA;EAAI;AACf,CAAA,CAAA,CAAA;AAIJ,IAAA,eAAeb;",
|
|
6
|
+
"names": ["Chess", "ChessJS", "Effect", "Operation", "Database", "Obj", "handler", "Move", "pipe", "Operation", "withHandler", "fn", "game", "move", "obj", "Database", "load", "chess", "ChessJS", "pgn", "loadPgn", "fen", "strict", "Obj", "update", "mutableGame"]
|
|
7
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChessHandlers
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-H6SON7WG.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Create,
|
|
6
6
|
Move,
|
|
7
7
|
Play,
|
|
8
8
|
Print
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-OBKYFOJA.mjs";
|
|
10
|
+
import "../chunk-IN3LZ2OO.mjs";
|
|
11
11
|
import "../chunk-J5LGTIGS.mjs";
|
|
12
12
|
export {
|
|
13
13
|
ChessHandlers,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Play
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-OBKYFOJA.mjs";
|
|
4
|
+
import "./chunk-IN3LZ2OO.mjs";
|
|
5
5
|
import "./chunk-J5LGTIGS.mjs";
|
|
6
6
|
|
|
7
7
|
// src/operations/play.ts
|
|
8
8
|
import { Chess as ChessJS } from "chess.js";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
+
import { Operation } from "@dxos/compute";
|
|
10
11
|
import { Database, Obj } from "@dxos/echo";
|
|
11
|
-
import { Operation } from "@dxos/operation";
|
|
12
12
|
var handler = Play.pipe(Operation.withHandler(Effect.fn(function* ({ game, side = "any" }) {
|
|
13
13
|
const object = yield* Database.load(game);
|
|
14
14
|
const chess = new ChessJS();
|
|
@@ -29,7 +29,7 @@ var handler = Play.pipe(Operation.withHandler(Effect.fn(function* ({ game, side
|
|
|
29
29
|
strict: false
|
|
30
30
|
});
|
|
31
31
|
const pgn = chess.pgn();
|
|
32
|
-
Obj.
|
|
32
|
+
Obj.update(object, (object2) => {
|
|
33
33
|
const mutableGame = object2;
|
|
34
34
|
mutableGame.pgn = pgn;
|
|
35
35
|
});
|
|
@@ -42,4 +42,4 @@ var play_default = handler;
|
|
|
42
42
|
export {
|
|
43
43
|
play_default as default
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=play-
|
|
45
|
+
//# sourceMappingURL=play-GHXPV2T2.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/play.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\nimport { Database, Obj } from '@dxos/echo';\n\nimport { type Chess } from '../types';\nimport { Play } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Play> = Play.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ game, side = 'any' }) {\n const object = (yield* Database.load(game)) as Chess.Game;\n const chess = new ChessJS();\n if (object.pgn) {\n chess.loadPgn(object.pgn);\n } else if (object.fen) {\n chess.load(object.fen);\n }\n\n if (\n !(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))\n ) {\n return { move: undefined, pgn: object.pgn! };\n }\n\n const moves = chess.moves();\n const move = moves[Math.floor(Math.random() * moves.length)];\n\n chess.move(move, { strict: false });\n const pgn = chess.pgn();\n Obj.update(object, (object) => {\n const mutableGame = object as Obj.Mutable<typeof object>;\n mutableGame.pgn = pgn;\n });\n return { move, pgn };\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,WAAW;AAK9B,IAAMC,UAA8CC,KAAKC,KACvDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,OAAO,MAAK,GAAE;AACzC,QAAMC,SAAU,OAAOC,SAASC,KAAKJ,IAAAA;AACrC,QAAMK,QAAQ,IAAIC,QAAAA;AAClB,MAAIJ,OAAOK,KAAK;AACdF,UAAMG,QAAQN,OAAOK,GAAG;EAC1B,WAAWL,OAAOO,KAAK;AACrBJ,UAAMD,KAAKF,OAAOO,GAAG;EACvB;AAEA,MACE,EAAER,SAAS,SAAUI,MAAMK,KAAI,MAAO,OAAOT,SAAS,WAAaI,MAAMK,KAAI,MAAO,OAAOT,SAAS,UACpG;AACA,WAAO;MAAEU,MAAMC;MAAWL,KAAKL,OAAOK;IAAK;EAC7C;AAEA,QAAMM,QAAQR,MAAMQ,MAAK;AACzB,QAAMF,OAAOE,MAAMC,KAAKC,MAAMD,KAAKE,OAAM,IAAKH,MAAMI,MAAM,CAAA;AAE1DZ,QAAMM,KAAKA,MAAM;IAAEO,QAAQ;EAAM,CAAA;AACjC,QAAMX,MAAMF,MAAME,IAAG;AACrBY,MAAIC,OAAOlB,QAAQ,CAACA,YAAAA;AAClB,UAAMmB,cAAcnB;AACpBmB,gBAAYd,MAAMA;EACpB,CAAA;AACA,SAAO;IAAEI;IAAMJ;EAAI;AACrB,CAAA,CAAA,CAAA;AAIJ,IAAA,eAAeb;",
|
|
6
|
+
"names": ["Chess", "ChessJS", "Effect", "Operation", "Database", "Obj", "handler", "Play", "pipe", "Operation", "withHandler", "fn", "game", "side", "object", "Database", "load", "chess", "ChessJS", "pgn", "loadPgn", "fen", "turn", "move", "undefined", "moves", "Math", "floor", "random", "length", "strict", "Obj", "update", "mutableGame"]
|
|
7
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Print
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-OBKYFOJA.mjs";
|
|
4
|
+
import "./chunk-IN3LZ2OO.mjs";
|
|
5
5
|
import "./chunk-J5LGTIGS.mjs";
|
|
6
6
|
|
|
7
7
|
// src/operations/print.ts
|
|
8
8
|
import { Chess as ChessJS } from "chess.js";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
-
import { Operation } from "@dxos/
|
|
10
|
+
import { Operation } from "@dxos/compute";
|
|
11
11
|
var handler = Print.pipe(Operation.withHandler(Effect.fn(function* ({ pgn, fen }) {
|
|
12
12
|
try {
|
|
13
13
|
const chess = new ChessJS(fen);
|
|
@@ -27,4 +27,4 @@ var print_default = handler;
|
|
|
27
27
|
export {
|
|
28
28
|
print_default as default
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=print-
|
|
30
|
+
//# sourceMappingURL=print-RNAGAOM7.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/operations/print.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\n\nimport { Print } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Print> = Print.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ pgn, fen }) {\n try {\n const chess = new ChessJS(fen);\n if (pgn) {\n chess.loadPgn(pgn);\n }\n return { ascii: chess.ascii() };\n } catch {\n return { ascii: '' };\n }\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
5
|
"mappings": ";;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAI1B,IAAMC,UAA+CC,MAAMC,KACzDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,KAAKC,IAAG,GAAE;AAC/B,MAAI;AACF,UAAMC,QAAQ,IAAIC,QAAQF,GAAAA;AAC1B,QAAID,KAAK;AACPE,YAAME,QAAQJ,GAAAA;IAChB;AACA,WAAO;MAAEK,OAAOH,MAAMG,MAAK;IAAG;EAChC,QAAQ;AACN,WAAO;MAAEA,OAAO;IAAG;EACrB;AACF,CAAA,CAAA,CAAA;AAIJ,IAAA,gBAAeX;",
|
|
6
6
|
"names": ["Chess", "ChessJS", "Effect", "Operation", "handler", "Print", "pipe", "Operation", "withHandler", "fn", "pgn", "fen", "chess", "ChessJS", "loadPgn", "ascii"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/translations.ts
|
|
4
|
+
import { meta } from "#meta";
|
|
5
|
+
import { Chess } from "#types";
|
|
6
|
+
var translations = [
|
|
7
|
+
{
|
|
8
|
+
"en-US": {
|
|
9
|
+
[Chess.Game.typename]: {
|
|
10
|
+
"typename.label": "Game",
|
|
11
|
+
"typename.label_zero": "Games",
|
|
12
|
+
"typename.label_one": "Game",
|
|
13
|
+
"typename.label_other": "Games",
|
|
14
|
+
"object-name.placeholder": "New game",
|
|
15
|
+
"add-object.label": "Add game",
|
|
16
|
+
"rename-object.label": "Rename game",
|
|
17
|
+
"delete-object.label": "Delete game",
|
|
18
|
+
"object-deleted.label": "Game deleted"
|
|
19
|
+
},
|
|
20
|
+
[meta.id]: {
|
|
21
|
+
"plugin.name": "Chess",
|
|
22
|
+
"delete-game.label": "Delete",
|
|
23
|
+
"game.checkmate.label": "Checkmate",
|
|
24
|
+
"game.stalemate.label": "Stalemate",
|
|
25
|
+
"game.draw.label": "Draw",
|
|
26
|
+
"game.check.label": "Check",
|
|
27
|
+
"select-player.button": "Select player",
|
|
28
|
+
"toggle-info.button": "Toggle info",
|
|
29
|
+
"close-info.button": "Close info",
|
|
30
|
+
"flip-board.button": "Flip board"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
export {
|
|
36
|
+
translations
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=translations.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\nexport const translations = [\n {\n 'en-US': {\n [Chess.Game.typename]: {\n 'typename.label': 'Game',\n 'typename.label_zero': 'Games',\n 'typename.label_one': 'Game',\n 'typename.label_other': 'Games',\n 'object-name.placeholder': 'New game',\n 'add-object.label': 'Add game',\n 'rename-object.label': 'Rename game',\n 'delete-object.label': 'Delete game',\n 'object-deleted.label': 'Game deleted',\n },\n [meta.id]: {\n 'plugin.name': 'Chess',\n 'delete-game.label': 'Delete',\n 'game.checkmate.label': 'Checkmate',\n 'game.stalemate.label': 'Stalemate',\n 'game.draw.label': 'Draw',\n 'game.check.label': 'Check',\n 'select-player.button': 'Select player',\n 'toggle-info.button': 'Toggle info',\n 'close-info.button': 'Close info',\n 'flip-board.button': 'Flip board',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
+
"mappings": ";;;AAMA,SAASA,YAAY;AACrB,SAASC,aAAa;AAEf,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,MAAME,KAAKC,QAAQ,GAAG;QACrB,kBAAkB;QAClB,uBAAuB;QACvB,sBAAsB;QACtB,wBAAwB;QACxB,2BAA2B;QAC3B,oBAAoB;QACpB,uBAAuB;QACvB,uBAAuB;QACvB,wBAAwB;MAC1B;MACA,CAACJ,KAAKK,EAAE,GAAG;QACT,eAAe;QACf,qBAAqB;QACrB,wBAAwB;QACxB,wBAAwB;QACxB,mBAAmB;QACnB,oBAAoB;QACpB,wBAAwB;QACxB,sBAAsB;QACtB,qBAAqB;QACrB,qBAAqB;MACvB;IACF;EACF;;",
|
|
6
|
+
"names": ["meta", "Chess", "translations", "Game", "typename", "id"]
|
|
7
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
chess_blueprint_default
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-NSFPC4IO.mjs";
|
|
5
5
|
import {
|
|
6
6
|
operations_exports
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-4C4GPZTA.mjs";
|
|
8
|
+
import "../chunk-G2EHRXHX.mjs";
|
|
9
|
+
import "../chunk-OHBKSL2Q.mjs";
|
|
10
10
|
import "../chunk-HSLMI22Q.mjs";
|
|
11
11
|
export {
|
|
12
12
|
chess_blueprint_default as ChessBlueprint,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
Move,
|
|
5
5
|
Play,
|
|
6
6
|
Print
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-G2EHRXHX.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
10
|
} from "./chunk-HSLMI22Q.mjs";
|
|
@@ -18,12 +18,12 @@ __export(operations_exports, {
|
|
|
18
18
|
Play: () => Play,
|
|
19
19
|
Print: () => Print
|
|
20
20
|
});
|
|
21
|
-
import { OperationHandlerSet } from "@dxos/
|
|
22
|
-
var Handlers = OperationHandlerSet.lazy(() => import("./create-
|
|
21
|
+
import { OperationHandlerSet } from "@dxos/compute";
|
|
22
|
+
var Handlers = OperationHandlerSet.lazy(() => import("./create-CC2P7GPT.mjs"), () => import("./move-CYHXWHHM.mjs"), () => import("./play-KTNK2PBL.mjs"), () => import("./print-P23VKVNU.mjs"));
|
|
23
23
|
var ChessHandlers = Handlers;
|
|
24
24
|
|
|
25
25
|
export {
|
|
26
26
|
ChessHandlers,
|
|
27
27
|
operations_exports
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-4C4GPZTA.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/compute';\n\nconst Handlers = OperationHandlerSet.lazy(\n () => import('./create'),\n () => import('./move'),\n () => import('./play'),\n () => import('./print'),\n);\n\nexport { Create, Move, Play, Print } from './definitions';\n\nexport const ChessHandlers = Handlers;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAAA;;;;;;;;AAIA,SAASA,2BAA2B;AAEpC,IAAMC,WAAWD,oBAAoBE,KACnC,MAAM,OAAO,uBAAA,GACb,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,sBAAA,CAAA;AAKR,IAAMC,gBAAgBF;",
|
|
6
|
+
"names": ["OperationHandlerSet", "Handlers", "lazy", "ChessHandlers"]
|
|
7
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
Chess_exports
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OHBKSL2Q.mjs";
|
|
5
5
|
|
|
6
6
|
// src/operations/definitions.ts
|
|
7
7
|
import * as Schema from "effect/Schema";
|
|
8
|
+
import { Operation } from "@dxos/compute";
|
|
8
9
|
import { Database, Ref } from "@dxos/echo";
|
|
9
|
-
import { Operation } from "@dxos/operation";
|
|
10
10
|
var Create = Operation.make({
|
|
11
11
|
meta: {
|
|
12
12
|
key: "org.dxos.function.chess.create",
|
|
@@ -108,4 +108,4 @@ export {
|
|
|
108
108
|
Play,
|
|
109
109
|
Print
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-G2EHRXHX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/definitions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/compute';\nimport { Database, Ref } from '@dxos/echo';\n\nimport { Chess } from '../types';\n\nexport const Create = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.create',\n name: 'Create Chess',\n description: 'Creates a new chess game.',\n },\n input: Schema.Struct({\n name: Schema.optional(\n Schema.String.annotations({\n description: 'Name of the game.',\n }),\n ),\n pgn: Schema.optional(\n Schema.String.annotations({\n description: 'Portable Game Notation.',\n }),\n ),\n fen: Schema.optional(\n Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }),\n ),\n }),\n output: Chess.Game,\n services: [Database.Service],\n});\n\nexport const Move = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.move',\n name: 'Move',\n description: 'Makes a move in the given chess game.',\n },\n input: Schema.Struct({\n game: Ref.Ref(Chess.Game).annotations({\n description: 'The ID of the chess object.',\n }),\n move: Schema.String.annotations({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotations({\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: 'org.dxos.function.chess.play',\n name: 'Play',\n description: 'Uses the chess engine to play the next move.',\n },\n input: Schema.Struct({\n game: Ref.Ref(Chess.Game).annotations({\n description: 'The ID of the chess object.',\n }),\n side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({\n description: 'The side to play.',\n defaultValue: 'any',\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'The PGN of the game after the move was played.',\n }),\n move: Schema.optional(Schema.String).annotations({\n description: 'The move that was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Print = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.print',\n name: 'Print game',\n description: 'Prints the chess game to ASCII.',\n },\n input: Schema.Struct({\n pgn: Schema.optional(\n Schema.String.annotations({\n description: 'Portable Game Notation.',\n }),\n ),\n fen: Schema.optional(\n Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }),\n ),\n }),\n output: Schema.Struct({\n ascii: Schema.String,\n }),\n});\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,WAAW;AAIvB,IAAMC,SAASC,UAAUC,KAAK;EACnCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBH,MAAaI,gBACJC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFM,KAAYH,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFO,KAAYJ,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA;EACAQ,QAAQC,cAAMC;EACdC,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMC,OAAOnB,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBa,MAAMC,IAAIA,IAAIP,cAAMC,IAAI,EAAEL,YAAY;MACpCL,aAAa;IACf,CAAA;IACAiB,MAAab,cAAOC,YAAY;MAC9BL,aAAa;MACbkB,UAAU;QAAC;QAAM;;IACnB,CAAA;EACF,CAAA;EACAV,QAAeN,cAAO;IACpBI,KAAYF,cAAOC,YAAY;MAC7BL,aAAa;IACf,CAAA;EACF,CAAA;EACAW,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMM,OAAOxB,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBa,MAAMC,IAAIA,IAAIP,cAAMC,IAAI,EAAEL,YAAY;MACpCL,aAAa;IACf,CAAA;IACAoB,MAAajB,gBAAgBkB,eAAQ,SAAS,SAAS,KAAA,CAAA,EAAQhB,YAAY;MACzEL,aAAa;MACbsB,cAAc;IAChB,CAAA;EACF,CAAA;EACAd,QAAeN,cAAO;IACpBI,KAAYF,cAAOC,YAAY;MAC7BL,aAAa;IACf,CAAA;IACAiB,MAAad,gBAAgBC,aAAM,EAAEC,YAAY;MAC/CL,aAAa;IACf,CAAA;EACF,CAAA;EACAW,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMU,QAAQ5B,UAAUC,KAAK;EAClCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBI,KAAYH,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFO,KAAYJ,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA;EACAQ,QAAeN,cAAO;IACpBsB,OAAcpB;EAChB,CAAA;AACF,CAAA;",
|
|
6
|
+
"names": ["Schema", "Operation", "Database", "Ref", "Create", "Operation", "make", "meta", "key", "name", "description", "input", "Struct", "optional", "String", "annotations", "pgn", "fen", "output", "Chess", "Game", "services", "Database", "Service", "Move", "game", "Ref", "move", "examples", "Play", "side", "Literal", "defaultValue", "Print", "ascii"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/blueprints/chess-blueprint.ts
|
|
4
|
-
import { Blueprint, Template } from "@dxos/
|
|
4
|
+
import { Blueprint, Template } from "@dxos/compute";
|
|
5
5
|
import { trim } from "@dxos/util";
|
|
6
6
|
import { Create, Move, Play, Print } from "#operations";
|
|
7
7
|
var BLUEPRINT_KEY = "org.dxos.blueprint.chess";
|
|
@@ -35,4 +35,4 @@ var chess_blueprint_default = blueprint;
|
|
|
35
35
|
export {
|
|
36
36
|
chess_blueprint_default
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-NSFPC4IO.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blueprints/chess-blueprint.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Blueprint, Template } from '@dxos/compute';\nimport { trim } from '@dxos/util';\n\nimport { Create, Move, Play, Print } from '#operations';\n\nconst BLUEPRINT_KEY = 'org.dxos.blueprint.chess';\n\nconst operations = [Create, Move, Play, Print];\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'Chess',\n tools: Blueprint.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 }),\n });\n\nconst blueprint: Blueprint.Definition = {\n key: BLUEPRINT_KEY,\n make,\n};\n\nexport default blueprint;\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;AAErB,SAASC,QAAQC,MAAMC,MAAMC,aAAa;AAE1C,IAAMC,gBAAgB;AAEtB,IAAMC,aAAa;EAACL;EAAQC;EAAMC;EAAMC;;AAExC,IAAMG,OAAO,MACXT,UAAUS,KAAK;EACbC,KAAKH;EACLI,MAAM;EACNC,OAAOZ,UAAUa,gBAAgB;IAAEL;EAAW,CAAA;EAC9CM,cAAcb,SAASQ,KAAK;IAC1BM,QAAQb;;;;;;EAMV,CAAA;AACF,CAAA;AAEF,IAAMc,YAAkC;EACtCN,KAAKH;EACLE;AACF;AAEA,IAAA,0BAAeO;",
|
|
6
|
+
"names": ["Blueprint", "Template", "trim", "Create", "Move", "Play", "Print", "BLUEPRINT_KEY", "operations", "make", "key", "name", "tools", "toolDefinitions", "instructions", "source", "blueprint"]
|
|
7
|
+
}
|
|
@@ -46,12 +46,7 @@ var make = ({ name, pgn, fen } = {}) => {
|
|
|
46
46
|
try {
|
|
47
47
|
chess.loadPgn(pgn);
|
|
48
48
|
} catch {
|
|
49
|
-
log.warn(pgn, void 0, {
|
|
50
|
-
F: __dxlog_file,
|
|
51
|
-
L: 52,
|
|
52
|
-
S: void 0,
|
|
53
|
-
C: (f, a) => f(...a)
|
|
54
|
-
});
|
|
49
|
+
log.warn(pgn, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 40, S: void 0 });
|
|
55
50
|
}
|
|
56
51
|
}
|
|
57
52
|
return Obj.make(Game, {
|
|
@@ -65,4 +60,4 @@ var make = ({ name, pgn, fen } = {}) => {
|
|
|
65
60
|
export {
|
|
66
61
|
Chess_exports
|
|
67
62
|
};
|
|
68
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-OHBKSL2Q.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/Chess.ts"],
|
|
4
4
|
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { log } from '@dxos/log';\n\nexport const Game = Schema.Struct({\n name: Schema.optional(Schema.String),\n players: Schema.Struct({\n white: Schema.optional(\n Schema.String.annotations({\n description: 'DID of white player',\n }),\n ),\n black: Schema.optional(\n Schema.String.annotations({\n description: 'DID of black player',\n }),\n ),\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n pgn: Schema.String.annotations({\n description: 'Portable Game Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n fen: Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.chess',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({\n icon: 'ph--shield-chevron--regular',\n hue: 'amber',\n }),\n);\n\nexport interface Game extends Schema.Schema.Type<typeof Game> {}\n\nexport const make = ({ name, pgn, fen }: { name?: string; pgn?: string; fen?: string } = {}) => {\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(Game, {\n name,\n pgn,\n fen,\n players: {},\n });\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAAA;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,YAAYC,KAAKC,YAAY;AACtC,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,WAAW
|
|
6
|
-
"names": ["Chess", "ChessJS", "Schema", "Annotation", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "log", "Game", "
|
|
5
|
+
"mappings": ";;;;;;AAAA;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,YAAYC,KAAKC,YAAY;AACtC,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,WAAW;AAEpB,IAAA,eAAaC;AAEXC,IAASR,OAAc,cAAA;QACdA,gBACLA,aAAOS;WACLC,cAAa;IACf,OAAA,gBAAA,cAAA,YAAA;MAEFC,aAAcC;;IAGZ,OAAA,gBAAA,cAAA,YAAA;MAEIR,aAAAA;IACRS,CAAKb,CAAAA;UACHU,oBAAa,IAAA,KAAA,GAAA,eAAA;EACf,KAAQN,cAAAA,YAAuB;IAC/BU,aAAYL;UACVC,oBAAa,IAAA,KAAA,GAAA,eAAA;EACf,KAAQN,cAAAA,YAAuB;IAE/BD,aAAY;EACVY,CAAAA,EAAAA,KAAAA,oBAAU,IAAA,KAAA,GAAA,eAAA;QACVC,KAAS,OAAA;EAEXX,UAAAA;EAAqB,SAAA;CAAO,GAC5BJ,gBAAWgB,IAAAA;EACTC;IACAC,WAAK,eAAA,IAAA;EAEP,MAAA;EAIF,KAAO;;AAEL,IAAS,OAAA,CAAA,EAAA,MAAA,KAAA,IAAA,IAAA,CAAA,MAAA;QACP,QAAI,IAAA,QAAA;WACFC;AACF,QAAE;AACAd,YAAIe,QAAKR,GAAAA;IACX,QAAA;AACF,UAAA,KAAA,KAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;IAEA;;SAEEA,IAAAA,KAAAA,MAAAA;IACAC;IACAN;IACF;IACA,SAAA,CAAA;;;",
|
|
6
|
+
"names": ["Chess", "ChessJS", "Schema", "Annotation", "Obj", "Type", "FormInputAnnotation", "LabelAnnotation", "log", "Game", "players", "String", "description", "black", "optional", "pgn", "fen", "typename", "version", "IconAnnotation", "icon", "hue", "chess", "warn"]
|
|
7
7
|
}
|