@dcl/playground-assets 7.31.1-40962203448.commit-c68a75f → 7.31.1-41472004640.commit-3147448

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/alpha.d.ts CHANGED
@@ -245,6 +245,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
245
245
  getAudioState(entity: Entity): PBAudioEvent | undefined;
246
246
  }
247
247
 
248
+ /**
249
+ * @public
250
+ */
251
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
252
+
253
+ /**
254
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
255
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
256
+ *
257
+ * @param entity - Uint32 number of the entity
258
+ * @param componentId - Uint32 number of id
259
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
260
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
261
+ * @public
262
+ */
263
+ export declare type AuthoritativePutComponentMessageBody = {
264
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
265
+ entityId: Entity;
266
+ componentId: number;
267
+ timestamp: number;
268
+ data: Uint8Array;
269
+ };
270
+
271
+ /**
272
+ * @public
273
+ */
274
+ export declare namespace AuthoritativePutComponentOperation {
275
+ const MESSAGE_HEADER_LENGTH = 16;
276
+ /**
277
+ * Call this function for an optimal writing data passing the ByteBuffer
278
+ * already allocated
279
+ */
280
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
281
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
282
+ }
283
+
248
284
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
249
285
  /**
250
286
  * @public
@@ -420,6 +456,22 @@ export declare interface BaseComponent<T> {
420
456
  * If the value is undefined, the component was deleted.
421
457
  */
422
458
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
459
+ /**
460
+ * @public
461
+ *
462
+ */
463
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
464
+ validateBeforeChange(cb: ValidateCallback<T>): void;
465
+ /**
466
+ * Get the CRDT state for an entity (serialized data and timestamp)
467
+ * @param entity - Entity to get the CRDT state for
468
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
469
+ * @public
470
+ */
471
+ getCrdtState(entity: Entity): {
472
+ data: Uint8Array;
473
+ timestamp: number;
474
+ } | null;
423
475
  }
424
476
 
425
477
  /** @public */
@@ -1387,44 +1439,6 @@ export declare type Color4Type = {
1387
1439
  a: number;
1388
1440
  };
1389
1441
 
1390
- /**
1391
- * Piecewise-linear, with keys interpolated in ascending order of `time`. Positions before the first key
1392
- * or after the last key take that key's color. No keys means the gradient is unset.
1393
- * If two keys have the same `time`, then the gradient keeps the key that comes later in `keys`.
1394
- */
1395
- /**
1396
- * @public
1397
- */
1398
- export declare interface ColorGradient {
1399
- keys: ColorKey[];
1400
- }
1401
-
1402
- /**
1403
- * @public
1404
- */
1405
- export declare namespace ColorGradient {
1406
- export function encode(message: ColorGradient, writer?: _m0.Writer): _m0.Writer;
1407
- export function decode(input: _m0.Reader | Uint8Array, length?: number): ColorGradient;
1408
- }
1409
-
1410
- /**
1411
- * @public
1412
- */
1413
- export declare interface ColorKey {
1414
- /** position along the gradient, from 0 to 1. Values outside that range clamp to it */
1415
- time: number;
1416
- /** linear color. Values above 1 are allowed (HDR) */
1417
- color: PBColor4 | undefined;
1418
- }
1419
-
1420
- /**
1421
- * @public
1422
- */
1423
- export declare namespace ColorKey {
1424
- export function encode(message: ColorKey, writer?: _m0.Writer): _m0.Writer;
1425
- export function decode(input: _m0.Reader | Uint8Array, length?: number): ColorKey;
1426
- }
1427
-
1428
1442
  /** A range of Color4 values. Randomized or lerped between start and end. */
1429
1443
  /**
1430
1444
  * @public
@@ -1491,7 +1505,6 @@ export declare const componentDefinitionByName: {
1491
1505
  "core::CameraMode": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraMode>>;
1492
1506
  "core::CameraModeArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraModeArea>>;
1493
1507
  "core::EngineInfo": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBEngineInfo>>;
1494
- "core::EnvironmentFog": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBEnvironmentFog>>;
1495
1508
  "core::ExplorerItemPurchaseResult": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBExplorerItemPurchaseResult>>;
1496
1509
  "core::ExplorerUiEventsResult": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBExplorerUiEventsResult>>;
1497
1510
  "core::GltfContainer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
@@ -1515,9 +1528,7 @@ export declare const componentDefinitionByName: {
1515
1528
  "core::Raycast": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycast>>;
1516
1529
  "core::RaycastResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycastResult>>;
1517
1530
  "core::RealmInfo": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRealmInfo>>;
1518
- "core::Skybox": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBSkybox>>;
1519
1531
  "core::SkyboxTime": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBSkyboxTime>>;
1520
- "core::Sun": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBSun>>;
1521
1532
  "core::TextShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTextShape>>;
1522
1533
  "core::TouchScreenControls": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTouchScreenControls>>;
1523
1534
  "core::TriggerArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTriggerArea>>;
@@ -1704,12 +1715,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1704
1715
  /**
1705
1716
  * @public
1706
1717
  */
