@patterkit/model 0.10.0 → 0.11.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
@@ -26,6 +26,7 @@ __export(index_exports, {
26
26
  DEFAULT_CAPTION_DELIMITERS: () => DEFAULT_CAPTION_DELIMITERS,
27
27
  DEFAULT_DOCUMENTATION_CLASSES: () => DEFAULT_DOCUMENTATION_CLASSES,
28
28
  DEFAULT_LAYOUT: () => DEFAULT_LAYOUT,
29
+ DEFAULT_QUALIFIERS: () => DEFAULT_QUALIFIERS,
29
30
  DEFAULT_RECORDING_STATUSES: () => DEFAULT_RECORDING_STATUSES,
30
31
  DEFAULT_WRITING_STATUSES: () => DEFAULT_WRITING_STATUSES,
31
32
  FLOW_SCHEMA: () => FLOW_SCHEMA,
@@ -47,7 +48,10 @@ __export(index_exports, {
47
48
  isValidGameId: () => isValidGameId,
48
49
  isValidPropertyName: () => import_expr.isValidPropertyName,
49
50
  projectLayout: () => projectLayout,
51
+ projectQualifiers: () => projectQualifiers,
50
52
  propertyNameify: () => import_expr.propertyNameify,
53
+ qualifierStringKey: () => qualifierStringKey,
54
+ usedQualifiers: () => usedQualifiers,
51
55
  walkNodes: () => walkNodes
52
56
  });
53
57
  module.exports = __toCommonJS(index_exports);
@@ -77,6 +81,29 @@ function effectiveGameId(entity) {
77
81
  return g ? g : gameIdify(entity.name);
78
82
  }
79
83
  var COMMON_GENDERS = ["male", "female", "neuter"];
84
+ var DEFAULT_QUALIFIERS = [
85
+ { gameId: "vo", name: "V.O.", description: "Voice-over: the character isn't in the scene (a thought, narration, a voice in the ear)." },
86
+ { gameId: "os", name: "O.S.", description: "Off-screen: the character is there, but not seen (the next room, behind a door)." },
87
+ { gameId: "radio", name: "RADIO", description: "Heard through a radio, a phone, or a loudspeaker." }
88
+ ];
89
+ function projectQualifiers(project) {
90
+ return project.qualifiers ?? DEFAULT_QUALIFIERS;
91
+ }
92
+ function usedQualifiers(project, scenes) {
93
+ const used = /* @__PURE__ */ new Set();
94
+ for (const scene of scenes) {
95
+ for (const block of scene.blocks) {
96
+ walkNodes(block.children, (node) => {
97
+ if (node.type === "group") {
98
+ if (node.prompt?.kind === "line" && node.prompt.qualifier) used.add(node.prompt.qualifier);
99
+ return;
100
+ }
101
+ for (const beat of node.beats ?? []) if (beat.kind === "line" && beat.qualifier) used.add(beat.qualifier);
102
+ });
103
+ }
104
+ }
105
+ return projectQualifiers(project).filter((q) => used.has(q.gameId));
106
+ }
80
107
  var DEFAULT_WRITING_STATUSES = [
81
108
  { name: "stub", colour: 0 },
82
109
  // red
@@ -122,6 +149,9 @@ var PROJECT_LOCALE_SCENE = "@project";
122
149
  function castStringKey(name) {
123
150
  return `cast:${name}`;
124
151
  }
152
+ function qualifierStringKey(gameId) {
153
+ return `qualifier:${gameId}`;
154
+ }
125
155
  var HANDOFF_SCHEMA = "patter/handoff@0";
126
156
  var DEFAULT_CAPTION_DELIMITERS = { open: "[", close: "]" };
127
157
  var DEFAULT_CAPTION_CHARACTER = "SFX";
@@ -143,6 +173,7 @@ var AUTHORING_SCHEMA = "patter/authoring@0";
143
173
  DEFAULT_CAPTION_DELIMITERS,
144
174
  DEFAULT_DOCUMENTATION_CLASSES,
145
175
  DEFAULT_LAYOUT,
176
+ DEFAULT_QUALIFIERS,
146
177
  DEFAULT_RECORDING_STATUSES,
147
178
  DEFAULT_WRITING_STATUSES,
148
179
  FLOW_SCHEMA,
@@ -164,6 +195,9 @@ var AUTHORING_SCHEMA = "patter/authoring@0";
164
195
  isValidGameId,
165
196
  isValidPropertyName,
166
197
  projectLayout,
198
+ projectQualifiers,
167
199
  propertyNameify,
200
+ qualifierStringKey,
201
+ usedQualifiers,
168
202
  walkNodes
169
203
  });
package/dist/index.d.cts CHANGED
@@ -23,6 +23,10 @@ interface LineBeat {
23
23
  character?: string;
24
24
  /** Performance direction, language-neutral (never localised). */
25
25
  direction?: string;
26
+ /** Speaker qualifier: the `gameId` of one of the project's qualifiers (`vo`, `os`, `radio`), which says
27
+ * how the line is delivered (`TAM (O.S.)`), not who says it. Absent = none. The speaker is still
28
+ * `character` for every authoring and reporting purpose. See `SpeakerQualifier`. */
29
+ qualifier?: string;
26
30
  gameData?: GameData;
27
31
  /** Author-defined freeform tags (#215): a cross-cutting label layer that travels to the runtime.
28
32
  * At runtime a beat's tags are the UNION of its own and every ancestor's (scene → block → group(s) →
@@ -328,6 +332,29 @@ interface CastMember {
328
332
  actor?: string;
329
333
  gameData?: GameData;
330
334
  }
335
+ /** A speaker qualifier (a screenplay's character extension): `V.O.`, `O.S.`, `RADIO`, or the project's own.
336
+ * A line stores the `gameId`; the `name` is what the cue, Play, and the scripts show, and is localised as a
337
+ * cast display name is (`qualifierStringKey`). */
338
+ interface SpeakerQualifier {
339
+ /** What code switches on, and what a line stores. Unique in the project; hyphen-slug form (`gameIdify`). */
340
+ gameId: string;
341
+ /** What the script shows (`V.O.`). Free to change: lines hold the `gameId`. */
342
+ name: string;
343
+ /** What the qualifier means, for writers. Authoring only. */
344
+ description?: string;
345
+ }
346
+ /** The qualifiers a project starts with. Their `gameId`s are pinned (`gameIdify` would make `V.O.` into
347
+ * `v-o`); a qualifier a writer adds takes its `gameId` from `gameIdify(name)`. */
348
+ declare const DEFAULT_QUALIFIERS: SpeakerQualifier[];
349
+ /** The project's qualifiers: its own list, else the defaults. */
350
+ declare function projectQualifiers(project: Pick<ProjectFile, "qualifiers">): SpeakerQualifier[];
351
+ /** The project's qualifiers that some line (or line prompt) in these scenes uses, in the project's order. */
352
+ declare function usedQualifiers(project: Pick<ProjectFile, "qualifiers">, scenes: Scene[]): SpeakerQualifier[];
353
+ /** A qualifier as it reaches a compiled bundle: its `gameId` and authored name (the unlocalised fallback). */
354
+ interface BundleQualifier {
355
+ gameId: string;
356
+ name: string;
357
+ }
331
358
  /** The cast as it reaches a compiled bundle: the player-facing fields only. `notes`, `actor` and
332
359
  * `gender` are authoring / production / translation context, and the compiler drops them, so a shipped
333
360
  * game never carries a real person's name or a writer's private notes. The compiler copies the shipping
@@ -565,6 +592,9 @@ interface ProjectFile {
565
592
  * externally-gated branches get exercised. Authoring-only (never reaches the runtime bundle). */
566
593
  coverageDrivers?: CoverageDriver[];
567
594
  cast?: CastMember[];
595
+ /** The speaker qualifiers a line can pick from, in display order; default `DEFAULT_QUALIFIERS`. An empty
596
+ * list means the project uses none. */
597
+ qualifiers?: SpeakerQualifier[];
568
598
  gameDataFields?: GameDataFields;
569
599
  /** Ordered writing-status ladder (not-done -> done); default `DEFAULT_WRITING_STATUSES`. */
570
600
  writingStatuses?: WritingStatusDecl[];
@@ -605,12 +635,16 @@ interface LocaleFile {
605
635
  strings: Record<string, string>;
606
636
  }
607
637
  /** The `scene` marker for a project-level loc shard (`loc/<locale>/_project.patterloc`): strings that
608
- * aren't tied to a scene beat - currently cast display names, later project title / UI strings. */
638
+ * aren't tied to a scene beat - currently cast display names and speaker qualifier names, later project
639
+ * title / UI strings. */
609
640
  declare const PROJECT_LOCALE_SCENE = "@project";
610
641
  /** The project-level loc-string key for a cast member's player-facing name, e.g. `cast:BARKEEP`.
611
642
  * Namespaced so it can't collide with opaque beat ids. The default-locale value is seeded from the
612
643
  * CastMember's `displayName`; the runtime resolves a character's shown name through this key. */
613
644
  declare function castStringKey(name: string): string;
645
+ /** The project-level loc-string key for a speaker qualifier's shown name, e.g. `qualifier:vo`. Resolved as a
646
+ * cast display name is: the active locale, then the default locale, then the authored `name`. */
647
+ declare function qualifierStringKey(gameId: string): string;
614
648
  /** Typed documentation annotation line (spec §18). */
615
649
  interface DocLine {
616
650
  /** The documentation CLASS (a `DocumentationClass.name`) - routes export
@@ -690,6 +724,10 @@ interface Suggestion {
690
724
  /** A proposed new direction (the parenthetical), and the direction when suggested ("" for none). */
691
725
  proposedDirection?: string;
692
726
  baselineDirection?: string;
727
+ /** A proposed new speaker qualifier (a `gameId` from the project's list, "" for none), and the qualifier
728
+ * when suggested ("" for none). */
729
+ proposedQualifier?: string;
730
+ baselineQualifier?: string;
693
731
  /** A proposal to cut the beat (an editor emptied its line). Accept marks it cut. */
694
732
  proposedCut?: boolean;
695
733
  /** Where the suggestion came from, when it arrived in an editable-script handoff: the handoff and the
@@ -795,8 +833,9 @@ interface HandoffLine {
795
833
  /** The beat id (a line, a narration beat, or an option prompt). */
796
834
  id: string;
797
835
  kind: "line" | "narration" | "option";
798
- /** The speaker and direction as sent (spoken lines only). */
836
+ /** The speaker, speaker qualifier (`gameId`), and direction as sent (spoken lines only). */
799
837
  character?: string;
838
+ qualifier?: string;
800
839
  direction?: string;
801
840
  /** The text as sent: the baseline for every comparison on reimport. */
802
841
  baseline: string;
@@ -910,6 +949,9 @@ interface Bundle {
910
949
  };
911
950
  /** Player-facing cast only: the compiler strips notes / actor / gender (see `BundleCastMember`). */
912
951
  cast?: BundleCastMember[];
952
+ /** The speaker qualifiers the content uses, in the project's order. Absent when no line has one, so a
953
+ * bundle without qualifiers is exactly as before. */
954
+ qualifiers?: BundleQualifier[];
913
955
  properties?: PropertyDecl[];
914
956
  /** Host / world scope declarations, baked from the project so the runtime can self-back a declared
915
957
  * scope (`@world`, ...) when no host resolver claims its token. Absent = no host scopes. */
@@ -991,6 +1033,8 @@ interface SavedChoicePrompt {
991
1033
  character?: string;
992
1034
  characterName?: string;
993
1035
  direction?: string;
1036
+ qualifier?: string;
1037
+ qualifierName?: string;
994
1038
  }
995
1039
  /** One option of a pending choice, saved VERBATIM: re-deriving on load would re-evaluate conditions. */
996
1040
  interface SavedChoiceOption {
@@ -1092,4 +1136,4 @@ declare const PROJECT_SCHEMA = "patter/project@0";
1092
1136
  declare const STRINGS_SCHEMA = "patter/strings@0";
1093
1137
  declare const AUTHORING_SCHEMA = "patter/authoring@0";
1094
1138
 
1095
- export { AUTHORING_SCHEMA, type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, 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_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, FLOW_SCHEMA, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, 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, PROJECT_LOCALE_SCENE, PROJECT_SCHEMA, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, 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 StackFrame, type Suggestion, type SuggestionSource, type TextBeat, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, gameIdify, isContentlessBeat, isValidGameId, projectLayout, walkNodes };
1139
+ export { AUTHORING_SCHEMA, type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, 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_QUALIFIERS, DEFAULT_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, FLOW_SCHEMA, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, 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, PROJECT_LOCALE_SCENE, PROJECT_SCHEMA, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, 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, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, gameIdify, isContentlessBeat, isValidGameId, projectLayout, projectQualifiers, qualifierStringKey, usedQualifiers, walkNodes };
package/dist/index.d.ts CHANGED
@@ -23,6 +23,10 @@ interface LineBeat {
23
23
  character?: string;
24
24
  /** Performance direction, language-neutral (never localised). */
25
25
  direction?: string;
26
+ /** Speaker qualifier: the `gameId` of one of the project's qualifiers (`vo`, `os`, `radio`), which says
27
+ * how the line is delivered (`TAM (O.S.)`), not who says it. Absent = none. The speaker is still
28
+ * `character` for every authoring and reporting purpose. See `SpeakerQualifier`. */
29
+ qualifier?: string;
26
30
  gameData?: GameData;
27
31
  /** Author-defined freeform tags (#215): a cross-cutting label layer that travels to the runtime.
28
32
  * At runtime a beat's tags are the UNION of its own and every ancestor's (scene → block → group(s) →
@@ -328,6 +332,29 @@ interface CastMember {
328
332
  actor?: string;
329
333
  gameData?: GameData;
330
334
  }
335
+ /** A speaker qualifier (a screenplay's character extension): `V.O.`, `O.S.`, `RADIO`, or the project's own.
336
+ * A line stores the `gameId`; the `name` is what the cue, Play, and the scripts show, and is localised as a
337
+ * cast display name is (`qualifierStringKey`). */
338
+ interface SpeakerQualifier {
339
+ /** What code switches on, and what a line stores. Unique in the project; hyphen-slug form (`gameIdify`). */
340
+ gameId: string;
341
+ /** What the script shows (`V.O.`). Free to change: lines hold the `gameId`. */
342
+ name: string;
343
+ /** What the qualifier means, for writers. Authoring only. */
344
+ description?: string;
345
+ }
346
+ /** The qualifiers a project starts with. Their `gameId`s are pinned (`gameIdify` would make `V.O.` into
347
+ * `v-o`); a qualifier a writer adds takes its `gameId` from `gameIdify(name)`. */
348
+ declare const DEFAULT_QUALIFIERS: SpeakerQualifier[];
349
+ /** The project's qualifiers: its own list, else the defaults. */
350
+ declare function projectQualifiers(project: Pick<ProjectFile, "qualifiers">): SpeakerQualifier[];
351
+ /** The project's qualifiers that some line (or line prompt) in these scenes uses, in the project's order. */
352
+ declare function usedQualifiers(project: Pick<ProjectFile, "qualifiers">, scenes: Scene[]): SpeakerQualifier[];
353
+ /** A qualifier as it reaches a compiled bundle: its `gameId` and authored name (the unlocalised fallback). */
354
+ interface BundleQualifier {
355
+ gameId: string;
356
+ name: string;
357
+ }
331
358
  /** The cast as it reaches a compiled bundle: the player-facing fields only. `notes`, `actor` and
332
359
  * `gender` are authoring / production / translation context, and the compiler drops them, so a shipped
333
360
  * game never carries a real person's name or a writer's private notes. The compiler copies the shipping
@@ -565,6 +592,9 @@ interface ProjectFile {
565
592
  * externally-gated branches get exercised. Authoring-only (never reaches the runtime bundle). */
566
593
  coverageDrivers?: CoverageDriver[];
567
594
  cast?: CastMember[];
595
+ /** The speaker qualifiers a line can pick from, in display order; default `DEFAULT_QUALIFIERS`. An empty
596
+ * list means the project uses none. */
597
+ qualifiers?: SpeakerQualifier[];
568
598
  gameDataFields?: GameDataFields;
569
599
  /** Ordered writing-status ladder (not-done -> done); default `DEFAULT_WRITING_STATUSES`. */
570
600
  writingStatuses?: WritingStatusDecl[];
@@ -605,12 +635,16 @@ interface LocaleFile {
605
635
  strings: Record<string, string>;
606
636
  }
607
637
  /** The `scene` marker for a project-level loc shard (`loc/<locale>/_project.patterloc`): strings that
608
- * aren't tied to a scene beat - currently cast display names, later project title / UI strings. */
638
+ * aren't tied to a scene beat - currently cast display names and speaker qualifier names, later project
639
+ * title / UI strings. */
609
640
  declare const PROJECT_LOCALE_SCENE = "@project";
610
641
  /** The project-level loc-string key for a cast member's player-facing name, e.g. `cast:BARKEEP`.
611
642
  * Namespaced so it can't collide with opaque beat ids. The default-locale value is seeded from the
612
643
  * CastMember's `displayName`; the runtime resolves a character's shown name through this key. */
613
644
  declare function castStringKey(name: string): string;
645
+ /** The project-level loc-string key for a speaker qualifier's shown name, e.g. `qualifier:vo`. Resolved as a
646
+ * cast display name is: the active locale, then the default locale, then the authored `name`. */
647
+ declare function qualifierStringKey(gameId: string): string;
614
648
  /** Typed documentation annotation line (spec §18). */
615
649
  interface DocLine {
616
650
  /** The documentation CLASS (a `DocumentationClass.name`) - routes export
@@ -690,6 +724,10 @@ interface Suggestion {
690
724
  /** A proposed new direction (the parenthetical), and the direction when suggested ("" for none). */
691
725
  proposedDirection?: string;
692
726
  baselineDirection?: string;
727
+ /** A proposed new speaker qualifier (a `gameId` from the project's list, "" for none), and the qualifier
728
+ * when suggested ("" for none). */
729
+ proposedQualifier?: string;
730
+ baselineQualifier?: string;
693
731
  /** A proposal to cut the beat (an editor emptied its line). Accept marks it cut. */
694
732
  proposedCut?: boolean;
695
733
  /** Where the suggestion came from, when it arrived in an editable-script handoff: the handoff and the
@@ -795,8 +833,9 @@ interface HandoffLine {
795
833
  /** The beat id (a line, a narration beat, or an option prompt). */
796
834
  id: string;
797
835
  kind: "line" | "narration" | "option";
798
- /** The speaker and direction as sent (spoken lines only). */
836
+ /** The speaker, speaker qualifier (`gameId`), and direction as sent (spoken lines only). */
799
837
  character?: string;
838
+ qualifier?: string;
800
839
  direction?: string;
801
840
  /** The text as sent: the baseline for every comparison on reimport. */
802
841
  baseline: string;
@@ -910,6 +949,9 @@ interface Bundle {
910
949
  };
911
950
  /** Player-facing cast only: the compiler strips notes / actor / gender (see `BundleCastMember`). */
912
951
  cast?: BundleCastMember[];
952
+ /** The speaker qualifiers the content uses, in the project's order. Absent when no line has one, so a
953
+ * bundle without qualifiers is exactly as before. */
954
+ qualifiers?: BundleQualifier[];
913
955
  properties?: PropertyDecl[];
914
956
  /** Host / world scope declarations, baked from the project so the runtime can self-back a declared
915
957
  * scope (`@world`, ...) when no host resolver claims its token. Absent = no host scopes. */
@@ -991,6 +1033,8 @@ interface SavedChoicePrompt {
991
1033
  character?: string;
992
1034
  characterName?: string;
993
1035
  direction?: string;
1036
+ qualifier?: string;
1037
+ qualifierName?: string;
994
1038
  }
995
1039
  /** One option of a pending choice, saved VERBATIM: re-deriving on load would re-evaluate conditions. */
996
1040
  interface SavedChoiceOption {
@@ -1092,4 +1136,4 @@ declare const PROJECT_SCHEMA = "patter/project@0";
1092
1136
  declare const STRINGS_SCHEMA = "patter/strings@0";
1093
1137
  declare const AUTHORING_SCHEMA = "patter/authoring@0";
1094
1138
 
1095
- export { AUTHORING_SCHEMA, type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, 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_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, FLOW_SCHEMA, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, 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, PROJECT_LOCALE_SCENE, PROJECT_SCHEMA, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, 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 StackFrame, type Suggestion, type SuggestionSource, type TextBeat, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, gameIdify, isContentlessBeat, isValidGameId, projectLayout, walkNodes };
1139
+ export { AUTHORING_SCHEMA, type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, 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_QUALIFIERS, DEFAULT_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, FLOW_SCHEMA, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, 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, PROJECT_LOCALE_SCENE, PROJECT_SCHEMA, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, 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, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, gameIdify, isContentlessBeat, isValidGameId, projectLayout, projectQualifiers, qualifierStringKey, usedQualifiers, walkNodes };
package/dist/index.js CHANGED
@@ -30,6 +30,29 @@ function effectiveGameId(entity) {
30
30
  return g ? g : gameIdify(entity.name);
31
31
  }
32
32
  var COMMON_GENDERS = ["male", "female", "neuter"];
33
+ var DEFAULT_QUALIFIERS = [
34
+ { gameId: "vo", name: "V.O.", description: "Voice-over: the character isn't in the scene (a thought, narration, a voice in the ear)." },
35
+ { gameId: "os", name: "O.S.", description: "Off-screen: the character is there, but not seen (the next room, behind a door)." },
36
+ { gameId: "radio", name: "RADIO", description: "Heard through a radio, a phone, or a loudspeaker." }
37
+ ];
38
+ function projectQualifiers(project) {
39
+ return project.qualifiers ?? DEFAULT_QUALIFIERS;
40
+ }
41
+ function usedQualifiers(project, scenes) {
42
+ const used = /* @__PURE__ */ new Set();
43
+ for (const scene of scenes) {
44
+ for (const block of scene.blocks) {
45
+ walkNodes(block.children, (node) => {
46
+ if (node.type === "group") {
47
+ if (node.prompt?.kind === "line" && node.prompt.qualifier) used.add(node.prompt.qualifier);
48
+ return;
49
+ }
50
+ for (const beat of node.beats ?? []) if (beat.kind === "line" && beat.qualifier) used.add(beat.qualifier);
51
+ });
52
+ }
53
+ }
54
+ return projectQualifiers(project).filter((q) => used.has(q.gameId));
55
+ }
33
56
  var DEFAULT_WRITING_STATUSES = [
34
57
  { name: "stub", colour: 0 },
35
58
  // red
@@ -75,6 +98,9 @@ var PROJECT_LOCALE_SCENE = "@project";
75
98
  function castStringKey(name) {
76
99
  return `cast:${name}`;
77
100
  }
101
+ function qualifierStringKey(gameId) {
102
+ return `qualifier:${gameId}`;
103
+ }
78
104
  var HANDOFF_SCHEMA = "patter/handoff@0";
79
105
  var DEFAULT_CAPTION_DELIMITERS = { open: "[", close: "]" };
80
106
  var DEFAULT_CAPTION_CHARACTER = "SFX";
@@ -95,6 +121,7 @@ export {
95
121
  DEFAULT_CAPTION_DELIMITERS,
96
122
  DEFAULT_DOCUMENTATION_CLASSES,
97
123
  DEFAULT_LAYOUT,
124
+ DEFAULT_QUALIFIERS,
98
125
  DEFAULT_RECORDING_STATUSES,
99
126
  DEFAULT_WRITING_STATUSES,
100
127
  FLOW_SCHEMA,
@@ -116,6 +143,9 @@ export {
116
143
  isValidGameId,
117
144
  isValidPropertyName,
118
145
  projectLayout,
146
+ projectQualifiers,
119
147
  propertyNameify,
148
+ qualifierStringKey,
149
+ usedQualifiers,
120
150
  walkNodes
121
151
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/model",
3
- "version": "0.10.0",
3
+ "version": "0.11.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",