@dreamboard-games/sdk 0.5.0-alpha.35 → 0.5.0-alpha.37

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.
@@ -1,4 +1,4 @@
1
- import { l as BoardSpaceTarget, by as TopologyDefinitions, j as BoardIdOfTable, bs as TileSpaceId, ba as SeatSpaceRef, bg as SpaceIdOfTable, bv as TiledBoardIdOfTable, bw as TiledEdgeIdOfTable, bx as TiledVertexIdOfTable, m as BoardStateOfTable, aF as PositionTarget, bb as SeatTileRef, b0 as RuntimeJson, b8 as SeatBoardTopology, be as SourceSnapshot, bf as SourceState, bj as SubmitResult, ac as InteractionInputDescriptor, $ as InputDomain, S as GameSource, ay as PhaseNamesOfDefinition, ab as InteractionIdOfDefinitionPhase, w as ClientParamsOfInteractionOfDefinition, _ as InputCollectorOfDefinition, bH as ViewOfDefinition, a8 as InteractionDescriptor, aK as ProjectedTile, aM as ReadonlyRuntimeData, n as BoardTopologyOf, W as HiddenCardId, bB as ViewCard, bC as ViewCardOfTable, N as GameEvent } from './extract-BF6nUlze.js';
1
+ import { l as BoardSpaceTarget, by as TopologyDefinitions, j as BoardIdOfTable, bs as TileSpaceId, ba as SeatSpaceRef, bg as SpaceIdOfTable, bv as TiledBoardIdOfTable, bw as TiledEdgeIdOfTable, bx as TiledVertexIdOfTable, m as BoardStateOfTable, aF as PositionTarget, bb as SeatTileRef, b0 as RuntimeJson, b8 as SeatBoardTopology, be as SourceSnapshot, bf as SourceState, bj as SubmitResult, ac as InteractionInputDescriptor, $ as InputDomain, S as GameSource, ay as PhaseNamesOfDefinition, ab as InteractionIdOfDefinitionPhase, w as ClientParamsOfInteractionOfDefinition, _ as InputCollectorOfDefinition, bH as ViewOfDefinition, a8 as InteractionDescriptor, aK as ProjectedTile, aM as ReadonlyRuntimeData, n as BoardTopologyOf, W as HiddenCardId, bB as ViewCard, bC as ViewCardOfTable, N as GameEvent } from './extract-_TyEXSCt.js';
2
2
  import { z } from 'zod';
3
3
  import { Store } from '@tanstack/store';
4
4
 
@@ -527,7 +527,7 @@ interface InteractionBase<G, K extends InteractionKey<G>> {
527
527
  readonly help?: string;
528
528
  readonly kind: "inputs" | "steps";
529
529
  readonly game: CoreInstance<G>;
530
- getAvailability(): InteractionDescriptor["availability"];
530
+ getAvailability(params?: InteractionParams<G, K>): InteractionDescriptor["availability"];
531
531
  getIsAvailable(params?: InteractionParams<G, K>): boolean;
532
532
  getUnavailableReason(): string | null;
533
533
  getStep(): InteractionDescriptor["step"] | null;
package/dist/react.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { PointerEvent, FocusEvent, MouseEvent, DragEvent, CSSProperties, ReactNode } from 'react';
3
- import { aF as PositionTarget, bM as ZoneVisibility, S as GameSource } from './extract-BF6nUlze.js';
4
- import { f as ShortcutZoneTarget, c as ShortcutOptions, e as ShortcutTarget, b as ShortcutHint } from './shortcuts-BQEIVHSm.js';
5
- import { a7 as TargetOptions, r as Features, C as Card, a4 as SeatCardId, p as DropTarget, I as IdOf, ae as ZoneHostId, J as InstanceOptions, n as CoreInstance, q as FeatureContext, G as GameInstance, s as GameSnapshot, o as DropAreaBinding } from './model-C7ScBVY5.js';
3
+ import { aF as PositionTarget, bM as ZoneVisibility, S as GameSource } from './extract-_TyEXSCt.js';
4
+ import { f as ShortcutZoneTarget, c as ShortcutOptions, e as ShortcutTarget, b as ShortcutHint } from './shortcuts-DXkAlfNw.js';
5
+ import { a7 as TargetOptions, r as Features, C as Card, a4 as SeatCardId, p as DropTarget, I as IdOf, ae as ZoneHostId, J as InstanceOptions, n as CoreInstance, q as FeatureContext, G as GameInstance, s as GameSnapshot, o as DropAreaBinding } from './model-U0F5B3cr.js';
6
6
  import '@tanstack/store';
7
7
  import 'zod';
8
8
  import 'honeycomb-grid';
package/dist/react.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createGestureRecognizer,
4
4
  isSameDropTarget,
5
5
  magneticDropPoint
6
- } from "./chunk-JWPWE5EI.js";
6
+ } from "./chunk-54U3ZCFA.js";
7
7
  import {
8
8
  inputValueKey
9
9
  } from "./chunk-7GX27XU6.js";