1707
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1718
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1708
1719
 
1709
1720
  /**
1710
1721
  * @public
1711
1722
  */
1712
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1723
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1713
1724
 
1714
1725
  /**
1715
1726
  * Min length = 8 bytes
@@ -1764,7 +1775,8 @@ export declare enum CrdtMessageType {
1764
1775
  PUT_COMPONENT_NETWORK = 5,
1765
1776
  DELETE_COMPONENT_NETWORK = 6,
1766
1777
  DELETE_ENTITY_NETWORK = 7,
1767
- MAX_MESSAGE_TYPE = 8
1778
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1779
+ MAX_MESSAGE_TYPE = 9
1768
1780
  }
1769
1781
 
1770
1782
  /**
@@ -1772,6 +1784,8 @@ export declare enum CrdtMessageType {
1772
1784
  */
1773
1785
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1774
1786
 
1787
+ export declare const CreatedBy: ICreatedBy;
1788
+
1775
1789
  /**
1776
1790
  * @public
1777
1791
  */
@@ -2208,9 +2222,6 @@ export declare namespace EntityUtils {
2208
2222
  export function toEntityId(entityNumber: number, entityVersion: number): Entity;
2209
2223
  }
2210
2224
 
2211
- /** @public */
2212
- export declare const EnvironmentFog: LastWriteWinElementSetComponentDefinition<PBEnvironmentFog>;
2213
-
2214
2225
  /**
2215
2226
  * Constant used to define the minimal number value in Babylon.js
2216
2227
  * @public
@@ -2551,6 +2562,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2551
2562
 
2552
2563
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2553
2564
 
2565
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2566
+
2567
+ export declare interface ICreatedByType {
2568
+ address: string;
2569
+ }
2570
+
2554
2571
  /**
2555
2572
  * @public
2556
2573
  */
@@ -3037,6 +3054,35 @@ export declare const enum InteractionType {
3037
3054
  PROXIMITY = 1
3038
3055
  }
3039
3056
 
3057
+ /**
3058
+ * Internal component interface that exposes all internal methods for SDK use
3059
+ * This is not exposed to users, only for internal SDK operations
3060
+ */
3061
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
3062
+ /**
3063
+ * @public
3064
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
3065
+ */
3066
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
3067
+ /**
3068
+ * @public
3069
+ * Get the iterator to every entity has the component
3070
+ */
3071
+ iterator(): Iterable<[Entity, any]>;
3072
+ /**
3073
+ * @public
3074
+ */
3075
+ dirtyIterator(): Iterable<Entity>;
3076
+ /**
3077
+ * @public
3078
+ */
3079
+ __onChangeCallbacks(entity: Entity, value: T): void;
3080
+ /**
3081
+ * @public
3082
+ */
3083
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
3084
+ }
3085
+
3040
3086
  /**
3041
3087
  * @public
3042
3088
  */
@@ -5325,34 +5371,6 @@ export declare namespace PBEngineInfo {
5325
5371
  export function decode(input: _m0.Reader | Uint8Array, length?: number): PBEngineInfo;
5326
5372
  }
5327
5373
 
