-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathSRDataModels.swift
More file actions
3137 lines (2689 loc) · 130 KB
/
Copy pathSRDataModels.swift
File metadata and controls
3137 lines (2689 loc) · 130 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/
#if os(iOS)
import DatadogInternal
// This file was generated from JSON Schema. Do not modify it directly.
// swiftlint:disable all
internal protocol SRDataModel: Codable {}
/// A rendering group that groups child wireframes and child layers. Does not draw pixels itself. Ordered rendering modifiers and compositing are applied to its composed output.
@_spi(Internal)
public struct SRCompositionLayer: Codable, Hashable {
/// Ordered back-to-front references to child wireframes or child layers.
public let children: [SRCompositionLayerChild]
/// Operation used when compositing the rendered group into its parent.
public let compositeOperation: CompositeOperation?
/// The height in pixels of the layer. Uses the same coordinate space as mobile wireframes.
public let height: Int64
/// Stable layer identifier, persistent throughout the view lifetime.
public let id: Int64
/// Ordered list of rendering modifiers applied to the composed layer output in array order.
public let modifiers: [SRCompositionLayerModifier]?
/// The width in pixels of the layer. Uses the same coordinate space as mobile wireframes.
public let width: Int64
/// The position in pixels on the X axis of the layer in absolute coordinates. Uses the same coordinate space as mobile wireframes.
public let x: Int64
/// The position in pixels on the Y axis of the layer in absolute coordinates. Uses the same coordinate space as mobile wireframes.
public let y: Int64
public enum CodingKeys: String, CodingKey {
case children = "children"
case compositeOperation = "compositeOperation"
case height = "height"
case id = "id"
case modifiers = "modifiers"
case width = "width"
case x = "x"
case y = "y"
}
/// A rendering group that groups child wireframes and child layers. Does not draw pixels itself. Ordered rendering modifiers and compositing are applied to its composed output.
///
/// - Parameters:
/// - children: Ordered back-to-front references to child wireframes or child layers.
/// - compositeOperation: Operation used when compositing the rendered group into its parent.
/// - height: The height in pixels of the layer. Uses the same coordinate space as mobile wireframes.
/// - id: Stable layer identifier, persistent throughout the view lifetime.
/// - modifiers: Ordered list of rendering modifiers applied to the composed layer output in array order.
/// - width: The width in pixels of the layer. Uses the same coordinate space as mobile wireframes.
/// - x: The position in pixels on the X axis of the layer in absolute coordinates. Uses the same coordinate space as mobile wireframes.
/// - y: The position in pixels on the Y axis of the layer in absolute coordinates. Uses the same coordinate space as mobile wireframes.
public init(
children: [SRCompositionLayerChild],
compositeOperation: CompositeOperation? = nil,
height: Int64,
id: Int64,
modifiers: [SRCompositionLayerModifier]? = nil,
width: Int64,
x: Int64,
y: Int64
) {
self.children = children
self.compositeOperation = compositeOperation
self.height = height
self.id = id
self.modifiers = modifiers
self.width = width
self.x = x
self.y = y
}
/// Operation used when compositing the rendered group into its parent.
@_spi(Internal)
public enum CompositeOperation: String, Codable {
case sourceOver = "sourceOver"
case destinationIn = "destinationIn"
case destinationOut = "destinationOut"
case plusDarker = "plusDarker"
}
}
/// Adds a signed brightness bias to the rendered layer contents.
@_spi(Internal)
public struct SRCompositionLayerBrightnessBiasModifier: Codable, Hashable {
/// The type of the modifier.
public let type: String = "brightnessBias"
/// Brightness bias from -1 to 1 added to each normalized RGB channel (alpha is unchanged). 0 leaves content unchanged. Positive values brighten; negative values darken. Each channel is clamped to [0, 1] after the bias is applied.
public let value: Double
public enum CodingKeys: String, CodingKey {
case type = "type"
case value = "value"
}
/// Adds a signed brightness bias to the rendered layer contents.
///
/// - Parameters:
/// - value: Brightness bias from -1 to 1 added to each normalized RGB channel (alpha is unchanged). 0 leaves content unchanged. Positive values brighten; negative values darken. Each channel is clamped to [0, 1] after the bias is applied.
public init(
value: Double
) {
self.value = value
}
}
/// A reference to a child wireframe or child layer in a composition layer.
@_spi(Internal)
public struct SRCompositionLayerChild: Codable, Hashable {
/// The id of the referenced wireframe or layer.
public let id: Int64
/// The type of the child reference.
public let type: SRCompositionLayerChildType
public enum CodingKeys: String, CodingKey {
case id = "id"
case type = "type"
}
/// A reference to a child wireframe or child layer in a composition layer.
///
/// - Parameters:
/// - id: The id of the referenced wireframe or layer.
/// - type: The type of the child reference.
public init(
id: Int64,
type: SRCompositionLayerChildType
) {
self.id = id
self.type = type
}
}
/// The type of the child reference.
@_spi(Internal)
public enum SRCompositionLayerChildType: String, Codable {
case wireframe = "wireframe"
case layer = "layer"
}
/// Geometric clipping applied to the composed layer output, in coordinates local to the layer rectangle.
@_spi(Internal)
public struct SRCompositionLayerClipModifier: Codable, Hashable {
/// Path fill rule. Defaults to 'nonzero'.
public let fillRule: FillRule?
/// SVG path string defining the clip region, in coordinates local to the layer rectangle.
public let path: String
/// The type of the modifier.
public let type: String = "clip"
public enum CodingKeys: String, CodingKey {
case fillRule = "fillRule"
case path = "path"
case type = "type"
}
/// Geometric clipping applied to the composed layer output, in coordinates local to the layer rectangle.
///
/// - Parameters:
/// - fillRule: Path fill rule. Defaults to 'nonzero'.
/// - path: SVG path string defining the clip region, in coordinates local to the layer rectangle.
public init(
fillRule: FillRule? = nil,
path: String
) {
self.fillRule = fillRule
self.path = path
}
/// Path fill rule. Defaults to 'nonzero'.
@_spi(Internal)
public enum FillRule: String, Codable {
case nonzero = "nonzero"
case evenodd = "evenodd"
}
}
/// Color transformation using a 4x5 matrix applied to the composed layer output.
@_spi(Internal)
public struct SRCompositionLayerColorMatrixModifier: Codable, Hashable {
/// 4x5 color matrix encoded as 20 numbers in row-major order. Input and output color channels are normalized to [0, 1]. The transform for each output channel is: R' = m[0]*R + m[1]*G + m[2]*B + m[3]*A + m[4], G' = m[5]*R + m[6]*G + m[7]*B + m[8]*A + m[9], B' = m[10]*R + m[11]*G + m[12]*B + m[13]*A + m[14], A' = m[15]*R + m[16]*G + m[17]*B + m[18]*A + m[19]. Each output channel is clamped to [0, 1] after evaluation.
public let matrix: [Double]
/// The type of the modifier.
public let type: String = "colorMatrix"
public enum CodingKeys: String, CodingKey {
case matrix = "matrix"
case type = "type"
}
/// Color transformation using a 4x5 matrix applied to the composed layer output.
///
/// - Parameters:
/// - matrix: 4x5 color matrix encoded as 20 numbers in row-major order. Input and output color channels are normalized to [0, 1]. The transform for each output channel is: R' = m[0]*R + m[1]*G + m[2]*B + m[3]*A + m[4], G' = m[5]*R + m[6]*G + m[7]*B + m[8]*A + m[9], B' = m[10]*R + m[11]*G + m[12]*B + m[13]*A + m[14], A' = m[15]*R + m[16]*G + m[17]*B + m[18]*A + m[19]. Each output channel is clamped to [0, 1] after evaluation.
public init(
matrix: [Double]
) {
self.matrix = matrix
}
}
/// Gaussian blur applied to the composed layer output.
@_spi(Internal)
public struct SRCompositionLayerGaussianBlurModifier: Codable, Hashable {
/// Gaussian blur radius.
public let radius: Double
/// The type of the modifier.
public let type: String = "gaussianBlur"
public enum CodingKeys: String, CodingKey {
case radius = "radius"
case type = "type"
}
/// Gaussian blur applied to the composed layer output.
///
/// - Parameters:
/// - radius: Gaussian blur radius.
public init(
radius: Double
) {
self.radius = radius
}
}
/// Image mask applied to the composed layer output at this point in the modifier order. The referenced image is mapped to the layer bounds and interpreted as an alpha mask: transparent pixels hide content, opaque pixels keep content, and partial alpha multiplies content alpha. RGB channels are ignored.
@_spi(Internal)
public struct SRCompositionLayerMaskImageModifier: Codable, Hashable {
/// Unique identifier of the image resource used as a bounds-aligned alpha mask.
public let resourceId: String
/// The type of the modifier.
public let type: String = "maskImage"
public enum CodingKeys: String, CodingKey {
case resourceId = "resourceId"
case type = "type"
}
/// Image mask applied to the composed layer output at this point in the modifier order. The referenced image is mapped to the layer bounds and interpreted as an alpha mask: transparent pixels hide content, opaque pixels keep content, and partial alpha multiplies content alpha. RGB channels are ignored.
///
/// - Parameters:
/// - resourceId: Unique identifier of the image resource used as a bounds-aligned alpha mask.
public init(
resourceId: String
) {
self.resourceId = resourceId
}
}
/// A rendering modifier applied to the composed layer output.
@_spi(Internal)
public enum SRCompositionLayerModifier: Codable, Hashable {
case compositionLayerClipModifier(value: SRCompositionLayerClipModifier)
case compositionLayerOpacityModifier(value: SRCompositionLayerOpacityModifier)
case compositionLayerColorMatrixModifier(value: SRCompositionLayerColorMatrixModifier)
case compositionLayerGaussianBlurModifier(value: SRCompositionLayerGaussianBlurModifier)
case compositionLayerShadowModifier(value: SRCompositionLayerShadowModifier)
case compositionLayerBrightnessBiasModifier(value: SRCompositionLayerBrightnessBiasModifier)
case compositionLayerSaturateModifier(value: SRCompositionLayerSaturateModifier)
case compositionLayerMaskImageModifier(value: SRCompositionLayerMaskImageModifier)
private enum DiscriminatorCodingKeys: String, CodingKey {
case discriminator = "type"
}
// MARK: - Codable
public func encode(to encoder: Encoder) throws {
// Encode only the associated value, without encoding enum case
var container = encoder.singleValueContainer()
switch self {
case .compositionLayerClipModifier(let value):
try container.encode(value)
case .compositionLayerOpacityModifier(let value):
try container.encode(value)
case .compositionLayerColorMatrixModifier(let value):
try container.encode(value)
case .compositionLayerGaussianBlurModifier(let value):
try container.encode(value)
case .compositionLayerShadowModifier(let value):
try container.encode(value)
case .compositionLayerBrightnessBiasModifier(let value):
try container.encode(value)
case .compositionLayerSaturateModifier(let value):
try container.encode(value)
case .compositionLayerMaskImageModifier(let value):
try container.encode(value)
}
}
public init(from decoder: Decoder) throws {
// Decode enum case from discriminator
let container = try decoder.singleValueContainer()
let discriminatorContainer = try decoder.container(keyedBy: DiscriminatorCodingKeys.self)
switch try discriminatorContainer.decode(String.self, forKey: .discriminator) {
case "clip":
self = .compositionLayerClipModifier(value: try container.decode(SRCompositionLayerClipModifier.self))
return
case "opacity":
self = .compositionLayerOpacityModifier(value: try container.decode(SRCompositionLayerOpacityModifier.self))
return
case "colorMatrix":
self = .compositionLayerColorMatrixModifier(value: try container.decode(SRCompositionLayerColorMatrixModifier.self))
return
case "gaussianBlur":
self = .compositionLayerGaussianBlurModifier(value: try container.decode(SRCompositionLayerGaussianBlurModifier.self))
return
case "shadow":
self = .compositionLayerShadowModifier(value: try container.decode(SRCompositionLayerShadowModifier.self))
return
case "brightnessBias":
self = .compositionLayerBrightnessBiasModifier(value: try container.decode(SRCompositionLayerBrightnessBiasModifier.self))
return
case "saturate":
self = .compositionLayerSaturateModifier(value: try container.decode(SRCompositionLayerSaturateModifier.self))
return
case "maskImage":
self = .compositionLayerMaskImageModifier(value: try container.decode(SRCompositionLayerMaskImageModifier.self))
return
default:
let error = DecodingError.Context(
codingPath: discriminatorContainer.codingPath + [DiscriminatorCodingKeys.discriminator],
debugDescription: """
Failed to decode `SRCompositionLayerModifier`.
Discriminator `type` did not match any known case.
"""
)
throw DecodingError.dataCorrupted(error)
}
}
}
/// Opacity applied to the composed layer output at this point in the modifier order.
@_spi(Internal)
public struct SRCompositionLayerOpacityModifier: Codable, Hashable {
/// The type of the modifier.
public let type: String = "opacity"
/// Opacity value from 0 to 1.
public let value: Double
public enum CodingKeys: String, CodingKey {
case type = "type"
case value = "value"
}
/// Opacity applied to the composed layer output at this point in the modifier order.
///
/// - Parameters:
/// - value: Opacity value from 0 to 1.
public init(
value: Double
) {
self.value = value
}
}
/// Applies a saturation adjustment to the rendered layer contents.
@_spi(Internal)
public struct SRCompositionLayerSaturateModifier: Codable, Hashable {
/// The type of the modifier.
public let type: String = "saturate"
/// Saturation multiplier. 1 leaves content unchanged. 0 removes saturation.
public let value: Double
public enum CodingKeys: String, CodingKey {
case type = "type"
case value = "value"
}
/// Applies a saturation adjustment to the rendered layer contents.
///
/// - Parameters:
/// - value: Saturation multiplier. 1 leaves content unchanged. 0 removes saturation.
public init(
value: Double
) {
self.value = value
}
}
/// Drop shadow drawn behind the composed layer output.
@_spi(Internal)
public struct SRCompositionLayerShadowModifier: Codable, Hashable {
/// The shadow color as a String hexadecimal. Follows the #RRGGBBAA color format with the alpha value as optional. SDKs should encode the effective shadow alpha in this color and omit the shadow modifier when the effective alpha is 0.
public let color: String
/// Horizontal shadow offset in pixels.
public let offsetX: Double
/// Vertical shadow offset in pixels.
public let offsetY: Double
/// Optional SVG path string defining the shadow outline, in coordinates local to the layer rectangle. When present, the path is interpreted using the non-zero winding rule. When omitted, the shadow follows the composed layer alpha.
public let path: String?
/// Blur radius used to create the shadow.
public let radius: Double
/// The type of the modifier.
public let type: String = "shadow"
public enum CodingKeys: String, CodingKey {
case color = "color"
case offsetX = "offsetX"
case offsetY = "offsetY"
case path = "path"
case radius = "radius"
case type = "type"
}
/// Drop shadow drawn behind the composed layer output.
///
/// - Parameters:
/// - color: The shadow color as a String hexadecimal. Follows the #RRGGBBAA color format with the alpha value as optional. SDKs should encode the effective shadow alpha in this color and omit the shadow modifier when the effective alpha is 0.
/// - offsetX: Horizontal shadow offset in pixels.
/// - offsetY: Vertical shadow offset in pixels.
/// - path: Optional SVG path string defining the shadow outline, in coordinates local to the layer rectangle. When present, the path is interpreted using the non-zero winding rule. When omitted, the shadow follows the composed layer alpha.
/// - radius: Blur radius used to create the shadow.
public init(
color: String,
offsetX: Double,
offsetY: Double,
path: String? = nil,
radius: Double
) {
self.color = color
self.offsetX = offsetX
self.offsetY = offsetY
self.path = path
self.radius = radius
}
}
/// Sparse update for a composition layer. Omitted fields are unchanged.
@_spi(Internal)
public struct SRCompositionLayerUpdate: Codable, Hashable {
/// When present, replaces the full child list for this layer.
public let children: [SRCompositionLayerChild]?
/// Updated composite operation for this layer.
public let compositeOperation: CompositeOperation?
/// Updated height in pixels. Uses the same coordinate space as mobile wireframes.
public let height: Int64?
/// The id of the layer to update.
public let id: Int64
/// When present, replaces the full modifier list for this layer.
public let modifiers: [SRCompositionLayerModifier]?
/// Updated width in pixels. Uses the same coordinate space as mobile wireframes.
public let width: Int64?
/// Updated X position in absolute coordinates. Uses the same coordinate space as mobile wireframes.
public let x: Int64?
/// Updated Y position in absolute coordinates. Uses the same coordinate space as mobile wireframes.
public let y: Int64?
public enum CodingKeys: String, CodingKey {
case children = "children"
case compositeOperation = "compositeOperation"
case height = "height"
case id = "id"
case modifiers = "modifiers"
case width = "width"
case x = "x"
case y = "y"
}
/// Sparse update for a composition layer. Omitted fields are unchanged.
///
/// - Parameters:
/// - children: When present, replaces the full child list for this layer.
/// - compositeOperation: Updated composite operation for this layer.
/// - height: Updated height in pixels. Uses the same coordinate space as mobile wireframes.
/// - id: The id of the layer to update.
/// - modifiers: When present, replaces the full modifier list for this layer.
/// - width: Updated width in pixels. Uses the same coordinate space as mobile wireframes.
/// - x: Updated X position in absolute coordinates. Uses the same coordinate space as mobile wireframes.
/// - y: Updated Y position in absolute coordinates. Uses the same coordinate space as mobile wireframes.
public init(
children: [SRCompositionLayerChild]? = nil,
compositeOperation: CompositeOperation? = nil,
height: Int64? = nil,
id: Int64,
modifiers: [SRCompositionLayerModifier]? = nil,
width: Int64? = nil,
x: Int64? = nil,
y: Int64? = nil
) {
self.children = children
self.compositeOperation = compositeOperation
self.height = height
self.id = id
self.modifiers = modifiers
self.width = width
self.x = x
self.y = y
}
/// Updated composite operation for this layer.
@_spi(Internal)
public enum CompositeOperation: String, Codable {
case sourceOver = "sourceOver"
case destinationIn = "destinationIn"
case destinationOut = "destinationOut"
case plusDarker = "plusDarker"
}
}
/// Optional composition tree describing the rendering hierarchy. When present, the player uses this tree for rendering order and group operations.
@_spi(Internal)
public struct SRCompositionTree: Codable {
/// Non-root composition layers referenced by the tree.
public let layers: [SRCompositionLayer]?
/// A rendering group that groups child wireframes and child layers. Does not draw pixels itself. Ordered rendering modifiers and compositing are applied to its composed output.
public let root: SRCompositionLayer
public enum CodingKeys: String, CodingKey {
case layers = "layers"
case root = "root"
}
/// Optional composition tree describing the rendering hierarchy. When present, the player uses this tree for rendering order and group operations.
///
/// - Parameters:
/// - layers: Non-root composition layers referenced by the tree.
/// - root: A rendering group that groups child wireframes and child layers. Does not draw pixels itself. Ordered rendering modifiers and compositing are applied to its composed output.
public init(
layers: [SRCompositionLayer]? = nil,
root: SRCompositionLayer
) {
self.layers = layers
self.root = root
}
}
/// Mobile-specific. Incremental data carrying composition tree layer mutations.
@_spi(Internal)
public struct SRCompositionTreeMutationData: Codable {
/// Full layer definitions for newly added layers.
public let adds: [SRCompositionLayer]?
/// Ids of layer definitions to remove. Removing a referenced layer also requires updating the parent or root child list.
public let removes: [Int64]?
/// A rendering group that groups child wireframes and child layers. Does not draw pixels itself. Ordered rendering modifiers and compositing are applied to its composed output.
public let root: SRCompositionLayer?
/// The source of this type of incremental data.
public let source: Int64 = 10
/// Sparse updates for existing layers.
public let updates: [SRCompositionLayerUpdate]?
public enum CodingKeys: String, CodingKey {
case adds = "adds"
case removes = "removes"
case root = "root"
case source = "source"
case updates = "updates"
}
/// Mobile-specific. Incremental data carrying composition tree layer mutations.
///
/// - Parameters:
/// - adds: Full layer definitions for newly added layers.
/// - removes: Ids of layer definitions to remove. Removing a referenced layer also requires updating the parent or root child list.
/// - root: A rendering group that groups child wireframes and child layers. Does not draw pixels itself. Ordered rendering modifiers and compositing are applied to its composed output.
/// - updates: Sparse updates for existing layers.
public init(
adds: [SRCompositionLayer]? = nil,
removes: [Int64]? = nil,
root: SRCompositionLayer? = nil,
updates: [SRCompositionLayerUpdate]? = nil
) {
self.adds = adds
self.removes = removes
self.root = root
self.updates = updates
}
}
/// Schema of clipping information for a Wireframe.
@_spi(Internal)
public struct SRContentClip: Codable, Hashable {
/// The amount of space in pixels that needs to be clipped (masked) at the bottom of the wireframe.
public let bottom: Int64?
/// The amount of space in pixels that needs to be clipped (masked) at the left of the wireframe.
public let left: Int64?
/// The amount of space in pixels that needs to be clipped (masked) at the right of the wireframe.
public let right: Int64?
/// The amount of space in pixels that needs to be clipped (masked) at the top of the wireframe.
public let top: Int64?
public enum CodingKeys: String, CodingKey {
case bottom = "bottom"
case left = "left"
case right = "right"
case top = "top"
}
/// Schema of clipping information for a Wireframe.
///
/// - Parameters:
/// - bottom: The amount of space in pixels that needs to be clipped (masked) at the bottom of the wireframe.
/// - left: The amount of space in pixels that needs to be clipped (masked) at the left of the wireframe.
/// - right: The amount of space in pixels that needs to be clipped (masked) at the right of the wireframe.
/// - top: The amount of space in pixels that needs to be clipped (masked) at the top of the wireframe.
public init(
bottom: Int64? = nil,
left: Int64? = nil,
right: Int64? = nil,
top: Int64? = nil
) {
self.bottom = bottom
self.left = left
self.right = right
self.top = top
}
}
/// Schema of all properties of an EmbeddedContentWireframe.
@_spi(Internal)
public struct SREmbeddedContentWireframe: Codable, Hashable {
/// The border properties of this wireframe. The default value is null (no-border).
public let border: SRShapeBorder?
/// Schema of clipping information for a Wireframe.
public let clip: SRContentClip?
/// The height in pixels of the UI element, normalized based on the device pixels per inch density (DPI). Example: if a device has a DPI = 2, the height of all UI elements is divided by 2 to get a normalized height.
public let height: Int64
/// Defines the unique ID of the wireframe. This is persistent throughout the view lifetime.
public let id: Int64
/// Whether this embedded content is visible or not.
public let isVisible: Bool?
/// A globally unique and stable identifier for this UI element, computed as the hash of the element's path. Used to correlate wireframes with RUM action events.
public let permanentId: String?
/// The style of this wireframe.
public let shapeStyle: SRShapeStyle?
/// Unique Id of the slot containing this embedded content.
public let slotId: String
/// The type of the wireframe.
public let type: String = "embedded_content"
/// The width in pixels of the UI element, normalized based on the device pixels per inch density (DPI). Example: if a device has a DPI = 2, the width of all UI elements is divided by 2 to get a normalized width.
public let width: Int64
/// The position in pixels on X axis of the UI element in absolute coordinates. The anchor point is always the top-left corner of the wireframe.
public let x: Int64
/// The position in pixels on Y axis of the UI element in absolute coordinates. The anchor point is always the top-left corner of the wireframe.
public let y: Int64
public enum CodingKeys: String, CodingKey {
case border = "border"
case clip = "clip"
case height = "height"
case id = "id"
case isVisible = "isVisible"
case permanentId = "permanentId"
case shapeStyle = "shapeStyle"
case slotId = "slotId"
case type = "type"
case width = "width"
case x = "x"
case y = "y"
}
/// Schema of all properties of an EmbeddedContentWireframe.
///
/// - Parameters:
/// - border: The border properties of this wireframe. The default value is null (no-border).
/// - clip: Schema of clipping information for a Wireframe.
/// - height: The height in pixels of the UI element, normalized based on the device pixels per inch density (DPI). Example: if a device has a DPI = 2, the height of all UI elements is divided by 2 to get a normalized height.
/// - id: Defines the unique ID of the wireframe. This is persistent throughout the view lifetime.
/// - isVisible: Whether this embedded content is visible or not.
/// - permanentId: A globally unique and stable identifier for this UI element, computed as the hash of the element's path. Used to correlate wireframes with RUM action events.
/// - shapeStyle: The style of this wireframe.
/// - slotId: Unique Id of the slot containing this embedded content.
/// - width: The width in pixels of the UI element, normalized based on the device pixels per inch density (DPI). Example: if a device has a DPI = 2, the width of all UI elements is divided by 2 to get a normalized width.
/// - x: The position in pixels on X axis of the UI element in absolute coordinates. The anchor point is always the top-left corner of the wireframe.
/// - y: The position in pixels on Y axis of the UI element in absolute coordinates. The anchor point is always the top-left corner of the wireframe.
public init(
border: SRShapeBorder? = nil,
clip: SRContentClip? = nil,
height: Int64,
id: Int64,
isVisible: Bool? = nil,
permanentId: String? = nil,
shapeStyle: SRShapeStyle? = nil,
slotId: String,
width: Int64,
x: Int64,
y: Int64
) {
self.border = border
self.clip = clip
self.height = height
self.id = id
self.isVisible = isVisible
self.permanentId = permanentId
self.shapeStyle = shapeStyle
self.slotId = slotId
self.width = width
self.x = x
self.y = y
}
}
/// Schema of a Record type which contains focus information.
@_spi(Internal)
public struct SRFocusRecord: Codable {
public let data: Data
/// Unique ID of the slot that generated this record.
public let slotId: String?
/// Defines the UTC time in milliseconds when this Record was performed.
public let timestamp: Int64
/// The type of this Record.
public let type: Int64 = 6
public enum CodingKeys: String, CodingKey {
case data = "data"
case slotId = "slotId"
case timestamp = "timestamp"
case type = "type"
}
/// Schema of a Record type which contains focus information.
///
/// - Parameters:
/// - data:
/// - slotId: Unique ID of the slot that generated this record.
/// - timestamp: Defines the UTC time in milliseconds when this Record was performed.
public init(
data: Data,
slotId: String? = nil,
timestamp: Int64
) {
self.data = data
self.slotId = slotId
self.timestamp = timestamp
}
@_spi(Internal)
public struct Data: Codable {
/// Whether this screen has a focus or not. For now it will always be true for mobile.
public let hasFocus: Bool
public enum CodingKeys: String, CodingKey {
case hasFocus = "has_focus"
}
///
/// - Parameters:
/// - hasFocus: Whether this screen has a focus or not. For now it will always be true for mobile.
public init(
hasFocus: Bool
) {
self.hasFocus = hasFocus
}
}
}
/// Mobile-specific. Schema of a Record type which contains the full snapshot of a screen.
@_spi(Internal)
public struct SRFullSnapshotRecord: Codable {
public let data: Data
/// Unique ID of the slot that generated this record.
public let slotId: String?
/// Defines the UTC time in milliseconds when this Record was performed.
public let timestamp: Int64
/// The type of this Record.
public let type: Int64 = 10
public enum CodingKeys: String, CodingKey {
case data = "data"
case slotId = "slotId"
case timestamp = "timestamp"
case type = "type"
}
/// Mobile-specific. Schema of a Record type which contains the full snapshot of a screen.
///
/// - Parameters:
/// - data:
/// - slotId: Unique ID of the slot that generated this record.
/// - timestamp: Defines the UTC time in milliseconds when this Record was performed.
public init(
data: Data,
slotId: String? = nil,
timestamp: Int64
) {
self.data = data
self.slotId = slotId
self.timestamp = timestamp
}
@_spi(Internal)
public struct Data: Codable {
/// Optional composition tree describing the rendering hierarchy. When present, the player uses this tree for rendering order and group operations.
public let compositionTree: SRCompositionTree?
/// The Wireframes contained by this Record.
public let wireframes: [SRWireframe]
public enum CodingKeys: String, CodingKey {
case compositionTree = "compositionTree"
case wireframes = "wireframes"
}
///
/// - Parameters:
/// - compositionTree: Optional composition tree describing the rendering hierarchy. When present, the player uses this tree for rendering order and group operations.
/// - wireframes: The Wireframes contained by this Record.
public init(
compositionTree: SRCompositionTree? = nil,
wireframes: [SRWireframe]
) {
self.compositionTree = compositionTree
self.wireframes = wireframes
}
}
}
/// Schema of all properties of a ImageWireframe.
@_spi(Internal)
public struct SRImageWireframe: Codable, Hashable {
/// base64 representation of the image. Not required as the ImageWireframe can be initialised without any base64
public var base64: String?
/// The border properties of this wireframe. The default value is null (no-border).
public let border: SRShapeBorder?
/// Schema of clipping information for a Wireframe.
public let clip: SRContentClip?
/// The height in pixels of the UI element, normalized based on the device pixels per inch density (DPI). Example: if a device has a DPI = 2, the height of all UI elements is divided by 2 to get a normalized height.
public let height: Int64
/// Defines the unique ID of the wireframe. This is persistent throughout the view lifetime.
public let id: Int64
/// Flag describing an image wireframe that should render an empty state placeholder
public var isEmpty: Bool?
/// MIME type of the image file
public var mimeType: String?
/// A globally unique and stable identifier for this UI element, computed as the hash of the element's path. Used to correlate wireframes with RUM action events.
public let permanentId: String?
/// Unique identifier of the image resource
public var resourceId: String?
/// The style of this wireframe.
public let shapeStyle: SRShapeStyle?
/// The type of the wireframe.
public let type: String = "image"
/// The width in pixels of the UI element, normalized based on the device pixels per inch density (DPI). Example: if a device has a DPI = 2, the width of all UI elements is divided by 2 to get a normalized width.
public let width: Int64
/// The position in pixels on X axis of the UI element in absolute coordinates. The anchor point is always the top-left corner of the wireframe.
public let x: Int64
/// The position in pixels on Y axis of the UI element in absolute coordinates. The anchor point is always the top-left corner of the wireframe.
public let y: Int64
public enum CodingKeys: String, CodingKey {
case base64 = "base64"
case border = "border"
case clip = "clip"
case height = "height"
case id = "id"
case isEmpty = "isEmpty"
case mimeType = "mimeType"
case permanentId = "permanentId"
case resourceId = "resourceId"
case shapeStyle = "shapeStyle"
case type = "type"
case width = "width"
case x = "x"
case y = "y"
}
/// Schema of all properties of a ImageWireframe.
///
/// - Parameters:
/// - base64: base64 representation of the image. Not required as the ImageWireframe can be initialised without any base64
/// - border: The border properties of this wireframe. The default value is null (no-border).
/// - clip: Schema of clipping information for a Wireframe.
/// - height: The height in pixels of the UI element, normalized based on the device pixels per inch density (DPI). Example: if a device has a DPI = 2, the height of all UI elements is divided by 2 to get a normalized height.
/// - id: Defines the unique ID of the wireframe. This is persistent throughout the view lifetime.
/// - isEmpty: Flag describing an image wireframe that should render an empty state placeholder
/// - mimeType: MIME type of the image file
/// - permanentId: A globally unique and stable identifier for this UI element, computed as the hash of the element's path. Used to correlate wireframes with RUM action events.
/// - resourceId: Unique identifier of the image resource
/// - shapeStyle: The style of this wireframe.
/// - width: The width in pixels of the UI element, normalized based on the device pixels per inch density (DPI). Example: if a device has a DPI = 2, the width of all UI elements is divided by 2 to get a normalized width.
/// - x: The position in pixels on X axis of the UI element in absolute coordinates. The anchor point is always the top-left corner of the wireframe.
/// - y: The position in pixels on Y axis of the UI element in absolute coordinates. The anchor point is always the top-left corner of the wireframe.
public init(
base64: String? = nil,
border: SRShapeBorder? = nil,
clip: SRContentClip? = nil,
height: Int64,
id: Int64,
isEmpty: Bool? = nil,
mimeType: String? = nil,
permanentId: String? = nil,
resourceId: String? = nil,
shapeStyle: SRShapeStyle? = nil,
width: Int64,
x: Int64,
y: Int64
) {
self.base64 = base64
self.border = border
self.clip = clip
self.height = height
self.id = id
self.isEmpty = isEmpty
self.mimeType = mimeType
self.permanentId = permanentId
self.resourceId = resourceId
self.shapeStyle = shapeStyle
self.width = width
self.x = x
self.y = y
}
}
/// Mobile-specific. Schema of a Record type which contains mutations of a screen.
@_spi(Internal)
public struct SRIncrementalSnapshotRecord: Codable {
/// Mobile-specific. Schema of a Session Replay IncrementalData type.
public let data: Data
/// Unique ID of the slot that generated this record.
public let slotId: String?
/// Defines the UTC time in milliseconds when this Record was performed.
public let timestamp: Int64
/// The type of this Record.
public let type: Int64 = 11
public enum CodingKeys: String, CodingKey {
case data = "data"
case slotId = "slotId"
case timestamp = "timestamp"
case type = "type"
}
/// Mobile-specific. Schema of a Record type which contains mutations of a screen.
///