@mirage-x/mirror 0.0.0-stage → 0.1.1

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 (87) 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 +49 -0
  12. package/dist/build.d.ts.map +1 -0
  13. package/dist/build.js +79 -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/fromFeedback.d.ts +8 -0
  52. package/dist/frame/fromFeedback.d.ts.map +1 -0
  53. package/dist/frame/fromFeedback.js +13 -0
  54. package/dist/frame/fromFeedback.js.map +1 -0
  55. package/dist/frame/installFrame/index.d.ts +19 -0
  56. package/dist/frame/installFrame/index.d.ts.map +1 -0
  57. package/dist/frame/installFrame/index.js +27 -0
  58. package/dist/frame/installFrame/index.js.map +1 -0
  59. package/dist/frame/placeCore.d.ts +24 -0
  60. package/dist/frame/placeCore.d.ts.map +1 -0
  61. package/dist/frame/placeCore.js +46 -0
  62. package/dist/frame/placeCore.js.map +1 -0
  63. package/dist/frame/simpleFrame/index.d.ts +18 -0
  64. package/dist/frame/simpleFrame/index.d.ts.map +1 -0
  65. package/dist/frame/simpleFrame/index.js +29 -0
  66. package/dist/frame/simpleFrame/index.js.map +1 -0
  67. package/dist/frdt/util.d.ts +53 -0
  68. package/dist/frdt/util.d.ts.map +1 -0
  69. package/dist/frdt/util.js +117 -0
  70. package/dist/frdt/util.js.map +1 -0
  71. package/dist/frdt/versions.d.ts +44 -0
  72. package/dist/frdt/versions.d.ts.map +1 -0
  73. package/dist/frdt/versions.js +134 -0
  74. package/dist/frdt/versions.js.map +1 -0
  75. package/dist/generateClient.d.ts +36 -0
  76. package/dist/generateClient.d.ts.map +1 -0
  77. package/dist/generateClient.js +63 -0
  78. package/dist/generateClient.js.map +1 -0
  79. package/dist/index.d.ts +14 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +10 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/unit/generateMirrorUnitFromFeedback.d.ts +25 -0
  84. package/dist/unit/generateMirrorUnitFromFeedback.d.ts.map +1 -0
  85. package/dist/unit/generateMirrorUnitFromFeedback.js +158 -0
  86. package/dist/unit/generateMirrorUnitFromFeedback.js.map +1 -0
  87. 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=fetchUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchUtil.js","sourceRoot":"","sources":["../../src/feedback/fetchUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,UAAkB,EACG,EAAE;IACvB,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,GACzB,UAAU,CAAC,KAAK,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC;IACpD,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEhE,MAAM,EACJ,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,GAC7D,GAAG,MAAM,KAAK,CAAC,GAAG,CACjB,4BAA4B,SAAS,IAAI,OAAO,YAAY,QAAQ,EAAE,CACvE,CAAC;IAEF,OAAO;QACL,EAAE;QACF,IAAI;QACJ,IAAI;QACJ,UAAU;QACV,SAAS;QACT,OAAO;QACP,YAAY;QACZ,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,SAAiB,EAAyB,EAAE;IAC3E,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,CAAC;IAC1E,MAAM,EAAE,IAA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ions } 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":["../../src/feedback/sanitize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAa,EAAY,EAAE;IACtD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACxB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAChC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;QACvC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,2BAA2B,CAAC;AAE9C,mEAAmE;AACnE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,iBAAiB;IACjB,mBAAmB;IACnB,qBAAqB;IACrB,mBAAmB;CACpB,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CACjC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,IAAI,GAAG,CAAC,IAAU,EAAE,CAAS,EAAE,KAAa,EAA4B,EAAE;IAC9E,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,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,EAAE,CAAC;oBACrC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC3C,CAAC;gBACD,OAAO;YACT,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 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,GAAa,EAAE,IAAU,EAAY,EAAE,CACjE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;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,8 @@