5328
- /**
5329
- * PBEnvironmentFog overrides the environment fog while the player is inside the scene.
5330
- * Valid only on the scene root entity (`engine.RootEntity`).
5331
- *
5332
- * An unset field keeps the time-of-day default.
5333
- * Gradient `time` is the normalized time of day: 0 = 00:00, 0.5 = 12:00, 1 = 24:00.
5334
- * Gradients do not wrap around midnight.
5335
- * A scene cannot turn fog on or off. That is a user quality setting.
5336
- *
5337
- * While active, the overrides are global: they also change how neighbouring parcels look from inside the scene.
5338
- */
5339
- /**
5340
- * @public
5341
- */
5342
- export declare interface PBEnvironmentFog {
5343
- color?: ColorGradient | undefined;
5344
- /** default = 0.0005, per meter: fog = 1 - e^(-density * distance). Negative values clamp to 0 */
5345
- density?: number | undefined;
5346
- }
5347
-
5348
- /**
5349
- * @public
5350
- */
5351
- export declare namespace PBEnvironmentFog {
5352
- export function encode(message: PBEnvironmentFog, writer?: _m0.Writer): _m0.Writer;
5353
- export function decode(input: _m0.Reader | Uint8Array, length?: number): PBEnvironmentFog;
5354
- }
5355
-
5356
5374
  /**
5357
5375
  * Grow-only value set appended to the scene root entity.
5358
5376
  * Reports the outcome of an EU_ITEM_PURCHASE flow triggered via OpenExplorerUi.
@@ -6710,105 +6728,6 @@ export declare namespace PBRealmInfo {
6710
6728
  export function decode(input: _m0.Reader | Uint8Array, length?: number): PBRealmInfo;
6711
6729
  }
6712
6730
 
6713
- /**
6714
- * PBSkybox overrides the visible sky while the player is inside the scene.
6715
- * Valid only on the scene root entity (`engine.RootEntity`).
6716
- *
6717
- * An unset field keeps the time-of-day default.
6718
- * Gradient `time` is the normalized time of day: 0 = 00:00, 0.5 = 12:00, 1 = 24:00.
6719
- * Gradients do not wrap around midnight.
6720
- * The sun is controlled by `PBSun` and the fog by `PBEnvironmentFog`.
6721
- *
6722
- * While active, the overrides are global: they also change how neighbouring parcels look from inside the scene.
6723
- */
6724
- /**
6725
- * @public
6726
- */
6727
- export declare interface PBSkybox {
6728
- /**
6729
- * Replaces the visible sky with an image, given as its source path with the same rules as `Texture.src`.
6730
- * It must be an equirectangular (latitude-longitude) image with a 2:1 aspect ratio:
6731
- * the image centre faces +Z, the top row is the zenith and the bottom row the nadir.
6732
- * Cube cross, 3x2 and six-face layouts are not supported.
6733
- * The sun, the fog and the ambient lighting do not change: the ambient still follows `sky_colors`.
6734
- */
6735
- skyboxTexture?: string | undefined;
6736
- /**
6737
- * Procedural sky colors. They also drive the ambient lighting, also while `skybox_texture` is set.
6738
- * While `skybox_texture` is set they no longer color the visible sky.
6739
- */
6740
- skyColors?: PBSkybox_SkyColors | undefined;
6741
- /** Ignored while `skybox_texture` is set. */
6742
- clouds?: PBSkybox_Clouds | undefined;
6743
- /** Ignored while `skybox_texture` is set. */
6744
- stars?: PBSkybox_Stars | undefined;
6745
- }
6746
-
6747
- /**
6748
- * @public
6749
- */
6750
- export declare namespace PBSkybox {
6751
- export function encode(message: PBSkybox, writer?: _m0.Writer): _m0.Writer;
6752
- export function decode(input: _m0.Reader | Uint8Array, length?: number): PBSkybox;
6753
- }
6754
-
6755
- /**
6756
- * @public
6757
- */
6758
- export declare interface PBSkybox_Clouds {
6759
- /** default = 1, from 0 to 1 */
6760
- opacity?: number | undefined;
6761
- /** default = 0.01, in radians per second around the sky axis (0.01 is one turn every ~10 minutes). 0 = static, negative reverses the direction */
6762
- speed?: number | undefined;
6763
- color?: ColorGradient | undefined;
6764
- }
6765
-
6766
- /**
6767
- * @public
6768
- */
6769
- export declare namespace PBSkybox_Clouds {
6770
- export function encode(message: PBSkybox_Clouds, writer?: _m0.Writer): _m0.Writer;
6771
- export function decode(input: _m0.Reader | Uint8Array, length?: number): PBSkybox_Clouds;
6772
- }
6773
-
6774
- /**
6775
- * @public
6776
- */
6777
- export declare interface PBSkybox_SkyColors {
6778
- /** the sky straight up */
6779
- zenith?: ColorGradient | undefined;
6780
- /** the broad band of sky around the horizon */
6781
- horizon?: ColorGradient | undefined;
6782
- /** The sky below the horizon, visible wherever no terrain covers it (landscape disabled, high altitude). */
6783
- nadir?: ColorGradient | undefined;
6784
- /** Narrow glow right on the horizon line, like a sunset glow. Unset = follows `horizon` when that is set. */
6785
- rim?: ColorGradient | undefined;
6786
- }
6787
-
6788
- /**
6789
- * @public
6790
- */
6791
- export declare namespace PBSkybox_SkyColors {
6792
- export function encode(message: PBSkybox_SkyColors, writer?: _m0.Writer): _m0.Writer;
6793
- export function decode(input: _m0.Reader | Uint8Array, length?: number): PBSkybox_SkyColors;
6794
- }
6795
-
6796
- /**
6797
- * @public
6798
- */
6799
- export declare interface PBSkybox_Stars {
6800
- /** default = 4.62, multiplier on the star texture (1 = as authored, values above 1 are HDR). 0 hides the stars, negative values clamp to 0. Stars are visible only at night */
6801
- brightness?: number | undefined;
6802
- }
6803
-
6804
- /**
6805
- * @public
6806
- */
6807
- export declare namespace PBSkybox_Stars {
6808
- export function encode(message: PBSkybox_Stars, writer?: _m0.Writer): _m0.Writer;
6809
- export function decode(input: _m0.Reader | Uint8Array, length?: number): PBSkybox_Stars;
6810
- }
6811
-
6812
6731
  /**
6813
6732
  * The SkyboxTime component allows controlling the time of day for the skybox,
6814
6733
  * affecting the lighting and appearance of the sky in the scene.
@@ -6831,42 +6750,6 @@ export declare namespace PBSkyboxTime {
6831
6750
  export function decode(input: _m0.Reader | Uint8Array, length?: number): PBSkyboxTime;
6832
6751
  }
6833
6752
 
6834
- /**
6835
- * PBSun overrides the directional light (sun and moon) while the player is inside the scene.
6836
- * Valid only on the scene root entity (`engine.RootEntity`).
6837
- *
6838
- * An unset field keeps the time-of-day default.
6839
- * Gradient `time` is the normalized time of day: 0 = 00:00, 0.5 = 12:00, 1 = 24:00.
6840
- * Gradients do not wrap around midnight.
6841
- *
6842
- * While active, the overrides are global: they also change how neighbouring parcels look from inside the scene.
6843
- */
6844
- /**
6845
- * @public
6846
- */
6847
- export declare interface PBSun {
6848
- /** tints the directional light and the sun disc */
6849
- color?: ColorGradient | undefined;
6850
- /** default = true. false hides the sun and moon discs and the lens flare, but not their light */
6851
- visible?: boolean | undefined;
6852
- /** default = 1, multiplier on the renderer's time-of-day light intensity. Negative values clamp to 0 */
6853
- intensity?: number | undefined;
6854
- /**
6855
- * Direction the sunlight travels, in scene space: (0,-1,0) = sun straight overhead. Normalized by the renderer.
6856
- * Set = the sun stays fixed at every time of day; its color and intensity still follow the time of day.
6857
- * Unset or zero = the time-of-day path.
6858
- */
6859
- direction?: PBVector3 | undefined;
6860
- }
6861
-
6862
- /**
6863
- * @public
6864
- */
6865
- export declare namespace PBSun {
6866
- export function encode(message: PBSun, writer?: _m0.Writer): _m0.Writer;
6867
- export function decode(input: _m0.Reader | Uint8Array, length?: number): PBSun;
6868
- }
6869
-
6870
6753
  /**
6871
6754
  * The TextShape component renders customizable floating text.
6872
6755
  *
@@ -9299,9 +9182,6 @@ export declare interface SetMoveRotateScaleParams extends MoveRotateScaleModePar
9299
9182
  easingFunction?: EasingFunction;
9300
9183
  }
9301
9184
 
9302
- /** @public */
9303
- export declare const Skybox: LastWriteWinElementSetComponentDefinition<PBSkybox>;
9304
-
9305
9185
  /** @public */
