@dreamboard-games/sdk 0.4.0-alpha.7 → 0.4.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/REFERENCE.md +153 -51
  2. package/dist/authoring/index.js +2 -2
  3. package/dist/{chunk-52DH7VQF.js → chunk-2TAKLJJD.js} +5 -2
  4. package/dist/{chunk-52DH7VQF.js.map → chunk-2TAKLJJD.js.map} +1 -1
  5. package/dist/{chunk-TGMXBRKY.js → chunk-3BLN5POZ.js} +5 -3
  6. package/dist/chunk-3BLN5POZ.js.map +1 -0
  7. package/dist/{chunk-RKGJ64UN.js → chunk-44N3T2A5.js} +2 -2
  8. package/dist/{chunk-IU6KGPY7.js → chunk-5CQIJHGF.js} +6 -2
  9. package/dist/{chunk-IU6KGPY7.js.map → chunk-5CQIJHGF.js.map} +1 -1
  10. package/dist/{chunk-5IHU5CUK.js → chunk-IYX5OO2K.js} +12 -22
  11. package/dist/chunk-IYX5OO2K.js.map +1 -0
  12. package/dist/{chunk-Q322XCY2.js → chunk-VTK4TIXC.js} +3 -3
  13. package/dist/{chunk-KYEWGZ2Y.js → chunk-VTNEWMWJ.js} +2 -2
  14. package/dist/{chunk-KYEWGZ2Y.js.map → chunk-VTNEWMWJ.js.map} +1 -1
  15. package/dist/{chunk-3QIZKXJ2.js → chunk-XV27IQHA.js} +3 -3
  16. package/dist/{chunk-NO537WSS.js → chunk-YGQTL63W.js} +2 -2
  17. package/dist/{chunk-VLG4YST5.js → chunk-ZYONCTZ2.js} +2 -2
  18. package/dist/codegen.js +1 -1
  19. package/dist/{index.d-DMASeF6M.d.ts → index.d-C0PKOVbh.d.ts} +25 -4
  20. package/dist/index.js +2 -2
  21. package/dist/package-set.d.ts +2 -2
  22. package/dist/package-set.js +2 -2
  23. package/dist/{protocol-835hEGne.d.ts → protocol-nS2ojsGr.d.ts} +5 -0
  24. package/dist/reducer/advanced.d.ts +2 -2
  25. package/dist/reducer-contract.d.ts +1 -1
  26. package/dist/reducer-contract.js +2 -2
  27. package/dist/reducer.d.ts +23 -20
  28. package/dist/reducer.js +131 -84
  29. package/dist/reducer.js.map +1 -1
  30. package/dist/runtime/primitives.js +3 -3
  31. package/dist/runtime/workspace-contract.js +4 -4
  32. package/dist/runtime.d.ts +3 -3
  33. package/dist/runtime.js +9 -9
  34. package/dist/testing-runtime.d.ts +2 -2
  35. package/dist/testing-runtime.js +2 -2
  36. package/dist/testing.d.ts +5 -5
  37. package/dist/testing.js +4 -4
  38. package/dist/{types-DcADVHe9.d.ts → types-B_3pObUV.d.ts} +1 -1
  39. package/dist/{types-aI4V9CWe.d.ts → types-CTeN_QAk.d.ts} +1 -1
  40. package/dist/types.d.ts +4 -0
  41. package/dist/{views-32rSsfeU.d.ts → views-Qx-EHBP8.d.ts} +27 -10
  42. package/package.json +1 -2
  43. package/dist/chunk-5IHU5CUK.js.map +0 -1
  44. package/dist/chunk-TGMXBRKY.js.map +0 -1
  45. /package/dist/{chunk-RKGJ64UN.js.map → chunk-44N3T2A5.js.map} +0 -0
  46. /package/dist/{chunk-Q322XCY2.js.map → chunk-VTK4TIXC.js.map} +0 -0
  47. /package/dist/{chunk-3QIZKXJ2.js.map → chunk-XV27IQHA.js.map} +0 -0
  48. /package/dist/{chunk-NO537WSS.js.map → chunk-YGQTL63W.js.map} +0 -0
  49. /package/dist/{chunk-VLG4YST5.js.map → chunk-ZYONCTZ2.js.map} +0 -0
package/REFERENCE.md CHANGED
@@ -2592,13 +2592,23 @@ function defineEffect(...args: never[]): unknown;
2592
2592
 
