@mirage-x/mirror 0.0.0-stage → 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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja.md +28 -0
  3. package/README.md +27 -2
  4. package/assets/core/ResFeedback.brson +0 -0
  5. package/assets/frame/installFrame/ResFeedback.brson +0 -0
  6. package/assets/frame/simpleFrame/ResFeedback.brson +0 -0
  7. package/dist/assets.d.ts +7 -0
  8. package/dist/assets.d.ts.map +1 -0
  9. package/dist/assets.js +8 -0
  10. package/dist/assets.js.map +1 -0
  11. package/dist/build.d.ts +42 -0
  12. package/dist/build.d.ts.map +1 -0
  13. package/dist/build.js +78 -0
  14. package/dist/build.js.map +1 -0
  15. package/dist/compareOutput.d.ts +8 -0
  16. package/dist/compareOutput.d.ts.map +1 -0
  17. package/dist/compareOutput.js +16 -0
  18. package/dist/compareOutput.js.map +1 -0
  19. package/dist/feedback/attachCoreAndFrames.d.ts +15 -0
  20. package/dist/feedback/attachCoreAndFrames.d.ts.map +1 -0
  21. package/dist/feedback/attachCoreAndFrames.js +71 -0
  22. package/dist/feedback/attachCoreAndFrames.js.map +1 -0
  23. package/dist/feedback/attachUnits.d.ts +15 -0
  24. package/dist/feedback/attachUnits.d.ts.map +1 -0
  25. package/dist/feedback/attachUnits.js +44 -0
  26. package/dist/feedback/attachUnits.js.map +1 -0
  27. package/dist/feedback/feedbackFile.d.ts +14 -0
  28. package/dist/feedback/feedbackFile.d.ts.map +1 -0
  29. package/dist/feedback/feedbackFile.js +22 -0
  30. package/dist/feedback/feedbackFile.js.map +1 -0
  31. package/dist/feedback/fetchFeedback.d.ts +11 -0
  32. package/dist/feedback/fetchFeedback.d.ts.map +1 -0
  33. package/dist/feedback/fetchFeedback.js +48 -0
  34. package/dist/feedback/fetchFeedback.js.map +1 -0
  35. package/dist/feedback/fetchUtil.d.ts +16 -0
  36. package/dist/feedback/fetchUtil.d.ts.map +1 -0
  37. package/dist/feedback/fetchUtil.js +40 -0
  38. package/dist/feedback/fetchUtil.js.map +1 -0
  39. package/dist/feedback/index.d.ts +8 -0
  40. package/dist/feedback/index.d.ts.map +1 -0
  41. package/dist/feedback/index.js +5 -0
  42. package/dist/feedback/index.js.map +1 -0
  43. package/dist/feedback/sanitize.d.ts +14 -0
  44. package/dist/feedback/sanitize.d.ts.map +1 -0
  45. package/dist/feedback/sanitize.js +82 -0
  46. package/dist/feedback/sanitize.js.map +1 -0
  47. package/dist/feedback/staging.d.ts +28 -0
  48. package/dist/feedback/staging.d.ts.map +1 -0
  49. package/dist/feedback/staging.js +49 -0
  50. package/dist/feedback/staging.js.map +1 -0
  51. package/dist/frame/installFrame/index.d.ts +7 -0
  52. package/dist/frame/installFrame/index.d.ts.map +1 -0
  53. package/dist/frame/installFrame/index.js +17 -0
  54. package/dist/frame/installFrame/index.js.map +1 -0
  55. package/dist/frame/placeCore.d.ts +14 -0
  56. package/dist/frame/placeCore.d.ts.map +1 -0
  57. package/dist/frame/placeCore.js +36 -0
  58. package/dist/frame/placeCore.js.map +1 -0
  59. package/dist/frame/simpleFrame/index.d.ts +4 -0
  60. package/dist/frame/simpleFrame/index.d.ts.map +1 -0
  61. package/dist/frame/simpleFrame/index.js +17 -0
  62. package/dist/frame/simpleFrame/index.js.map +1 -0
  63. package/dist/frdt/util.d.ts +53 -0
  64. package/dist/frdt/util.d.ts.map +1 -0
  65. package/dist/frdt/util.js +117 -0
  66. package/dist/frdt/util.js.map +1 -0
  67. package/dist/frdt/versions.d.ts +33 -0
  68. package/dist/frdt/versions.d.ts.map +1 -0
  69. package/dist/frdt/versions.js +86 -0
  70. package/dist/frdt/versions.js.map +1 -0
  71. package/dist/generateClient.d.ts +33 -0
  72. package/dist/generateClient.d.ts.map +1 -0
  73. package/dist/generateClient.js +66 -0
  74. package/dist/generateClient.js.map +1 -0
  75. package/dist/index.d.ts +11 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +8 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/unit/generateMirrorUnitFromFeedback.d.ts +25 -0
  80. package/dist/unit/generateMirrorUnitFromFeedback.d.ts.map +1 -0
  81. package/dist/unit/generateMirrorUnitFromFeedback.js +158 -0
  82. package/dist/unit/generateMirrorUnitFromFeedback.js.map +1 -0
  83. package/package.json +57 -3
