@patterkit/model 0.9.0 → 0.10.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
@@ -20,19 +20,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ AUTHORING_SCHEMA: () => AUTHORING_SCHEMA,
23
24
  COMMON_GENDERS: () => COMMON_GENDERS,
24
25
  DEFAULT_CAPTION_CHARACTER: () => DEFAULT_CAPTION_CHARACTER,
25
26
  DEFAULT_CAPTION_DELIMITERS: () => DEFAULT_CAPTION_DELIMITERS,
26
27
  DEFAULT_DOCUMENTATION_CLASSES: () => DEFAULT_DOCUMENTATION_CLASSES,
28
+ DEFAULT_LAYOUT: () => DEFAULT_LAYOUT,
27
29
  DEFAULT_RECORDING_STATUSES: () => DEFAULT_RECORDING_STATUSES,
28
30
  DEFAULT_WRITING_STATUSES: () => DEFAULT_WRITING_STATUSES,
31
+ FLOW_SCHEMA: () => FLOW_SCHEMA,
29
32
  HANDOFF_SCHEMA: () => HANDOFF_SCHEMA,
30
33
  PROJECT_LOCALE_SCENE: () => PROJECT_LOCALE_SCENE,
34
+ PROJECT_SCHEMA: () => PROJECT_SCHEMA,
31
35
  RERECORD_STATUS: () => RERECORD_STATUS,
32
36
  RERECORD_STATUS_DECL: () => RERECORD_STATUS_DECL,
33
37
  RESERVED_PROPERTY_NAMES: () => import_expr.RESERVED_PROPERTY_NAMES,
34
38
  SAVE_SCHEMA: () => SAVE_SCHEMA,
35
39
  SAVE_VERSION: () => SAVE_VERSION,
40
+ STRINGS_SCHEMA: () => STRINGS_SCHEMA,
36
41
  castStringKey: () => castStringKey,
37
42
  deriveRecordingFolders: () => deriveRecordingFolders,
38
43
  effectiveGameId: () => effectiveGameId,
@@ -41,6 +46,7 @@ __export(index_exports, {
41
46
  isContentlessBeat: () => isContentlessBeat,
42
47
  isValidGameId: () => isValidGameId,
43
48
  isValidPropertyName: () => import_expr.isValidPropertyName,
49
+ projectLayout: () => projectLayout,
44
50
  propertyNameify: () => import_expr.propertyNameify,
45
51
  walkNodes: () => walkNodes
46
52
  });
@@ -121,21 +127,34 @@ var DEFAULT_CAPTION_DELIMITERS = { open: "[", close: "]" };
121
127
  var DEFAULT_CAPTION_CHARACTER = "SFX";
122
128
  var SAVE_SCHEMA = "patter/save@0";
123
129
  var SAVE_VERSION = 3;
130
+ var DEFAULT_LAYOUT = { flow: "scenes/", strings: "loc/", authoring: "authoring/" };
131
+ function projectLayout(project) {
132
+ return { ...DEFAULT_LAYOUT, ...project.layout };
133
+ }
134
+ var FLOW_SCHEMA = "patter/flow@0";
135
+ var PROJECT_SCHEMA = "patter/project@0";
136
+ var STRINGS_SCHEMA = "patter/strings@0";
137
+ var AUTHORING_SCHEMA = "patter/authoring@0";
124
138
  // Annotate the CommonJS export names for ESM import in node:
125
139
  0 && (module.exports = {
140
+ AUTHORING_SCHEMA,
126
141
  COMMON_GENDERS,
127
142
  DEFAULT_CAPTION_CHARACTER,
128
143
  DEFAULT_CAPTION_DELIMITERS,
129
144
  DEFAULT_DOCUMENTATION_CLASSES,
145
+ DEFAULT_LAYOUT,
130
146
  DEFAULT_RECORDING_STATUSES,
131
147
  DEFAULT_WRITING_STATUSES,
148
+ FLOW_SCHEMA,
132
149
  HANDOFF_SCHEMA,
133
150
  PROJECT_LOCALE_SCENE,
151
+ PROJECT_SCHEMA,
134
152
  RERECORD_STATUS,
135
153
  RERECORD_STATUS_DECL,
136
154
  RESERVED_PROPERTY_NAMES,
137
155
  SAVE_SCHEMA,
138
156
  SAVE_VERSION,
157
+ STRINGS_SCHEMA,
139
158
  castStringKey,
140
159
  deriveRecordingFolders,
141
160
  effectiveGameId,
@@ -144,6 +163,7 @@ var SAVE_VERSION = 3;
144
163
  isContentlessBeat,
145
164
  isValidGameId,
146
165
  isValidPropertyName,
166
+ projectLayout,
147
167
  propertyNameify,
148
168
  walkNodes
149
169
  });
package/dist/index.d.cts CHANGED
@@ -533,7 +533,7 @@ interface ProjectFile {
533
533
  authoring?: string;
534
534
  };