package/dist/reducer.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { al as ManifestIdSchema, b6 as SchemaLike, x as CollectorState, Z as InputCollector, aB as PlayerIdOfState, bn as TableQueriesOfState, aZ as ResourceMapDomainDescriptor, t as BoundedNumberDomainDescriptor, u as ChoiceDomainDescriptor, v as ChoiceListDomainDescriptor, by as TopologyDefinitions, z as CollectorValueWitness, y as CollectorValueOf, a2 as InputSelectionDescriptor, aT as ReducerManifestContractLike, b4 as RuntimeTableRecord, b3 as RuntimeRecord, bi as StateDefinition, aj as ManifestContractOf, B as BaseGameStateOfContract, I as ErrorCodeOfContract, bv as TiledBoardIdOfTable, bl as TableOfManifest, bx as TiledVertexIdOfTable, bw as TiledEdgeIdOfTable, j as BoardIdOfTable, bg as SpaceIdOfTable, l as BoardSpaceTarget, av as PerPlayerInstanceId, bK as ZoneIdOfTable, C as CardIdOfManifest, aG as PositionTargetSchema, aF as PositionTarget, bq as TileIdOfTable, ap as OptionsOfContract, aW as ReducerTransaction, bE as ViewData, bF as ViewDefinition, ax as PhaseMapOf, bG as ViewOfContract, aR as ReducerGameDefinitionInput, aQ as ReducerGameDefinition, ai as InteractionSteps, b7 as ScopedPhaseState, ag as InteractionSpec, af as InteractionRule, aw as PhaseDefinition, ae as InteractionMap, aS as ReducerManifestContract, aO as ReducerGameContract, F as CompiledManifestWitness, E as CompiledManifest, bk as SystemActionEvent, s as BotStrategyMetadata, aC as PluginGameplayFrame, bH as ViewOfDefinition, ay as PhaseNamesOfDefinition, ab as InteractionIdOfDefinitionPhase, w as ClientParamsOfInteractionOfDefinition, bY as validatedReducerDefinition, an as ManifestOf, ah as InteractionSpecByNameOfDefinitionPhase, _ as InputCollectorOfDefinition, aP as ReducerGameContractLike, b2 as RuntimeQueryTable, bI as ZoneDefinitions, bm as TableQueries, b5 as SchemaAuthoring, U as GameTopologyManifest$1, K as FieldsInput, e as AuthoredTileDisclosure, a$ as RuntimeIdsFromCount, bt as TileSpaceIds, i as BoardEdgeRef, q as BoardVertexRef, ak as ManifestCountValidation, bz as ValidatedManifest, c as AuthoredManifest, aM as ReadonlyRuntimeData, d as AuthoredOf } from './extract-BF6nUlze.js';
2
- export { f as AuthoredTileFaceAudience, h as BoardEdgeId, k as BoardSpaceHostId, p as BoardVertexId, J as FieldSchema, L as FieldsOutput, M as FrameworkErrorCodes, N as GameEvent, O as GameEventDetail, Q as GameOutcome, am as ManifestIdsOf, ao as ManifestTable, aq as OutcomeResult, ar as OutcomeScoreComponent, as as OutcomeStanding, at as OutcomeTieBreak, au as PerPlayerInstanceFamily, aA as PlayerId, aL as PublicTileAppearance, aX as ReducerTransactionOutcome, aY as ReducerValidationResult, bW as ReducerWire, bV as ReducerWireZod, a_ as RotateZoneArgs, ba as SeatSpaceRef, bb as SeatTileRef, bh as SquareBoardSpec, bo as TileDisclosure, bp as TileFaceAudience, br as TileSeedSpec, bs as TileSpaceId, bu as TileTypeSpec, bA as ValidationIssue, bN as asPlayerId, bO as boardSpaceHostId, bP as isPlayerId, bQ as parseBoardSpaceHostId, bR as parsePerPlayerInstanceId, bS as parseTileSpaceId, bT as perPlayerInstanceId, bU as ref, bX as tileSpaceId } from './extract-BF6nUlze.js';
1
+ import { al as ManifestIdSchema, b6 as SchemaLike, x as CollectorState, Z as InputCollector, aB as PlayerIdOfState, bn as TableQueriesOfState, aZ as ResourceMapDomainDescriptor, t as BoundedNumberDomainDescriptor, u as ChoiceDomainDescriptor, v as ChoiceListDomainDescriptor, by as TopologyDefinitions, z as CollectorValueWitness, y as CollectorValueOf, a2 as InputSelectionDescriptor, aT as ReducerManifestContractLike, b4 as RuntimeTableRecord, b3 as RuntimeRecord, bi as StateDefinition, aj as ManifestContractOf, B as BaseGameStateOfContract, I as ErrorCodeOfContract, bv as TiledBoardIdOfTable, bl as TableOfManifest, bx as TiledVertexIdOfTable, bw as TiledEdgeIdOfTable, j as BoardIdOfTable, bg as SpaceIdOfTable, l as BoardSpaceTarget, av as PerPlayerInstanceId, bK as ZoneIdOfTable, C as CardIdOfManifest, aG as PositionTargetSchema, aF as PositionTarget, bq as TileIdOfTable, ap as OptionsOfContract, aW as ReducerTransaction, bE as ViewData, bF as ViewDefinition, ax as PhaseMapOf, bG as ViewOfContract, aR as ReducerGameDefinitionInput, aQ as ReducerGameDefinition, ai as InteractionSteps, b7 as ScopedPhaseState, ag as InteractionSpec, af as InteractionRule, aw as PhaseDefinition, ae as InteractionMap, aS as ReducerManifestContract, aO as ReducerGameContract, F as CompiledManifestWitness, E as CompiledManifest, bk as SystemActionEvent, s as BotStrategyMetadata, aC as PluginGameplayFrame, bH as ViewOfDefinition, ay as PhaseNamesOfDefinition, ab as InteractionIdOfDefinitionPhase, w as ClientParamsOfInteractionOfDefinition, bY as validatedReducerDefinition, an as ManifestOf, ah as InteractionSpecByNameOfDefinitionPhase, _ as InputCollectorOfDefinition, aP as ReducerGameContractLike, b2 as RuntimeQueryTable, bI as ZoneDefinitions, bm as TableQueries, b5 as SchemaAuthoring, U as GameTopologyManifest$1, K as FieldsInput, e as AuthoredTileDisclosure, a$ as RuntimeIdsFromCount, bt as TileSpaceIds, i as BoardEdgeRef, q as BoardVertexRef, ak as ManifestCountValidation, bz as ValidatedManifest, c as AuthoredManifest, aM as ReadonlyRuntimeData, d as AuthoredOf } from './extract-_TyEXSCt.js';
2
+ export { f as AuthoredTileFaceAudience, h as BoardEdgeId, k as BoardSpaceHostId, p as BoardVertexId, J as FieldSchema, L as FieldsOutput, M as FrameworkErrorCodes, N as GameEvent, O as GameEventDetail, Q as GameOutcome, am as ManifestIdsOf, ao as ManifestTable, aq as OutcomeResult, ar as OutcomeScoreComponent, as as OutcomeStanding, at as OutcomeTieBreak, au as PerPlayerInstanceFamily, aA as PlayerId, aL as PublicTileAppearance, aX as ReducerTransactionOutcome, aY as ReducerValidationResult, bW as ReducerWire, bV as ReducerWireZod, a_ as RotateZoneArgs, ba as SeatSpaceRef, bb as SeatTileRef, bh as SquareBoardSpec, bo as TileDisclosure, bp as TileFaceAudience, br as TileSeedSpec, bs as TileSpaceId, bu as TileTypeSpec, bA as ValidationIssue, bN as asPlayerId, bO as boardSpaceHostId, bP as isPlayerId, bQ as parseBoardSpaceHostId, bR as parsePerPlayerInstanceId, bS as parseTileSpaceId, bT as perPlayerInstanceId, bU as ref, bX as tileSpaceId } from './extract-_TyEXSCt.js';
3
3
  import * as z from 'zod';
