@patterkit/model 0.1.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 ADDED
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ DEFAULT_CAPTION_CHARACTER: () => DEFAULT_CAPTION_CHARACTER,
24
+ DEFAULT_CAPTION_DELIMITERS: () => DEFAULT_CAPTION_DELIMITERS,
25
+ DEFAULT_DOCUMENTATION_CLASSES: () => DEFAULT_DOCUMENTATION_CLASSES,
26
+ DEFAULT_RECORDING_STATUSES: () => DEFAULT_RECORDING_STATUSES,
27
+ DEFAULT_WRITING_STATUSES: () => DEFAULT_WRITING_STATUSES,
28
+ PROJECT_LOCALE_SCENE: () => PROJECT_LOCALE_SCENE,
29
+ castStringKey: () => castStringKey,
30
+ deriveRecordingFolders: () => deriveRecordingFolders,
31
+ effectiveGameId: () => effectiveGameId,
32
+ gameIdify: () => gameIdify,
33
+ isContentlessBeat: () => isContentlessBeat,
34
+ isValidGameId: () => isValidGameId,
35
+ walkNodes: () => walkNodes
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ function walkNodes(nodes, visit) {
39
+ for (const node of nodes) {
40
+ visit(node);
41
+ const children = node.children;
42
+ if (children) walkNodes(children, visit);
43
+ }
44
+ }
45
+ function isContentlessBeat(beat, hasText) {
46
+ if (beat.kind === "gameEvent") return false;
47
+ if (hasText) return false;
48
+ if (beat.gameData && Object.keys(beat.gameData).length > 0) return false;
49
+ if (beat.tags && beat.tags.length > 0) return false;
50
+ return beat.kind === "text" || !beat.character && !beat.direction;
51
+ }
52
+ function gameIdify(text) {
53
+ return text.toLowerCase().replace(/['’]/g, "").replace(/[^a-z0-9-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
54
+ }
55
+ function isValidGameId(gameId) {
56
+ return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(gameId);
57
+ }
58
+ function effectiveGameId(entity) {
59
+ const g = entity.gameId?.trim();
60
+ return g ? g : gameIdify(entity.name);
61
+ }
62
+ var DEFAULT_WRITING_STATUSES = [
63
+ { name: "stub", colour: 0 },
64
+ // red
65
+ { name: "draft 1", colour: 1 },
66
+ // rust
67
+ { name: "draft 2", colour: 2 },
68
+ // ochre
69
+ { name: "edited", readyToRecord: true, colour: 4 },
70
+ // green
71
+ { name: "final", readyToShip: true, colour: 9 }
72
+ // purple (violet)
73
+ ];
74
+ var DEFAULT_RECORDING_STATUSES = [
75
+ { name: "missing", colour: 0 },
76
+ // red
77
+ { name: "scratch", colour: 2 },
78
+ // ochre
79
+ { name: "recorded", colour: 4 },
80
+ // green
81
+ { name: "final", colour: 9 }
82
+ // purple
83
+ ];
84
+ function deriveRecordingFolders(audioRoot, statuses) {
85
+ const root = audioRoot?.trim();
86
+ return statuses.map((s, i) => {
87
+ if (i === 0 || !root) return { name: s.name };
88
+ return { name: s.name, folder: `${root}/${gameIdify(s.name)}` };
89
+ });
90
+ }
91
+ var DEFAULT_DOCUMENTATION_CLASSES = [
92
+ { name: "everyone", deliver: "*" },
93
+ // every export, and (like all) the editor
94
+ { name: "vo", deliver: ["vo"] },
95
+ // voice-recording scripts
96
+ { name: "loc", deliver: ["loc"] }
97
+ // localisation handoff
98
+ ];
99
+ var PROJECT_LOCALE_SCENE = "@project";
100
+ function castStringKey(name) {
101
+ return `cast:${name}`;
102
+ }
103
+ var DEFAULT_CAPTION_DELIMITERS = { open: "[", close: "]" };
104
+ var DEFAULT_CAPTION_CHARACTER = "SFX";
105
+ // Annotate the CommonJS export names for ESM import in node:
106
+ 0 && (module.exports = {
107
+ DEFAULT_CAPTION_CHARACTER,
108
+ DEFAULT_CAPTION_DELIMITERS,
109
+ DEFAULT_DOCUMENTATION_CLASSES,
110
+ DEFAULT_RECORDING_STATUSES,
111
+ DEFAULT_WRITING_STATUSES,
112
+ PROJECT_LOCALE_SCENE,
113
+ castStringKey,
114
+ deriveRecordingFolders,
115
+ effectiveGameId,
116
+ gameIdify,
117
+ isContentlessBeat,
118
+ isValidGameId,
119
+ walkNodes
120
+ });