9306
9186
  export declare const SkyboxTime: LastWriteWinElementSetComponentDefinition<PBSkyboxTime>;
9307
9187
 
@@ -9312,9 +9192,6 @@ export declare interface Spec {
9312
9192
  [key: string]: ISchema;
9313
9193
  }
9314
9194
 
9315
- /** @public */
9316
- export declare const Sun: LastWriteWinElementSetComponentDefinition<PBSun>;
9317
-
9318
9195
  /**
9319
9196
  * @alpha
9320
9197
  * This is going to be used for sync components through a server.
@@ -9756,6 +9633,16 @@ export declare type Transport = {
9756
9633
  onmessage?(message: Uint8Array): void;
9757
9634
  filter(message: Omit<TransportMessage, 'messageBuffer'>): boolean;
9758
9635
  type?: string;
9636
+ /**
9637
+ * Whether this transport is allowed to mutate reserved-range entities
9638
+ * (root/player/camera + avatars, entity number below `RESERVED_STATIC_ENTITIES`).
9639
+ * Only the trusted host/renderer transport sets this. An inbound DELETE_ENTITY
9640
+ * or component operation (PUT_COMPONENT, DELETE_COMPONENT, APPEND_VALUE,
9641
+ * AUTHORITATIVE_PUT_COMPONENT) on a reserved entity from a transport without
9642
+ * this flag (a comms peer, or any scene-added transport) is rejected — see
9643
+ * `receiveMessages`.
9644
+ */
9645
+ allowReservedEntities?: boolean;
9759
9646
  };
9760
9647
 
9761
9648
  /**
@@ -10337,6 +10224,14 @@ export declare interface UiTransformProps {
10337
10224
  */
10338
10225
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
10339
10226
 
10227
+ export declare type ValidateCallback<T> = (value: {
10228
+ entity: Entity;
10229
+ currentValue: T | undefined;
10230
+ newValue: T | undefined;
10231
+ senderAddress: string;
10232
+ createdBy: string;
10233
+ }) => boolean;
10234
+
10340
10235
  /**
10341
10236
  * @public
10342
10237
  */