535
535
  /** `bundle`: the compiled `.patterc` output path (relative to the project root,
536
- * or absolute); default `dist/<project-file-stem>.patterc` (spec §11).
536
+ * or absolute); default `../patter-dist/<project-file-stem>.patterc`, beside the project (spec §11).
537
537
  * `localisation`: how strings ship + are resolved (spec §11).
538
538
  * - "embedded" (default): every locale's strings live INSIDE the `.patterc`; the runtime resolves
539
539
  * them and can switch locale live (`setLocale`).
@@ -1067,5 +1067,29 @@ interface SaveGameV2 {
1067
1067
  stageBags: Record<string, Record<string, ScalarValue>>;
1068
1068
  flows: Record<string, FlowSnapshotV2>;
1069
1069
  }
1070
+ /** Where a project keeps its shards unless its `layout` says otherwise, relative to the project root. */
1071
+ declare const DEFAULT_LAYOUT: {
1072
+ readonly flow: "scenes/";
1073
+ readonly strings: "loc/";
1074
+ readonly authoring: "authoring/";
1075
+ };
1076
+ /** A project's layout with the defaults filled in: the one place they are written down (the loader,
1077
+ * validate, localisation, the scene scaffold, and Patterpad each had a copy). */
1078
+ declare function projectLayout(project: {
1079
+ layout?: {
1080
+ flow?: string;
1081
+ strings?: string;
1082
+ authoring?: string;
1083
+ };
1084
+ }): {
1085
+ flow: string;
1086
+ strings: string;
1087
+ authoring: string;
1088
+ };
1089
+ /** The source shards' schema tags (spec §10), written by every tool that makes one. */
1090
+ declare const FLOW_SCHEMA = "patter/flow@0";
1091
+ declare const PROJECT_SCHEMA = "patter/project@0";
1092
+ declare const STRINGS_SCHEMA = "patter/strings@0";
1093
+ declare const AUTHORING_SCHEMA = "patter/authoring@0";
1070
1094
 
1071
- export { 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_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, 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, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, 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, walkNodes };
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 };
package/dist/index.d.ts CHANGED
@@ -533,7 +533,7 @@ interface ProjectFile {
533
533
  authoring?: string;
534
534
  };
535
535
  /** `bundle`: the compiled `.patterc` output path (relative to the project root,
536
- * or absolute); default `dist/<project-file-stem>.patterc` (spec §11).
536
+ * or absolute); default `../patter-dist/<project-file-stem>.patterc`, beside the project (spec §11).
537
537
  * `localisation`: how strings ship + are resolved (spec §11).
538
538
  * - "embedded" (default): every locale's strings live INSIDE the `.patterc`; the runtime resolves
539
539
  * them and can switch locale live (`setLocale`).
@@ -1067,5 +1067,29 @@ interface SaveGameV2 {
1067
1067
  stageBags: Record<string, Record<string, ScalarValue>>;
1068
1068
  flows: Record<string, FlowSnapshotV2>;
1069
1069
  }
1070
+ /** Where a project keeps its shards unless its `layout` says otherwise, relative to the project root. */
1071
+ declare const DEFAULT_LAYOUT: {
1072
+ readonly flow: "scenes/";
1073
+ readonly strings: "loc/";
1074
+ readonly authoring: "authoring/";
1075
+ };
1076
+ /** A project's layout with the defaults filled in: the one place they are written down (the loader,
1077
+ * validate, localisation, the scene scaffold, and Patterpad each had a copy). */
1078
+ declare function projectLayout(project: {
1079
+ layout?: {
1080
+ flow?: string;
1081
+ strings?: string;
1082
+ authoring?: string;
1083
+ };
1084
+ }): {
1085
+ flow: string;
1086
+ strings: string;
1087
+ authoring: string;
1088
+ };
1089
+ /** The source shards' schema tags (spec §10), written by every tool that makes one. */
1090
+ declare const FLOW_SCHEMA = "patter/flow@0";
1091
+ declare const PROJECT_SCHEMA = "patter/project@0";
1092
+ declare const STRINGS_SCHEMA = "patter/strings@0";
1093
+ declare const AUTHORING_SCHEMA = "patter/authoring@0";
1070
1094
 
1071
- export { 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_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, 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, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, 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, walkNodes };
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 };
package/dist/index.js CHANGED
@@ -80,20 +80,33 @@ var DEFAULT_CAPTION_DELIMITERS = { open: "[", close: "]" };
80
80
  var DEFAULT_CAPTION_CHARACTER = "SFX";
81
81
  var SAVE_SCHEMA = "patter/save@0";
82
82
  var SAVE_VERSION = 3;
83
+ var DEFAULT_LAYOUT = { flow: "scenes/", strings: "loc/", authoring: "authoring/" };
84
+ function projectLayout(project) {
85
+ return { ...DEFAULT_LAYOUT, ...project.layout };
86
+ }
87
+ var FLOW_SCHEMA = "patter/flow@0";
88
+ var PROJECT_SCHEMA = "patter/project@0";
89
+ var STRINGS_SCHEMA = "patter/strings@0";
90
+ var AUTHORING_SCHEMA = "patter/authoring@0";
83
91
  export {
92
+ AUTHORING_SCHEMA,
84
93
  COMMON_GENDERS,
85
94
  DEFAULT_CAPTION_CHARACTER,
86
95
  DEFAULT_CAPTION_DELIMITERS,
87
96
  DEFAULT_DOCUMENTATION_CLASSES,
97
+ DEFAULT_LAYOUT,
88
98
  DEFAULT_RECORDING_STATUSES,
89
99
  DEFAULT_WRITING_STATUSES,
100
+ FLOW_SCHEMA,
90
101
  HANDOFF_SCHEMA,
91
102
  PROJECT_LOCALE_SCENE,
103
+ PROJECT_SCHEMA,
92
104
  RERECORD_STATUS,
93
105
  RERECORD_STATUS_DECL,
94
106
  RESERVED_PROPERTY_NAMES,
95
107
  SAVE_SCHEMA,
96
108
  SAVE_VERSION,
109
+ STRINGS_SCHEMA,
97
110
  castStringKey,
98
111
  deriveRecordingFolders,
99
112
  effectiveGameId,
@@ -102,6 +115,7 @@ export {
102
115
  isContentlessBeat,
103
116
  isValidGameId,
104
117
  isValidPropertyName,
118
+ projectLayout,
105
119
  propertyNameify,
106
120
  walkNodes
107
121
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/model",
3
- "version": "0.9.0",
3
+ "version": "0.10.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",