4
4
  import { z as z$1 } from 'zod';
5
5
  export { z };
6
- import { N as InteractionKey } from './model-C7ScBVY5.js';
7
- import { a as ReducerBundleContract, c as ReducerDiagnosticsSink } from './diagnostics-DNGfYfY8.js';
8
- export { D as DispatchTraceSummaryEntry, M as MaybePromise, R as REDUCER_CONTRACT_VERSION, b as ReducerDiagnosticEvent, d as assertReducerBundleContract, n as noopDiagnosticsSink } from './diagnostics-DNGfYfY8.js';
9
- export { b as boardEdgeId, a as boardVertexId, p as parseBoardElementId } from './board-element-Bdc0Kv6W.js';
6
+ import { N as InteractionKey } from './model-U0F5B3cr.js';
7
+ import { a as ReducerBundleContract, c as ReducerDiagnosticsSink } from './diagnostics-Bgu7w8LA.js';
8
+ export { D as DispatchTraceSummaryEntry, M as MaybePromise, R as REDUCER_CONTRACT_VERSION, b as ReducerDiagnosticEvent, d as assertReducerBundleContract, n as noopDiagnosticsSink } from './diagnostics-Bgu7w8LA.js';
9
+ export { b as boardEdgeId, a as boardVertexId, p as parseBoardElementId } from './board-element-yXrGm5eP.js';
10
10
  import '@tanstack/store';
