@patterkit/ops 0.16.1 → 0.17.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ian Thomas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -426,6 +426,7 @@ type PlayEvent =
426
426
  direction?: string;
427
427
  qualifier?: string;
428
428
  qualifierName?: string;
429
+ speakerLabel?: string;
429
430
  padAfter?: number;
430
431
  gameData?: GameData;
431
432
  } | {
@@ -785,7 +786,8 @@ declare function renderReportText(data: ReportData): string[];
785
786
  declare function runReportXlsx(data: ReportData): Promise<Buffer>;
786
787
 
787
788
  /** One localisable string. `id` is the beat id (or `cast:<NAME>` for a display name, `qualifier:<gameId>` for a
788
- * speaker qualifier's name). */
789
+ * speaker qualifier's name, `speaker:pattern` for the speaker pattern, `speaker:<NAME>:<gameId>` for a
790
+ * character's own label with a qualifier). */
789
791
  interface LocEntry {
790
792
  id: string;
791
793
  /** Owning scene id, or `@project` for project-level strings (display names). */
@@ -822,6 +824,15 @@ interface ApplyStats {
822
824
  /** Loc shard files touched. */
823
825
  files: number;
824
826
  }
827
+ /**
828
+ * The source text of every project-level string the project defines, by id: each cast display name
829
+ * (`cast:<NAME>`), each qualifier's name (`qualifier:<gameId>`), the speaker pattern (`speaker:pattern`), and
830
+ * each character's own label with a qualifier (`speaker:<NAME>:<gameId>`). A string's source is the default
831
+ * locale's `@project` shard value where it has one, else what the project file authors. Not filtered by what
832
+ * the lines use: the export picks from it, and a settings save compares it before and after to know which
833
+ * translations a change makes stale.
834
+ */
835
+ declare function projectStringSources(project: ProjectFile, sourceTable: Record<string, string>): Record<string, string>;
825
836
  /**
826
837
  * Build the format-neutral localisation catalog. With no `locale` (or the default locale) it is a
827
838
  * TEMPLATE: every `translation` is "". Otherwise translations come from that locale's shards.
@@ -829,6 +840,8 @@ interface ApplyStats {
829
840
  declare function extractLoc(loaded: LoadedProject, opts?: {
830
841
  locale?: string;
831
842
  }): LocCatalog;
843
+ /** The authoring shard path for a scene (mirrors the flow stem), or `_project.patterx` for `@project`. */
844
+ declare function authoringPath(loaded: LoadedProject, scene: string): string;
832
845
  /**
833
846
  * Write a catalog's translations back. Throws, writing nothing, when the catalogue names a locale the
834
847
  * project does not declare or a scene it does not have. Produces the loc-shard writes (one per scene touched) and stamps
@@ -1040,6 +1053,102 @@ declare function scriptToDocx(doc: ScriptDoc): Promise<Buffer>;
1040
1053
  /** Render the readable screenplay as a PDF. Resolves once PDFKit has flushed the whole document. */
1041
1054
  declare function scriptToPdf(doc: ScriptDoc): Promise<Buffer>;
1042
1055
 
1056
+ var serif = [
1057
+ "@fontsource/newsreader/files/newsreader-latin-400-normal.woff",
1058
+ "@fontsource/newsreader/files/newsreader-latin-ext-400-normal.woff",
1059
+ "@fontsource/newsreader/files/newsreader-vietnamese-400-normal.woff"
1060
+ ];
1061
+ var serifBold = [
1062
+ "@fontsource/newsreader/files/newsreader-latin-600-normal.woff",
1063
+ "@fontsource/newsreader/files/newsreader-latin-ext-600-normal.woff",
1064
+ "@fontsource/newsreader/files/newsreader-vietnamese-600-normal.woff"
1065
+ ];
1066
+ var serifItalic = [
1067
+ "@fontsource/newsreader/files/newsreader-latin-400-italic.woff",
1068
+ "@fontsource/newsreader/files/newsreader-latin-ext-400-italic.woff",
1069
+ "@fontsource/newsreader/files/newsreader-vietnamese-400-italic.woff"
1070
+ ];
1071
+ var serifBoldItalic = [
1072
+ "@fontsource/newsreader/files/newsreader-latin-600-italic.woff",
1073
+ "@fontsource/newsreader/files/newsreader-latin-ext-600-italic.woff",
1074
+ "@fontsource/newsreader/files/newsreader-vietnamese-600-italic.woff"
1075
+ ];
1076
+ var sans = [
1077
+ "@fontsource/inter/files/inter-latin-400-normal.woff",
1078
+ "@fontsource/inter/files/inter-latin-ext-400-normal.woff",
1079
+ "@fontsource/inter/files/inter-greek-400-normal.woff",
1080
+ "@fontsource/inter/files/inter-greek-ext-400-normal.woff",
1081
+ "@fontsource/inter/files/inter-cyrillic-400-normal.woff",
1082
+ "@fontsource/inter/files/inter-cyrillic-ext-400-normal.woff",
1083
+ "@fontsource/inter/files/inter-vietnamese-400-normal.woff"
1084
+ ];
1085
+ var sansBold = [
1086
+ "@fontsource/inter/files/inter-latin-600-normal.woff",
1087
+ "@fontsource/inter/files/inter-latin-ext-600-normal.woff",
1088
+ "@fontsource/inter/files/inter-greek-600-normal.woff",
1089
+ "@fontsource/inter/files/inter-greek-ext-600-normal.woff",
1090
+ "@fontsource/inter/files/inter-cyrillic-600-normal.woff",
1091
+ "@fontsource/inter/files/inter-cyrillic-ext-600-normal.woff",
1092
+ "@fontsource/inter/files/inter-vietnamese-600-normal.woff"
1093
+ ];
1094
+ var mono = [
1095
+ "@ibm/plex-mono/fonts/complete/woff/IBMPlexMono-Regular.woff"
1096
+ ];
1097
+ var fallback = [
1098
+ "@fontsource/noto-sans/files/noto-sans-latin-400-normal.woff",
1099
+ "@fontsource/noto-sans/files/noto-sans-latin-ext-400-normal.woff",
1100
+ "@fontsource/noto-sans/files/noto-sans-greek-400-normal.woff",
1101
+ "@fontsource/noto-sans/files/noto-sans-greek-ext-400-normal.woff",
1102
+ "@fontsource/noto-sans/files/noto-sans-cyrillic-400-normal.woff",
1103
+ "@fontsource/noto-sans/files/noto-sans-cyrillic-ext-400-normal.woff",
1104
+ "@fontsource/noto-sans/files/noto-sans-vietnamese-400-normal.woff",
1105
+ "@fontsource/noto-sans/files/noto-sans-devanagari-400-normal.woff",
1106
+ "@fontsource/noto-sans-math/files/noto-sans-math-latin-400-normal.woff"
1107
+ ];
1108
+ var emoji = [
1109
+ "@fontsource/noto-emoji/files/noto-emoji-emoji-400-normal.woff",
1110
+ "@fontsource/noto-emoji/files/noto-emoji-0-400-normal.woff",
1111
+ "@fontsource/noto-emoji/files/noto-emoji-1-400-normal.woff",
1112
+ "@fontsource/noto-emoji/files/noto-emoji-2-400-normal.woff",
1113
+ "@fontsource/noto-emoji/files/noto-emoji-3-400-normal.woff",
1114
+ "@fontsource/noto-emoji/files/noto-emoji-4-400-normal.woff",
1115
+ "@fontsource/noto-emoji/files/noto-emoji-5-400-normal.woff",
1116
+ "@fontsource/noto-emoji/files/noto-emoji-6-400-normal.woff",
1117
+ "@fontsource/noto-emoji/files/noto-emoji-7-400-normal.woff",
1118
+ "@fontsource/noto-emoji/files/noto-emoji-8-400-normal.woff",
1119
+ "@fontsource/noto-emoji/files/noto-emoji-9-400-normal.woff",
1120
+ "@fontsource/noto-emoji/files/noto-emoji-10-400-normal.woff"
1121
+ ];
1122
+ var FACES = {
1123
+ serif: serif,
1124
+ serifBold: serifBold,
1125
+ serifItalic: serifItalic,
1126
+ serifBoldItalic: serifBoldItalic,
1127
+ sans: sans,
1128
+ sansBold: sansBold,
1129
+ mono: mono,
1130
+ fallback: fallback,
1131
+ emoji: emoji
1132
+ };
1133
+
1134
+ /** A face the PDF export registers: the design's three roles, plus the two fallbacks every role shares. */
1135
+ type ScriptFace = keyof typeof FACES;
1136
+ /** Each face's files, as module paths (`<package>/<file>`), in the order a character tries them. */
1137
+ declare const SCRIPT_FONT_FILES: Readonly<Record<ScriptFace, readonly string[]>>;
1138
+ /** The packages the faces come from, each of which carries the licence its fonts travel under. */
1139
+ declare const SCRIPT_FONT_PACKAGES: readonly string[];
1140
+ /** Read the files from these paths, keyed by module path, instead of resolving them from node_modules;
1141
+ * and the licences from `licencePaths`, keyed by package. For a bundle that embeds the files itself
1142
+ * (the standalone CLI, Patterpad). */
1143
+ declare function useScriptFontFiles(paths: Readonly<Record<string, string>>, licencePaths?: Readonly<Record<string, string>>): void;
1144
+ /** Where a font package's licence file is in node_modules (LICENSE, LICENSE.txt or OFL.txt). */
1145
+ declare function scriptFontLicencePath(pkg: string): string;
1146
+ /** Each font package's licence text, for a listing of what the PDF export embeds and under what terms. */
1147
+ declare function scriptFontLicences(): {
1148
+ package: string;
1149
+ text: string;
1150
+ }[];
1151
+
1043
1152
  type InitVcs = "git" | "perforce" | "plastic" | "svn";
1044
1153
  /** Whether the compiled `.patterc` bundle is committed or built in CI (spec §11). */
1045
1154
  type BundlePosture = "commit" | "ignore";
@@ -1645,4 +1754,4 @@ declare const REFUSE_MISSING_SHARE = 0.25;
1645
1754
  /** Plan an import. Reads the handoff record named in the document from the project. */
1646
1755
  declare function planEditableImport(loaded: LoadedProject, returned: ReturnedDoc, opts: ImportOptions): ImportPlan;
1647
1756
 
1648
- export { AUDIO_MANIFEST_FILE, AUDIO_MANIFEST_SCHEMA, AUTHORING_HANDLED, type ApplyStats, type AudioEntry, type AudioRung, type AudioSnapshot, type BuildPlan, type BundlePosture, CONFLICT_SIDECAR, type CharacterReport, type Conflict, type ConflictKind, type ContentError, type CoverageAsyncHooks, type CoverageBeat, type CoverageHooks, type CoverageOptions, type CoverageOrder, type CoverageReport, type DecisionPlan, type DecisionResult, type DocumentManifest, type EditableScript, type EditableScriptOptions, type ExportOptions, type FormatResult, GAME_SCOPES_OWNER, type GameScopes, type GameScopesIssue, HANDOFF_DIR, type HandoffIssue, type HygieneIssue, type ImportOptions, type ImportPlan, type ImportProblem, type ImportReport, type InitOptions, type InitResult, type InitVcs, type LoadedProject, type LocCatalog, type LocEntry, type LocaleReport, type MergeFileType, type MergeResult, type MergedShard, NotAPackError, type OpenSuggestion, PATTER_SCOPES_FILE, PATTER_SCOPES_OWNER, type PinPlan, type PinnedName, type PlannedWrite, type PlayEvent, type PlayOptions, type PlayOutcome, type PlayResult, type ProvenanceCheck, RARE_REACH_PCT, REFUSE_MISSING_SHARE, type Random, type ReadBox, type ReadComment, type ReadItem, type ReadMarker, type ReadParagraph, type ReadText, type ReplaceHit, type ReplaceOptions, type ReplacePlan, type ReportData, type ReportTotals, type ResolveEntry, type ReturnedDoc, SHARD_EXTENSIONS, type SceneReport, type ScriptDoc, type ScriptElement, type SearchFocus, type SuggestionDecision, type TrackedChange, type UnpackMergeResult, type UnpackResult, UnsafeEntryError, UnsupportedMergeError, type ValidateResult, type VoiceLine, type VoiceScript, type VoicedCounts, type WebExport, type WrittenCounts, applyLoc, applySceneOrder, applySuggestionDecisions, applyWrites, audioFolderRungs, audioFoldersActive, audioManifest, audioManifestWrite, besideBundlePath, bundleOutputPath, catalogToJson, catalogToPo, catalogToXlsx, classesForChannel, compileLoaded, cueLabel, currentBundlePosture, defaultBundlePath, defaultGameScopesDir, detectMergeType, discoverGameScopes, drivableScopes, exportBlockers, exportEditableScript, extractLoc, findProjectFile, formatMarker, gameScopeTokens, gameScopesCatalogue, gameScopesSnapshot, handoffPath, handoffWrite, hostScopeTokens, issueMarkerCodes, jsonToCatalog, leastReachedFirst, listOpenSuggestions, listProjectTags, loadProject, loadProjectLanding, markerLength, newHandoffId, parseHandoff, patterScopesFile, patterScopesStale, patterScopesWrite, pickAudio, planBuild, planEditableImport, planPins, planReturnedWorld, planShareScopes, planWorldSave, poToCatalog, previewRegistry, proposeCoverageDrivers, qualifierNamer, reachabilityIssues, readEditableDocx, readGameScopes, readHandoff, readHandoffs, readMarker, renderCoverageText, renderPlay, renderReportText, resolveDocumentation, resolveStart, runCoverage, runCoverageAsync, runExport, runExportFull, runExportHtml, runExportWeb, runFormat, runInit, runMerge, runPack, runPlay, runPropertyUsage, runReplace, runReport, runReportXlsx, runResolve, runScriptDoc, runSearch, runStatusBrowse, runTagBrowse, runUnpack, runUnpackMerge, runValidate, runVoiceScript, scanAudio, scanAudioStatus, sceneIdForShard, scriptToDocx, scriptToPdf, serialiseHandoff, setCut, sidecarIssues, staleParts, vcsConfigWrites, voiceScriptToXlsx, worldSettingsScopes, xlsxToCatalog };
1757
+ export { AUDIO_MANIFEST_FILE, AUDIO_MANIFEST_SCHEMA, AUTHORING_HANDLED, type ApplyStats, type AudioEntry, type AudioRung, type AudioSnapshot, type BuildPlan, type BundlePosture, CONFLICT_SIDECAR, type CharacterReport, type Conflict, type ConflictKind, type ContentError, type CoverageAsyncHooks, type CoverageBeat, type CoverageHooks, type CoverageOptions, type CoverageOrder, type CoverageReport, type DecisionPlan, type DecisionResult, type DocumentManifest, type EditableScript, type EditableScriptOptions, type ExportOptions, type FormatResult, GAME_SCOPES_OWNER, type GameScopes, type GameScopesIssue, HANDOFF_DIR, type HandoffIssue, type HygieneIssue, type ImportOptions, type ImportPlan, type ImportProblem, type ImportReport, type InitOptions, type InitResult, type InitVcs, type LoadedProject, type LocCatalog, type LocEntry, type LocaleReport, type MergeFileType, type MergeResult, type MergedShard, NotAPackError, type OpenSuggestion, PATTER_SCOPES_FILE, PATTER_SCOPES_OWNER, type PinPlan, type PinnedName, type PlannedWrite, type PlayEvent, type PlayOptions, type PlayOutcome, type PlayResult, type ProvenanceCheck, RARE_REACH_PCT, REFUSE_MISSING_SHARE, type Random, type ReadBox, type ReadComment, type ReadItem, type ReadMarker, type ReadParagraph, type ReadText, type ReplaceHit, type ReplaceOptions, type ReplacePlan, type ReportData, type ReportTotals, type ResolveEntry, type ReturnedDoc, SCRIPT_FONT_FILES, SCRIPT_FONT_PACKAGES, SHARD_EXTENSIONS, type SceneReport, type ScriptDoc, type ScriptElement, type ScriptFace, type SearchFocus, type SuggestionDecision, type TrackedChange, type UnpackMergeResult, type UnpackResult, UnsafeEntryError, UnsupportedMergeError, type ValidateResult, type VoiceLine, type VoiceScript, type VoicedCounts, type WebExport, type WrittenCounts, applyLoc, applySceneOrder, applySuggestionDecisions, applyWrites, audioFolderRungs, audioFoldersActive, audioManifest, audioManifestWrite, authoringPath, besideBundlePath, bundleOutputPath, catalogToJson, catalogToPo, catalogToXlsx, classesForChannel, compileLoaded, cueLabel, currentBundlePosture, defaultBundlePath, defaultGameScopesDir, detectMergeType, discoverGameScopes, drivableScopes, exportBlockers, exportEditableScript, extractLoc, findProjectFile, formatMarker, gameScopeTokens, gameScopesCatalogue, gameScopesSnapshot, handoffPath, handoffWrite, hostScopeTokens, issueMarkerCodes, jsonToCatalog, leastReachedFirst, listOpenSuggestions, listProjectTags, loadProject, loadProjectLanding, markerLength, newHandoffId, parseHandoff, patterScopesFile, patterScopesStale, patterScopesWrite, pickAudio, planBuild, planEditableImport, planPins, planReturnedWorld, planShareScopes, planWorldSave, poToCatalog, previewRegistry, projectStringSources, proposeCoverageDrivers, qualifierNamer, reachabilityIssues, readEditableDocx, readGameScopes, readHandoff, readHandoffs, readMarker, renderCoverageText, renderPlay, renderReportText, resolveDocumentation, resolveStart, runCoverage, runCoverageAsync, runExport, runExportFull, runExportHtml, runExportWeb, runFormat, runInit, runMerge, runPack, runPlay, runPropertyUsage, runReplace, runReport, runReportXlsx, runResolve, runScriptDoc, runSearch, runStatusBrowse, runTagBrowse, runUnpack, runUnpackMerge, runValidate, runVoiceScript, scanAudio, scanAudioStatus, sceneIdForShard, scriptFontLicencePath, scriptFontLicences, scriptToDocx, scriptToPdf, serialiseHandoff, setCut, sidecarIssues, staleParts, useScriptFontFiles, vcsConfigWrites, voiceScriptToXlsx, worldSettingsScopes, xlsxToCatalog };