x-runtime-lib 0.8.105 → 0.8.107

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.
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
@@ -1,2 +1,2 @@
1
- import { SpawnedNode } from '@/types';
2
- export declare function spawn(type: string, subtype: string): SpawnedNode | undefined;
1
+ import { NodePair } from '@/types';
2
+ export declare function spawn(type: string, subtype: string): NodePair | undefined;
package/dist/index.js CHANGED
@@ -175,16 +175,11 @@ function E(t, n) {
175
175
  }
176
176
  const $i = ["common", "scene"], Ci = ["common", "scene"];
177
177
  function eu({ type: t, version: n, view: e, code: o }) {
178
- const s = JSON.parse(
179
- JSON.stringify(e.nodeLites, (a, c) => {
180
- if (["id", "children"].includes(a))
181
- return c;
182
- })
183
- ), r = {
178
+ const r = {
184
179
  type: t,
185
180
  version: n,
186
181
  view: {
187
- nodeLites: s,
182
+ nodeLites: [],
188
183
  nodes: e.nodes
189
184
  },
190
185
  code: o
@@ -198,11 +193,11 @@ function tu(t) {
198
193
  view: o,
199
194
  code: s
200
195
  }, a = (c, u) => {
201
- c.key = u.basic.key, c.alias = u.basic.alias, c.refId = u.reference?.comp, c.children?.map((p) => {
196
+ c.key = u.basic.key, c.alias = u.basic.alias, c.refId = u.reference?.comp, c.children?.forEach((p) => {
202
197
  a(p, r.view.nodes[p.id]);
203
198
  });
204
199
  };
205
- return r.view.nodeLites.map((c) => {
200
+ return r.view.nodeLites.forEach((c) => {
206
201
  a(c, r.view.nodes[c.id]);
207
202
  }), r;
208
203
  }
@@ -8442,17 +8437,19 @@ function du(t, n) {
8442
8437
  }
8443
8438
  }
8444
8439
  function wc(t) {
8445
- function n(o) {
8446
- o.basic.id = z(16), o.children?.forEach((s) => n(s));
8447
- }
8448
- const e = K(t);
8449
- return n(e), e;
8440
+ const n = {}, e = (r) => {
8441
+ const a = z(16);
8442
+ n[r.id] = a, r.id = a, r.children?.map((c) => e(c));
8443
+ }, o = K(t.nodeLite);
8444
+ e(o);
8445
+ const s = {};
8446
+ return Object.values(t.nodes).forEach((r) => {
8447
+ const a = K(r);
8448
+ a.basic.id = n[a.basic.id], s[a.basic.id] = a;
8449
+ }), { nodeLite: o, nodes: s };
8450
8450
  }
8451
8451
  function fu(t) {
8452
- const n = [];
8453
- return t.forEach((e) => {
8454
- n.push(wc(e));
8455
- }), n;
8452
+ return t.map((n) => wc(n));
8456
8453
  }
8457
8454
  const To = "runtimeOrg", Eo = "runtimeEnv", Ao = "runtimeMode", Mo = "runtimeDevice", Bo = "runtimeDark", Wo = "runtimeType", Ro = "runtimeData", Ko = "runtimeDepends", Do = "runtimeRuntime", Oo = "runtimeSandbox";
8458
8455
  function yu(t) {
@@ -9400,8 +9397,8 @@ export {
9400
9397
  ra as datePickerV1,
9401
9398
  sa as dialogV1,
9402
9399
  Ll as directionalLightV1,
9403
- wc as duplicateNode,
9404
- fu as duplicateNodes,
9400
+ wc as duplicateNodePair,
9401
+ fu as duplicateNodePairs,
9405
9402
  nu as elementKeys,
9406
9403
  Ke as elements,
9407
9404
  Qc as ensureContext,
@@ -9413,9 +9410,9 @@ export {
9413
9410
  We as getBreakpointProp,
9414
9411
  xe as getField,
9415
9412
  un as getIndexOfBreakpoint,
9413
+ du as getNodeLite,
9416
9414
  lo as getPropertyDefault,
9417
9415
  B as getPropertyTag,
9418
- du as getTreeNode,
9419
9416
  Zc as getTypeColor,
9420
9417
  Hl as globalityV1,
9421
9418
  El as groupV1,
@@ -16,7 +16,7 @@ export type Node = {
16
16
  };
17
17
  [key: string]: any;
18
18
  };
19
- export type SpawnedNode = {
19
+ export type NodePair = {
20
20
  nodeLite: NodeLite;
21
21
  nodes: {
22
22
  [key: string]: Node;
@@ -1,5 +1,5 @@
1
1
  import { Type } from './basic';
2
- import { SpawnedNode } from './data';
2
+ import { NodePair } from './data';
3
3
  export type ZField = {
4
4
  key: string;
5
5
  name: string;
@@ -183,7 +183,7 @@ export type ZElement = {
183
183
  leaf?: boolean;
184
184
  internal?: boolean;
185
185
  teleport?: boolean;
186
- spawn?: (type: string, subtype: string) => SpawnedNode | undefined;
186
+ spawn?: (type: string, subtype: string) => NodePair | undefined;
187
187
  };
188
188
  export type ZElements = {
189
189
  [key: string]: ZElement;
@@ -1,5 +1,5 @@
1
- import { Node, NodeLite, SpawnedNode } from '../types';
2
- export declare function spawnNode(type: string, subtype: string, version: string, ref: boolean, keyOrRefId: string): SpawnedNode | undefined;
3
- export declare function getTreeNode(nodes: NodeLite[], id: string): NodeLite | undefined;
4
- export declare function duplicateNode(src: Node): Node;
5
- export declare function duplicateNodes(src: Node[]): Node[];
1
+ import { NodeLite, NodePair } from '../types';
2
+ export declare function spawnNode(type: string, subtype: string, version: string, ref: boolean, keyOrRefId: string): NodePair | undefined;
3
+ export declare function getNodeLite(nodeLites: NodeLite[], id: string): NodeLite | undefined;
4
+ export declare function duplicateNodePair(src: NodePair): NodePair;
5
+ export declare function duplicateNodePairs(srcs: NodePair[]): NodePair[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-runtime-lib",
3
3
  "private": false,
4
- "version": "0.8.105",
4
+ "version": "0.8.107",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",