1
+ import { Document } from "@frdt/frdt";
2
+ import { type FeedbackFile } from "../feedback/feedbackFile.js";
3
+ /**
4
+ * A fresh document of a frame feedback for each build. A `Document` is
5
+ * copied, so the caller's document is not changed.
6
+ */
7
+ export declare const openFrame: (feedback: FeedbackFile | Document) => Document;
8
+ //# sourceMappingURL=fromFeedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fromFeedback.d.ts","sourceRoot":"","sources":["../../src/frame/fromFeedback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE9E;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,UAAU,YAAY,GAAG,QAAQ,KAAG,QAGlC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Document } from "@frdt/frdt";
2
+ import { readFeedback } from "../feedback/feedbackFile.js";
3
+ /**
4
+ * A fresh document of a frame feedback for each build. A `Document` is
5
+ * copied, so the caller's document is not changed.
6
+ */
7
+ export const openFrame = (feedback) => isDocument(feedback)
8
+ ? Document.open(feedback.writeBrson())
9
+ : readFeedback(feedback);
10
+ /** Duck-typed, so a Document from another copy of frdt works too. */
11
+ const isDocument = (value) => typeof value === "object" &&
12
+ typeof value.writeBrson === "function";
13
+ //# sourceMappingURL=fromFeedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fromFeedback.js","sourceRoot":"","sources":["../../src/frame/fromFeedback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAiC,EAAY,EAAE,CACvE,UAAU,CAAC,QAAQ,CAAC;IAClB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACtC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;AAE7B,qEAAqE;AACrE,MAAM,UAAU,GAAG,CAAC,KAA8B,EAAqB,EAAE,CACvE,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAQ,KAA2B,CAAC,UAAU,KAAK,UAAU,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Document } from "@frdt/frdt";
2
+ import type { FeedbackFile } from "../../feedback/feedbackFile.js";
3
+ import type { GenerateFrame } from "../../generateClient.js";
4
+ /**
5
+ * An install frame from your own frame feedback: the root is named
6
+ * `<appCode>Root`, its panel (`Static.PanelRoot`) is named `appCode`, and the
7
+ * core goes under the panel.
8
+ *
9
+ * The frame needs what `placeCore` needs (`Static.AppRoot` on the root,
10
+ * pointing at the placeholder, and a `DV` child of the root) and a
11
+ * `Static.PanelRoot` reference on the root.
12
+ *
13
+ * `feedback` is a `.brson` file (path or URL) or a `Document`; it is read
14
+ * (or copied) for each build.
15
+ */
16
+ export declare const generateInstallFrameFromFeedback: (feedback: FeedbackFile | Document) => GenerateFrame;
17
+ /** The bundled install frame. See `generateInstallFrameFromFeedback`. */
18
+ export declare const generateInstallFrame: GenerateFrame;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frame/installFrame/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,GAC1C,UAAU,YAAY,GAAG,QAAQ,KAAG,aAUpC,CAAC;AAEJ,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,aAGxB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { assetPath } from "../../assets.js";
2
+ import { requireReference, str } from "../../frdt/util.js";
3
+ import { openFrame } from "../fromFeedback.js";
4
+ import { placeCore } from "../placeCore.js";
5
+ /**
6
+ * An install frame from your own frame feedback: the root is named
7
+ * `<appCode>Root`, its panel (`Static.PanelRoot`) is named `appCode`, and the
8
+ * core goes under the panel.
9
+ *
10
+ * The frame needs what `placeCore` needs (`Static.AppRoot` on the root,
11
+ * pointing at the placeholder, and a `DV` child of the root) and a
12
+ * `Static.PanelRoot` reference on the root.
13
+ *
14
+ * `feedback` is a `.brson` file (path or URL) or a `Document`; it is read
15
+ * (or copied) for each build.
16
+ */
17
+ export const generateInstallFrameFromFeedback = (feedback) => ({ appCode, core, env }) => {
18
+ const frame = openFrame(feedback);
19
+ const frameRoot = frame.root();
20
+ frameRoot.set("Name", str(`${appCode}Root`));
21
+ const panel = frame.slotById(requireReference(frameRoot, "Static.PanelRoot"));
22
+ panel.set("Name", str(appCode));
23
+ return placeCore(frame, { core, env }, () => panel);
24
+ };
25
+ /** The bundled install frame. See `generateInstallFrameFromFeedback`. */
26
+ export const generateInstallFrame = (option) => generateInstallFrameFromFeedback(assetPath("frame/installFrame/ResFeedback.brson"))(option);
27
+ //# 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;AAG5C,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAC3C,CAAC,QAAiC,EAAiB,EAAE,CACrD,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;IACzB,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAClC,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,CAC1B,gBAAgB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAChD,CAAC;IACF,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;AAEJ,yEAAyE;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAkB,CAAC,MAAM,EAAE,EAAE,CAC5D,gCAAgC,CAC9B,SAAS,CAAC,sCAAsC,CAAC,CAClD,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,24 @@
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
+ * The frame needs a `Static.AppRoot` reference on its root pointing at the
8
+ * placeholder slot, and a `DV` child of the root (ENV goes there).
9
+ *
10
+ * `parentFor(placeholder)` decides where the core goes (the placeholder's
11
+ * parent for the simple frame, `Static.PanelRoot` for the install frame).
12
+ * For the placeholder's parent, use `parentOf(frame, placeholder)` from this
13
+ * package: in a file saved by Resonite, `ParentReference` is not the parent's
14
+ * id, so `slot.parentReference()` cannot be used.
15
+ *
16
+ * `frame` is changed in place and returned. For your own frame feedback,
17
+ * `generateSimpleFrameFromFeedback` / `generateInstallFrameFromFeedback` do
18
+ * this for you.
19
+ */
20
+ export declare const placeCore: (frame: Document, { core, env }: {
21
+ core: Document;
22
+ env: Document;
23
+ }, parentFor: (placeholder: Slot) => Slot) => Document;
24
+ //# 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;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS,GACpB,OAAO,QAAQ,EACf,eAAe;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,EAChD,WAAW,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,KACrC,QAgCF,CAAC"}
@@ -0,0 +1,46 @@
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
+ * The frame needs a `Static.AppRoot` reference on its root pointing at the
8
+ * placeholder slot, and a `DV` child of the root (ENV goes there).
9
+ *
10
+ * `parentFor(placeholder)` decides where the core goes (the placeholder's
11
+ * parent for the simple frame, `Static.PanelRoot` for the install frame).
12
+ * For the placeholder's parent, use `parentOf(frame, placeholder)` from this
13
+ * package: in a file saved by Resonite, `ParentReference` is not the parent's
14
+ * id, so `slot.parentReference()` cannot be used.
15
+ *
16
+ * `frame` is changed in place and returned. For your own frame feedback,
17
+ * `generateSimpleFrameFromFeedback` / `generateInstallFrameFromFeedback` do
18
+ * this for you.
19
+ */
20
+ export const placeCore = (frame, { core, env }, parentFor) => {
21
+ const frameRoot = frame.root();
22
+ const placeholder = frame.slotById(requireReference(frameRoot, "Static.AppRoot"));
23
+ const parent = parentFor(placeholder);
24
+ // An older core may still point at the frame it was saved in (attach now
25
+ // writes null there); it is rewritten below either way.
26
+ const oldFrameRoot = referenceOf(core.root(), "Static.FrameRoot");
27
+ const [newCore] = importSlots(frame, parent, [core.root()], {
28
+ allowed: oldFrameRoot ? [oldFrameRoot] : [],
29
+ label: "The core",
30
+ }).slots();
31
+ if (!newCore) {
32
+ throw new Error("Failed to import the core into the frame");
33
+ }
34
+ for (const child of placeholder.children()) {
35
+ frame.moveSlot(child, newCore);
36
+ }
37
+ frame.removeSlot(placeholder);
38
+ importSlots(frame, requireChild(frameRoot, "DV"), [env.root()], {
39
+ label: "ENV (frame)",
40
+ });
41
+ setReference(frameRoot, "Static.AppRoot", newCore.id());
42
+ setReference(newCore, "Static.FrameRoot", frameRoot.id());
43
+ frame.rebuildTypes();
44
+ return frame;
45
+ };
46
+ //# 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;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAe,EACf,EAAE,IAAI,EAAE,GAAG,EAAqC,EAChD,SAAsC,EAC5B,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,SAAS,CAAC,WAAW,CAAC,CAAC;IAEtC,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,18 @@
1
+ import type { Document } from "@frdt/frdt";
2
+ import type { FeedbackFile } from "../../feedback/feedbackFile.js";
3
+ import type { GenerateFrame } from "../../generateClient.js";
4
+ /**
5
+ * A simple frame from your own frame feedback: the root is named `appCode`
6
+ * and the core takes the place of the placeholder (`Static.AppRoot`), under
7
+ * the placeholder's parent.
8
+ *
9
+ * The frame needs what `placeCore` needs: `Static.AppRoot` on the root,
10
+ * pointing at the placeholder, and a `DV` child of the root.
11
+ *
12
+ * `feedback` is a `.brson` file (path or URL) or a `Document`; it is read
13
+ * (or copied) for each build.
14
+ */
15
+ export declare const generateSimpleFrameFromFeedback: (feedback: FeedbackFile | Document) => GenerateFrame;
16
+ /** The bundled simple frame. See `generateSimpleFrameFromFeedback`. */
17
+ export declare const generateSimpleFrame: GenerateFrame;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frame/simpleFrame/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAQ,MAAM,YAAY,CAAC;AAGjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,GACzC,UAAU,YAAY,GAAG,QAAQ,KAAG,aAWpC,CAAC;AAEJ,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,EAAE,aAGvB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { assetPath } from "../../assets.js";
2
+ import { parentOf, str } from "../../frdt/util.js";
3
+ import { openFrame } from "../fromFeedback.js";
4
+ import { placeCore } from "../placeCore.js";
5
+ /**
6
+ * A simple frame from your own frame feedback: the root is named `appCode`
7
+ * and the core takes the place of the placeholder (`Static.AppRoot`), under
8
+ * the placeholder's parent.
9
+ *
10
+ * The frame needs what `placeCore` needs: `Static.AppRoot` on the root,
11
+ * pointing at the placeholder, and a `DV` child of the root.
12
+ *
13
+ * `feedback` is a `.brson` file (path or URL) or a `Document`; it is read
14
+ * (or copied) for each build.
15
+ */
16
+ export const generateSimpleFrameFromFeedback = (feedback) => ({ appCode, core, env }) => {
17
+ const frame = openFrame(feedback);
18
+ frame.root().set("Name", str(appCode));
19
+ return placeCore(frame, { core, env }, (placeholder) => {
20
+ const parent = parentOf(frame, placeholder);
21
+ if (!parent) {
22
+ throw new Error("Static.AppRoot has no parent in the simple frame");
23
+ }
24
+ return parent;
25
+ });
26
+ };
27
+ /** The bundled simple frame. See `generateSimpleFrameFromFeedback`. */
28
+ export const generateSimpleFrame = (option) => generateSimpleFrameFromFeedback(assetPath("frame/simpleFrame/ResFeedback.brson"))(option);
29
+ //# 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;AAG5C,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,CAAC,QAAiC,EAAiB,EAAE,CACrD,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;IACzB,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAClC,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;AAEJ,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAkB,CAAC,MAAM,EAAE,EAAE,CAC3D,+BAA+B,CAC7B,SAAS,CAAC,qCAAqC,CAAC,CACjD,CAAC,MAAM,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;AAC7D,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEzD,eAAO,MAAM,GAAG,GAAI,OAAO,MAAM,KAAG,WAA0C,CAAC;AAC/E,eAAO,MAAM,IAAI,GAAI,OAAO,OAAO,KAAG,SAAsC,CAAC;AAC7E,eAAO,MAAM,GAAG,GAAI,OAAO,MAAM,KAAG,KAAiC,CAAC;AAEtE,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,IACb,CAAC;AAExD,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,EAAE,MAAM,MAAM,KAAG,IAAI,GAAG,SACL,CAAC;AAEzD,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,EAAE,MAAM,MAAM,KAAG,IA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