@mirage-x/core 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.
- package/LICENSE +21 -0
- package/README.ja.md +29 -0
- package/README.md +28 -2
- package/dist/common/interactionEvent.d.ts +7 -0
- package/dist/common/interactionEvent.d.ts.map +1 -0
- package/dist/common/interactionEvent.js +2 -0
- package/dist/common/interactionEvent.js.map +1 -0
- package/dist/common/mainProp.d.ts +91 -0
- package/dist/common/mainProp.d.ts.map +1 -0
- package/dist/common/mainProp.js +2 -0
- package/dist/common/mainProp.js.map +1 -0
- package/dist/common/mirrorRef.d.ts +28 -0
- package/dist/common/mirrorRef.d.ts.map +1 -0
- package/dist/common/mirrorRef.js +59 -0
- package/dist/common/mirrorRef.js.map +1 -0
- package/dist/common/noop.d.ts +7 -0
- package/dist/common/noop.d.ts.map +1 -0
- package/dist/common/noop.js +7 -0
- package/dist/common/noop.js.map +1 -0
- package/dist/common/unitChangeEvent.d.ts +62 -0
- package/dist/common/unitChangeEvent.d.ts.map +1 -0
- package/dist/common/unitChangeEvent.js +2 -0
- package/dist/common/unitChangeEvent.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/unit/index.d.ts +62 -0
- package/dist/unit/index.d.ts.map +1 -0
- package/dist/unit/index.js +23 -0
- package/dist/unit/index.js.map +1 -0
- package/dist/unit/unitProp.d.ts +77 -0
- package/dist/unit/unitProp.d.ts.map +1 -0
- package/dist/unit/unitProp.js +251 -0
- package/dist/unit/unitProp.js.map +1 -0
- package/dist/unit/unitPropSlot.d.ts +12 -0
- package/dist/unit/unitPropSlot.d.ts.map +1 -0
- package/dist/unit/unitPropSlot.js +14 -0
- package/dist/unit/unitPropSlot.js.map +1 -0
- package/dist/unit/unitRef.d.ts +11 -0
- package/dist/unit/unitRef.d.ts.map +1 -0
- package/dist/unit/unitRef.js +8 -0
- package/dist/unit/unitRef.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/docs/reference-prop.md +112 -0
- package/package.json +49 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 rheniumNV
|
|
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/README.ja.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[English](https://github.com/rheniumNV/mirage-x/blob/master/packages/core/README.md) | [日本語](https://github.com/rheniumNV/mirage-x/blob/master/packages/core/README.ja.md)
|
|
2
|
+
|
|
3
|
+
# @mirage-x/core
|
|
4
|
+
|
|
5
|
+
[MirageX](https://github.com/rheniumNV/mirage-x/blob/master/README.ja.md) の共有部分です。MirageX は、WebSocket を介して Unit のツリーを Resonite 側のミラーと同期させるサーバーサイド React フレームワークです。
|
|
6
|
+
|
|
7
|
+
実行時とビルド時の両方が使うものをまとめています:
|
|
8
|
+
|
|
9
|
+
- Unit の定義: `generateUnitConfig`、`UnitProp`、`UnitRef` とその型(`DetailBase`、`UnitConfig`、`getMainProps` など)
|
|
10
|
+
- `MirrorRef`(`createMirrorRef`、`isMirrorRef`)と `FunctionEnv`
|
|
11
|
+
- サーバーとミラーの間の同期のプロトコルの型
|
|
12
|
+
|
|
13
|
+
実行時の依存はありません。Slot の参照は [docs/reference-prop.md](https://github.com/rheniumNV/mirage-x/blob/master/packages/core/docs/reference-prop.md) で説明しています。
|
|
14
|
+
|
|
15
|
+
MirageX は 3 つのパッケージで公開していて、一緒に使います。[`@mirage-x/core`](https://www.npmjs.com/package/@mirage-x/core)(共有する Unit の定義)、[`@mirage-x/server`](https://www.npmjs.com/package/@mirage-x/server)(実行時)、[`@mirage-x/mirror`](https://www.npmjs.com/package/@mirage-x/mirror)(ビルド時)です。**使い方は [MirageX の README](https://github.com/rheniumNV/mirage-x/blob/master/README.ja.md) を見てください**。完成したアプリの例は [`examples/basic`](https://github.com/rheniumNV/mirage-x/tree/master/examples/basic) にあります。
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @mirage-x/core @mirage-x/server @mirage-x/mirror react@19
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Node.js 22 以上、ESM のみです。3 つのパッケージはバージョンを揃えてください。
|
|
22
|
+
|
|
23
|
+
## ライセンス
|
|
24
|
+
|
|
25
|
+
MIT
|
|
26
|
+
|
|
27
|
+
## 生成 AI を使った開発
|
|
28
|
+
|
|
29
|
+
このプロジェクトは、生成 AI のコーディングツールを使って開発しています。変更はメンテナーが確認し、Resonite での動作も含めてテストしています。
|
package/README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
[English](https://github.com/rheniumNV/mirage-x/blob/master/packages/core/README.md) | [日本語](https://github.com/rheniumNV/mirage-x/blob/master/packages/core/README.ja.md)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @mirage-x/core
|
|
4
|
+
|
|
5
|
+
The shared part of [MirageX](https://github.com/rheniumNV/mirage-x#readme), a server-side React framework that syncs a Unit tree to a Resonite-side mirror over WebSocket.
|
|
6
|
+
|
|
7
|
+
It holds what the run time and the build time both use:
|
|
8
|
+
|
|
9
|
+
- Unit definitions: `generateUnitConfig`, `UnitProp`, `UnitRef` and their types (`DetailBase`, `UnitConfig`, `getMainProps` …)
|
|
10
|
+
- `MirrorRef` (`createMirrorRef`, `isMirrorRef`) and `FunctionEnv`
|
|
11
|
+
- The types of the sync protocol between the server and the mirror
|
|
12
|
+
|
|
13
|
+
It has no runtime dependencies. Slot references are described in [docs/reference-prop.md](https://github.com/rheniumNV/mirage-x/blob/master/packages/core/docs/reference-prop.md).
|
|
14
|
+
|
|
15
|
+
MirageX is published as three packages, used together: [`@mirage-x/core`](https://www.npmjs.com/package/@mirage-x/core) (shared Unit definitions), [`@mirage-x/server`](https://www.npmjs.com/package/@mirage-x/server) (run time) and [`@mirage-x/mirror`](https://www.npmjs.com/package/@mirage-x/mirror) (build time). **See the [MirageX README](https://github.com/rheniumNV/mirage-x#readme) for how to use them**, and [`examples/basic`](https://github.com/rheniumNV/mirage-x/tree/master/examples/basic) for a complete app.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @mirage-x/core @mirage-x/server @mirage-x/mirror react@19
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Node.js 22 or later, ESM only. Keep the three packages at the same version.
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
MIT
|
|
26
|
+
|
|
27
|
+
## Development with generative AI
|
|
28
|
+
|
|
29
|
+
This project is developed with generative AI coding tools. Changes are reviewed and tested by the maintainer, including in Resonite.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionEvent.d.ts","sourceRoot":"","sources":["../../src/common/interactionEvent.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,6BAA8B,CAAC;AACrD,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionEvent.js","sourceRoot":"","sources":["../../src/common/interactionEvent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { FunctionEnv } from "./interactionEvent.js";
|
|
2
|
+
import type { MirrorRef } from "./mirrorRef.js";
|
|
3
|
+
export type DvMode = "Field" | "Variable";
|
|
4
|
+
export type RefType = "RootSlot" | "Slot";
|
|
5
|
+
type Common = {
|
|
6
|
+
resDVType: string;
|
|
7
|
+
dvMode: DvMode;
|
|
8
|
+
enumType?: string;
|
|
9
|
+
enumKeys?: string[];
|
|
10
|
+
};
|
|
11
|
+
export type Boolean = Common & {
|
|
12
|
+
type: "Boolean";
|
|
13
|
+
main: boolean;
|
|
14
|
+
mirror: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type Float = Common & {
|
|
17
|
+
type: "Float";
|
|
18
|
+
main: number;
|
|
19
|
+
mirror: number;
|
|
20
|
+
};
|
|
21
|
+
export type Float2 = Common & {
|
|
22
|
+
type: "Float2";
|
|
23
|
+
main: [number, number];
|
|
24
|
+
mirror: [number, number];
|
|
25
|
+
};
|
|
26
|
+
export type Float3 = Common & {
|
|
27
|
+
type: "Float3";
|
|
28
|
+
main: [number, number, number];
|
|
29
|
+
mirror: [number, number, number];
|
|
30
|
+
};
|
|
31
|
+
export type Float4 = Common & {
|
|
32
|
+
type: "Float4";
|
|
33
|
+
main: [number, number, number, number];
|
|
34
|
+
mirror: [number, number, number, number];
|
|
35
|
+
};
|
|
36
|
+
export type FloatQ = Common & {
|
|
37
|
+
type: "FloatQ";
|
|
38
|
+
main: [number, number, number, number];
|
|
39
|
+
mirror: [number, number, number, number];
|
|
40
|
+
};
|
|
41
|
+
export type Rect = Common & {
|
|
42
|
+
type: "Rect";
|
|
43
|
+
main: [number, number, number, number];
|
|
44
|
+
mirror: [number, number, number, number];
|
|
45
|
+
};
|
|
46
|
+
export type String = Common & {
|
|
47
|
+
type: "String";
|
|
48
|
+
main: string;
|
|
49
|
+
mirror: string;
|
|
50
|
+
};
|
|
51
|
+
export type Uri = Common & {
|
|
52
|
+
type: "Uri";
|
|
53
|
+
main: string;
|
|
54
|
+
mirror: string;
|
|
55
|
+
};
|
|
56
|
+
export type Enum<T extends string> = Common & {
|
|
57
|
+
type: "Enum";
|
|
58
|
+
main: T;
|
|
59
|
+
mirror: number;
|
|
60
|
+
enumType: string;
|
|
61
|
+
enumKeys: T[];
|
|
62
|
+
};
|
|
63
|
+
export type Function<A extends unknown[]> = Common & {
|
|
64
|
+
type: "Function";
|
|
65
|
+
main: (env: FunctionEnv, ...args: A) => void;
|
|
66
|
+
mirror: string;
|
|
67
|
+
};
|
|
68
|
+
export type Color = Common & {
|
|
69
|
+
type: "Color";
|
|
70
|
+
main: [number, number, number, number] | [number, number, number, number, "sRGB" | "sRGBAlpha" | "Linear"];
|
|
71
|
+
mirror: [number, number, number, number] | [number, number, number, number, "sRGB" | "sRGBAlpha" | "Linear"];
|
|
72
|
+
};
|
|
73
|
+
export type Int = Common & {
|
|
74
|
+
type: "Int";
|
|
75
|
+
main: number;
|
|
76
|
+
mirror: number;
|
|
77
|
+
};
|
|
78
|
+
export type Long = Common & {
|
|
79
|
+
type: "Long";
|
|
80
|
+
main: number;
|
|
81
|
+
mirror: number;
|
|
82
|
+
};
|
|
83
|
+
export type Reference = Common & {
|
|
84
|
+
type: "Reference";
|
|
85
|
+
main: MirrorRef | null;
|
|
86
|
+
mirror: string;
|
|
87
|
+
refType: RefType;
|
|
88
|
+
};
|
|
89
|
+
export type Base = Boolean | Float | Float2 | Float3 | Float4 | FloatQ | Rect | String | Function<any[]> | Color | Int | Long | Uri | Enum<string> | Reference;
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=mainProp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainProp.d.ts","sourceRoot":"","sources":["../../src/common/mainProp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAE1C,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAE1C,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAA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,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,IAAI,GACZ,OAAO,GACP,KAAK,GACL,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,IAAI,GACJ,MAAM,GACN,QAAQ,CAAC,GAAG,EAAE,CAAC,GACf,KAAK,GACL,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,CAAC,MAAM,CAAC,GACZ,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainProp.js","sourceRoot":"","sources":["../../src/common/mainProp.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RefType } from "./mainProp.js";
|
|
2
|
+
type Listener = () => void;
|
|
3
|
+
export type MirrorRefOption = {
|
|
4
|
+
refType: "RootSlot";
|
|
5
|
+
} | {
|
|
6
|
+
refType: "Slot";
|
|
7
|
+
refKey: string;
|
|
8
|
+
};
|
|
9
|
+
export type MirrorRefBindMeta = MirrorRefOption;
|
|
10
|
+
export type MirrorRef = {
|
|
11
|
+
/** Bound producer unit id, or empty string when unbound. */
|
|
12
|
+
getUnitId: () => string;
|
|
13
|
+
/** How Resonite should resolve this ref (RootSlot vs named Slot). */
|
|
14
|
+
getOption: () => MirrorRefOption;
|
|
15
|
+
/** Stable string for React sync deps. */
|
|
16
|
+
getSnapshot: () => string;
|
|
17
|
+
subscribe: (listener: Listener) => () => void;
|
|
18
|
+
/** Bind this handle to a producer unit + ref kind. */
|
|
19
|
+
bind: (unitId: string, meta: MirrorRefBindMeta) => void;
|
|
20
|
+
/** Clear bind if it currently points at `unitId`. */
|
|
21
|
+
clearIf: (unitId: string) => void;
|
|
22
|
+
/** Clear bind unconditionally. */
|
|
23
|
+
clear: () => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const createMirrorRef: () => MirrorRef;
|
|
26
|
+
export declare const isMirrorRef: (value: unknown) => value is MirrorRef;
|
|
27
|
+
export type { RefType };
|
|
28
|
+
//# sourceMappingURL=mirrorRef.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mirrorRef.d.ts","sourceRoot":"","sources":["../../src/common/mirrorRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,MAAM,MAAM,eAAe,GACvB;IAAE,OAAO,EAAE,UAAU,CAAA;CAAE,GACvB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG;IACtB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,qEAAqE;IACrE,SAAS,EAAE,MAAM,eAAe,CAAC;IACjC,yCAAyC;IACzC,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,SAAS,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,IAAI,CAAC;IAC9C,sDAAsD;IACtD,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACxD,qDAAqD;IACrD,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,kCAAkC;IAClC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AASF,eAAO,MAAM,eAAe,QAAO,SA6ClC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,SASrD,CAAC;AAEF,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const snapshotOf = (unitId, option) => {
|
|
2
|
+
if (option.refType === "RootSlot") {
|
|
3
|
+
return `${unitId}|RootSlot`;
|
|
4
|
+
}
|
|
5
|
+
return `${unitId}|Slot|${option.refKey}`;
|
|
6
|
+
};
|
|
7
|
+
export const createMirrorRef = () => {
|
|
8
|
+
let unitId = "";
|
|
9
|
+
let option = { refType: "RootSlot" };
|
|
10
|
+
const listeners = new Set();
|
|
11
|
+
const notify = () => {
|
|
12
|
+
for (const listener of listeners) {
|
|
13
|
+
listener();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
getUnitId: () => unitId,
|
|
18
|
+
getOption: () => option,
|
|
19
|
+
getSnapshot: () => snapshotOf(unitId, option),
|
|
20
|
+
subscribe: (listener) => {
|
|
21
|
+
listeners.add(listener);
|
|
22
|
+
return () => {
|
|
23
|
+
listeners.delete(listener);
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
bind: (nextUnitId, meta) => {
|
|
27
|
+
const nextSnapshot = snapshotOf(nextUnitId, meta);
|
|
28
|
+
if (snapshotOf(unitId, option) === nextSnapshot) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
unitId = nextUnitId;
|
|
32
|
+
option = meta;
|
|
33
|
+
notify();
|
|
34
|
+
},
|
|
35
|
+
clearIf: (expectedUnitId) => {
|
|
36
|
+
if (unitId !== expectedUnitId) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
unitId = "";
|
|
40
|
+
notify();
|
|
41
|
+
},
|
|
42
|
+
clear: () => {
|
|
43
|
+
if (unitId === "") {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
unitId = "";
|
|
47
|
+
notify();
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export const isMirrorRef = (value) => {
|
|
52
|
+
return (typeof value === "object" &&
|
|
53
|
+
value !== null &&
|
|
54
|
+
"getUnitId" in value &&
|
|
55
|
+
"getOption" in value &&
|
|
56
|
+
"subscribe" in value &&
|
|
57
|
+
"bind" in value);
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=mirrorRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mirrorRef.js","sourceRoot":"","sources":["../../src/common/mirrorRef.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,MAAuB,EAAU,EAAE;IACrE,IAAI,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,GAAG,MAAM,WAAW,CAAC;IAC9B,CAAC;IACD,OAAO,GAAG,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAc,EAAE;IAC7C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,MAAM,GAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IACtD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAY,CAAC;IAEtC,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;QACvB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC;QAC7C,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE;YACtB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,GAAG,EAAE;gBACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC7B,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE;YACzB,MAAM,YAAY,GAAG,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAClD,IAAI,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,YAAY,EAAE,CAAC;gBAChD,OAAO;YACT,CAAC;YACD,MAAM,GAAG,UAAU,CAAC;YACpB,MAAM,GAAG,IAAI,CAAC;YACd,MAAM,EAAE,CAAC;QACX,CAAC;QACD,OAAO,EAAE,CAAC,cAAc,EAAE,EAAE;YAC1B,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;gBAC9B,OAAO;YACT,CAAC;YACD,MAAM,GAAG,EAAE,CAAC;YACZ,MAAM,EAAE,CAAC;QACX,CAAC;QACD,KAAK,EAAE,GAAG,EAAE;YACV,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;gBAClB,OAAO;YACT,CAAC;YACD,MAAM,GAAG,EAAE,CAAC;YACZ,MAAM,EAAE,CAAC;QACX,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAsB,EAAE;IAChE,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,WAAW,IAAI,KAAK;QACpB,WAAW,IAAI,KAAK;QACpB,WAAW,IAAI,KAAK;QACpB,MAAM,IAAI,KAAK,CAChB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../src/common/noop.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,OAAO,OAAO,EAAE,KAAG,IAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.js","sourceRoot":"","sources":["../../src/common/noop.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,KAAgB,EAAQ,EAAE,GAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type * as MainProp from "./mainProp.js";
|
|
2
|
+
export type Prop = {
|
|
3
|
+
type: MainProp.Base["type"];
|
|
4
|
+
value: MainProp.Base["main"];
|
|
5
|
+
};
|
|
6
|
+
export type Unit = {
|
|
7
|
+
code: string;
|
|
8
|
+
props: {
|
|
9
|
+
[key: string]: MainProp.Base["type"];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type GenerateUnitEvent = {
|
|
13
|
+
type: "generateUnit";
|
|
14
|
+
unit: {
|
|
15
|
+
id: string;
|
|
16
|
+
parentId: string;
|
|
17
|
+
code: string;
|
|
18
|
+
defaultProps: {
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
value: unknown;
|
|
22
|
+
option: unknown;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type InitUnitPropOriginEvent = {
|
|
27
|
+
type: "initUnitPropOrigin";
|
|
28
|
+
unit: {
|
|
29
|
+
code: string;
|
|
30
|
+
prop: {
|
|
31
|
+
key: string;
|
|
32
|
+
type: string;
|
|
33
|
+
value: unknown;
|
|
34
|
+
option: unknown;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type DestroyUnitEvent = {
|
|
39
|
+
type: "destroyUnit";
|
|
40
|
+
unit: {
|
|
41
|
+
id: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export type UpdatePropEvent = {
|
|
45
|
+
type: "updateProp";
|
|
46
|
+
unit: {
|
|
47
|
+
id: string;
|
|
48
|
+
prop: {
|
|
49
|
+
key: string;
|
|
50
|
+
type: string;
|
|
51
|
+
value: unknown;
|
|
52
|
+
option: unknown;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export type CustomEventEvent = {
|
|
57
|
+
type: "customEvent";
|
|
58
|
+
code: string;
|
|
59
|
+
};
|
|
60
|
+
export type UnitChangeServerEvent = GenerateUnitEvent | DestroyUnitEvent | UpdatePropEvent | CustomEventEvent;
|
|
61
|
+
export type UnitChangeClientEvent = GenerateUnitEvent | DestroyUnitEvent | UpdatePropEvent | InitUnitPropOriginEvent | CustomEventEvent;
|
|
62
|
+
//# sourceMappingURL=unitChangeEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitChangeEvent.d.ts","sourceRoot":"","sources":["../../src/common/unitChangeEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE;YACZ,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,OAAO,CAAC;YACf,MAAM,EAAE,OAAO,CAAC;SACjB,EAAE,CAAC;KACL,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE;YACJ,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,OAAO,CAAC;YACf,MAAM,EAAE,OAAO,CAAC;SACjB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE;YACJ,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,OAAO,CAAC;YACf,MAAM,EAAE,OAAO,CAAC;SACjB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,CAAC;AAErB,MAAM,MAAM,qBAAqB,GAC7B,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,uBAAuB,GACvB,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitChangeEvent.js","sourceRoot":"","sources":["../../src/common/unitChangeEvent.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { version } from "./version.js";
|
|
2
|
+
export { generateUnitConfig, UnitProp, UnitRef } from "./unit/index.js";
|
|
3
|
+
export type { DetailBase, UnitConfig, RefConfig, getMainProps, getDefaultProps, getMirrorProps, getWebProps, } from "./unit/index.js";
|
|
4
|
+
export type { FunctionEnv, Language } from "./common/interactionEvent.js";
|
|
5
|
+
export { languages } from "./common/interactionEvent.js";
|
|
6
|
+
export { noop } from "./common/noop.js";
|
|
7
|
+
export { createMirrorRef, isMirrorRef } from "./common/mirrorRef.js";
|
|
8
|
+
export type { MirrorRef, MirrorRefOption, MirrorRefBindMeta, } from "./common/mirrorRef.js";
|
|
9
|
+
export type { RefType, DvMode } from "./common/mainProp.js";
|
|
10
|
+
export type { UnitChangeServerEvent, UnitChangeClientEvent, } from "./common/unitChangeEvent.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxE,YAAY,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACZ,eAAe,EACf,cAAc,EACd,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrE,YAAY,EACV,SAAS,EACT,eAAe,EACf,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG5D,YAAY,EACV,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Shared by @mirage-x/server (run time) and @mirage-x/mirror (build time):
|
|
2
|
+
// Unit definitions, prop and ref types, and the sync protocol.
|
|
3
|
+
export { version } from "./version.js";
|
|
4
|
+
export { generateUnitConfig, UnitProp, UnitRef } from "./unit/index.js";
|
|
5
|
+
export { languages } from "./common/interactionEvent.js";
|
|
6
|
+
export { noop } from "./common/noop.js";
|
|
7
|
+
export { createMirrorRef, isMirrorRef } from "./common/mirrorRef.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+DAA+D;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAYxE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type * as MainProp from "../common/mainProp.js";
|
|
3
|
+
import type { MirrorRef } from "../common/mirrorRef.js";
|
|
4
|
+
import type { RefConfig } from "./unitRef.js";
|
|
5
|
+
export * as UnitProp from "./unitProp.js";
|
|
6
|
+
export * as UnitRef from "./unitRef.js";
|
|
7
|
+
export type { RefConfig } from "./unitRef.js";
|
|
8
|
+
export type DetailBase = {
|
|
9
|
+
code: string;
|
|
10
|
+
propsConfig: {
|
|
11
|
+
[key: string]: MainProp.Base;
|
|
12
|
+
};
|
|
13
|
+
refsConfig?: {
|
|
14
|
+
[key: string]: RefConfig;
|
|
15
|
+
};
|
|
16
|
+
children?: "multi";
|
|
17
|
+
};
|
|
18
|
+
type RefPropName<K extends string> = `${K}Ref`;
|
|
19
|
+
type getNamedRefProps<C extends DetailBase> = C["refsConfig"] extends {
|
|
20
|
+
[key: string]: RefConfig;
|
|
21
|
+
} ? {
|
|
22
|
+
[K in keyof C["refsConfig"] & string as RefPropName<K>]?: MirrorRef | null;
|
|
23
|
+
} : object;
|
|
24
|
+
/** Every Unit can export its root Slot via `rootSlotRef`. */
|
|
25
|
+
type getRootSlotRefProp = {
|
|
26
|
+
rootSlotRef?: MirrorRef | null;
|
|
27
|
+
};
|
|
28
|
+
export type getDefaultProps<C extends DetailBase> = {
|
|
29
|
+
[K in keyof C["propsConfig"]]: C["propsConfig"][K]["main"];
|
|
30
|
+
};
|
|
31
|
+
export type getMainProps<C extends DetailBase> = Partial<getDefaultProps<C> & getRootSlotRefProp & getNamedRefProps<C> & (C["children"] extends "multi" ? {
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
} : object)>;
|
|
34
|
+
export type getMirrorProps<C extends DetailBase> = {
|
|
35
|
+
[K in keyof C["propsConfig"]]: C["propsConfig"][K]["mirror"];
|
|
36
|
+
};
|
|
37
|
+
export type getWebProps<C extends DetailBase> = {
|
|
38
|
+
[K in keyof C["propsConfig"]]: C["propsConfig"][K]["mirror"];
|
|
39
|
+
} & (C["children"] extends "multi" ? {
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
} : object);
|
|
42
|
+
type SyncPropConfig = {
|
|
43
|
+
name: string;
|
|
44
|
+
type: MainProp.Base["type"];
|
|
45
|
+
resDVType: string;
|
|
46
|
+
dvMode: MainProp.DvMode;
|
|
47
|
+
enumType?: string;
|
|
48
|
+
enumKeys?: string[];
|
|
49
|
+
refType?: MainProp.RefType;
|
|
50
|
+
};
|
|
51
|
+
type RefExportConfig = {
|
|
52
|
+
name: string;
|
|
53
|
+
refType: Extract<MainProp.RefType, "Slot">;
|
|
54
|
+
};
|
|
55
|
+
export type UnitConfig<C extends DetailBase> = {
|
|
56
|
+
code: string;
|
|
57
|
+
defaultProps: getDefaultProps<C>;
|
|
58
|
+
syncPropConfigList: SyncPropConfig[];
|
|
59
|
+
refsConfigList: RefExportConfig[];
|
|
60
|
+
};
|
|
61
|
+
export declare const generateUnitConfig: <C extends DetailBase>(config: C) => UnitConfig<C>;
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unit/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC;KAC9B,CAAC;IACF,UAAU,CAAC,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC;AAE/C,KAAK,gBAAgB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,CAAC,YAAY,CAAC,SAAS;IACpE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,GACG;KACG,CAAC,IAAI,MAAM,CAAC,CAAC,YAAY,CAAC,GAAG,MAAM,IAAI,WAAW,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AAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IACjC,kBAAkB,EAAE,cAAc,EAAE,CAAC;IACrC,cAAc,EAAE,eAAe,EAAE,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,UAAU,EACrD,QAAQ,CAAC,KACR,UAAU,CAAC,CAAC,CA2Bb,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * as UnitProp from "./unitProp.js";
|
|
2
|
+
export * as UnitRef from "./unitRef.js";
|
|
3
|
+
export const generateUnitConfig = (config) => ({
|
|
4
|
+
code: config.code,
|
|
5
|
+
defaultProps: Object.entries(config.propsConfig).reduce((acc, [key, propConfig]) => {
|
|
6
|
+
acc[key] = propConfig.main;
|
|
7
|
+
return acc;
|
|
8
|
+
}, {}),
|
|
9
|
+
syncPropConfigList: Object.entries(config.propsConfig).map(([key, propConfig]) => ({
|
|
10
|
+
name: key,
|
|
11
|
+
type: propConfig.type,
|
|
12
|
+
resDVType: propConfig.resDVType,
|
|
13
|
+
dvMode: propConfig.dvMode,
|
|
14
|
+
enumType: propConfig.enumType,
|
|
15
|
+
enumKeys: propConfig.enumKeys,
|
|
16
|
+
refType: propConfig.type === "Reference" ? propConfig.refType : undefined,
|
|
17
|
+
})),
|
|
18
|
+
refsConfigList: Object.entries(config.refsConfig ?? {}).map(([key, refConfig]) => ({
|
|
19
|
+
name: key,
|
|
20
|
+
refType: refConfig.type,
|
|
21
|
+
})),
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/unit/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAsExC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAS,EACM,EAAE,CAAC,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,CACrD,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,UAAU,CAA0C,EAAE,EAAE;QAClE,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAwB,CACzB;IACD,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CACxD,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,OAAO,EACL,UAAU,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;KACnE,CAAC,CACH;IACD,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CACzD,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,SAAS,CAAC,IAAI;KACxB,CAAC,CACH;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type * as MainProp from "../common/mainProp.js";
|
|
2
|
+
type Option = {
|
|
3
|
+
dvMode: MainProp.DvMode;
|
|
4
|
+
};
|
|
5
|
+
export declare const Float: (defaultValue: number, { dvMode }?: Option) => MainProp.Float;
|
|
6
|
+
export declare const Boolean: (defaultValue: boolean, { dvMode }?: Option) => MainProp.Boolean;
|
|
7
|
+
export declare const String: (defaultValue: string, { dvMode }?: Option) => MainProp.String;
|
|
8
|
+
export declare const Uri: (defaultValue: string, { dvMode }?: Option) => MainProp.Uri;
|
|
9
|
+
declare const textHorizontalAlignmentKeys: ["Left", "Center", "Right", "Justify"];
|
|
10
|
+
export declare const EnumTextHorizontalAlignment: (defaultValue?: (typeof textHorizontalAlignmentKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof textHorizontalAlignmentKeys)[number]>;
|
|
11
|
+
declare const textVerticalAlignmentKeys: ["Top", "Middle", "Bottom"];
|
|
12
|
+
export declare const EnumTextVerticalAlignment: (defaultValue?: (typeof textVerticalAlignmentKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof textVerticalAlignmentKeys)[number]>;
|
|
13
|
+
declare const layoutElementHorizontalAlignmentKeys: [
|
|
14
|
+
"Left",
|
|
15
|
+
"Center",
|
|
16
|
+
"Right",
|
|
17
|
+
"Justify"
|
|
18
|
+
];
|
|
19
|
+
export declare const EnumLayoutHorizontalAlignment: (defaultValue?: (typeof layoutElementHorizontalAlignmentKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof layoutElementHorizontalAlignmentKeys)[number]>;
|
|
20
|
+
declare const layoutElementVerticalAlignmentKeys: [
|
|
21
|
+
"Top",
|
|
22
|
+
"Middle",
|
|
23
|
+
"Bottom",
|
|
24
|
+
"Justify"
|
|
25
|
+
];
|
|
26
|
+
export declare const EnumLayoutVerticalAlignment: (defaultValue?: (typeof layoutElementVerticalAlignmentKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof layoutElementVerticalAlignmentKeys)[number]>;
|
|
27
|
+
declare const staticTextureFilterModeKeys: [
|
|
28
|
+
"Point",
|
|
29
|
+
"Bilinear",
|
|
30
|
+
"Trilinear",
|
|
31
|
+
"Anisotropic"
|
|
32
|
+
];
|
|
33
|
+
export declare const EnumStaticTextureFilterMode: (defaultValue?: (typeof staticTextureFilterModeKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof staticTextureFilterModeKeys)[number]>;
|
|
34
|
+
declare const staticTextureWrapModeKeys: ["Repeat", "Clamp", "Mirror", "MirrorOnce"];
|
|
35
|
+
export declare const EnumStaticTextureWrapMode: (defaultValue?: (typeof staticTextureWrapModeKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof staticTextureWrapModeKeys)[number]>;
|
|
36
|
+
declare const zWriteKeys: ["Auto", "Off", "On"];
|
|
37
|
+
export declare const EnumZWrite: (defaultValue?: (typeof zWriteKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof zWriteKeys)[number]>;
|
|
38
|
+
export declare const Function: <A extends unknown[]>(defaultValue: MainProp.Function<A>["main"], { dvMode }?: Option) => MainProp.Function<A>;
|
|
39
|
+
export declare const Color: (defaultValue?: [number, number, number, number] | [number, number, number, number, "sRGB" | "sRGBAlpha" | "Linear"], { dvMode }?: Option) => MainProp.Color;
|
|
40
|
+
export declare const Float2: (defaultValue?: [number, number], { dvMode }?: Option) => MainProp.Float2;
|
|
41
|
+
export declare const Float3: (defaultValue?: [number, number, number], { dvMode }?: Option) => MainProp.Float3;
|
|
42
|
+
export declare const Float4: (defaultValue?: [number, number, number, number], { dvMode }?: Option) => MainProp.Float4;
|
|
43
|
+
export declare const FloatQ: (defaultValue?: [number, number, number, number], { dvMode }?: Option) => MainProp.FloatQ;
|
|
44
|
+
export declare const Rect: (defaultValue?: [number, number, number, number], { dvMode }?: Option) => MainProp.Rect;
|
|
45
|
+
export declare const Int: (defaultValue?: number, { dvMode }?: Option) => MainProp.Int;
|
|
46
|
+
export declare const Long: (defaultValue?: number, { dvMode }?: Option) => MainProp.Long;
|
|
47
|
+
declare const sizeFitKeys: ["Disabled", "MinSize", "PreferredSize"];
|
|
48
|
+
export declare const EnumSizeFit: (defaultValue?: (typeof sizeFitKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof sizeFitKeys)[number]>;
|
|
49
|
+
declare const interactionElementColorModeKeys: [
|
|
50
|
+
"Explicit",
|
|
51
|
+
"Multiply",
|
|
52
|
+
"Additive",
|
|
53
|
+
"Direct"
|
|
54
|
+
];
|
|
55
|
+
export declare const EnumInteractionElementColorMode: (defaultValue?: (typeof interactionElementColorModeKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof interactionElementColorModeKeys)[number]>;
|
|
56
|
+
declare const nineSliceSizingKeys: [
|
|
57
|
+
"FixedSize",
|
|
58
|
+
"TextureSize",
|
|
59
|
+
"RectWidth",
|
|
60
|
+
"RectHeight"
|
|
61
|
+
];
|
|
62
|
+
export declare const EnumNineSliceSizing: (defaultValue?: (typeof nineSliceSizingKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof nineSliceSizingKeys)[number]>;
|
|
63
|
+
declare const alignmentModeKeys: ["Geometric", "LineBased"];
|
|
64
|
+
export declare const EnumAlignmentMode: (defaultValue?: (typeof alignmentModeKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof alignmentModeKeys)[number]>;
|
|
65
|
+
declare const blendModeKeys: [
|
|
66
|
+
"Opaque",
|
|
67
|
+
"Cutout",
|
|
68
|
+
"Alpha",
|
|
69
|
+
"Transparent",
|
|
70
|
+
"Additive",
|
|
71
|
+
"Multiply"
|
|
72
|
+
];
|
|
73
|
+
export declare const EnumBlendMode: (defaultValue?: (typeof blendModeKeys)[number], { dvMode }?: Option) => MainProp.Enum<(typeof blendModeKeys)[number]>;
|
|
74
|
+
declare const sidednessKey: ["Auto", "Front", "Back", "Double"];
|
|
75
|
+
export declare const EnumSidedness: (defaultValue?: (typeof sidednessKey)[number], { dvMode }?: Option) => MainProp.Enum<(typeof sidednessKey)[number]>;
|
|
76
|
+
export { Slot } from "./unitPropSlot.js";
|
|
77
|
+
//# sourceMappingURL=unitProp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitProp.d.ts","sourceRoot":"","sources":["../../src/unit/unitProp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAEvD,KAAK,MAAM,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAA;CAAE,CAAC;AAE1C,eAAO,MAAM,KAAK,GAChB,cAAc,MAAM,EACpB,aAAY,MAA4B,KACvC,QAAQ,CAAC,KAMV,CAAC;AAEH,eAAO,MAAM,OAAO,GAClB,cAAc,OAAO,EACrB,aAAY,MAA4B,KACvC,QAAQ,CAAC,OAMV,CAAC;AAEH,eAAO,MAAM,MAAM,GACjB,cAAc,MAAM,EACpB,aAAY,MAA4B,KACvC,QAAQ,CAAC,MAMV,CAAC;AAEH,eAAO,MAAM,GAAG,GACd,cAAc,MAAM,EACpB,aAAY,MAA4B,KACvC,QAAQ,CAAC,GAMV,CAAC;AAEH,QAAA,MAAM,2BAA2B,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAKvE,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,eAAc,CAAC,OAAO,2BAA2B,EAAE,MAAM,CAAU,EACnE,aAAY,MAA4B,KACvC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,2BAA2B,EAAE,MAAM,CAAC,CAQ3D,CAAC;AAEH,QAAA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,QAAA,MAAM,iBAAiB,EAAE,CAAC,WAAW,EAAE,WAAW,CAGjD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,eAAc,CAAC,OAAO,iBAAiB,EAAE,MAAM,CAAe,EAC9D,aAAY,MAA4B,KACvC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,iBAAiB,EAAE,MAAM,CAAC,CAQjD,CAAC;AAEH,QAAA,MAAM,aAAa,EAAE;IACnB,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,aAAa;IACb,UAAU;IACV,UAAU;CAC4D,CAAC;AAEzE,eAAO,MAAM,aAAa,GACxB,eAAc,CAAC,OAAO,aAAa,EAAE,MAAM,CAAY,EACvD,aAAY,MAA4B,KACvC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,aAAa,EAAE,MAAM,CAAC,CAQ7C,CAAC;AAEH,QAAA,MAAM,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAKrD,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,eAAc,CAAC,OAAO,YAAY,EAAE,MAAM,CAAU,EACpD,aAAY,MAA4B,KACvC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,YAAY,EAAE,MAAM,CAAC,CAQ5C,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
export const Float = (defaultValue, { dvMode } = { dvMode: "Field" }) => ({
|
|
2
|
+
type: "Float",
|
|
3
|
+
main: defaultValue,
|
|
4
|
+
mirror: defaultValue,
|
|
5
|
+
resDVType: "float",
|
|
6
|
+
dvMode,
|
|
7
|
+
});
|
|
8
|
+
export const Boolean = (defaultValue, { dvMode } = { dvMode: "Field" }) => ({
|
|
9
|
+
type: "Boolean",
|
|
10
|
+
main: defaultValue,
|
|
11
|
+
mirror: defaultValue,
|
|
12
|
+
resDVType: "bool",
|
|
13
|
+
dvMode,
|
|
14
|
+
});
|
|
15
|
+
export const String = (defaultValue, { dvMode } = { dvMode: "Field" }) => ({
|
|
16
|
+
type: "String",
|
|
17
|
+
main: defaultValue,
|
|
18
|
+
mirror: defaultValue,
|
|
19
|
+
resDVType: "string",
|
|
20
|
+
dvMode,
|
|
21
|
+
});
|
|
22
|
+
export const Uri = (defaultValue, { dvMode } = { dvMode: "Field" }) => ({
|
|
23
|
+
type: "Uri",
|
|
24
|
+
main: defaultValue,
|
|
25
|
+
mirror: defaultValue,
|
|
26
|
+
resDVType: "Uri",
|
|
27
|
+
dvMode,
|
|
28
|
+
});
|
|
29
|
+
const textHorizontalAlignmentKeys = [
|
|
30
|
+
"Left",
|
|
31
|
+
"Center",
|
|
32
|
+
"Right",
|
|
33
|
+
"Justify",
|
|
34
|
+
];
|
|
35
|
+
export const EnumTextHorizontalAlignment = (defaultValue = "Left", { dvMode } = { dvMode: "Field" }) => ({
|
|
36
|
+
type: "Enum",
|
|
37
|
+
main: defaultValue,
|
|
38
|
+
mirror: textHorizontalAlignmentKeys.indexOf(defaultValue),
|
|
39
|
+
resDVType: "[Elements.Assets]Elements.Assets.TextHorizontalAlignment",
|
|
40
|
+
dvMode,
|
|
41
|
+
enumKeys: textHorizontalAlignmentKeys,
|
|
42
|
+
enumType: "CodeX.TextHorizontalAlignment",
|
|
43
|
+
});
|
|
44
|
+
const textVerticalAlignmentKeys = [
|
|
45
|
+
"Top",
|
|
46
|
+
"Middle",
|
|
47
|
+
"Bottom",
|
|
48
|
+
];
|
|
49
|
+
export const EnumTextVerticalAlignment = (defaultValue = "Top", { dvMode } = { dvMode: "Field" }) => ({
|
|
50
|
+
type: "Enum",
|
|
51
|
+
main: defaultValue,
|
|
52
|
+
mirror: textVerticalAlignmentKeys.indexOf(defaultValue),
|
|
53
|
+
resDVType: "[Elements.Assets]Elements.Assets.TextVerticalAlignment",
|
|
54
|
+
dvMode,
|
|
55
|
+
enumKeys: textVerticalAlignmentKeys,
|
|
56
|
+
enumType: "CodeX.TextVerticalAlignment",
|
|
57
|
+
});
|
|
58
|
+
const layoutElementHorizontalAlignmentKeys = ["Left", "Center", "Right", "Justify"];
|
|
59
|
+
export const EnumLayoutHorizontalAlignment = (defaultValue = "Left", { dvMode } = { dvMode: "Field" }) => ({
|
|
60
|
+
type: "Enum",
|
|
61
|
+
main: defaultValue,
|
|
62
|
+
mirror: layoutElementHorizontalAlignmentKeys.indexOf(defaultValue),
|
|
63
|
+
resDVType: "[FrooxEngine]FrooxEngine.UIX.LayoutHorizontalAlignment",
|
|
64
|
+
dvMode,
|
|
65
|
+
enumKeys: layoutElementHorizontalAlignmentKeys,
|
|
66
|
+
enumType: "FrooxEngine.UIX.LayoutHorizontalAlignment",
|
|
67
|
+
});
|
|
68
|
+
const layoutElementVerticalAlignmentKeys = ["Top", "Middle", "Bottom", "Justify"];
|
|
69
|
+
export const EnumLayoutVerticalAlignment = (defaultValue = "Top", { dvMode } = { dvMode: "Field" }) => ({
|
|
70
|
+
type: "Enum",
|
|
71
|
+
main: defaultValue,
|
|
72
|
+
mirror: layoutElementVerticalAlignmentKeys.indexOf(defaultValue),
|
|
73
|
+
resDVType: "[FrooxEngine]FrooxEngine.UIX.LayoutVerticalAlignment",
|
|
74
|
+
dvMode,
|
|
75
|
+
enumKeys: layoutElementVerticalAlignmentKeys,
|
|
76
|
+
enumType: "FrooxEngine.UIX.LayoutVerticalAlignment",
|
|
77
|
+
});
|
|
78
|
+
const staticTextureFilterModeKeys = ["Point", "Bilinear", "Trilinear", "Anisotropic"];
|
|
79
|
+
export const EnumStaticTextureFilterMode = (defaultValue = "Bilinear", { dvMode } = { dvMode: "Field" }) => ({
|
|
80
|
+
type: "Enum",
|
|
81
|
+
main: defaultValue,
|
|
82
|
+
mirror: staticTextureFilterModeKeys.indexOf(defaultValue),
|
|
83
|
+
resDVType: "[FrooxEngine]FrooxEngine.TextureFilterMode",
|
|
84
|
+
dvMode,
|
|
85
|
+
enumKeys: staticTextureFilterModeKeys,
|
|
86
|
+
enumType: "FrooxEngine.TextureFilterMode",
|
|
87
|
+
});
|
|
88
|
+
const staticTextureWrapModeKeys = [
|
|
89
|
+
"Repeat",
|
|
90
|
+
"Clamp",
|
|
91
|
+
"Mirror",
|
|
92
|
+
"MirrorOnce",
|
|
93
|
+
];
|
|
94
|
+
export const EnumStaticTextureWrapMode = (defaultValue = "Repeat", { dvMode } = { dvMode: "Field" }) => ({
|
|
95
|
+
type: "Enum",
|
|
96
|
+
main: defaultValue,
|
|
97
|
+
mirror: staticTextureWrapModeKeys.indexOf(defaultValue),
|
|
98
|
+
resDVType: "[FrooxEngine]FrooxEngine.TextureWrapMode",
|
|
99
|
+
dvMode,
|
|
100
|
+
enumKeys: staticTextureWrapModeKeys,
|
|
101
|
+
enumType: "FrooxEngine.TextureWrapMode",
|
|
102
|
+
});
|
|
103
|
+
const zWriteKeys = ["Auto", "Off", "On"];
|
|
104
|
+
export const EnumZWrite = (defaultValue = "Auto", { dvMode } = { dvMode: "Field" }) => ({
|
|
105
|
+
type: "Enum",
|
|
106
|
+
main: defaultValue,
|
|
107
|
+
mirror: zWriteKeys.indexOf(defaultValue),
|
|
108
|
+
resDVType: "[FrooxEngine]FrooxEngine.ZWrite",
|
|
109
|
+
dvMode,
|
|
110
|
+
enumKeys: zWriteKeys,
|
|
111
|
+
enumType: "FrooxEngine.ZWrite",
|
|
112
|
+
});
|
|
113
|
+
export const Function = (defaultValue, { dvMode } = { dvMode: "Field" }) => ({
|
|
114
|
+
type: "Function",
|
|
115
|
+
main: defaultValue,
|
|
116
|
+
mirror: "",
|
|
117
|
+
resDVType: "string",
|
|
118
|
+
dvMode,
|
|
119
|
+
});
|
|
120
|
+
export const Color = (defaultValue = [
|
|
121
|
+
1, 1, 1, 1,
|
|
122
|
+
], { dvMode } = { dvMode: "Field" }) => ({
|
|
123
|
+
type: "Color",
|
|
124
|
+
main: defaultValue,
|
|
125
|
+
mirror: defaultValue,
|
|
126
|
+
resDVType: "colorX",
|
|
127
|
+
dvMode,
|
|
128
|
+
});
|
|
129
|
+
export const Float2 = (defaultValue = [0, 0], { dvMode } = { dvMode: "Field" }) => ({
|
|
130
|
+
type: "Float2",
|
|
131
|
+
main: defaultValue,
|
|
132
|
+
mirror: defaultValue,
|
|
133
|
+
resDVType: "float2",
|
|
134
|
+
dvMode,
|
|
135
|
+
});
|
|
136
|
+
export const Float3 = (defaultValue = [0, 0, 0], { dvMode } = { dvMode: "Field" }) => ({
|
|
137
|
+
type: "Float3",
|
|
138
|
+
main: defaultValue,
|
|
139
|
+
mirror: defaultValue,
|
|
140
|
+
resDVType: "float3",
|
|
141
|
+
dvMode,
|
|
142
|
+
});
|
|
143
|
+
export const Float4 = (defaultValue = [0, 0, 0, 0], { dvMode } = { dvMode: "Field" }) => ({
|
|
144
|
+
type: "Float4",
|
|
145
|
+
main: defaultValue,
|
|
146
|
+
mirror: defaultValue,
|
|
147
|
+
resDVType: "float4",
|
|
148
|
+
dvMode,
|
|
149
|
+
});
|
|
150
|
+
export const FloatQ = (defaultValue = [0, 0, 0, 0], { dvMode } = { dvMode: "Field" }) => ({
|
|
151
|
+
type: "FloatQ",
|
|
152
|
+
main: defaultValue,
|
|
153
|
+
mirror: defaultValue,
|
|
154
|
+
resDVType: "floatQ",
|
|
155
|
+
dvMode,
|
|
156
|
+
});
|
|
157
|
+
export const Rect = (defaultValue = [0, 0, 0, 0], { dvMode } = { dvMode: "Field" }) => ({
|
|
158
|
+
type: "Rect",
|
|
159
|
+
main: defaultValue,
|
|
160
|
+
mirror: defaultValue,
|
|
161
|
+
resDVType: "Rect",
|
|
162
|
+
dvMode,
|
|
163
|
+
});
|
|
164
|
+
export const Int = (defaultValue = 0, { dvMode } = { dvMode: "Field" }) => ({
|
|
165
|
+
type: "Int",
|
|
166
|
+
main: defaultValue,
|
|
167
|
+
mirror: defaultValue,
|
|
168
|
+
resDVType: "int",
|
|
169
|
+
dvMode,
|
|
170
|
+
});
|
|
171
|
+
export const Long = (defaultValue = 0, { dvMode } = { dvMode: "Field" }) => ({
|
|
172
|
+
type: "Long",
|
|
173
|
+
main: defaultValue,
|
|
174
|
+
mirror: defaultValue,
|
|
175
|
+
resDVType: "long",
|
|
176
|
+
dvMode,
|
|
177
|
+
});
|
|
178
|
+
const sizeFitKeys = [
|
|
179
|
+
"Disabled",
|
|
180
|
+
"MinSize",
|
|
181
|
+
"PreferredSize",
|
|
182
|
+
];
|
|
183
|
+
export const EnumSizeFit = (defaultValue = "Disabled", { dvMode } = { dvMode: "Field" }) => ({
|
|
184
|
+
type: "Enum",
|
|
185
|
+
main: defaultValue,
|
|
186
|
+
mirror: sizeFitKeys.indexOf(defaultValue),
|
|
187
|
+
resDVType: "[FrooxEngine]FrooxEngine.UIX.SizeFit",
|
|
188
|
+
dvMode,
|
|
189
|
+
enumKeys: sizeFitKeys,
|
|
190
|
+
enumType: "FrooxEngine.UIX.SizeFit",
|
|
191
|
+
});
|
|
192
|
+
const interactionElementColorModeKeys = ["Explicit", "Multiply", "Additive", "Direct"];
|
|
193
|
+
export const EnumInteractionElementColorMode = (defaultValue = "Explicit", { dvMode } = { dvMode: "Field" }) => ({
|
|
194
|
+
type: "Enum",
|
|
195
|
+
main: defaultValue,
|
|
196
|
+
mirror: interactionElementColorModeKeys.indexOf(defaultValue),
|
|
197
|
+
resDVType: "[FrooxEngine]FrooxEngine.UIX.InteractionElement+ColorMode",
|
|
198
|
+
dvMode,
|
|
199
|
+
enumKeys: interactionElementColorModeKeys,
|
|
200
|
+
enumType: "FrooxEngine.UIX.InteractionElement+ColorMode",
|
|
201
|
+
});
|
|
202
|
+
const nineSliceSizingKeys = ["FixedSize", "TextureSize", "RectWidth", "RectHeight"];
|
|
203
|
+
export const EnumNineSliceSizing = (defaultValue = "TextureSize", { dvMode } = { dvMode: "Field" }) => ({
|
|
204
|
+
type: "Enum",
|
|
205
|
+
main: defaultValue,
|
|
206
|
+
mirror: nineSliceSizingKeys.indexOf(defaultValue),
|
|
207
|
+
resDVType: "[FrooxEngine]FrooxEngine.UIX.NineSliceSizing",
|
|
208
|
+
dvMode,
|
|
209
|
+
enumKeys: nineSliceSizingKeys,
|
|
210
|
+
enumType: "FrooxEngine.UIX.NineSliceSizing",
|
|
211
|
+
});
|
|
212
|
+
const alignmentModeKeys = [
|
|
213
|
+
"Geometric",
|
|
214
|
+
"LineBased",
|
|
215
|
+
];
|
|
216
|
+
export const EnumAlignmentMode = (defaultValue = "Geometric", { dvMode } = { dvMode: "Field" }) => ({
|
|
217
|
+
type: "Enum",
|
|
218
|
+
main: defaultValue,
|
|
219
|
+
mirror: alignmentModeKeys.indexOf(defaultValue),
|
|
220
|
+
resDVType: "[Elements.Assets]Elements.Assets.AlignmentMode",
|
|
221
|
+
dvMode,
|
|
222
|
+
enumKeys: alignmentModeKeys,
|
|
223
|
+
enumType: "Elements.Assets.AlignmentMode",
|
|
224
|
+
});
|
|
225
|
+
const blendModeKeys = ["Opaque", "Cutout", "Alpha", "Transparent", "Additive", "Multiply"];
|
|
226
|
+
export const EnumBlendMode = (defaultValue = "Opaque", { dvMode } = { dvMode: "Field" }) => ({
|
|
227
|
+
type: "Enum",
|
|
228
|
+
main: defaultValue,
|
|
229
|
+
mirror: blendModeKeys.indexOf(defaultValue),
|
|
230
|
+
resDVType: "[FrooxEngine]FrooxEngine.BlendMode",
|
|
231
|
+
dvMode,
|
|
232
|
+
enumKeys: blendModeKeys,
|
|
233
|
+
enumType: "FrooxEngine.BlendMode",
|
|
234
|
+
});
|
|
235
|
+
const sidednessKey = [
|
|
236
|
+
"Auto",
|
|
237
|
+
"Front",
|
|
238
|
+
"Back",
|
|
239
|
+
"Double",
|
|
240
|
+
];
|
|
241
|
+
export const EnumSidedness = (defaultValue = "Auto", { dvMode } = { dvMode: "Field" }) => ({
|
|
242
|
+
type: "Enum",
|
|
243
|
+
main: defaultValue,
|
|
244
|
+
mirror: sidednessKey.indexOf(defaultValue),
|
|
245
|
+
resDVType: "[FrooxEngine]FrooxEngine.Sidedness",
|
|
246
|
+
dvMode,
|
|
247
|
+
enumKeys: sidednessKey,
|
|
248
|
+
enumType: "FrooxEngine.Sidedness",
|
|
249
|
+
});
|
|
250
|
+
export { Slot } from "./unitPropSlot.js";
|
|
251
|
+
//# sourceMappingURL=unitProp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitProp.js","sourceRoot":"","sources":["../../src/unit/unitProp.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,YAAoB,EACpB,EAAE,MAAM,KAAa,EAAE,MAAM,EAAE,OAAO,EAAE,EACxB,EAAE,CAAC,CAAC;IACpB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,OAAO;IAClB,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,YAAqB,EACrB,EAAE,MAAM,KAAa,EAAE,MAAM,EAAE,OAAO,EAAE,EACtB,EAAE,CAAC,CAAC;IACtB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,MAAM;IACjB,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,YAAoB,EACpB,EAAE,MAAM,KAAa,EAAE,MAAM,EAAE,OAAO,EAAE,EACvB,EAAE,CAAC,CAAC;IACrB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,QAAQ;IACnB,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,YAAoB,EACpB,EAAE,MAAM,KAAa,EAAE,MAAM,EAAE,OAAO,EAAE,EAC1B,EAAE,CAAC,CAAC;IAClB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,KAAK;IAChB,MA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,MAAM,aAAa,GAOf,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,eAA+C,QAAQ,EACvD,EAAE,MAAM,KAAa,EAAE,MAAM,EAAE,OAAO,EAAE,EACO,EAAE,CAAC,CAAC;IACnD,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC;IAC3C,SAAS,EAAE,oCAAoC;IAC/C,MAAM;IACN,QAAQ,EAAE,aAAa;IACvB,QAAQ,EAAE,uBAAuB;CAClC,CAAC,CAAC;AAEH,MAAM,YAAY,GAAwC;IACxD,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,eAA8C,MAAM,EACpD,EAAE,MAAM,KAAa,EAAE,MAAM,EAAE,OAAO,EAAE,EACM,EAAE,CAAC,CAAC;IAClD,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC;IAC1C,SAAS,EAAE,oCAAoC;IAC/C,MAAM;IACN,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,uBAAuB;CAClC,CAAC,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as MainProp from "../common/mainProp.js";
|
|
2
|
+
import type { MirrorRef } from "../common/mirrorRef.js";
|
|
3
|
+
type Option = {
|
|
4
|
+
dvMode: MainProp.DvMode;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Consumer prop: accepts a MirrorRef and syncs as `type: "Reference"`.
|
|
8
|
+
* Wire `option` comes from the MirrorRef bind (`RootSlot` or `Slot` + `refKey`).
|
|
9
|
+
*/
|
|
10
|
+
export declare const Slot: (defaultValue?: MirrorRef | null, { dvMode }?: Option) => MainProp.Reference;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=unitPropSlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitPropSlot.d.ts","sourceRoot":"","sources":["../../src/unit/unitPropSlot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,KAAK,MAAM,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAA;CAAE,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,IAAI,GACf,eAAc,SAAS,GAAG,IAAW,EACrC,aAAY,MAA4B,KACvC,QAAQ,CAAC,SAQV,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consumer prop: accepts a MirrorRef and syncs as `type: "Reference"`.
|
|
3
|
+
* Wire `option` comes from the MirrorRef bind (`RootSlot` or `Slot` + `refKey`).
|
|
4
|
+
*/
|
|
5
|
+
export const Slot = (defaultValue = null, { dvMode } = { dvMode: "Field" }) => ({
|
|
6
|
+
type: "Reference",
|
|
7
|
+
main: defaultValue,
|
|
8
|
+
mirror: "",
|
|
9
|
+
resDVType: "[FrooxEngine]FrooxEngine.Slot",
|
|
10
|
+
dvMode,
|
|
11
|
+
/** Field is a Slot SyncRef; source kind is carried on the MirrorRef. */
|
|
12
|
+
refType: "Slot",
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=unitPropSlot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitPropSlot.js","sourceRoot":"","sources":["../../src/unit/unitPropSlot.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,eAAiC,IAAI,EACrC,EAAE,MAAM,KAAa,EAAE,MAAM,EAAE,OAAO,EAAE,EACpB,EAAE,CAAC,CAAC;IACxB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,+BAA+B;IAC1C,MAAM;IACN,wEAAwE;IACxE,OAAO,EAAE,MAAM;CAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RefType } from "../common/mainProp.js";
|
|
2
|
+
export type RefConfig = {
|
|
3
|
+
/** Named export under DV/Refs (not the unit root). */
|
|
4
|
+
type: Extract<RefType, "Slot">;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Producer export for a named Slot under `DV/Refs.{name}`.
|
|
8
|
+
* Enables `${name}Ref` bind prop. Root Slot is always available as `rootSlotRef`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Slot: () => RefConfig;
|
|
11
|
+
//# sourceMappingURL=unitRef.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitRef.d.ts","sourceRoot":"","sources":["../../src/unit/unitRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG;IACtB,sDAAsD;IACtD,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAChC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,QAAO,SAEtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unitRef.js","sourceRoot":"","sources":["../../src/unit/unitRef.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,GAAc,EAAE,CAAC,CAAC;IACpC,IAAI,EAAE,MAAM;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,EAAG,OAAgB,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAgB,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Reference props(Slot / RootSlot)
|
|
2
|
+
|
|
3
|
+
React 側では `useMirrorRef` で Unit 間の Slot 参照を共有します。Resonite 側は既存の sync イベントで適用します(**新しい event type は追加しません**)。
|
|
4
|
+
|
|
5
|
+
## React での使い方
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { UnitProp, UnitRef, generateUnitConfig } from "@mirage-x/core";
|
|
9
|
+
import { generateMain, useMirrorRef } from "@mirage-x/server";
|
|
10
|
+
|
|
11
|
+
// 生産者: ルート Slot は常に rootSlotRef で export 可能(refsConfig 不要)
|
|
12
|
+
// refsConfig の名前付き ref は mirror brson の DV/Refs.{name} になる
|
|
13
|
+
const producerDetail = {
|
|
14
|
+
code: "Demo/SlotHost",
|
|
15
|
+
propsConfig: {},
|
|
16
|
+
refsConfig: {
|
|
17
|
+
anchor: UnitRef.Slot(), // → anchorRef={...}, DV/Refs.anchor
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// 消費者
|
|
22
|
+
const consumerDetail = {
|
|
23
|
+
code: "Demo/NeedsSlot",
|
|
24
|
+
propsConfig: {
|
|
25
|
+
parent: UnitProp.Slot(), // MirrorRef を受け取る
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const rootSlotRef = useMirrorRef();
|
|
30
|
+
const anchorRef = useMirrorRef();
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<SlotHost rootSlotRef={rootSlotRef} anchorRef={anchorRef} />
|
|
35
|
+
<NeedsSlot parent={rootSlotRef} />
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Bind prop | 生産者側の実体 | Sync の `option` |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `rootSlotRef`(全 Unit) | Unit のルート Slot(`Static.Ref`) | `{ refType: "RootSlot" }` |
|
|
43
|
+
| `refsConfig` 由来の `${name}Ref` | `DV/Refs.{name}` | `{ refType: "Slot", refKey: "<name>" }` |
|
|
44
|
+
|
|
45
|
+
## Sync フレーム
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
{ type: "sync", data: <UnitChangeClientEvent> }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### `updateProp`(本命)
|
|
52
|
+
|
|
53
|
+
**ルート Slot**
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
{
|
|
57
|
+
type: "updateProp",
|
|
58
|
+
unit: {
|
|
59
|
+
id: "<consumerUnitId>",
|
|
60
|
+
prop: {
|
|
61
|
+
key: "parent",
|
|
62
|
+
type: "Reference",
|
|
63
|
+
value: "<sourceUnitId>" | "",
|
|
64
|
+
option: { refType: "RootSlot" }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Resonite 側: `value` で生産者 Unit を特定し、そのルート Slot(`Static.Ref`)を消費者の `Props.{key}` に書く。`value === ""` のときはクリア。
|
|
71
|
+
|
|
72
|
+
**名前付き Slot(`refsConfig`)**
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
{
|
|
76
|
+
type: "updateProp",
|
|
77
|
+
unit: {
|
|
78
|
+
id: "<consumerUnitId>",
|
|
79
|
+
prop: {
|
|
80
|
+
key: "parent",
|
|
81
|
+
type: "Reference",
|
|
82
|
+
value: "<sourceUnitId>" | "",
|
|
83
|
+
option: { refType: "Slot", refKey: "anchor" }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Resonite 側: `value` で生産者 Unit を特定し、その `DV/Refs` 配下の `Refs.{refKey}` を読み、消費者の `Props.{key}` に書く。
|
|
90
|
+
|
|
91
|
+
DV 名:
|
|
92
|
+
|
|
93
|
+
- 消費者フィールド: `"Props." + key`(`DV/Props` 配下)
|
|
94
|
+
- 生産者の名前付き export: `"Refs." + refKey`(`DV/Refs` 配下)
|
|
95
|
+
|
|
96
|
+
### `initUnitPropOrigin`
|
|
97
|
+
|
|
98
|
+
他の prop と同じ形。Reference の初期値は `value: ""` で、MirrorRef が bind されるまでは通常 `option: { refType: "RootSlot" }`。
|
|
99
|
+
|
|
100
|
+
### Mirror brson 上の配置
|
|
101
|
+
|
|
102
|
+
- `DV/Props` — `propsConfig`(値フィールド + 消費者側 Reference の DRV)
|
|
103
|
+
- `DV/Refs` — `refsConfig` があるときのみ。エントリごとに `DynamicReferenceVariable<Slot>`(`Refs.{name}`)
|
|
104
|
+
- ルート Slot の export 用に `DV/Refs` は作らない。既存の `Static.Ref` を使う
|
|
105
|
+
|
|
106
|
+
## 送らないもの
|
|
107
|
+
|
|
108
|
+
| 項目 | 理由 |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| `useMirrorRef` / `*Ref={handle}` の bind | React 専用 |
|
|
111
|
+
| 専用の `registerRef` イベント | 生産者 id + `option` で足りる |
|
|
112
|
+
| User / Asset の `refType` | 後続 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirage-x/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MirageX shared definitions: Units, props and refs, used by @mirage-x/server and @mirage-x/mirror",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"resonite",
|
|
7
|
+
"react",
|
|
8
|
+
"mirage-x"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/rheniumNV/mirage-x.git",
|
|
14
|
+
"directory": "packages/core"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/rheniumNV/mirage-x/tree/master/packages/core#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/rheniumNV/mirage-x/issues"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=22"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"docs",
|
|
27
|
+
"README.md",
|
|
28
|
+
"README.ja.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@types/react": "^19.3.3"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"tsx": "^4.23.12"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc -p tsconfig.json",
|
|
48
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
49
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json",
|
|
50
|
+
"test": "tsx --tsconfig tsconfig.test.json --test \"test/**/*.test.ts\""
|
|
51
|
+
}
|
|
6
52
|
}
|