@patterkit/model 0.18.0 → 0.20.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
@@ -64,6 +64,8 @@ __export(index_exports, {
64
64
  projectQualifiers: () => projectQualifiers,
65
65
  propertyNameify: () => import_expr.propertyNameify,
66
66
  qualifierStringKey: () => qualifierStringKey,
67
+ resolveSceneRef: () => resolveSceneRef,
68
+ sceneAddressIndex: () => sceneAddressIndex,
67
69
  speakerLabelKey: () => speakerLabelKey,
68
70
  textIsAction: () => textIsAction,
69
71
  usedQualifiers: () => usedQualifiers,
@@ -96,6 +98,14 @@ function effectiveGameId(entity) {
96
98
  const g = entity.gameId?.trim();
97
99
  return g ? g : gameIdify(entity.name);
98
100
  }
101
+ function sceneAddressIndex(scenes) {
102
+ const byAddress = /* @__PURE__ */ new Map();
103
+ for (const [id, scene] of Object.entries(scenes)) byAddress.set(effectiveGameId(scene), id);
104
+ return byAddress;
105
+ }
106
+ function resolveSceneRef(scenes, ref, byAddress) {
107
+ return (byAddress ?? sceneAddressIndex(scenes)).get(ref) ?? (Object.hasOwn(scenes, ref) ? ref : void 0);
108
+ }
99
109
  var COMMON_GENDERS = ["male", "female", "neuter"];
100
110
  var DEFAULT_QUALIFIERS = [
101
111
  { gameId: "vo", name: "V.O.", description: "Voice-over: the character isn't in the scene (a thought, narration, a voice in the ear)." },
@@ -288,6 +298,8 @@ var UNRESOLVED_KEY = "unresolved";
288
298
  projectQualifiers,
289
299
  propertyNameify,
290
300
  qualifierStringKey,
301
+ resolveSceneRef,
302
+ sceneAddressIndex,
291
303
  speakerLabelKey,
292
304
  textIsAction,
293
305
  usedQualifiers,
package/dist/index.d.cts CHANGED
@@ -257,6 +257,25 @@ declare function effectiveGameId(entity: {
257
257
  gameId?: string;
258
258
  name: string;
259
259
  }): string;
260
+ /** A bundle's scenes by their address (effective gameId), for `resolveSceneRef` to look up in. */
261
+ declare function sceneAddressIndex(scenes: Readonly<Record<string, {
262
+ gameId?: string;
263
+ name: string;
264
+ }>>): Map<string, string>;
265
+ /**
266
+ * THE rule for resolving a scene reference to its internal id: its address (the effective gameId, the
267
+ * host-facing name, spec §6) first, then its internal id. Undefined when neither names a scene.
268
+ *
269
+ * One rule for the runtime's openFlow, goto and every engine lookup, and for every tool that has to land
270
+ * where the game will (the Storylet Engine's Board and pairing check, Patterpad's Show Card). Each used to
271
+ * keep a copy, and the copies tried the internal id first, so where one scene's id was another's gameId
272
+ * they picked a different scene from the one the game opened (family parity item 1). Pass `byAddress`
273
+ * (from `sceneAddressIndex`) to look up many references in one bundle without rebuilding it.
274
+ */
275
+ declare function resolveSceneRef(scenes: Readonly<Record<string, {
276
+ gameId?: string;
277
+ name: string;
278
+ }>>, ref: string, byAddress?: ReadonlyMap<string, string>): string | undefined;
260
279
  type PropertyType = "boolean" | "number" | "string" | "flags" | "enum" | "quality";
261
280
  interface PropertyDecl {
262
281
  name: string;
@@ -681,11 +700,10 @@ interface ProjectFile {
681
700
  gameDataFields?: GameDataFields;
682
701
  /**
683
702
  * The Patter extensions this project takes, by id (ruled 2026-10-18: the project opts in), each pinned to a
684
- * version, with its settings (the host fields its claims present, by setting name). The manifest itself
685
- * sits in `extensions/<id>.extension.json`, and the data in `.patterextension` shards. Authoring config:
686
- * the bundle carries each one's compiled declarations, values, and resolved settings
687
- * (`BundleExtension.settings`), never this block itself. An extension named here whose manifest is missing
688
- * is a warning, and its data is left untouched.
703
+ * version. The manifest itself sits in `extensions/<id>.extension.json`, and the data in `.patterextension`
704
+ * shards. Authoring config: the bundle carries each one's compiled declarations and values, never this
705
+ * block itself. An extension named here whose manifest is missing is a warning, and its data is left
706
+ * untouched.
689
707
  */
690
708
  extensions?: Record<string, ProjectExtension>;
691
709
  /** Ordered writing-status ladder (not-done -> done); default `DEFAULT_WRITING_STATUSES`. */
@@ -1094,9 +1112,9 @@ interface Bundle {
1094
1112
  gameDataFields?: GameDataFields;
1095
1113
  /**
1096
1114
  * The extensions the project takes, by id: each one's version and its compiled declarations by node kind,
1097
- * every default resolved (what `extensionDecls` reads), the project node's own values, and its settings,
1098
- * resolved (what `extensionSettings` reads). A node's values sit on the node, under `extensions`. Absent
1099
- * when the project takes none, so a bundle without them is byte for byte what it was.
1115
+ * every default resolved (what `extensionDecls` reads), and the project node's own values. A node's values
1116
+ * sit on the node, under `extensions`. Absent when the project takes none, so a bundle without them is byte
1117
+ * for byte what it was.
1100
1118
  */
1101
1119
  extensions?: Record<string, BundleExtension>;
1102
1120
  scenes: Record<string, CompiledScene>;
@@ -1310,12 +1328,12 @@ declare const MANIFEST_EXTENSION = ".extension.json";
1310
1328
  * folder, so a merge driver handed one shard's path can always find the manifest. */
1311
1329
  declare const EXTENSIONS_DIR = "extensions";
1312
1330
  /**
1313
- * The extensions a project takes (`ProjectFile.extensions`), one each: the version it is pinned to and its
1314
- * settings (the host fields its claims present, by setting name).
1331
+ * The extensions a project takes (`ProjectFile.extensions`), one each: the version it is pinned to. An older
1332
+ * pin may still carry `settings`, which named the host fields claims presented; claims and settings are gone
1333
+ * from the extensions spec (2026-10-20), so they're ignored, and `patter validate` says so.
1315
1334
  */
1316
1335
  interface ProjectExtension {
1317
1336
  version: string;
1318
- settings?: Record<string, string>;
1319
1337
  }
1320
1338
  /**
1321
1339
  * One extension's data for one scene, or for the project (`scene: "@project"`).
@@ -1347,13 +1365,6 @@ interface BundleExtension {
1347
1365
  fields: Record<string, ExtensionFieldDecl[]>;
1348
1366
  /** The project node's values, raw, when it has any. */
1349
1367
  project?: Record<string, unknown>;
1350
- /**
1351
- * Every setting the manifest declares, by setting name, keys sorted: the project's value (`ProjectExtension.
1352
- * settings`), or else the setting's default (`@wildwinter/toolkit/extensions`' `settingValues`). A setting
1353
- * names a host field, so a game reads here which gameData field holds what the extension claims. Present
1354
- * only when the manifest declares settings.
1355
- */
1356
- settings?: Record<string, string>;
1357
1368
  }
1358
1369
  /**
1359
1370
  * A compiled extension field declaration (`@wildwinter/toolkit/extensions`' FieldDecl, less the editor's
@@ -1383,4 +1394,4 @@ interface ExtensionFieldDecl {
1383
1394
  /** A node's extension values in a bundle: extension id -> field -> value, raw. */
1384
1395
  type NodeExtensions = Record<string, Record<string, unknown>>;
1385
1396
 
1386
- export { AUTHORING_SCHEMA, type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, type BundleExtension, type BundleQualifier, COMMON_GENDERS, type CaptionDelimiters, type CastMember, type Comment, type CommentMessage, type CommentRange, type CompiledBlock, type CompiledEffect, type CompiledGroup, type CompiledScene, type CompiledSnippet, type CoverageDriver, DEFAULT_CAPTION_CHARACTER, DEFAULT_CAPTION_DELIMITERS, DEFAULT_DOCUMENTATION_CLASSES, DEFAULT_LAYOUT, DEFAULT_PAD_AFTER, DEFAULT_QUALIFIERS, DEFAULT_RECORDING_STATUSES, DEFAULT_SPEAKER_PATTERN, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, EXTENSIONS_DIR, EXTENSION_SCHEMA, EXTENSION_SHARD, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, type ExtensionFieldDecl, type ExtensionShard, FLOW_SCHEMA, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, type FlowState, type FlowValues, type GameData, type GameDataField, type GameDataFieldType, type GameDataFields, type GameDataNodeKind, type GameEventBeat, type GrammaticalGender, type Group, HANDOFF_SCHEMA, type HandoffFile, type HandoffImport, type HandoffLine, type HandoffRow, type HostScopeDecl, type HostScopeRegistry, type HostScopeSpec, type Jump, type JumpTarget, type LineBeat, type LocaleFile, MANIFEST_EXTENSION, type NodeExtensions, PAD_AFTER_MAX, PAD_AFTER_MIN, PROJECT_EXTENSION_STEM, PROJECT_LOCALE_SCENE, PROJECT_SCHEMA, type ProjectDictionary, type ProjectExtension, type ProjectFile, type ProjectLayout, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, SPEAKER_PATTERN_KEY, STRINGS_SCHEMA, type SaveEnvelope, type SaveGame, type SaveGameV2, type SavedChoice, type SavedChoiceOption, type SavedChoicePrompt, type ScalarValue, type Scene, type Selector, type SelectorExhaust, type SelectorOrder, type SelectorSnapshot, type SequenceOptions, type Snippet, type SpeakerQualifier, type StackFrame, type Suggestion, type SuggestionSource, type TextBeat, UNRESOLVED_KEY, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, formatSpeakerLabel, gameIdify, isContentlessBeat, isDialogueScene, isValidGameId, projectLayout, projectQualifiers, qualifierStringKey, speakerLabelKey, textIsAction, usedQualifiers, usedSpeakerPairs, walkNodes };
1397
+ export { AUTHORING_SCHEMA, type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, type BundleExtension, type BundleQualifier, COMMON_GENDERS, type CaptionDelimiters, type CastMember, type Comment, type CommentMessage, type CommentRange, type CompiledBlock, type CompiledEffect, type CompiledGroup, type CompiledScene, type CompiledSnippet, type CoverageDriver, DEFAULT_CAPTION_CHARACTER, DEFAULT_CAPTION_DELIMITERS, DEFAULT_DOCUMENTATION_CLASSES, DEFAULT_LAYOUT, DEFAULT_PAD_AFTER, DEFAULT_QUALIFIERS, DEFAULT_RECORDING_STATUSES, DEFAULT_SPEAKER_PATTERN, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, EXTENSIONS_DIR, EXTENSION_SCHEMA, EXTENSION_SHARD, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, type ExtensionFieldDecl, type ExtensionShard, FLOW_SCHEMA, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, type FlowState, type FlowValues, type GameData, type GameDataField, type GameDataFieldType, type GameDataFields, type GameDataNodeKind, type GameEventBeat, type GrammaticalGender, type Group, HANDOFF_SCHEMA, type HandoffFile, type HandoffImport, type HandoffLine, type HandoffRow, type HostScopeDecl, type HostScopeRegistry, type HostScopeSpec, type Jump, type JumpTarget, type LineBeat, type LocaleFile, MANIFEST_EXTENSION, type NodeExtensions, PAD_AFTER_MAX, PAD_AFTER_MIN, PROJECT_EXTENSION_STEM, PROJECT_LOCALE_SCENE, PROJECT_SCHEMA, type ProjectDictionary, type ProjectExtension, type ProjectFile, type ProjectLayout, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, SPEAKER_PATTERN_KEY, STRINGS_SCHEMA, type SaveEnvelope, type SaveGame, type SaveGameV2, type SavedChoice, type SavedChoiceOption, type SavedChoicePrompt, type ScalarValue, type Scene, type Selector, type SelectorExhaust, type SelectorOrder, type SelectorSnapshot, type SequenceOptions, type Snippet, type SpeakerQualifier, type StackFrame, type Suggestion, type SuggestionSource, type TextBeat, UNRESOLVED_KEY, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, formatSpeakerLabel, gameIdify, isContentlessBeat, isDialogueScene, isValidGameId, projectLayout, projectQualifiers, qualifierStringKey, resolveSceneRef, sceneAddressIndex, speakerLabelKey, textIsAction, usedQualifiers, usedSpeakerPairs, walkNodes };
package/dist/index.d.ts CHANGED
@@ -257,6 +257,25 @@ declare function effectiveGameId(entity: {
257
257
  gameId?: string;
258
258
  name: string;
259
259
  }): string;
260
+ /** A bundle's scenes by their address (effective gameId), for `resolveSceneRef` to look up in. */
261
+ declare function sceneAddressIndex(scenes: Readonly<Record<string, {
262
+ gameId?: string;
263
+ name: string;
264
+ }>>): Map<string, string>;
265
+ /**
266
+ * THE rule for resolving a scene reference to its internal id: its address (the effective gameId, the
267
+ * host-facing name, spec §6) first, then its internal id. Undefined when neither names a scene.
268
+ *
269
+ * One rule for the runtime's openFlow, goto and every engine lookup, and for every tool that has to land
270
+ * where the game will (the Storylet Engine's Board and pairing check, Patterpad's Show Card). Each used to
271
+ * keep a copy, and the copies tried the internal id first, so where one scene's id was another's gameId
272
+ * they picked a different scene from the one the game opened (family parity item 1). Pass `byAddress`
273
+ * (from `sceneAddressIndex`) to look up many references in one bundle without rebuilding it.
274
+ */
275
+ declare function resolveSceneRef(scenes: Readonly<Record<string, {
276
+ gameId?: string;
277
+ name: string;
278
+ }>>, ref: string, byAddress?: ReadonlyMap<string, string>): string | undefined;
260
279
  type PropertyType = "boolean" | "number" | "string" | "flags" | "enum" | "quality";
261
280
  interface PropertyDecl {
262
281
  name: string;
@@ -681,11 +700,10 @@ interface ProjectFile {
681
700
  gameDataFields?: GameDataFields;
682
701
  /**
683
702
  * The Patter extensions this project takes, by id (ruled 2026-10-18: the project opts in), each pinned to a
684
- * version, with its settings (the host fields its claims present, by setting name). The manifest itself
685
- * sits in `extensions/<id>.extension.json`, and the data in `.patterextension` shards. Authoring config:
686
- * the bundle carries each one's compiled declarations, values, and resolved settings
687
- * (`BundleExtension.settings`), never this block itself. An extension named here whose manifest is missing
688
- * is a warning, and its data is left untouched.
703
+ * version. The manifest itself sits in `extensions/<id>.extension.json`, and the data in `.patterextension`
704
+ * shards. Authoring config: the bundle carries each one's compiled declarations and values, never this
705
+ * block itself. An extension named here whose manifest is missing is a warning, and its data is left
706
+ * untouched.
689
707
  */
690
708
  extensions?: Record<string, ProjectExtension>;
691
709
  /** Ordered writing-status ladder (not-done -> done); default `DEFAULT_WRITING_STATUSES`. */
@@ -1094,9 +1112,9 @@ interface Bundle {
1094
1112
  gameDataFields?: GameDataFields;
1095
1113
  /**
1096
1114
  * The extensions the project takes, by id: each one's version and its compiled declarations by node kind,
1097
- * every default resolved (what `extensionDecls` reads), the project node's own values, and its settings,
1098
- * resolved (what `extensionSettings` reads). A node's values sit on the node, under `extensions`. Absent
1099
- * when the project takes none, so a bundle without them is byte for byte what it was.
1115
+ * every default resolved (what `extensionDecls` reads), and the project node's own values. A node's values
1116
+ * sit on the node, under `extensions`. Absent when the project takes none, so a bundle without them is byte
1117
+ * for byte what it was.
1100
1118
  */
1101
1119
  extensions?: Record<string, BundleExtension>;
1102
1120
  scenes: Record<string, CompiledScene>;
@@ -1310,12 +1328,12 @@ declare const MANIFEST_EXTENSION = ".extension.json";
1310
1328
  * folder, so a merge driver handed one shard's path can always find the manifest. */
1311
1329
  declare const EXTENSIONS_DIR = "extensions";
1312
1330
  /**
1313
- * The extensions a project takes (`ProjectFile.extensions`), one each: the version it is pinned to and its
1314
- * settings (the host fields its claims present, by setting name).
1331
+ * The extensions a project takes (`ProjectFile.extensions`), one each: the version it is pinned to. An older
1332
+ * pin may still carry `settings`, which named the host fields claims presented; claims and settings are gone
1333
+ * from the extensions spec (2026-10-20), so they're ignored, and `patter validate` says so.
1315
1334
  */
1316
1335
  interface ProjectExtension {
1317
1336
  version: string;
1318
- settings?: Record<string, string>;
1319
1337
  }
1320
1338
  /**
1321
1339
  * One extension's data for one scene, or for the project (`scene: "@project"`).
@@ -1347,13 +1365,6 @@ interface BundleExtension {
1347
1365
  fields: Record<string, ExtensionFieldDecl[]>;
1348
1366
  /** The project node's values, raw, when it has any. */
1349
1367
  project?: Record<string, unknown>;
1350
- /**
1351
- * Every setting the manifest declares, by setting name, keys sorted: the project's value (`ProjectExtension.
1352
- * settings`), or else the setting's default (`@wildwinter/toolkit/extensions`' `settingValues`). A setting
1353
- * names a host field, so a game reads here which gameData field holds what the extension claims. Present
1354
- * only when the manifest declares settings.
1355
- */
1356
- settings?: Record<string, string>;
1357
1368
  }
1358
1369
  /**
1359
1370
  * A compiled extension field declaration (`@wildwinter/toolkit/extensions`' FieldDecl, less the editor's
@@ -1383,4 +1394,4 @@ interface ExtensionFieldDecl {
1383
1394
  /** A node's extension values in a bundle: extension id -> field -> value, raw. */
1384
1395
  type NodeExtensions = Record<string, Record<string, unknown>>;
1385
1396
 
1386
- export { AUTHORING_SCHEMA, type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, type BundleExtension, type BundleQualifier, COMMON_GENDERS, type CaptionDelimiters, type CastMember, type Comment, type CommentMessage, type CommentRange, type CompiledBlock, type CompiledEffect, type CompiledGroup, type CompiledScene, type CompiledSnippet, type CoverageDriver, DEFAULT_CAPTION_CHARACTER, DEFAULT_CAPTION_DELIMITERS, DEFAULT_DOCUMENTATION_CLASSES, DEFAULT_LAYOUT, DEFAULT_PAD_AFTER, DEFAULT_QUALIFIERS, DEFAULT_RECORDING_STATUSES, DEFAULT_SPEAKER_PATTERN, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, EXTENSIONS_DIR, EXTENSION_SCHEMA, EXTENSION_SHARD, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, type ExtensionFieldDecl, type ExtensionShard, FLOW_SCHEMA, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, type FlowState, type FlowValues, type GameData, type GameDataField, type GameDataFieldType, type GameDataFields, type GameDataNodeKind, type GameEventBeat, type GrammaticalGender, type Group, HANDOFF_SCHEMA, type HandoffFile, type HandoffImport, type HandoffLine, type HandoffRow, type HostScopeDecl, type HostScopeRegistry, type HostScopeSpec, type Jump, type JumpTarget, type LineBeat, type LocaleFile, MANIFEST_EXTENSION, type NodeExtensions, PAD_AFTER_MAX, PAD_AFTER_MIN, PROJECT_EXTENSION_STEM, PROJECT_LOCALE_SCENE, PROJECT_SCHEMA, type ProjectDictionary, type ProjectExtension, type ProjectFile, type ProjectLayout, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, SPEAKER_PATTERN_KEY, STRINGS_SCHEMA, type SaveEnvelope, type SaveGame, type SaveGameV2, type SavedChoice, type SavedChoiceOption, type SavedChoicePrompt, type ScalarValue, type Scene, type Selector, type SelectorExhaust, type SelectorOrder, type SelectorSnapshot, type SequenceOptions, type Snippet, type SpeakerQualifier, type StackFrame, type Suggestion, type SuggestionSource, type TextBeat, UNRESOLVED_KEY, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, formatSpeakerLabel, gameIdify, isContentlessBeat, isDialogueScene, isValidGameId, projectLayout, projectQualifiers, qualifierStringKey, speakerLabelKey, textIsAction, usedQualifiers, usedSpeakerPairs, walkNodes };
1397
+ export { AUTHORING_SCHEMA, type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, type BundleExtension, type BundleQualifier, COMMON_GENDERS, type CaptionDelimiters, type CastMember, type Comment, type CommentMessage, type CommentRange, type CompiledBlock, type CompiledEffect, type CompiledGroup, type CompiledScene, type CompiledSnippet, type CoverageDriver, DEFAULT_CAPTION_CHARACTER, DEFAULT_CAPTION_DELIMITERS, DEFAULT_DOCUMENTATION_CLASSES, DEFAULT_LAYOUT, DEFAULT_PAD_AFTER, DEFAULT_QUALIFIERS, DEFAULT_RECORDING_STATUSES, DEFAULT_SPEAKER_PATTERN, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, EXTENSIONS_DIR, EXTENSION_SCHEMA, EXTENSION_SHARD, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, type ExtensionFieldDecl, type ExtensionShard, FLOW_SCHEMA, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, type FlowState, type FlowValues, type GameData, type GameDataField, type GameDataFieldType, type GameDataFields, type GameDataNodeKind, type GameEventBeat, type GrammaticalGender, type Group, HANDOFF_SCHEMA, type HandoffFile, type HandoffImport, type HandoffLine, type HandoffRow, type HostScopeDecl, type HostScopeRegistry, type HostScopeSpec, type Jump, type JumpTarget, type LineBeat, type LocaleFile, MANIFEST_EXTENSION, type NodeExtensions, PAD_AFTER_MAX, PAD_AFTER_MIN, PROJECT_EXTENSION_STEM, PROJECT_LOCALE_SCENE, PROJECT_SCHEMA, type ProjectDictionary, type ProjectExtension, type ProjectFile, type ProjectLayout, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, SPEAKER_PATTERN_KEY, STRINGS_SCHEMA, type SaveEnvelope, type SaveGame, type SaveGameV2, type SavedChoice, type SavedChoiceOption, type SavedChoicePrompt, type ScalarValue, type Scene, type Selector, type SelectorExhaust, type SelectorOrder, type SelectorSnapshot, type SequenceOptions, type Snippet, type SpeakerQualifier, type StackFrame, type Suggestion, type SuggestionSource, type TextBeat, UNRESOLVED_KEY, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, formatSpeakerLabel, gameIdify, isContentlessBeat, isDialogueScene, isValidGameId, projectLayout, projectQualifiers, qualifierStringKey, resolveSceneRef, sceneAddressIndex, speakerLabelKey, textIsAction, usedQualifiers, usedSpeakerPairs, walkNodes };
package/dist/index.js CHANGED
@@ -29,6 +29,14 @@ function effectiveGameId(entity) {
29
29
  const g = entity.gameId?.trim();
30
30
  return g ? g : gameIdify(entity.name);
31
31
  }
32
+ function sceneAddressIndex(scenes) {
33
+ const byAddress = /* @__PURE__ */ new Map();
34
+ for (const [id, scene] of Object.entries(scenes)) byAddress.set(effectiveGameId(scene), id);
35
+ return byAddress;
36
+ }
37
+ function resolveSceneRef(scenes, ref, byAddress) {
38
+ return (byAddress ?? sceneAddressIndex(scenes)).get(ref) ?? (Object.hasOwn(scenes, ref) ? ref : void 0);
39
+ }
32
40
  var COMMON_GENDERS = ["male", "female", "neuter"];
33
41
  var DEFAULT_QUALIFIERS = [
34
42
  { gameId: "vo", name: "V.O.", description: "Voice-over: the character isn't in the scene (a thought, narration, a voice in the ear)." },
@@ -220,6 +228,8 @@ export {
220
228
  projectQualifiers,
221
229
  propertyNameify,
222
230
  qualifierStringKey,
231
+ resolveSceneRef,
232
+ sceneAddressIndex,
223
233
  speakerLabelKey,
224
234
  textIsAction,
225
235
  usedQualifiers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/model",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Patter data-model types: source (scene/block/group/snippet/beat/jump), project, locale, authoring. The shape source-of-truth.",
5
5
  "type": "module",
6
6
  "license": "MIT",