2593
2593
  _No JSDoc summary is available yet._
2594
2594
 
2595
+ ### defineEmptyView
2596
+
2597
+ ```ts
2598
+ function defineEmptyView<
2599
+ Contract extends AnyReducerGameContract,
2600
+ >(): EmptyViewDefinition<ContractState<Contract>, ContractManifest<Contract>>;
2601
+ ```
2602
+
2603
+ _No JSDoc summary is available yet._
2604
+
2595
2605
  ### defineGame
2596
2606
 
2597
2607
  ```ts
2598
2608
  function defineGame<
2599
2609
  const Contract extends AnyReducerGameContract,
2600
2610
  Definitions extends PhaseMapOf<Contract>,
2601
- Views extends ViewMapOf<Contract> = Record<string, never>,
2611
+ Views extends ViewMapOf<Contract>,
2602
2612
  >(
2603
2613
  definition: { contract: Contract } & Omit<
2604
2614
  ReducerGameDefinition<NoInfer<Contract>, Definitions, Views>,
@@ -2670,6 +2680,49 @@ function definePhaseStage<
2670
2680
 
2671
2681
  _No JSDoc summary is available yet._
2672
2682
 
2683
+ ### definePlayerView
2684
+
2685
+ ```ts
2686
+ function definePlayerView<Contract extends AnyReducerGameContract>(): <
2687
+ SharedProjection = unknown,
2688
+ Projection = unknown,
2689
+ >(
2690
+ definition: PlayerViewDefinition<
2691
+ ContractState<Contract>,
2692
+ ContractManifest<Contract>,
2693
+ SharedProjection,
2694
+ Projection
2695
+ >,
2696
+ ) => PlayerViewDefinition<
2697
+ ContractState<Contract>,
2698
+ ContractManifest<Contract>,
2699
+ SharedProjection,
2700
+ Projection
2701
+ >;
2702
+ ```
2703
+
2704
+ _No JSDoc summary is available yet._
2705
+
2706
+ ### defineSharedView
2707
+
2708
+ ```ts
2709
+ function defineSharedView<Contract extends AnyReducerGameContract>(): <
2710
+ Projection,
2711
+ >(
2712
+ definition: SharedViewDefinition<
2713
+ ContractState<Contract>,
2714
+ ContractManifest<Contract>,
2715
+ Projection
2716
+ >,
2717
+ ) => SharedViewDefinition<
2718
+ ContractState<Contract>,
2719
+ ContractManifest<Contract>,
2720
+ Projection
2721
+ >;
2722
+ ```
2723
+
2724
+ _No JSDoc summary is available yet._
2725
+
2673
2726
  ### defineStage
2674
2727
 
2675
2728
  ```ts
@@ -2693,7 +2746,7 @@ function defineStaticView<Contract extends AnyReducerGameContract>(): <
2693
2746
  ) => StaticViewDefinition<ExactManifestContractOf<Contract>, Projection>;
2694
2747
  ```
2695
2748
 
2696
- Factory for the session-scoped static view (see {@link StaticViewDefinition}). Kept separate from {@link defineView} because the argument shape is structurally different: it exposes only the manifest and generated static queries, with no `state`, `playerId`, `runtime`, `fx`, `ops`, or `accept/reject`. That shape is what prevents authors from accidentally projecting per-tick state into the once-per-session payload.
2749
+ Factory for the session-scoped static view (see {@link StaticViewDefinition}). Kept separate from dynamic view helpers because the argument shape is structurally different: it exposes only the manifest and generated static queries, with no `state`, `playerId`, `runtime`, `fx`, `ops`, or `accept/reject`. That shape is what prevents authors from accidentally projecting per-tick state into the once-per-session payload.
2697
2750
 
2698
2751
  ### defineStepPhase
2699
2752
 
@@ -2703,24 +2756,6 @@ function defineStepPhase(...args: never[]): unknown;
2703
2756
 
2704
2757
  _No JSDoc summary is available yet._
2705
2758
 
2706
- ### defineView
2707
-
2708
- ```ts
2709
- function defineView<Contract extends AnyReducerGameContract>(): <Projection>(
2710
- definition: ViewDefinition<
2711
- ContractState<Contract>,
2712
- ContractManifest<Contract>,
2713
- Projection
2714
- >,
2715
- ) => ViewDefinition<
2716
- ContractState<Contract>,
2717
- ContractManifest<Contract>,
2718
- Projection
2719
- >;
2720
- ```
2721
-
2722
- _No JSDoc summary is available yet._
2723
-
2724
2759
  ### DependencyValues
2725
2760
 
2726
2761
  ```ts