@@ -0,0 +1,40 @@
1
+ import axios from "axios";
2
+ export const getRecordInfo = async (recordLink) => {
3
+ const [, ownerId, recordId] = recordLink.match(/resrec:\/\/\/(.+)\/(.+)/) ?? [];
4
+ if (!ownerId || !recordId) {
5
+ throw new Error("invalid record link");
6
+ }
7
+ const ownerType = ownerId.startsWith("U-") ? "users" : "groups";
8
+ const { data: { id, path, name, recordType, creationTime, assetUri }, } = await axios.get(`https://api.resonite.com/${ownerType}/${ownerId}/records/${recordId}`);
9
+ return {
10
+ id,
11
+ path,
12
+ name,
13
+ recordType,
14
+ ownerType,
15
+ ownerId,
16
+ creationTime,
17
+ assetUri,
18
+ };
19
+ };
20
+ export const getRecords = async (recordUrl) => {
21
+ const { ownerId, ownerType, path, name } = await getRecordInfo(recordUrl);
22
+ const { data } = await axios.get(`https://api.resonite.com/${ownerType}/${ownerId}/records?path=${path}\\${name}`);
23
+ return data.sort((a, b) => a.creationTime.localeCompare(b.creationTime));
24
+ };
25
+ export const pickLatestObject = (records) => {
26
+ return records
27
+ .filter((x) => x.recordType === "object")
28
+ .sort((x, y) => x.creationTime.localeCompare(y.creationTime))
29
+ .pop();
30
+ };
31
+ /** The bytes of a `resdb:///<id>.brson` asset (a Resonite `.brson`). */
32
+ export const getAsset = async (assetUri) => {
33
+ const [, assetId] = assetUri.match(/resdb:\/\/\/(.+)\.brson/) ?? [];
34
+ if (!assetId) {
35
+ throw new Error(`invalid asset uri: ${assetUri}`);
36
+ }
37
+ const { data } = await axios.get(`https://assets.resonite.com/${assetId}`, { responseType: "arraybuffer" });
38
+ return Buffer.from(data);
39
+ };
40
+ //# sourceMappingURL=fetch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AqB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC1C,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAC7C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,OAAqB,EACG,EAAE;IAC1B,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;SACxC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;SAC5D,GAAG,EAAE,CAAC;AACX,CAAC,CAAC;AAEF,wEAAwE;AACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAgB,EAAmB,EAAE;IAClE,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC;IACpE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,CAC9B,+BAA+B,OAAO,EAAE,EACxC,EAAE,YAAY,EAAE,aAAa,EAAE,CAChC,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { fetchFeedback } from "./fetchFeedback.js";
2
+ export { attachUnits } from "./attachUnits.js";
3
+ export type { AttachUnitsOptions } from "./attachUnits.js";
4
+ export { attachCore, attachSimpleFrame, attachInstallFrame, } from "./attachCoreAndFrames.js";
5
+ export type { AttachFeedbackPaths } from "./attachCoreAndFrames.js";
6
+ export { readFeedback, readFeedbackIfExists, writeFeedback, writeFeedbackIfChanged, } from "./feedbackFile.js";
7
+ export type { FeedbackFile } from "./feedbackFile.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { fetchFeedback } from "./fetchFeedback.js";
2
+ export { attachUnits } from "./attachUnits.js";
3
+ export { attachCore, attachSimpleFrame, attachInstallFrame, } from "./attachCoreAndFrames.js";
4
+ export { readFeedback, readFeedbackIfExists, writeFeedback, writeFeedbackIfChanged, } from "./feedbackFile.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Document } from "@frdt/frdt";
2
+ /**
3
+ * A saved item can come wrapped in a `Holder` slot. Returns the document of
4
+ * its first child in that case, otherwise `doc` itself.
5
+ */
6
+ export declare const unwrapHolder: (doc: Document) => Document;
7
+ /**
8
+ * Clear the developer's local connection settings that a feedback picks up
9
+ * while it is saved from a local session (host names, debug `http://` /
10
+ * `ws://` URLs, a connected `WebsocketClient`). MirageX sets these at run
11
+ * time. Returns how many fields were changed.
12
+ */
13
+ export declare const sanitizeFeedback: (doc: Document) => number;
14
+ //# sourceMappingURL=sanitize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/feedback/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,YAAY,CAAC;AAIxD;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,QAAQ,KAAG,QAO5C,CAAC;AA2BF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,QAAQ,KAAG,MAyChD,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { allSlots, str, bool, stringOf } from "../frdt/util.js";
2
+ /**
3
+ * A saved item can come wrapped in a `Holder` slot. Returns the document of
4
+ * its first child in that case, otherwise `doc` itself.
5
+ */
6
+ export const unwrapHolder = (doc) => {
7
+ const root = doc.root();
8
+ const [first] = root.children();
9
+ if (root.name() !== "Holder" || !first) {
10
+ return doc;
11
+ }
12
+ return doc.extract(first, { unresolved: "null" }).document();
13
+ };
14
+ const FRAMEWORK = "[FrooxEngine]FrooxEngine.";
15
+ /** Dynamic variables whose value is the developer's local host. */
16
+ const LOCAL_VARIABLES = new Set([
17
+ "Static.Web.Host",
18
+ "Static.Web.Url.Ws",
19
+ "Static.Web.Url.Http",
20
+ "Env.Host.Fallback",
21
+ ]);
22
+ const isDebugUrl = (url) => url.includes("http://") || url.includes("ws://");
23
+ /**
24
+ * Read a field, `undefined` when the component has no such field or its value
25
+ * is not one frdt can read as a value.
26
+ */
27
+ const read = (slot, i, field) => {
28
+ try {
29
+ return slot.tryComponentValue(i, field);
30
+ }
31
+ catch {
32
+ return undefined;
33
+ }
34
+ };
35
+ /**
36
+ * Clear the developer's local connection settings that a feedback picks up
37
+ * while it is saved from a local session (host names, debug `http://` /
38
+ * `ws://` URLs, a connected `WebsocketClient`). MirageX sets these at run
39
+ * time. Returns how many fields were changed.
40
+ */
41
+ export const sanitizeFeedback = (doc) => {
42
+ let changed = 0;
43
+ const clear = (slot, i, field, value) => {
44
+ slot.setComponentValue(i, field, value);
45
+ changed++;
46
+ };
47
+ for (const slot of allSlots(doc.root())) {
48
+ slot.components().forEach(({ typeName }, i) => {
49
+ if (typeName === `${FRAMEWORK}DynamicValueVariable<string>`) {
50
+ const name = stringOf(read(slot, i, "VariableName"));
51
+ const value = stringOf(read(slot, i, "Value"));
52
+ if (name && LOCAL_VARIABLES.has(name) && value) {
53
+ clear(slot, i, "Value", str(""));
54
+ }
55
+ return;
56
+ }
57
+ if (typeName.startsWith(`${FRAMEWORK}CloudValueVariableDriver<`)) {
58
+ const fallback = stringOf(read(slot, i, "FallbackValue"));
59
+ if (fallback && isDebugUrl(fallback)) {
60
+ clear(slot, i, "FallbackValue", str(""));
61
+ }
62
+ return;
63
+ }
64
+ if (typeName === `${FRAMEWORK}StaticBinary`) {
65
+ const url = stringOf(read(slot, i, "URL"));
66
+ if (url && isDebugUrl(url)) {
67
+ clear(slot, i, "URL", str(""));
68
+ }
69
+ return;
70
+ }
71
+ if (typeName === `${FRAMEWORK}WebsocketClient`) {
72
+ const url = stringOf(read(slot, i, "URL"));
73
+ if (url && isDebugUrl(url)) {
74
+ clear(slot, i, "URL", str(""));
75
+ clear(slot, i, "IsConnected", bool(false));
76
+ }
77
+ }
78
+ });
79
+ }
80
+ return changed;
81
+ };
82
+ //# sourceMappingURL=sanitize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.js","sourceRoot":"","sources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ACT,CAAC;YACD,IAAI,QAAQ,KAAK,GAAG,SAAS,cAAc,EAAE,CAAC;gBAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;gBAC3C,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC3B,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBACjC,CAAC;gBACD,OAAO;YACT,CAAC;YACD,IAAI,QAAQ,KAAK,GAAG,SAAS,iBAAiB,EAAE,CAAC;gBAC/C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;gBAC3C,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC3B,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC/B,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { Document, Slot } from "@frdt/frdt";
2
+ /** The fetched feedback, as downloaded from Resonite. */
3
+ export declare const STAGED_FEEDBACK = "ResFeedbackOriginal.brson";
4
+ /** `{ id, creationTime }` of the fetched record. */
5
+ export declare const STAGED_META = "ResFeedbackMetaOriginal.json";
6
+ /**
7
+ * Open the fetched feedback in `dir`: unwrap a `Holder` and clear the local
8
+ * connection settings (`sanitizeFeedback`).
9
+ */
10
+ export declare const readStagedFeedback: (dir: string) => Document;
11
+ /** The fetched record's meta, or `undefined` when it is missing. */
12
+ export declare const readStagedMeta: (dir: string) => string | undefined;
13
+ /**
14
+ * A new document of `slot` and its subtree. References to slots and
15
+ * components outside it become null.
16
+ */
17
+ export declare const extractPart: (doc: Document, slot: Slot) => Document;
18
+ /**
19
+ * Write a feedback part to `<outputDir>/ResFeedback.brson` (with stable ids)
20
+ * and the record meta next to it, unless the part has not changed.
21
+ */
22
+ export declare const writePart: (option: {
23
+ outputDir: string;
24
+ part: Document;
25
+ meta: string | undefined;
26
+ label: string;
27
+ }) => void;
28
+ //# sourceMappingURL=staging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../../src/feedback/staging.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKjD,yDAAyD;AACzD,eAAO,MAAM,eAAe,8BAA8B,CAAC;AAC3D,oDAAoD;AACpD,eAAO,MAAM,WAAW,iCAAiC,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,QAQhD,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAGrD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,QAAQ,EAAE,MAAM,IAAI,KAAG,QACF,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,IAkBH,CAAC"}
@@ -0,0 +1,49 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { readFeedback, writeFeedbackIfChanged } from "./feedbackFile.js";
4
+ import { sanitizeFeedback, unwrapHolder } from "./sanitize.js";
5
+ /** The fetched feedback, as downloaded from Resonite. */
6
+ export const STAGED_FEEDBACK = "ResFeedbackOriginal.brson";
7
+ /** `{ id, creationTime }` of the fetched record. */
8
+ export const STAGED_META = "ResFeedbackMetaOriginal.json";
9
+ /**
10
+ * Open the fetched feedback in `dir`: unwrap a `Holder` and clear the local
11
+ * connection settings (`sanitizeFeedback`).
12
+ */
13
+ export const readStagedFeedback = (dir) => {
14
+ const file = path.resolve(dir, STAGED_FEEDBACK);
15
+ if (!fs.existsSync(file)) {
16
+ throw new Error(`Missing ${file}. Run feedback:fetch first.`);
17
+ }
18
+ const doc = unwrapHolder(readFeedback(file));
19
+ sanitizeFeedback(doc);
20
+ return doc;
21
+ };
22
+ /** The fetched record's meta, or `undefined` when it is missing. */
23
+ export const readStagedMeta = (dir) => {
24
+ const file = path.resolve(dir, STAGED_META);
25
+ return fs.existsSync(file) ? fs.readFileSync(file, "utf-8") : undefined;
26
+ };
27
+ /**
28
+ * A new document of `slot` and its subtree. References to slots and
29
+ * components outside it become null.
30
+ */
31
+ export const extractPart = (doc, slot) => doc.extract(slot, { unresolved: "null" }).document();
32
+ /**
33
+ * Write a feedback part to `<outputDir>/ResFeedback.brson` (with stable ids)
34
+ * and the record meta next to it, unless the part has not changed.
35
+ */
36
+ export const writePart = (option) => {
37
+ option.part.renumberIds(0);
38
+ fs.mkdirSync(option.outputDir, { recursive: true });
39
+ const written = writeFeedbackIfChanged(path.resolve(option.outputDir, "ResFeedback.brson"), option.part);
40
+ if (!written) {
41
+ console.info(`no change in ${option.label}`);
42
+ return;
43
+ }
44
+ if (option.meta !== undefined) {
45
+ fs.writeFileSync(path.resolve(option.outputDir, "ResFeedbackMeta.json"), option.meta);
46
+ }
47
+ console.info(`attached to ${option.label}`);
48
+ };
49
+ //# sourceMappingURL=staging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staging.js","sourceRoot":"","sources":["../../src/feedback/staging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,M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C;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAKzB,EAAQ,EAAE;IACT,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3B,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,sBAAsB,CACpC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC,EACnD,MAAM,CAAC,IAAI,CACZ,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,sBAAsB,CAAC,EACtD,MAAM,CAAC,IAAI,CACZ,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAC9C,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { GenerateFrame } from "../../generateClient.js";
2
+ /**
3
+ * A frame named `<appCode>Root` whose panel (`Static.PanelRoot`) is named
4
+ * `appCode`; the core goes under the panel.
5
+ */
6
+ export declare const generateInstallFrame: GenerateFrame;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frame/installFrame/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aASlC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { assetPath } from "../../assets.js";
2
+ import { readFeedback } from "../../feedback/feedbackFile.js";
3
+ import { requireReference, str } from "../../frdt/util.js";
4
+ import { placeCore } from "../placeCore.js";
5
+ /**
6
+ * A frame named `<appCode>Root` whose panel (`Static.PanelRoot`) is named
7
+ * `appCode`; the core goes under the panel.
8
+ */
9
+ export const generateInstallFrame = ({ appCode, core, env }) => {
10
+ const frame = readFeedback(assetPath("frame/installFrame/ResFeedback.brson"));
11
+ const frameRoot = frame.root();
12
+ frameRoot.set("Name", str(`${appCode}Root`));
13
+ const panel = frame.slotById(requireReference(frameRoot, "Static.PanelRoot"));
14
+ panel.set("Name", str(appCode));
15
+ return placeCore(frame, { core, env }, () => panel);
16
+ };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/frame/installFrame/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;IAC5E,MAAM,KAAK,GAAa,YAAY,CAClC,SAAS,CAAC,sCAAsC,CAAC,CAClD,CAAC;IACF,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC/B,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,MAAM,CAAC,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC9E,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAChC,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Document, Slot } from "@frdt/frdt";
2
+ /**
3
+ * Replace the frame template's placeholder core (`Static.AppRoot`) with the
4
+ * built core, put ENV into the frame's DV, and link the two:
5
+ * frame `Static.AppRoot` -> core root, core `Static.FrameRoot` -> frame root.
6
+ *
7
+ * `parentOf(placeholder)` decides where the core goes (the placeholder's
8
+ * parent for the simple frame, `Static.PanelRoot` for the install frame).
9
+ */
10
+ export declare const placeCore: (frame: Document, { core, env }: {
11
+ core: Document;
12
+ env: Document;
13
+ }, parentOf: (placeholder: Slot) => Slot) => Document;
14
+ //# sourceMappingURL=placeCore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeCore.d.ts","sourceRoot":"","sources":["../../src/frame/placeCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAUjD;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GACpB,OAAO,QAAQ,EACf,eAAe;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,EAChD,UAAU,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,KACpC,QAgCF,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { importSlots, referenceOf, requireChild, requireReference, setReference, } from "../frdt/util.js";
2
+ /**
3
+ * Replace the frame template's placeholder core (`Static.AppRoot`) with the
4
+ * built core, put ENV into the frame's DV, and link the two:
5
+ * frame `Static.AppRoot` -> core root, core `Static.FrameRoot` -> frame root.
6
+ *
7
+ * `parentOf(placeholder)` decides where the core goes (the placeholder's
8
+ * parent for the simple frame, `Static.PanelRoot` for the install frame).
9
+ */
10
+ export const placeCore = (frame, { core, env }, parentOf) => {
11
+ const frameRoot = frame.root();
12
+ const placeholder = frame.slotById(requireReference(frameRoot, "Static.AppRoot"));
13
+ const parent = parentOf(placeholder);
14
+ // An older core may still point at the frame it was saved in (attach now
15
+ // writes null there); it is rewritten below either way.
16
+ const oldFrameRoot = referenceOf(core.root(), "Static.FrameRoot");
17
+ const [newCore] = importSlots(frame, parent, [core.root()], {
18
+ allowed: oldFrameRoot ? [oldFrameRoot] : [],
19
+ label: "The core",
20
+ }).slots();
21
+ if (!newCore) {
22
+ throw new Error("Failed to import the core into the frame");
23
+ }
24
+ for (const child of placeholder.children()) {
25
+ frame.moveSlot(child, newCore);
26
+ }
27
+ frame.removeSlot(placeholder);
28
+ importSlots(frame, requireChild(frameRoot, "DV"), [env.root()], {
29
+ label: "ENV (frame)",
30
+ });
31
+ setReference(frameRoot, "Static.AppRoot", newCore.id());
32
+ setReference(newCore, "Static.FrameRoot", frameRoot.id());
33
+ frame.rebuildTypes();
34
+ return frame;
35
+ };
36
+ //# sourceMappingURL=placeCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeCore.js","sourceRoot":"","sources":["../../src/frame/placeCore.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAe,EACf,EAAE,IAAI,EAAE,GAAG,EAAqC,EAChD,QAAqC,EAC3B,EAAE;IACZ,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAChC,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAC9C,CAAC;IACF,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IAErC,yEAAyE;IACzE,wDAAwD;IACxD,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,kBAAkB,CAAC,CAAC;IAClE,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE;QAC1D,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE;QAC3C,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC,KAAK,EAAE,CAAC;IACX,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC3C,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAE9B,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE;QAC9D,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC;IAEH,YAAY,CAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IACxD,YAAY,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;IAE1D,KAAK,CAAC,YAAY,EAAE,CAAC;IACrB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { GenerateFrame } from "../../generateClient.js";
2
+ /** A frame named `appCode`; the core takes the placeholder's place. */
3
+ export declare const generateSimpleFrame: GenerateFrame;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frame/simpleFrame/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,EAAE,aAYjC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { assetPath } from "../../assets.js";
2
+ import { readFeedback } from "../../feedback/feedbackFile.js";
3
+ import { parentOf, str } from "../../frdt/util.js";
4
+ import { placeCore } from "../placeCore.js";
5
+ /** A frame named `appCode`; the core takes the placeholder's place. */
6
+ export const generateSimpleFrame = ({ appCode, core, env }) => {
7
+ const frame = readFeedback(assetPath("frame/simpleFrame/ResFeedback.brson"));
8
+ frame.root().set("Name", str(appCode));
9
+ return placeCore(frame, { core, env }, (placeholder) => {
10
+ const parent = parentOf(frame, placeholder);
11
+ if (!parent) {
12
+ throw new Error("Static.AppRoot has no parent in the simple frame");
13
+ }
14
+ return parent;
15
+ });
16
+ };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/frame/simpleFrame/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAkB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;IAC3E,MAAM,KAAK,GAAa,YAAY,CAClC,SAAS,CAAC,qCAAqC,CAAC,CACjD,CAAC;IACF,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACvC,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,WAAiB,EAAE,EAAE;QAC3D,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { Document, ImportOptions, Slot, Value } from "@frdt/frdt";
2
+ /**
3
+ * Small helpers over `@frdt/frdt` for the MirageX assembly: values, lookups by
4
+ * name / dynamic variable, and the components MirageX creates (the same
5
+ * fields as the component templates MirageX used before frdt).
6
+ */
7
+ export declare const SLOT_REFERENCE_VARIABLE = "[FrooxEngine]FrooxEngine.DynamicReferenceVariable<[FrooxEngine]FrooxEngine.Slot>";
8
+ export type StringValue = Extract<Value, {
9
+ kind: "string";
10
+ }>;
11
+ export type BoolValue = Extract<Value, {
12
+ kind: "bool";
13
+ }>;
14
+ export declare const str: (value: string) => StringValue;
15
+ export declare const bool: (value: boolean) => BoolValue;
16
+ export declare const int: (value: number) => Value;
17
+ export declare const stringOf: (value: Value | null | undefined) => string | null;
18
+ export declare const childNamed: (slot: Slot, name: string) => Slot | undefined;
19
+ export declare const requireChild: (slot: Slot, name: string) => Slot;
20
+ /** Index of the component whose `VariableName` is `name`, or -1. */
21
+ export declare const variableIndex: (slot: Slot, name: string) => number;
22
+ /** The id a `DynamicReferenceVariable` named `name` points at. */
23
+ export declare const referenceOf: (slot: Slot, name: string) => string | null;
24
+ export declare const requireReference: (slot: Slot, name: string) => string;
25
+ /** Every slot under `slot`, depth first, `slot` included. */
26
+ export declare const allSlots: (slot: Slot) => Slot[];
27
+ /**
28
+ * The parent of `slot`, found from the tree (`Children`), or `undefined` for
29
+ * the root. `slot.parentReference()` is not used: in a file saved by
30
+ * Resonite, `ParentReference` is not the parent slot's id.
31
+ */
32
+ export declare const parentOf: (doc: Document, slot: Slot) => Slot | undefined;
33
+ /**
34
+ * Set `Value` of every dynamic value variable named `name` on the slots of
35
+ * `doc` that `where` accepts (all by default). Returns how many were set.
36
+ */
37
+ export declare const setVariableValues: (doc: Document, name: string, value: Value, where?: (slot: Slot) => boolean) => number;
38
+ /** Point the `DynamicReferenceVariable` named `name` at `targetId`. */
39
+ export declare const setReference: (slot: Slot, name: string, targetId: string) => void;
40
+ export declare const addDynamicVariableSpace: (doc: Document, slot: Slot) => import("@frdt/frdt").NewComponent;
41
+ export declare const addSlotReferenceVariable: (doc: Document, slot: Slot, variableName: string, targetId: string | null) => import("@frdt/frdt").NewComponent;
42
+ export declare const addDynamicField: (doc: Document, slot: Slot, resDVType: string, variableName: string, targetFieldId: string | null) => import("@frdt/frdt").NewComponent;
43
+ export declare const addValueVariable: (doc: Document, slot: Slot, variableName: string, value: StringValue | BoolValue) => import("@frdt/frdt").NewComponent;
44
+ /**
45
+ * `doc.import` that fails when the copy still refers to ids that were not
46
+ * copied, except for `allowed` ones (references the caller rewrites).
47
+ * `label` names what is being imported in the error.
48
+ */
49
+ export declare const importSlots: (doc: Document, parent: Slot, slots: Slot[], { allowed, label, ...options }?: ImportOptions & {
50
+ allowed?: string[];
51
+ label?: string;
52
+ }) => import("@frdt/frdt").Import;
53
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/frdt/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAER,aAAa,EACb,IAAI,EACJ,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB,qFACgD,CAAC;AAGrF,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AA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GAAI,MAAM,IAAI,EAAE,MAAM,MAAM,EAAE,UAAU,MAAM,SAMtE,CAAC;AAQF,eAAO,MAAM,uBAAuB,GAAI,KAAK,QAAQ,EAAE,MAAM,IAAI,sCAM7D,CAAC;AAEL,eAAO,MAAM,wBAAwB,GACnC,KAAK,QAAQ,EACb,MAAM,IAAI,EACV,cAAc,MAAM,EACpB,UAAU,MAAM,GAAG,IAAI,sCAOrB,CAAC;AAEL,eAAO,MAAM,eAAe,GAC1B,KAAK,QAAQ,EACb,MAAM,IAAI,EACV,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,eAAe,MAAM,GAAG,IAAI,sCAW3B,CAAC;AAEJ,eAAO,MAAM,gBAAgB,GAC3B,KAAK,QAAQ,EACb,MAAM,IAAI,EACV,cAAc,MAAM,EACpB,OAAO,WAAW,GAAG,SAAS,sCAW7B,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,KAAK,QAAQ,EACb,QAAQ,IAAI,EACZ,OAAO,IAAI,EAAE,EACb,iCAIG,aAAa,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,gCAY/D,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Small helpers over `@frdt/frdt` for the MirageX assembly: values, lookups by
3
+ * name / dynamic variable, and the components MirageX creates (the same
4
+ * fields as the component templates MirageX used before frdt).
5
+ */
6
+ export const SLOT_REFERENCE_VARIABLE = "[FrooxEngine]FrooxEngine.DynamicReferenceVariable<[FrooxEngine]FrooxEngine.Slot>";
7
+ const DYNAMIC_VARIABLE_SPACE = "[FrooxEngine]FrooxEngine.DynamicVariableSpace";
8
+ export const str = (value) => ({ kind: "string", value });
9
+ export const bool = (value) => ({ kind: "bool", value });
10
+ export const int = (value) => ({ kind: "int", value });
11
+ export const stringOf = (value) => value && value.kind === "string" ? value.value : null;
12
+ export const childNamed = (slot, name) => slot.children().find((child) => child.name() === name);
13
+ export const requireChild = (slot, name) => {
14
+ const child = childNamed(slot, name);
15
+ if (!child) {
16
+ throw new Error(`Slot "${name}" not found under "${slot.name()}"`);
17
+ }
18
+ return child;
19
+ };
20
+ /** Index of the component whose `VariableName` is `name`, or -1. */
21
+ export const variableIndex = (slot, name) => slot
22
+ .components()
23
+ .findIndex((_, i) => stringOf(slot.tryComponentValue(i, "VariableName")) === name);
24
+ /** The id a `DynamicReferenceVariable` named `name` points at. */
25
+ export const referenceOf = (slot, name) => {
26
+ const i = variableIndex(slot, name);
27
+ return i < 0 ? null : stringOf(slot.tryComponentValue(i, "Reference"));
28
+ };
29
+ export const requireReference = (slot, name) => {
30
+ const id = referenceOf(slot, name);
31
+ if (!id) {
32
+ throw new Error(`"${name}" not found on "${slot.name()}"`);
33
+ }
34
+ return id;
35
+ };
36
+ /** Every slot under `slot`, depth first, `slot` included. */
37
+ export const allSlots = (slot) => [
38
+ slot,
39
+ ...slot.children().flatMap(allSlots),
40
+ ];
41
+ /**
42
+ * The parent of `slot`, found from the tree (`Children`), or `undefined` for
43
+ * the root. `slot.parentReference()` is not used: in a file saved by
44
+ * Resonite, `ParentReference` is not the parent slot's id.
45
+ */
46
+ export const parentOf = (doc, slot) => {
47
+ const id = slot.id();
48
+ return allSlots(doc.root()).find((candidate) => candidate.children().some((child) => child.id() === id));
49
+ };
50
+ /**
51
+ * Set `Value` of every dynamic value variable named `name` on the slots of
52
+ * `doc` that `where` accepts (all by default). Returns how many were set.
53
+ */
54
+ export const setVariableValues = (doc, name, value, where = () => true) => {
55
+ let count = 0;
56
+ for (const slot of allSlots(doc.root()).filter(where)) {
57
+ slot.components().forEach((_, i) => {
58
+ if (stringOf(slot.tryComponentValue(i, "VariableName")) === name) {
59
+ slot.setComponentValue(i, "Value", value);
60
+ count += 1;
61
+ }
62
+ });
63
+ }
64
+ return count;
65
+ };
66
+ /** Point the `DynamicReferenceVariable` named `name` at `targetId`. */
67
+ export const setReference = (slot, name, targetId) => {
68
+ const i = variableIndex(slot, name);
69
+ if (i < 0) {
70
+ throw new Error(`"${name}" not found on "${slot.name()}"`);
71
+ }
72
+ slot.setComponentValue(i, "Reference", str(targetId));
73
+ };
74
+ const base = (variableName) => [
75
+ { name: "UpdateOrder", value: int(0) },
76
+ { name: "Enabled", value: bool(true) },
77
+ { name: "VariableName", value: str(variableName) },
78
+ ];
79
+ export const addDynamicVariableSpace = (doc, slot) => doc.addComponent(slot, DYNAMIC_VARIABLE_SPACE, null, [
80
+ { name: "UpdateOrder", value: int(0) },
81
+ { name: "Enabled", value: bool(true) },
82
+ { name: "SpaceName", value: null },
83
+ { name: "OnlyDirectBinding", value: bool(false) },
84
+ ]);
85
+ export const addSlotReferenceVariable = (doc, slot, variableName, targetId) =>
86
+ // Resonite saves this type without a TypeVersions entry (version 0).
87
+ doc.addComponent(slot, SLOT_REFERENCE_VARIABLE, null, [
88
+ ...base(variableName),
89
+ { name: "Reference", value: targetId ? str(targetId) : null },
90
+ { name: "OverrideOnLink", value: bool(false) },
91
+ ]);
92
+ export const addDynamicField = (doc, slot, resDVType, variableName, targetFieldId) => doc.addComponent(slot, `[FrooxEngine]FrooxEngine.DynamicField<${resDVType}>`, null, [
93
+ ...base(variableName),
94
+ { name: "TargetField", value: targetFieldId ? str(targetFieldId) : null },
95
+ { name: "OverrideOnLink", value: bool(false) },
96
+ ]);
97
+ export const addValueVariable = (doc, slot, variableName, value) => doc.addComponent(slot, `[FrooxEngine]FrooxEngine.DynamicValueVariable<${value.kind === "bool" ? "bool" : "string"}>`, null, [
98
+ ...base(variableName),
99
+ { name: "Value", value },
100
+ { name: "OverrideOnLink", value: bool(false) },
101
+ ]);
102
+ /**
103
+ * `doc.import` that fails when the copy still refers to ids that were not
104
+ * copied, except for `allowed` ones (references the caller rewrites).
105
+ * `label` names what is being imported in the error.
106
+ */
107
+ export const importSlots = (doc, parent, slots, { allowed = [], label, ...options } = {}) => {
108
+ const imported = doc.import(parent, slots, { ...options, unresolved: "keep" });
109
+ const unresolved = imported
110
+ .unresolved()
111
+ .filter((id) => !allowed.includes(id));
112
+ if (unresolved.length > 0) {
113
+ throw new Error(`${label ?? `Import under "${parent.name()}"`} refers to ids that were not copied: ${unresolved.join(", ")}`);
114
+ }
115
+ return imported;
116
+ };
117
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/frdt/util.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAClC,kFAAkF,CAAC;AACrF,MAAM,sBAAsB,GAAG,+CAA+C,CAAC;AAK/E,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAAa,EAAe,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAAa,EAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAA+B,EAAiB,EAAE,CACzE,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAExD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAU,EAAE,IAAY,EAAoB,EAAE,CACvE,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,IAAY,EAAQ,EAAE;IAC7D,MAA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AM,CAAC,MAAM,WAAW,GAAG,CACzB,GAAa,EACb,MAAY,EACZ,KAAa,EACb,EACE,OAAO,GAAG,EAAE,EACZ,KAAK,EACL,GAAG,OAAO,KACgD,EAAE,EAC9D,EAAE;IACF,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/E,MAAM,UAAU,GAAG,QAAQ;SACxB,UAAU,EAAE;SACZ,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACzC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,IAAI,iBAAiB,MAAM,CAAC,IAAI,EAAE,GAAG,wCAAwC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7G,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { type Document, type FeatureFlag } from "@frdt/frdt";
2
+ /** A document that goes into the output, named for messages. */
3
+ export type Part = {
4
+ label: string;
5
+ doc: Document;
6
+ };
7
+ export type PartVersions = {
8
+ /** The oldest `VersionNumber` among the parts. */
9
+ versionNumber: string;
10
+ /**
11
+ * The flags every part has, in the order of the first part; when the
12
+ * parts disagree on a flag's value, the smallest.
13
+ */
14
+ featureFlags: FeatureFlag[];
15
+ /** Messages about parts that are far apart and flags left out or differing. */
16
+ warnings: string[];
17
+ };
18
+ /** Parts further apart than this are reported. */
19
+ export declare const VERSION_SPAN_WARNING_DAYS = 90;
20
+ /**
21
+ * The version and flags to write on a document made of `parts`: those of the
22
+ * oldest part, so that Resonite converts data saved by older versions when
23
+ * it loads the result.
24
+ */
25
+ export declare const partVersions: (parts: Part[]) => PartVersions;
26
+ /**
27
+ * Types whose `TypeVersions` entry in `parts` differs from the one written in
28
+ * `output`. The output keeps its own entries when parts are imported, so
29
+ * Resonite treats those components as saved by the output's type version.
30
+ * A type without an entry is at version 0.
31
+ */
32
+ export declare const typeVersionWarnings: (output: Document, parts: Part[]) => string[];
33
+ //# sourceMappingURL=versions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/frdt/versions.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAEpB,gEAAgE;AAChE,MAAM,MAAM,IAAI,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG;IACzB,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAS5C;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,IAAI,EAAE,KAAG,YA0D5C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,QAAQ,EAAE,OAAO,IAAI,EAAE,KAAG,MAAM,EAkB3E,CAAC"}