@storylet-studio/model 0.4.1 → 0.6.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/dist/index.cjs CHANGED
@@ -37,6 +37,7 @@ __export(index_exports, {
37
37
  RESERVED_PROPERTY_NAMES: () => import_expr.RESERVED_PROPERTY_NAMES,
38
38
  SAVEFILE_SCHEMA: () => SAVEFILE_SCHEMA,
39
39
  SAVE_SCHEMA: () => SAVE_SCHEMA,
40
+ SAVE_SCHEMA_V1: () => SAVE_SCHEMA_V1,
40
41
  SHARD_EXTENSIONS: () => SHARD_EXTENSIONS,
41
42
  SPATIAL: () => SPATIAL,
42
43
  TAGS_SCHEMA: () => TAGS_SCHEMA,
@@ -552,7 +553,8 @@ var parseHoleRef = (value) => {
552
553
  };
553
554
  var BUNDLE_SCHEMA = "storylets/bundle@0";
554
555
  var DEFAULT_PLAY_RUNG = "solo";
555
- var SAVE_SCHEMA = "storylets/save@1";
556
+ var SAVE_SCHEMA = "storylets/save@2";
557
+ var SAVE_SCHEMA_V1 = "storylets/save@1";
556
558
  var SAVEFILE_SCHEMA = "storylets/savefile@1";
557
559
  var PROJECT_FOLDER_EXTENSION = ".storylets";
558
560
  var BUNDLE_EXTENSION = ".storyletsc";
@@ -626,6 +628,7 @@ var FURNITURE_COLOURS = ["paper", "amber", "sage", "sky", "rose", "slate"];
626
628
  RESERVED_PROPERTY_NAMES,
627
629
  SAVEFILE_SCHEMA,
628
630
  SAVE_SCHEMA,
631
+ SAVE_SCHEMA_V1,
629
632
  SHARD_EXTENSIONS,
630
633
  SPATIAL,
631
634
  TAGS_SCHEMA,
package/dist/index.d.cts CHANGED
@@ -976,8 +976,14 @@ interface Bundle {
976
976
  boxes: Box<Expression>[];
977
977
  /** Maps, when the project asked for them. Absent is the normal state. */
978
978
  maps?: BundleMap[];
979
+ /** Other engines' game-wide scopes the content names (`patter`), sorted: the
980
+ * family's shared vocabulary, let through unchecked by the compiler. The
981
+ * engine reports when the game has not registered one. Absent when none. */
982
+ externalScopes?: string[];
979
983
  }
980
- declare const SAVE_SCHEMA = "storylets/save@1";
984
+ declare const SAVE_SCHEMA = "storylets/save@2";
985
+ /** The version 1 envelope's schema tag, still read. */
986
+ declare const SAVE_SCHEMA_V1 = "storylets/save@1";
981
987
  interface PlayRecord {
982
988
  /** Card and outcome by gameId (feeds the play-history functions). */
983
989
  card: string;
@@ -1002,10 +1008,13 @@ interface PropsPartition {
1002
1008
  /** Tag state, keyed by tag id. */
1003
1009
  value: Record<string, PropertyBag>;
1004
1010
  }
1005
- /** One flow's snapshot inside the envelope (schema 4). */
1011
+ /** One flow's snapshot inside the envelope (schema 4), and the blob
1012
+ * `saveFlow` parks. */
1006
1013
  interface FlowSave {
1007
- /** The per-flow property partitions. */
1008
- props: PropsPartition;
1014
+ /** The per-flow property partitions. Carried by `saveFlow`, which parks one
1015
+ * flow whole; absent from a version 2 envelope's flows, whose properties
1016
+ * are the registry's. Present in every flow of a version 1 envelope. */
1017
+ props?: PropsPartition;
1009
1018
  /** Per-box turn counters, keyed by box id (schema 3.4) - per flow: there
1010
1019
  * is deliberately no global turn. */
1011
1020
  turns: Record<string, number>;
@@ -1028,16 +1037,33 @@ interface FlowSave {
1028
1037
  * (design/shared-scarcity.md). Claims are NOT here: they are derived from the
1029
1038
  * live boards, and each flow's board rides its own blob. */
1030
1039
  interface SharedSave {
1031
- props: PropsPartition;
1040
+ /** The shared property partitions: version 1 only. */
1041
+ props?: PropsPartition;
1032
1042
  /** Card ids, sorted, so a save is byte-stable for a diff. */
1033
1043
  spent: string[];
1034
1044
  }
1035
1045
  interface SaveEnvelope {
1036
1046
  schema: typeof SAVE_SCHEMA;
1037
1047
  content: BundleContent;
1048
+ /** The engine's own registry's values, keyed by registry key: present only
1049
+ * when the engine made the registry itself (a standalone game). A game that
1050
+ * passed a registry saves it once, beside this envelope. */
1051
+ registry?: Record<string, PropertyBag>;
1038
1052
  shared: SharedSave;
1039
1053
  flows: Record<string, FlowSave>;
1040
1054
  }
1055
+ /** A version 1 envelope, from before the registry held the properties. Every
1056
+ * runtime still reads it: its partitions move into the registry as it loads. */
1057
+ interface SaveEnvelopeV1 {
1058
+ schema: typeof SAVE_SCHEMA_V1;
1059
+ content: BundleContent;
1060
+ shared: SharedSave & {
1061
+ props: PropsPartition;
1062
+ };
1063
+ flows: Record<string, FlowSave & {
1064
+ props: PropsPartition;
1065
+ }>;
1066
+ }
1041
1067
  /** One card that a restore refused to put back on the board.
1042
1068
  *
1043
1069
  * `vanished` and `hand-vanished` are the edit's doing (the card, or the hand
@@ -1115,7 +1141,8 @@ interface LoadReport {
1115
1141
  declare const SAVEFILE_SCHEMA = "storylets/savefile@1";
1116
1142
  interface SaveFile {
1117
1143
  schema: typeof SAVEFILE_SCHEMA;
1118
- engine: SaveEnvelope;
1144
+ /** The engine's envelope: version 2 when written today, version 1 still read. */
1145
+ engine: SaveEnvelope | SaveEnvelopeV1;
1119
1146
  /** The host's @world values, saved and restored by the host. */
1120
1147
  world?: PropertyBag;
1121
1148
  }
@@ -1410,6 +1437,14 @@ interface ProjectShard {
1410
1437
  * on state nothing writes) always warns, because that kills cards now. */
1411
1438
  warnUnreadWrites?: boolean;
1412
1439
  };
1440
+ /**
1441
+ * Where the game's shared scopes folder is, relative to the folder holding this file
1442
+ * (`"../../shared/game-scopes"`). Authoring config, never compiled, and usually absent: the
1443
+ * tools find a `game-scopes/` folder by walking up from the project on their own, stopping at
1444
+ * the version-control root, so this is only for a folder that walk would not reach. A path
1445
+ * that doesn't exist is a project error. (patterkit design/shared-scopes.md.)
1446
+ */
1447
+ gameScopes?: string;
1413
1448
  world: {
1414
1449
  properties: PropertyDecl[];
1415
1450
  registry?: unknown;
@@ -1508,4 +1543,4 @@ interface DeckShard {
1508
1543
  cards: Card<string>[];
1509
1544
  }
1510
1545
 
1511
- export { BOX_SCHEMA, BUNDLE_EXTENSION, BUNDLE_SCHEMA, type Box, type BoxMap, type BoxShard, type Bundle, type BundleBackground, type BundleContent, type BundleMap, type BundleSettings, CONTRACTS_DIR, CONTRACT_SCHEMA, type CanvasFurniture, type Card, type Comment, type CommentMark, type CommentMessage, type ContractProperty, type ContractShard, type CoverageConfig, type CoverageDriver, DECK_SCHEMA, DEFAULT_PLAY_RUNG, type Deck, type DeckCanvas, type DeckShard, FURNITURE_COLOURS, type FieldDecl, type FlowSave, type Frame, type FurnitureColour, HANDS_SCHEMA, type Hand, type HandBinding, type HandRule, type HandTemplate, type HandsShard, type HoleRef, type HoleRefScope, type LoadEviction, type LoadProperty, type LoadReport, MAP_SCHEMA, type MapShard, NOTES_SCHEMA, type NotesShard, type Outcome, PLACE_GROUP, PROJECT_FOLDER_EXTENSION, PROJECT_SCHEMA, type PlayRecord, type PlayRung, type Polygon, type ProjectSettings, type ProjectShard, type PropertyBag, type PropertyDecl, type PropertyType, type PropsPartition, type Rect, type RedrawPolicy, SAVEFILE_SCHEMA, SAVE_SCHEMA, SHARD_EXTENSIONS, SPATIAL, type SaveEnvelope, type SaveFile, type SharedSave, type SpatialBackground, type SpatialGroup, type StackMove, type Stacked, TAGS_SCHEMA, type Tag, type TagGroup, type TagsShard, VIEW_SCHEMA, type ValueAddresses, type ViewPoint, type ViewShard, ambiguousValueAddressMessage, backgroundsOf, bindHand, bundleAssetPath, byDisplayOrder, centroid, commentsOf, contractPropertyPath, contractPropertyType, droppedRect, effectiveGameId, framesOf, freeGameId, freeTitle, gameIdify, handBinding, inferDeclFromWrite, isHoleRef, isSpatial, isValidGameId, labelPoint, markOf, marksOn, openThreadCounts, parseHoleRef, pointInPolygon, polygonBounds, polygonOf, restack, spatialOf, stacked, threadsFor, turnSpan, unbindHand, valueAddresses, withBackgrounds, withPolygon, withSpatialGroup, withZ, zOf, zoneAt, zonesAt };
1546
+ export { BOX_SCHEMA, BUNDLE_EXTENSION, BUNDLE_SCHEMA, type Box, type BoxMap, type BoxShard, type Bundle, type BundleBackground, type BundleContent, type BundleMap, type BundleSettings, CONTRACTS_DIR, CONTRACT_SCHEMA, type CanvasFurniture, type Card, type Comment, type CommentMark, type CommentMessage, type ContractProperty, type ContractShard, type CoverageConfig, type CoverageDriver, DECK_SCHEMA, DEFAULT_PLAY_RUNG, type Deck, type DeckCanvas, type DeckShard, FURNITURE_COLOURS, type FieldDecl, type FlowSave, type Frame, type FurnitureColour, HANDS_SCHEMA, type Hand, type HandBinding, type HandRule, type HandTemplate, type HandsShard, type HoleRef, type HoleRefScope, type LoadEviction, type LoadProperty, type LoadReport, MAP_SCHEMA, type MapShard, NOTES_SCHEMA, type NotesShard, type Outcome, PLACE_GROUP, PROJECT_FOLDER_EXTENSION, PROJECT_SCHEMA, type PlayRecord, type PlayRung, type Polygon, type ProjectSettings, type ProjectShard, type PropertyBag, type PropertyDecl, type PropertyType, type PropsPartition, type Rect, type RedrawPolicy, SAVEFILE_SCHEMA, SAVE_SCHEMA, SAVE_SCHEMA_V1, SHARD_EXTENSIONS, SPATIAL, type SaveEnvelope, type SaveEnvelopeV1, type SaveFile, type SharedSave, type SpatialBackground, type SpatialGroup, type StackMove, type Stacked, TAGS_SCHEMA, type Tag, type TagGroup, type TagsShard, VIEW_SCHEMA, type ValueAddresses, type ViewPoint, type ViewShard, ambiguousValueAddressMessage, backgroundsOf, bindHand, bundleAssetPath, byDisplayOrder, centroid, commentsOf, contractPropertyPath, contractPropertyType, droppedRect, effectiveGameId, framesOf, freeGameId, freeTitle, gameIdify, handBinding, inferDeclFromWrite, isHoleRef, isSpatial, isValidGameId, labelPoint, markOf, marksOn, openThreadCounts, parseHoleRef, pointInPolygon, polygonBounds, polygonOf, restack, spatialOf, stacked, threadsFor, turnSpan, unbindHand, valueAddresses, withBackgrounds, withPolygon, withSpatialGroup, withZ, zOf, zoneAt, zonesAt };
package/dist/index.d.ts CHANGED
@@ -976,8 +976,14 @@ interface Bundle {
976
976
  boxes: Box<Expression>[];
977
977
  /** Maps, when the project asked for them. Absent is the normal state. */
978
978
  maps?: BundleMap[];
979
+ /** Other engines' game-wide scopes the content names (`patter`), sorted: the
980
+ * family's shared vocabulary, let through unchecked by the compiler. The
981
+ * engine reports when the game has not registered one. Absent when none. */
982
+ externalScopes?: string[];
979
983
  }
980
- declare const SAVE_SCHEMA = "storylets/save@1";
984
+ declare const SAVE_SCHEMA = "storylets/save@2";
985
+ /** The version 1 envelope's schema tag, still read. */
986
+ declare const SAVE_SCHEMA_V1 = "storylets/save@1";
981
987
  interface PlayRecord {
982
988
  /** Card and outcome by gameId (feeds the play-history functions). */
983
989
  card: string;
@@ -1002,10 +1008,13 @@ interface PropsPartition {
1002
1008
  /** Tag state, keyed by tag id. */
1003
1009
  value: Record<string, PropertyBag>;
1004
1010
  }
1005
- /** One flow's snapshot inside the envelope (schema 4). */
1011
+ /** One flow's snapshot inside the envelope (schema 4), and the blob
1012
+ * `saveFlow` parks. */
1006
1013
  interface FlowSave {
1007
- /** The per-flow property partitions. */
1008
- props: PropsPartition;
1014
+ /** The per-flow property partitions. Carried by `saveFlow`, which parks one
1015
+ * flow whole; absent from a version 2 envelope's flows, whose properties
1016
+ * are the registry's. Present in every flow of a version 1 envelope. */
1017
+ props?: PropsPartition;
1009
1018
  /** Per-box turn counters, keyed by box id (schema 3.4) - per flow: there
1010
1019
  * is deliberately no global turn. */
1011
1020
  turns: Record<string, number>;
@@ -1028,16 +1037,33 @@ interface FlowSave {
1028
1037
  * (design/shared-scarcity.md). Claims are NOT here: they are derived from the
1029
1038
  * live boards, and each flow's board rides its own blob. */
1030
1039
  interface SharedSave {
1031
- props: PropsPartition;
1040
+ /** The shared property partitions: version 1 only. */
1041
+ props?: PropsPartition;
1032
1042
  /** Card ids, sorted, so a save is byte-stable for a diff. */
1033
1043
  spent: string[];
1034
1044
  }
1035
1045
  interface SaveEnvelope {
1036
1046
  schema: typeof SAVE_SCHEMA;
1037
1047
  content: BundleContent;
1048
+ /** The engine's own registry's values, keyed by registry key: present only
1049
+ * when the engine made the registry itself (a standalone game). A game that
1050
+ * passed a registry saves it once, beside this envelope. */
1051
+ registry?: Record<string, PropertyBag>;
1038
1052
  shared: SharedSave;
1039
1053
  flows: Record<string, FlowSave>;
1040
1054
  }
1055
+ /** A version 1 envelope, from before the registry held the properties. Every
1056
+ * runtime still reads it: its partitions move into the registry as it loads. */
1057
+ interface SaveEnvelopeV1 {
1058
+ schema: typeof SAVE_SCHEMA_V1;
1059
+ content: BundleContent;
1060
+ shared: SharedSave & {
1061
+ props: PropsPartition;
1062
+ };
1063
+ flows: Record<string, FlowSave & {
1064
+ props: PropsPartition;
1065
+ }>;
1066
+ }
1041
1067
  /** One card that a restore refused to put back on the board.
1042
1068
  *
1043
1069
  * `vanished` and `hand-vanished` are the edit's doing (the card, or the hand
@@ -1115,7 +1141,8 @@ interface LoadReport {
1115
1141
  declare const SAVEFILE_SCHEMA = "storylets/savefile@1";
1116
1142
  interface SaveFile {
1117
1143
  schema: typeof SAVEFILE_SCHEMA;
1118
- engine: SaveEnvelope;
1144
+ /** The engine's envelope: version 2 when written today, version 1 still read. */
1145
+ engine: SaveEnvelope | SaveEnvelopeV1;
1119
1146
  /** The host's @world values, saved and restored by the host. */
1120
1147
  world?: PropertyBag;
1121
1148
  }
@@ -1410,6 +1437,14 @@ interface ProjectShard {
1410
1437
  * on state nothing writes) always warns, because that kills cards now. */
1411
1438
  warnUnreadWrites?: boolean;
1412
1439
  };
1440
+ /**
1441
+ * Where the game's shared scopes folder is, relative to the folder holding this file
1442
+ * (`"../../shared/game-scopes"`). Authoring config, never compiled, and usually absent: the
1443
+ * tools find a `game-scopes/` folder by walking up from the project on their own, stopping at
1444
+ * the version-control root, so this is only for a folder that walk would not reach. A path
1445
+ * that doesn't exist is a project error. (patterkit design/shared-scopes.md.)
1446
+ */
1447
+ gameScopes?: string;
1413
1448
  world: {
1414
1449
  properties: PropertyDecl[];
1415
1450
  registry?: unknown;
@@ -1508,4 +1543,4 @@ interface DeckShard {
1508
1543
  cards: Card<string>[];
1509
1544
  }
1510
1545
 
1511
- export { BOX_SCHEMA, BUNDLE_EXTENSION, BUNDLE_SCHEMA, type Box, type BoxMap, type BoxShard, type Bundle, type BundleBackground, type BundleContent, type BundleMap, type BundleSettings, CONTRACTS_DIR, CONTRACT_SCHEMA, type CanvasFurniture, type Card, type Comment, type CommentMark, type CommentMessage, type ContractProperty, type ContractShard, type CoverageConfig, type CoverageDriver, DECK_SCHEMA, DEFAULT_PLAY_RUNG, type Deck, type DeckCanvas, type DeckShard, FURNITURE_COLOURS, type FieldDecl, type FlowSave, type Frame, type FurnitureColour, HANDS_SCHEMA, type Hand, type HandBinding, type HandRule, type HandTemplate, type HandsShard, type HoleRef, type HoleRefScope, type LoadEviction, type LoadProperty, type LoadReport, MAP_SCHEMA, type MapShard, NOTES_SCHEMA, type NotesShard, type Outcome, PLACE_GROUP, PROJECT_FOLDER_EXTENSION, PROJECT_SCHEMA, type PlayRecord, type PlayRung, type Polygon, type ProjectSettings, type ProjectShard, type PropertyBag, type PropertyDecl, type PropertyType, type PropsPartition, type Rect, type RedrawPolicy, SAVEFILE_SCHEMA, SAVE_SCHEMA, SHARD_EXTENSIONS, SPATIAL, type SaveEnvelope, type SaveFile, type SharedSave, type SpatialBackground, type SpatialGroup, type StackMove, type Stacked, TAGS_SCHEMA, type Tag, type TagGroup, type TagsShard, VIEW_SCHEMA, type ValueAddresses, type ViewPoint, type ViewShard, ambiguousValueAddressMessage, backgroundsOf, bindHand, bundleAssetPath, byDisplayOrder, centroid, commentsOf, contractPropertyPath, contractPropertyType, droppedRect, effectiveGameId, framesOf, freeGameId, freeTitle, gameIdify, handBinding, inferDeclFromWrite, isHoleRef, isSpatial, isValidGameId, labelPoint, markOf, marksOn, openThreadCounts, parseHoleRef, pointInPolygon, polygonBounds, polygonOf, restack, spatialOf, stacked, threadsFor, turnSpan, unbindHand, valueAddresses, withBackgrounds, withPolygon, withSpatialGroup, withZ, zOf, zoneAt, zonesAt };
1546
+ export { BOX_SCHEMA, BUNDLE_EXTENSION, BUNDLE_SCHEMA, type Box, type BoxMap, type BoxShard, type Bundle, type BundleBackground, type BundleContent, type BundleMap, type BundleSettings, CONTRACTS_DIR, CONTRACT_SCHEMA, type CanvasFurniture, type Card, type Comment, type CommentMark, type CommentMessage, type ContractProperty, type ContractShard, type CoverageConfig, type CoverageDriver, DECK_SCHEMA, DEFAULT_PLAY_RUNG, type Deck, type DeckCanvas, type DeckShard, FURNITURE_COLOURS, type FieldDecl, type FlowSave, type Frame, type FurnitureColour, HANDS_SCHEMA, type Hand, type HandBinding, type HandRule, type HandTemplate, type HandsShard, type HoleRef, type HoleRefScope, type LoadEviction, type LoadProperty, type LoadReport, MAP_SCHEMA, type MapShard, NOTES_SCHEMA, type NotesShard, type Outcome, PLACE_GROUP, PROJECT_FOLDER_EXTENSION, PROJECT_SCHEMA, type PlayRecord, type PlayRung, type Polygon, type ProjectSettings, type ProjectShard, type PropertyBag, type PropertyDecl, type PropertyType, type PropsPartition, type Rect, type RedrawPolicy, SAVEFILE_SCHEMA, SAVE_SCHEMA, SAVE_SCHEMA_V1, SHARD_EXTENSIONS, SPATIAL, type SaveEnvelope, type SaveEnvelopeV1, type SaveFile, type SharedSave, type SpatialBackground, type SpatialGroup, type StackMove, type Stacked, TAGS_SCHEMA, type Tag, type TagGroup, type TagsShard, VIEW_SCHEMA, type ValueAddresses, type ViewPoint, type ViewShard, ambiguousValueAddressMessage, backgroundsOf, bindHand, bundleAssetPath, byDisplayOrder, centroid, commentsOf, contractPropertyPath, contractPropertyType, droppedRect, effectiveGameId, framesOf, freeGameId, freeTitle, gameIdify, handBinding, inferDeclFromWrite, isHoleRef, isSpatial, isValidGameId, labelPoint, markOf, marksOn, openThreadCounts, parseHoleRef, pointInPolygon, polygonBounds, polygonOf, restack, spatialOf, stacked, threadsFor, turnSpan, unbindHand, valueAddresses, withBackgrounds, withPolygon, withSpatialGroup, withZ, zOf, zoneAt, zonesAt };
package/dist/index.js CHANGED
@@ -468,7 +468,8 @@ var parseHoleRef = (value) => {
468
468
  };
469
469
  var BUNDLE_SCHEMA = "storylets/bundle@0";
470
470
  var DEFAULT_PLAY_RUNG = "solo";
471
- var SAVE_SCHEMA = "storylets/save@1";
471
+ var SAVE_SCHEMA = "storylets/save@2";
472
+ var SAVE_SCHEMA_V1 = "storylets/save@1";
472
473
  var SAVEFILE_SCHEMA = "storylets/savefile@1";
473
474
  var PROJECT_FOLDER_EXTENSION = ".storylets";
474
475
  var BUNDLE_EXTENSION = ".storyletsc";
@@ -541,6 +542,7 @@ export {
541
542
  RESERVED_PROPERTY_NAMES,
542
543
  SAVEFILE_SCHEMA,
543
544
  SAVE_SCHEMA,
545
+ SAVE_SCHEMA_V1,
544
546
  SHARD_EXTENSIONS,
545
547
  SPATIAL,
546
548
  TAGS_SCHEMA,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storylet-studio/model",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "description": "Storylets data-model types: source shards (project / box / tags / hands / deck), the compiled bundle, the save envelope. The shape source-of-truth.",
5
5
  "type": "module",
6
6
  "license": "MIT",