@@ -3409,6 +3444,23 @@ type ReducerPhaseDefinition<
3409
3444
 
3410
3445
  _No JSDoc summary is available yet._
3411
3446
 
3447
+ ### ReducerPlayerViewDefinition
3448
+
3449
+ ```ts
3450
+ type ReducerPlayerViewDefinition<
3451
+ Contract extends AnyReducerGameContract,
3452
+ SharedProjection = unknown,
3453
+ Projection = unknown,
3454
+ > = PlayerViewDefinition<
3455
+ ContractState<Contract>,
3456
+ ContractManifest<Contract>,
3457
+ SharedProjection,
3458
+ Projection
3459
+ >;
3460
+ ```
3461
+
3462
+ _No JSDoc summary is available yet._
3463
+
3412
3464
  ### ReducerReject
3413
3465
 
3414
3466
  ```ts
@@ -3429,6 +3481,21 @@ type ReducerResult<State> = ReducerAccept<State> | ReducerReject;
3429
3481
 
3430
3482
  _No JSDoc summary is available yet._
3431
3483
 
3484
+ ### ReducerSharedViewDefinition
3485
+
3486
+ ```ts
3487
+ type ReducerSharedViewDefinition<
3488
+ Contract extends AnyReducerGameContract,
3489
+ Projection = unknown,
3490
+ > = SharedViewDefinition<
3491
+ ContractState<Contract>,
3492
+ ContractManifest<Contract>,
3493
+ Projection
3494
+ >;
3495
+ ```
3496
+
3497
+ _No JSDoc summary is available yet._
3498
+
3432
3499
  ### ReducerStateBase
3433
3500
 
3434
3501
  ```ts
@@ -3463,21 +3530,6 @@ type ReducerValidationResult =
3463
3530
 
3464
3531
  _No JSDoc summary is available yet._
3465
3532
 
3466
- ### ReducerViewDefinition
3467
-
3468
- ```ts
3469
- type ReducerViewDefinition<
3470
- Contract extends AnyReducerGameContract,
3471
- Projection = unknown,
3472
- > = ViewDefinition<
3473
- ContractState<Contract>,
3474
- ContractManifest<Contract>,
3475
- Projection
3476
- >;
3477
- ```
3478
-
3479
- _No JSDoc summary is available yet._
3480
-
3481
3533
  ### rngInput
3482
3534
 
3483
3535
  ```ts
@@ -4879,6 +4931,23 @@ type EffectTypeTag = "rollDie" | "shuffleSharedZone" | "shufflePlayerZone";
4879
4931
 
4880
4932
  Marker tag attached by `defineEffect` to every effect spec. `fx.effect` uses `type` to dispatch to the right wire-effect builder.
4881
4933
 
4934
+ ### EmptyViewDefinition
4935
+
4936
+ ```ts
4937
+ type EmptyViewDefinition<
4938
+ State extends {
4939
+ table: RuntimeTableRecord;
4940
+ flow: {
4941
+ currentPhase: string;
4942
+ };
4943
+ },
4944
+ Manifest extends ManifestContract<TableOfState<State>>,
4945
+ > = SharedViewDefinition<State, Manifest, Record<string, never>> &
4946
+ PlayerViewDefinition<State, Manifest, unknown, Record<string, never>>;
4947
+ ```
4948
+
4949
+ _No JSDoc summary is available yet._
4950
+
4882
4951
  ### ErrorCodeOfContract
4883
4952
 
4884
4953
  ```ts
@@ -6126,6 +6195,14 @@ type PlayerPhaseDefinition = ...;
6126
6195
 
6127
6196
  _No JSDoc summary is available yet._
6128
6197
 
6198
+ ### PlayerViewDefinition
6199
+
6200
+ ```ts
6201
+ type PlayerViewDefinition = ...;
6202
+ ```
6203
+
6204
+ _No JSDoc summary is available yet._
6205
+
6129
6206
  ### PlayerZoneIdOfManifest
6130
6207
 