11
11
  import 'honeycomb-grid';
12
12
 
package/dist/reducer.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  sparseMap,
29
29
  unwrapWrappers,
30
30
  validatedReducerDefinition
31
- } from "./chunk-UGWQKBR6.js";
31
+ } from "./chunk-UARMSWDA.js";
32
32
  import {
33
33
  CARD_REFERENCE_PREFIX,
34
34
  boardSpaceHostId,
@@ -609,20 +609,31 @@ var DEFAULT_MISSING_CANDIDATE_ISSUE = {
609
609
  function createTargetRule(candidates, predicates, options = {}) {
610
610
  const missingCandidateIssue = options.missingCandidateIssue ?? DEFAULT_MISSING_CANDIDATE_ISSUE;
611
611
  const equals = options.equals ?? Object.is;
612
- const validate = (ctx, target) => {
613
- for (const candidate of candidates(ctx)) {
614
- if (!equals(candidate, target)) continue;
615
- for (const predicate of predicates) {
616
- if (!predicate.test({ ...ctx, targetId: candidate })) {
617
- return { errorCode: predicate.errorCode, message: predicate.message };
618
- }
612
+ const validateCandidate = (ctx, targetId) => {
613
+ for (const predicate of predicates) {
614
+ if (!predicate.test({ ...ctx, targetId })) {
615
+ return { errorCode: predicate.errorCode, message: predicate.message };
619
616
  }
620
- return null;
617
+ }
618
+ return null;
619
+ };
620
+ const validate = (ctx, target, resolved = candidates(ctx)) => {
621
+ for (const candidate of resolved) {
622
+ if (equals(candidate, target)) return validateCandidate(ctx, candidate);
621
623
  }
622
624
  return missingCandidateIssue;
623
625
  };
624
626
  const rule = {
625
- eligible: (ctx) => candidates(ctx).filter((targetId) => validate(ctx, targetId) == null),
627
+ eligible(ctx) {
628
+ const resolved = candidates(ctx);
629
+ if (equals === Object.is)
630
+ return resolved.filter(
631
+ (candidate) => validateCandidate(ctx, candidate) == null
632
+ );
633
+ return resolved.filter(
634
+ (target) => validate(ctx, target, resolved) == null
635
+ );
636
+ },
626
637
  validate,
627
638
  isEligible: (ctx, target) => validate(ctx, target) == null,
628
639
  bind: (ctx) => ({