@dxos/plugin-game 0.0.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/LICENSE +105 -0
- package/PLUGIN.mdl +334 -0
- package/dist/lib/neutral/GameArticle-AUJ4YDKW.mjs +40 -0
- package/dist/lib/neutral/GameArticle-AUJ4YDKW.mjs.map +7 -0
- package/dist/lib/neutral/GameCard-QBKHIL4Q.mjs +32 -0
- package/dist/lib/neutral/GameCard-QBKHIL4Q.mjs.map +7 -0
- package/dist/lib/neutral/GamePlugin.mjs +38 -0
- package/dist/lib/neutral/GamePlugin.mjs.map +7 -0
- package/dist/lib/neutral/GamePlugin.node.mjs +21 -0
- package/dist/lib/neutral/GamePlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/GamePlugin.workerd.mjs +18 -0
- package/dist/lib/neutral/GamePlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DSUJWWNN.mjs +98 -0
- package/dist/lib/neutral/chunk-DSUJWWNN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-R4V5PVU7.mjs +50 -0
- package/dist/lib/neutral/chunk-R4V5PVU7.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +96 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +11 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-UAD2JUWF.mjs +51 -0
- package/dist/lib/neutral/create-object-UAD2JUWF.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +24 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-GO3SKEMA.mjs +35 -0
- package/dist/lib/neutral/react-surface-GO3SKEMA.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +34 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +20 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/GamePlugin.d.ts +4 -0
- package/dist/types/src/GamePlugin.d.ts.map +1 -0
- package/dist/types/src/GamePlugin.node.d.ts +10 -0
- package/dist/types/src/GamePlugin.node.d.ts.map +1 -0
- package/dist/types/src/GamePlugin.workerd.d.ts +4 -0
- package/dist/types/src/GamePlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +5 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/CreateGamePanel.d.ts +19 -0
- package/dist/types/src/components/CreateGamePanel.d.ts.map +1 -0
- package/dist/types/src/components/CreateGamePanel.stories.d.ts +49 -0
- package/dist/types/src/components/CreateGamePanel.stories.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/containers/GameArticle/GameArticle.d.ts +6 -0
- package/dist/types/src/containers/GameArticle/GameArticle.d.ts.map +1 -0
- package/dist/types/src/containers/GameArticle/index.d.ts +2 -0
- package/dist/types/src/containers/GameArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/GameCard/GameCard.d.ts +6 -0
- package/dist/types/src/containers/GameCard/GameCard.d.ts.map +1 -0
- package/dist/types/src/containers/GameCard/index.d.ts +2 -0
- package/dist/types/src/containers/GameCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +33 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +36 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types/Game.d.ts +67 -0
- package/dist/types/src/types/Game.d.ts.map +1 -0
- package/dist/types/src/types/GameCapabilities.d.ts +10 -0
- package/dist/types/src/types/GameCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +46 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/src/util/load-game.d.ts +21 -0
- package/dist/types/src/util/load-game.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dx.config.ts +40 -0
- package/package.json +124 -0
- package/src/GamePlugin.node.tsx +24 -0
- package/src/GamePlugin.tsx +27 -0
- package/src/GamePlugin.workerd.tsx +13 -0
- package/src/capabilities/create-object.ts +67 -0
- package/src/capabilities/index.ts +8 -0
- package/src/capabilities/react-surface.tsx +36 -0
- package/src/components/CreateGamePanel.stories.tsx +92 -0
- package/src/components/CreateGamePanel.tsx +127 -0
- package/src/components/index.ts +5 -0
- package/src/containers/GameArticle/GameArticle.tsx +42 -0
- package/src/containers/GameArticle/index.ts +5 -0
- package/src/containers/GameCard/GameCard.tsx +35 -0
- package/src/containers/GameCard/index.ts +5 -0
- package/src/containers/index.ts +8 -0
- package/src/index.ts +6 -0
- package/src/meta.ts +9 -0
- package/src/plugin.ts +9 -0
- package/src/translations.ts +34 -0
- package/src/types/Game.ts +106 -0
- package/src/types/GameCapabilities.ts +19 -0
- package/src/types/index.ts +9 -0
- package/src/types/types.ts +53 -0
- package/src/util/index.ts +5 -0
- package/src/util/load-game.ts +41 -0
- package/src/vite-env.d.ts +10 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Game
|
|
3
|
+
} from "./chunk-DSUJWWNN.mjs";
|
|
4
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
5
|
+
|
|
6
|
+
// src/capabilities/react-surface.tsx
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
10
|
+
import { Surface } from "@dxos/app-framework/ui";
|
|
11
|
+
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
12
|
+
import { GameArticle, GameCard } from "#containers";
|
|
13
|
+
var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactSurface, [
|
|
14
|
+
Surface.create({
|
|
15
|
+
id: "game",
|
|
16
|
+
filter: AppSurface.oneOf(AppSurface.object(AppSurface.Article, Game), AppSurface.object(AppSurface.Section, Game)),
|
|
17
|
+
component: ({ data, role }) => /* @__PURE__ */ React.createElement(GameArticle, {
|
|
18
|
+
role,
|
|
19
|
+
subject: data.subject,
|
|
20
|
+
attendableId: data.attendableId
|
|
21
|
+
})
|
|
22
|
+
}),
|
|
23
|
+
Surface.create({
|
|
24
|
+
id: "gameCard",
|
|
25
|
+
filter: AppSurface.object(AppSurface.CardContent, Game),
|
|
26
|
+
component: ({ data, role }) => /* @__PURE__ */ React.createElement(GameCard, {
|
|
27
|
+
role,
|
|
28
|
+
subject: data.subject
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
])));
|
|
32
|
+
export {
|
|
33
|
+
react_surface_default as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=react-surface-GO3SKEMA.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\n\nimport { GameArticle, GameCard } from '#containers';\n\nimport { Game } from '../types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: 'game',\n filter: AppSurface.oneOf(\n AppSurface.object(AppSurface.Article, Game),\n AppSurface.object(AppSurface.Section, Game),\n ),\n component: ({ data, role }) => (\n <GameArticle role={role} subject={data.subject} attendableId={data.attendableId} />\n ),\n }),\n Surface.create({\n id: 'gameCard',\n filter: AppSurface.object(AppSurface.CardContent, Game),\n component: ({ data, role }) => <GameCard role={role} subject={data.subject} />,\n }),\n ]),\n ),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,WAAW;AAElB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,eAAe;AACxB,SAASC,kBAAkB;AAE3B,SAASC,aAAaC,gBAAgB;AAItC,IAAA,wBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,aAAaC,cAAc;EAChDC,QAAQC,OAAO;IACbC,IAAI;IACJC,QAAQC,WAAWC,MACjBD,WAAWE,OAAOF,WAAWG,SAASC,IAAAA,GACtCJ,WAAWE,OAAOF,WAAWK,SAASD,IAAAA,CAAAA;IAExCE,WAAW,CAAC,EAAEC,MAAMC,KAAI,MACtB,sBAAA,cAACC,aAAAA;MAAYD;MAAYE,SAASH,KAAKG;MAASC,cAAcJ,KAAKI;;EAEvE,CAAA;EACAf,QAAQC,OAAO;IACbC,IAAI;IACJC,QAAQC,WAAWE,OAAOF,WAAWY,aAAaR,IAAAA;IAClDE,WAAW,CAAC,EAAEC,MAAMC,KAAI,MAAO,sBAAA,cAACK,UAAAA;MAASL;MAAYE,SAASH,KAAKG;;EACrE,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "React", "Capabilities", "Capability", "Surface", "AppSurface", "GameArticle", "GameCard", "Capability", "makeModule", "succeed", "contributes", "Capabilities", "ReactSurface", "Surface", "create", "id", "filter", "AppSurface", "oneOf", "object", "Article", "Game", "Section", "component", "data", "role", "GameArticle", "subject", "attendableId", "CardContent", "GameCard"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/translations.ts
|
|
4
|
+
import { Type } from "@dxos/echo";
|
|
5
|
+
import { meta } from "#meta";
|
|
6
|
+
import { Game } from "#types";
|
|
7
|
+
var translations = [
|
|
8
|
+
{
|
|
9
|
+
"en-US": {
|
|
10
|
+
[Type.getTypename(Game)]: {
|
|
11
|
+
"typename.label": "Game",
|
|
12
|
+
"typename.label_zero": "Games",
|
|
13
|
+
"typename.label_one": "Game",
|
|
14
|
+
"typename.label_other": "Games",
|
|
15
|
+
"object-name.placeholder": "New game",
|
|
16
|
+
"add-object.label": "Add game",
|
|
17
|
+
"rename-object.label": "Rename game",
|
|
18
|
+
"delete-object.label": "Delete game",
|
|
19
|
+
"object-deleted.label": "Game deleted"
|
|
20
|
+
},
|
|
21
|
+
[meta.profile.key]: {
|
|
22
|
+
"plugin.name": "Game",
|
|
23
|
+
"create-panel.variant.label": "Select variant",
|
|
24
|
+
"create-panel.variant.placeholder": "Search variants...",
|
|
25
|
+
"create-panel.submit.label": "Create",
|
|
26
|
+
"unsupported-variant.label": "Unsupported game variant"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
export {
|
|
32
|
+
translations
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=translations.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Type } from '@dxos/echo';\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from '#meta';\nimport { Game } from '#types';\n\nexport const translations = [\n {\n 'en-US': {\n [Type.getTypename(Game)]: {\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.profile.key]: {\n 'plugin.name': 'Game',\n 'create-panel.variant.label': 'Select variant',\n 'create-panel.variant.placeholder': 'Search variants...',\n 'create-panel.submit.label': 'Create',\n 'unsupported-variant.label': 'Unsupported game variant',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,YAAY;AAGrB,SAASC,YAAY;AACrB,SAASC,YAAY;AAEd,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACH,KAAKI,YAAYF,IAAAA,CAAAA,GAAQ;QACxB,kBAAkB;QAClB,uBAAuB;QACvB,sBAAsB;QACtB,wBAAwB;QACxB,2BAA2B;QAC3B,oBAAoB;QACpB,uBAAuB;QACvB,uBAAuB;QACvB,wBAAwB;MAC1B;MACA,CAACD,KAAKI,QAAQC,GAAG,GAAG;QAClB,eAAe;QACf,8BAA8B;QAC9B,oCAAoC;QACpC,6BAA6B;QAC7B,6BAA6B;MAC/B;IACF;EACF;;",
|
|
6
|
+
"names": ["Type", "meta", "Game", "translations", "getTypename", "profile", "key"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Game,
|
|
3
|
+
GameCapabilities_exports,
|
|
4
|
+
GameRef,
|
|
5
|
+
GameVariantMismatchError,
|
|
6
|
+
Player,
|
|
7
|
+
loadGame,
|
|
8
|
+
make
|
|
9
|
+
} from "../chunk-DSUJWWNN.mjs";
|
|
10
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
11
|
+
export {
|
|
12
|
+
Game,
|
|
13
|
+
GameCapabilities_exports as GameCapabilities,
|
|
14
|
+
GameRef,
|
|
15
|
+
GameVariantMismatchError,
|
|
16
|
+
Player,
|
|
17
|
+
loadGame,
|
|
18
|
+
make
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
readonly plugin: {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly description?: string | undefined;
|
|
6
|
+
readonly author?: string | undefined;
|
|
7
|
+
readonly homePage?: string | undefined;
|
|
8
|
+
readonly source?: string | undefined;
|
|
9
|
+
readonly screenshots?: readonly {
|
|
10
|
+
readonly light?: string | undefined;
|
|
11
|
+
readonly dark?: string | undefined;
|
|
12
|
+
}[] | undefined;
|
|
13
|
+
readonly tags?: readonly string[] | undefined;
|
|
14
|
+
readonly icon?: {
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly hue?: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
readonly spec?: string | undefined;
|
|
19
|
+
readonly dependsOn?: readonly string[] | undefined;
|
|
20
|
+
};
|
|
21
|
+
readonly publish?: {
|
|
22
|
+
readonly buildCommand?: string | undefined;
|
|
23
|
+
readonly outputDirectory?: string | undefined;
|
|
24
|
+
readonly assetBaseUrl?: string | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
28
|
+
//# sourceMappingURL=dx.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dx.config.d.ts","sourceRoot":"","sources":["../../dx.config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GamePlugin.d.ts","sourceRoot":"","sources":["../../../src/GamePlugin.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAW7C,eAAO,MAAM,UAAU,4BAStB,CAAC;eAEa,UAAU"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Plugin } from '@dxos/app-framework';
|
|
2
|
+
/**
|
|
3
|
+
* Headless variant of GamePlugin (no React surfaces / CreateObject panel).
|
|
4
|
+
* Used in node contexts (CLI, agents, tests) where rendering is unavailable —
|
|
5
|
+
* the full variant lazy-loads `CreateGamePanel` from `react-ui-search` which
|
|
6
|
+
* downstream bundlers don't resolve cleanly under nested pnpm symlinks.
|
|
7
|
+
*/
|
|
8
|
+
export declare const GamePlugin: Plugin.PluginFactory<void>;
|
|
9
|
+
export default GamePlugin;
|
|
10
|
+
//# sourceMappingURL=GamePlugin.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GamePlugin.node.d.ts","sourceRoot":"","sources":["../../../src/GamePlugin.node.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO7C;;;;;GAKG;AACH,eAAO,MAAM,UAAU,4BAItB,CAAC;eAEa,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GamePlugin.workerd.d.ts","sourceRoot":"","sources":["../../../src/GamePlugin.workerd.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C,eAAO,MAAM,UAAU,4BAAuF,CAAC;eAEhG,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-object.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/create-object.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Capability } from '@dxos/app-framework';
|
|
2
|
+
export declare const CreateObject: Capability.LazyCapability<void, Capability.ModuleReturn, Error>;
|
|
3
|
+
export declare const ReactSurface: Capability.LazyCapability<void, Capability.ModuleReturn, Error>;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,YAAY,iEAAmE,CAAC;AAC7F,eAAO,MAAM,YAAY,iEAAmE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAgB,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type SpaceCapabilities } from '@dxos/plugin-space';
|
|
3
|
+
import { type GameVariant } from '#types';
|
|
4
|
+
export type CreateGamePanelProps = SpaceCapabilities.CreateObjectCustomPanelProps & {
|
|
5
|
+
/** Optional override (primarily for stories/tests). Defaults to GameCapabilities.VariantProvider. */
|
|
6
|
+
variants?: GameVariant[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Two-stage create panel for games:
|
|
10
|
+
* 1. Variant picker (SearchList over contributed `GameVariant[]`).
|
|
11
|
+
* 2. Variant-specific input form (rendered from variant.inputSchema).
|
|
12
|
+
*
|
|
13
|
+
* On submit, calls `onCreateObject({ variantId, name, input })` where `input` is the
|
|
14
|
+
* variant-specific form values. Plugin-game's CreateObjectEntry.createObject resolves
|
|
15
|
+
* the variantId, builds the variant state object via variant.createVariant, then wraps
|
|
16
|
+
* it in a Game.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CreateGamePanel: ({ target, onCreateObject, variants: variantsProp }: CreateGamePanelProps) => React.JSX.Element | null;
|
|
19
|
+
//# sourceMappingURL=CreateGamePanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateGamePanel.d.ts","sourceRoot":"","sources":["../../../../src/components/CreateGamePanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAM5D,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE5D,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,4BAA4B,GAAG;IAClF,qGAAqG;IACrG,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,uDAAwD,oBAAoB,6BA2DvG,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: () => React.JSX.Element;
|
|
6
|
+
decorators: import("@storybook/react").Decorator[];
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
translations: [{
|
|
10
|
+
readonly 'en-US': {
|
|
11
|
+
readonly [x: string]: {
|
|
12
|
+
readonly 'typename.label': 'Game';
|
|
13
|
+
readonly 'typename.label_zero': 'Games';
|
|
14
|
+
readonly 'typename.label_one': 'Game';
|
|
15
|
+
readonly 'typename.label_other': 'Games';
|
|
16
|
+
readonly 'object-name.placeholder': 'New game';
|
|
17
|
+
readonly 'add-object.label': 'Add game';
|
|
18
|
+
readonly 'rename-object.label': 'Rename game';
|
|
19
|
+
readonly 'delete-object.label': 'Delete game';
|
|
20
|
+
readonly 'object-deleted.label': 'Game deleted';
|
|
21
|
+
readonly 'plugin.name'?: undefined;
|
|
22
|
+
readonly 'create-panel.variant.label'?: undefined;
|
|
23
|
+
readonly 'create-panel.variant.placeholder'?: undefined;
|
|
24
|
+
readonly 'create-panel.submit.label'?: undefined;
|
|
25
|
+
readonly 'unsupported-variant.label'?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
readonly 'typename.label'?: undefined;
|
|
28
|
+
readonly 'typename.label_zero'?: undefined;
|
|
29
|
+
readonly 'typename.label_one'?: undefined;
|
|
30
|
+
readonly 'typename.label_other'?: undefined;
|
|
31
|
+
readonly 'object-name.placeholder'?: undefined;
|
|
32
|
+
readonly 'add-object.label'?: undefined;
|
|
33
|
+
readonly 'rename-object.label'?: undefined;
|
|
34
|
+
readonly 'delete-object.label'?: undefined;
|
|
35
|
+
readonly 'object-deleted.label'?: undefined;
|
|
36
|
+
readonly 'plugin.name': 'Game';
|
|
37
|
+
readonly 'create-panel.variant.label': 'Select variant';
|
|
38
|
+
readonly 'create-panel.variant.placeholder': 'Search variants...';
|
|
39
|
+
readonly 'create-panel.submit.label': 'Create';
|
|
40
|
+
readonly 'unsupported-variant.label': 'Unsupported game variant';
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default meta;
|
|
47
|
+
type Story = StoryObj<typeof meta>;
|
|
48
|
+
export declare const Default: Story;
|
|
49
|
+
//# sourceMappingURL=CreateGamePanel.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateGamePanel.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/CreateGamePanel.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAyExC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK2B,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
3
|
+
import { type Game } from '#types';
|
|
4
|
+
export type GameArticleProps = AppSurface.ObjectArticleProps<Game>;
|
|
5
|
+
export declare const GameArticle: ({ role, attendableId, subject: game }: GameArticleProps) => React.JSX.Element | null;
|
|
6
|
+
//# sourceMappingURL=GameArticle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GameArticle.d.ts","sourceRoot":"","sources":["../../../../../src/containers/GameArticle/GameArticle.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAMvD,OAAO,EAAE,KAAK,IAAI,EAAoB,MAAM,QAAQ,CAAC;AAErD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAEnE,eAAO,MAAM,WAAW,0CAA2C,gBAAgB,6BAwBlF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/containers/GameArticle/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
3
|
+
import { type Game } from '#types';
|
|
4
|
+
export type GameCardProps = AppSurface.ObjectCardProps<Game>;
|
|
5
|
+
export declare const GameCard: ({ role, subject: game }: GameCardProps) => React.JSX.Element | null;
|
|
6
|
+
//# sourceMappingURL=GameCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GameCard.d.ts","sourceRoot":"","sources":["../../../../../src/containers/GameCard/GameCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIvD,OAAO,EAAE,KAAK,IAAI,EAAoB,MAAM,QAAQ,CAAC;AAErD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAE7D,eAAO,MAAM,QAAQ,4BAA6B,aAAa,6BAmB9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/containers/GameCard/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/containers/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAQ,MAAM,OAAO,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,GAAG,CAAuC,CAAC;AACnF,eAAO,MAAM,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const meta: {
|
|
2
|
+
readonly profile: {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly description?: string | undefined;
|
|
6
|
+
readonly homePage?: string | undefined;
|
|
7
|
+
readonly source?: string | undefined;
|
|
8
|
+
readonly tags?: readonly string[] | undefined;
|
|
9
|
+
readonly screenshots?: readonly {
|
|
10
|
+
readonly light?: string | undefined;
|
|
11
|
+
readonly dark?: string | undefined;
|
|
12
|
+
}[] | undefined;
|
|
13
|
+
readonly icon?: {
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly hue?: string | undefined;
|
|
16
|
+
} | undefined;
|
|
17
|
+
readonly dependsOn?: readonly string[] | undefined;
|
|
18
|
+
readonly spec?: string | undefined;
|
|
19
|
+
readonly createdAt?: string | undefined;
|
|
20
|
+
readonly author?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
readonly release?: {
|
|
23
|
+
readonly version: string;
|
|
24
|
+
readonly moduleUrl: string;
|
|
25
|
+
readonly dependencies?: {
|
|
26
|
+
readonly [x: string]: string;
|
|
27
|
+
} | undefined;
|
|
28
|
+
readonly pluginKey?: string | undefined;
|
|
29
|
+
readonly manifestHash?: string | undefined;
|
|
30
|
+
readonly createdAt?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C,eAAO,MAAM,UAAU,4BAA6C,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const translations: [{
|
|
2
|
+
readonly 'en-US': {
|
|
3
|
+
readonly [x: string]: {
|
|
4
|
+
readonly 'typename.label': 'Game';
|
|
5
|
+
readonly 'typename.label_zero': 'Games';
|
|
6
|
+
readonly 'typename.label_one': 'Game';
|
|
7
|
+
readonly 'typename.label_other': 'Games';
|
|
8
|
+
readonly 'object-name.placeholder': 'New game';
|
|
9
|
+
readonly 'add-object.label': 'Add game';
|
|
10
|
+
readonly 'rename-object.label': 'Rename game';
|
|
11
|
+
readonly 'delete-object.label': 'Delete game';
|
|
12
|
+
readonly 'object-deleted.label': 'Game deleted';
|
|
13
|
+
readonly 'plugin.name'?: undefined;
|
|
14
|
+
readonly 'create-panel.variant.label'?: undefined;
|
|
15
|
+
readonly 'create-panel.variant.placeholder'?: undefined;
|
|
16
|
+
readonly 'create-panel.submit.label'?: undefined;
|
|
17
|
+
readonly 'unsupported-variant.label'?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
readonly 'typename.label'?: undefined;
|
|
20
|
+
readonly 'typename.label_zero'?: undefined;
|
|
21
|
+
readonly 'typename.label_one'?: undefined;
|
|
22
|
+
readonly 'typename.label_other'?: undefined;
|
|
23
|
+
readonly 'object-name.placeholder'?: undefined;
|
|
24
|
+
readonly 'add-object.label'?: undefined;
|
|
25
|
+
readonly 'rename-object.label'?: undefined;
|
|
26
|
+
readonly 'delete-object.label'?: undefined;
|
|
27
|
+
readonly 'object-deleted.label'?: undefined;
|
|
28
|
+
readonly 'plugin.name': 'Game';
|
|
29
|
+
readonly 'create-panel.variant.label': 'Select variant';
|
|
30
|
+
readonly 'create-panel.variant.placeholder': 'Search variants...';
|
|
31
|
+
readonly 'create-panel.submit.label': 'Create';
|
|
32
|
+
readonly 'unsupported-variant.label': 'Unsupported game variant';
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}];
|
|
36
|
+
//# sourceMappingURL=translations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY;;;uCAIC,MAAM;4CACD,OAAO;2CACR,MAAM;6CACJ,OAAO;gDACJ,UAAU;yCACjB,UAAU;4CACP,aAAa;4CACb,aAAa;6CACZ,cAAc;;;;;;;;;;;;;;;;oCAGvB,MAAM;mDACS,gBAAgB;yDACV,oBAAoB;kDAC3B,QAAQ;kDACR,0BAA0B;;;EAIhC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { Obj, Ref, Type } from '@dxos/echo';
|
|
3
|
+
/**
|
|
4
|
+
* A player in a game.
|
|
5
|
+
* `role` is variant-defined (e.g. 'white' | 'black' for chess, 'x' | 'o' for tictactoe).
|
|
6
|
+
* `identity` is the optional DID of a human player; absent for AI or empty seats.
|
|
7
|
+
* `name` is an optional display label (useful for AI/guest players).
|
|
8
|
+
*/
|
|
9
|
+
export declare const Player: Schema.Struct<{
|
|
10
|
+
role: Schema.SchemaClass<string, string, never>;
|
|
11
|
+
identity: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
12
|
+
name: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
13
|
+
}>;
|
|
14
|
+
export type Player = Schema.Schema.Type<typeof Player>;
|
|
15
|
+
declare const Game_base: Type.ObjClass<Game, {
|
|
16
|
+
readonly name?: string | undefined;
|
|
17
|
+
readonly players?: {
|
|
18
|
+
readonly role: string;
|
|
19
|
+
readonly identity?: string | undefined;
|
|
20
|
+
readonly name?: string | undefined;
|
|
21
|
+
}[] | undefined;
|
|
22
|
+
readonly variant: import("@dxos/echo/internal").Ref<Obj.Unknown>;
|
|
23
|
+
}, {}>;
|
|
24
|
+
/**
|
|
25
|
+
* Base Game object. Variant-specific state lives in a separate referenced object.
|
|
26
|
+
* Unifies all game variants (chess, tic-tac-toe, ...) under one typename so they share
|
|
27
|
+
* graph node, create flow, and shared surface scaffolding.
|
|
28
|
+
*/
|
|
29
|
+
export declare class Game extends Game_base {
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Variant-narrowed reference to a Game.
|
|
33
|
+
*
|
|
34
|
+
* Encodes — at the type level — that the variant ref points to a specific state type.
|
|
35
|
+
* Runtime narrowing is performed by `loadGame(ref, variantType)` which validates and
|
|
36
|
+
* returns the resolved Game together with its typed variant state.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* input: Schema.Struct({
|
|
41
|
+
* game: GameRef(Chess.State),
|
|
42
|
+
* }),
|
|
43
|
+
* // handler:
|
|
44
|
+
* const { game, variant } = yield* loadGame(input.game, Chess.State);
|
|
45
|
+
* // `variant` is typed as Chess.State.
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export type GameRef<_V> = Ref.Ref<Game>;
|
|
49
|
+
export declare const GameRef: <S extends Type.AnyObj>(_variantType: S) => Schema.Schema<GameRef<Type.InstanceType<S>>, any, never>;
|
|
50
|
+
/**
|
|
51
|
+
* Build a base `Game` object referencing the given variant-state ECHO object.
|
|
52
|
+
*
|
|
53
|
+
* The variant is stored as a `Ref` so the underlying state (e.g. `Chess.State`,
|
|
54
|
+
* `TicTacToe.State`) lives as its own ECHO object alongside the Game.
|
|
55
|
+
*
|
|
56
|
+
* @param name Optional display name shown in the graph node and Properties form.
|
|
57
|
+
* @param variant Variant-specific state object (e.g. `Chess.State`, `TicTacToe.State`).
|
|
58
|
+
* @param players Optional initial players; copied into a mutable array on the Game.
|
|
59
|
+
* @returns A new `Game` object with `variant` stored as a Ref.
|
|
60
|
+
*/
|
|
61
|
+
export declare const make: ({ name, players, variant, }: {
|
|
62
|
+
name?: string;
|
|
63
|
+
players?: ReadonlyArray<Player>;
|
|
64
|
+
variant: Obj.Unknown;
|
|
65
|
+
}) => Game;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=Game.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Game.d.ts","sourceRoot":"","sources":["../../../../src/types/Game.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAmB,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAG7D;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;EAcjB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,CAAC;;;;;;;;;;AAEvD;;;;GAIG;AACH,qBAAa,IAAK,SAAQ,SAiBzB;CAAG;AAEJ;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,OAAO,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,IAAI,CAAC,MAAM,gBAAgB,CAAC,KAC3C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,gCAId;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;CACtB,KAAG,IAMH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Capability } from '@dxos/app-framework';
|
|
2
|
+
import type { GameVariant } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A game variant contribution. Each variant plugin (chess, tic-tac-toe, ...)
|
|
5
|
+
* contributes one of these via `Capability.contributes(GameCapabilities.VariantProvider, variant)`.
|
|
6
|
+
* Consumers iterate via `Capability.getAll(GameCapabilities.VariantProvider)` (Effect) or
|
|
7
|
+
* `useCapabilities(GameCapabilities.VariantProvider)` (React).
|
|
8
|
+
*/
|
|
9
|
+
export declare const VariantProvider: Capability.InterfaceDef<GameVariant>;
|
|
10
|
+
//# sourceMappingURL=GameCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GameCapabilities.d.ts","sourceRoot":"","sources":["../../../../src/types/GameCapabilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,sCAAyE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACrD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type * as Effect from 'effect/Effect';
|
|
2
|
+
import type * as Schema from 'effect/Schema';
|
|
3
|
+
import type { ComponentType } from 'react';
|
|
4
|
+
import type { Database, Obj, Type } from '@dxos/echo';
|
|
5
|
+
import type { Game } from './Game';
|
|
6
|
+
/**
|
|
7
|
+
* Contribution from a variant plugin (e.g. plugin-chess, plugin-tictactoe).
|
|
8
|
+
* Defines how a game variant is created, rendered, and the roles its players take.
|
|
9
|
+
*/
|
|
10
|
+
export type GameVariant = {
|
|
11
|
+
/** Stable id, typically the variant state typename (e.g. 'org.dxos.type.chess.state'). */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Human-readable variant name (e.g. 'Chess'). */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Optional Phosphor icon name (e.g. 'ph--shield-chevron--regular'). */
|
|
16
|
+
icon?: string;
|
|
17
|
+
/** ECHO Type entity of the variant state object referenced by `Game.variant`. */
|
|
18
|
+
variantType: Type.AnyObj;
|
|
19
|
+
/**
|
|
20
|
+
* Optional Effect Schema rendered as a form after the user picks the variant.
|
|
21
|
+
* To use a `Type.Type` entity, extract its schema first via `Type.getSchema(...)`.
|
|
22
|
+
*/
|
|
23
|
+
inputSchema?: Schema.Schema.AnyNoContext;
|
|
24
|
+
/** Roles a player may take in this variant (e.g. ['white', 'black']). */
|
|
25
|
+
roles: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* Build the variant state object from the user's form input. May allocate ECHO
|
|
28
|
+
* objects, run effects, etc. Returned object is added to the database alongside the Game.
|
|
29
|
+
*/
|
|
30
|
+
createVariant: (input: Record<string, any>) => Effect.Effect<Obj.Any, Error, Database.Service>;
|
|
31
|
+
/** Optional Card surface component for this variant. */
|
|
32
|
+
card?: ComponentType<GameVariantSurfaceProps>;
|
|
33
|
+
/** Optional Article/Section surface component for this variant. */
|
|
34
|
+
article?: ComponentType<GameVariantSurfaceProps>;
|
|
35
|
+
};
|
|
36
|
+
export type GameVariantSurfaceProps = {
|
|
37
|
+
/** The base Game object (may be a snapshot from useObject/Surface). */
|
|
38
|
+
game: Obj.Snapshot<Game> | Game;
|
|
39
|
+
/** The resolved variant state object (may be a snapshot from useObject). */
|
|
40
|
+
variant: Obj.Snapshot<Obj.Unknown> | Obj.Unknown;
|
|
41
|
+
/** Surface role passed through from the host. */
|
|
42
|
+
role?: string;
|
|
43
|
+
/** Attendable id passed through from the host. */
|
|
44
|
+
attendableId?: string;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,0FAA0F;IAC1F,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACzC,yEAAyE;IACzE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/F,wDAAwD;IACxD,IAAI,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAC9C,mEAAmE;IACnE,OAAO,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,uEAAuE;IACvE,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAChC,4EAA4E;IAC5E,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACjD,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC"}
|