6131
6208
  ```ts
@@ -7626,6 +7703,30 @@ type SetupSelectionOfManifest<Manifest> = {
7626
7703
 
7627
7704
  _No JSDoc summary is available yet._
7628
7705
 
7706
+ ### SharedViewDefinition
7707
+
7708
+ ```ts
7709
+ type SharedViewDefinition<
7710
+ State extends {
7711
+ table: RuntimeTableRecord;
7712
+ flow: {
7713
+ currentPhase: string;
7714
+ };
7715
+ },
7716
+ Manifest extends ManifestContract<TableOfState<State>>,
7717
+ Projection = unknown,
7718
+ > = {
7719
+ project: (
7720
+ args: ActionContext<State, Manifest> &
7721
+ RuntimeHelpers<State> & {
7722
+ state: State;
7723
+ },
7724
+ ) => Projection;
7725
+ };
7726
+ ```
7727
+
7728
+ _No JSDoc summary is available yet._
7729
+
7629
7730
  ### SharedZoneIdOfManifest
7630
7731
 
7631
7732
  ```ts
@@ -8412,14 +8513,6 @@ type VertexTypeIdOfManifest<Manifest> = Manifest extends {
8412
8513
 
8413
8514
  _No JSDoc summary is available yet._
8414
8515
 
8415
- ### ViewDefinition
8416
-
8417
- ```ts
8418
- type ViewDefinition = ...;
8419
- ```
8420
-
8421
- _No JSDoc summary is available yet._
8422
-
8423
8516
  ### ViewDefinitionByName
8424
8517
 
8425
8518
  ```ts
@@ -8434,14 +8527,23 @@ _No JSDoc summary is available yet._
8434
8527
  ### ViewMapOf
8435
8528
 
8436
8529
  ```ts
8437
- type ViewMapOf<Contract> = Record<
8438
- string,
8439
- ViewDefinition<
8530
+ type ViewMapOf<
8531
+ Contract,
8532
+ SharedProjection = unknown,
8533
+ PlayerProjection = unknown,
8534
+ > = {
8535
+ shared: SharedViewDefinition<
8440
8536
  BaseGameStateOfContract<Contract>,
8441
8537
  ManifestContractOf<Contract>,
8442
- unknown
8443
- >
8444
- >;
8538
+ SharedProjection
8539
+ >;
8540
+ player: PlayerViewDefinition<
8541
+ BaseGameStateOfContract<Contract>,
8542
+ ManifestContractOf<Contract>,
8543
+ SharedProjection,
8544
+ PlayerProjection
8545
+ >;
8546
+ };
8445
8547
  ```
8446
8548
 
8447
8549
  _No JSDoc summary is available yet._
@@ -8477,9 +8579,9 @@ _No JSDoc summary is available yet._
8477
8579
 
8478
8580
  ```ts
8479
8581
  type ViewsOfDefinition<Definition> = Definition extends {
8480
- views?: infer Views;
8582
+ views: infer Views;
8481
8583
  }
8482
- ? NonNullable<Views>
8584
+ ? Views
8483
8585
  : never;
8484
8586
  ```
8485
8587
 
@@ -6,10 +6,10 @@ import {
6
6
  generateSeedFiles,
7
7
  materializeManifestTable,
8
8
  validateManifestAuthoring
9
- } from "../chunk-52DH7VQF.js";
9
+ } from "../chunk-2TAKLJJD.js";
10
10
  import {
11
11
  GENERATED_AUTHORING_METADATA
12
- } from "../chunk-KYEWGZ2Y.js";
12
+ } from "../chunk-VTNEWMWJ.js";
13
13
  import "../chunk-PZ5AY32C.js";
14
14
 
15
15
  // src/authoring/adapter.ts
@@ -8496,7 +8496,10 @@ export default authoring.game({
8496
8496
  initialPhase: "setup",
8497
8497
  setupProfiles,
8498
8498
  phases,
8499
- views: {},
8499
+ views: {
8500
+ shared: authoring.emptyView(),
8501
+ player: authoring.emptyView(),
8502
+ },
8500
8503
  });
8501
8504
  `;
8502
8505
  }
@@ -8841,4 +8844,4 @@ export {
8841
8844
  generateAuthoritativeFiles,
8842
8845
  generateDynamicGeneratedFiles
8843
8846
  };
8844
- //# sourceMappingURL=chunk-52DH7VQF.js.map
8847
+ //# sourceMappingURL=chunk-2TAKLJJD.js.map