@geastack/engine 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +29 -0
  3. package/bitmap_font.cpp +165 -0
  4. package/canvas.cpp +4608 -0
  5. package/components/Button.d.ts +4 -0
  6. package/components/Button.tsx +32 -0
  7. package/components/Image.d.ts +3 -0
  8. package/components/Image.tsx +17 -0
  9. package/components/Text.d.ts +3 -0
  10. package/components/Text.tsx +9 -0
  11. package/components/View.d.ts +3 -0
  12. package/components/View.tsx +24 -0
  13. package/components/index.d.ts +8 -0
  14. package/components/index.ts +4 -0
  15. package/css/animation.h +252 -0
  16. package/css/declarative.h +131 -0
  17. package/css/easing.h +160 -0
  18. package/css/engine.h +223 -0
  19. package/css/interpolate.h +38 -0
  20. package/image_store.cpp +807 -0
  21. package/package.json +62 -0
  22. package/rasterized_font.cpp +570 -0
  23. package/touch_runtime.cpp +513 -0
  24. package/ui/absolute_leaf_refresh.cpp +279 -0
  25. package/ui/absolute_leaf_refresh.h +12 -0
  26. package/ui/canvas_element.cpp +2314 -0
  27. package/ui/canvas_element.h +353 -0
  28. package/ui/canvas_store.cpp +188 -0
  29. package/ui/canvas_store.h +59 -0
  30. package/ui/core.cpp +135 -0
  31. package/ui/css_atom.cpp +155 -0
  32. package/ui/css_atom.h +21 -0
  33. package/ui/dirty_regions.cpp +66 -0
  34. package/ui/dirty_regions.h +34 -0
  35. package/ui/display_invalidation.cpp +101 -0
  36. package/ui/display_invalidation.h +15 -0
  37. package/ui/document.cpp +356 -0
  38. package/ui/document.h +101 -0
  39. package/ui/image.h +16 -0
  40. package/ui/image_element.cpp +13 -0
  41. package/ui/image_node.cpp +165 -0
  42. package/ui/input.cpp +936 -0
  43. package/ui/input_render.cpp +213 -0
  44. package/ui/internal.h +567 -0
  45. package/ui/layout.cpp +2025 -0
  46. package/ui/layout_snapshot.cpp +82 -0
  47. package/ui/layout_snapshot.h +12 -0
  48. package/ui/mirror.h +25 -0
  49. package/ui/node.cpp +243 -0
  50. package/ui/node.h +154 -0
  51. package/ui/node_lifecycle.cpp +137 -0
  52. package/ui/node_lifecycle.h +13 -0
  53. package/ui/node_model.h +597 -0
  54. package/ui/refresh_perf.h +235 -0
  55. package/ui/refresh_trace.h +68 -0
  56. package/ui/render.cpp +12097 -0
  57. package/ui/root_scroll_refresh.cpp +859 -0
  58. package/ui/root_scroll_refresh.h +30 -0
  59. package/ui/state_init.h +21 -0
  60. package/ui/style.cpp +14994 -0
  61. package/ui/style.h +727 -0
  62. package/ui/style_values.h +31 -0
  63. package/ui/text.cpp +2010 -0
  64. package/ui/text.h +15 -0
  65. package/ui/text_element.cpp +15 -0
  66. package/ui/tree_events.cpp +621 -0
  67. package/ui/tree_events.h +69 -0
  68. package/ui/tree_internal.h +191 -0
  69. package/ui/tree_nodes.cpp +628 -0
  70. package/ui/tree_render.cpp +3138 -0
  71. package/ui/tree_scroll_mirror.cpp +101 -0
  72. package/ui/tree_state.cpp +574 -0
  73. package/ui/tree_state.h +235 -0
  74. package/ui/tree_style.cpp +698 -0
  75. package/ui/ui.h +9 -0
  76. package/ui/view.cpp +2232 -0
  77. package/ui/view.h +14 -0
  78. package/ui/view_element.cpp +13 -0
  79. package/ui/viewport_region.cpp +36 -0
  80. package/ui/viewport_region.h +12 -0
  81. package/ui/virtual_keyboard.cpp +908 -0
  82. package/ui/virtual_keyboard.h +59 -0
  83. package/vendor/AnimatedGIF/AnimatedGIF.c +982 -0
  84. package/vendor/AnimatedGIF/AnimatedGIF.h +216 -0
  85. package/vendor/stb/stb_image.h +7988 -0
  86. package/vendor/stb/stb_truetype.h +5079 -0
package/ui/style.h ADDED
@@ -0,0 +1,727 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ #pragma once
3
+
4
+ #include <cstdint>
5
+ #include <initializer_list>
6
+ #include <string>
7
+
8
+ namespace gea::embedded::ui {
9
+
10
+ enum class Property : int {
11
+ Display = 0,
12
+ FlexDirection,
13
+ FlexWrap,
14
+ JustifyContent,
15
+ AlignItems,
16
+ JustifyItems,
17
+ AlignContent,
18
+ AlignSelf,
19
+ Gap,
20
+ Width,
21
+ Height,
22
+ WidthPercent,
23
+ HeightPercent,
24
+ MinWidth,
25
+ MinHeight,
26
+ MaxWidth,
27
+ MaxHeight,
28
+ Flex,
29
+ FlexShrink,
30
+ FlexBasis,
31
+ PaddingTop,
32
+ PaddingRight,
33
+ PaddingBottom,
34
+ PaddingLeft,
35
+ MarginTop,
36
+ MarginRight,
37
+ MarginBottom,
38
+ MarginLeft,
39
+ Position,
40
+ Top,
41
+ Right,
42
+ Bottom,
43
+ Left,
44
+ TopPercent,
45
+ RightPercent,
46
+ BottomPercent,
47
+ LeftPercent,
48
+ ZIndex,
49
+ BackgroundColor,
50
+ HasBackground,
51
+ ActiveBackgroundColor,
52
+ HasActiveBackground,
53
+ Color,
54
+ Opacity,
55
+ BlinkInterval,
56
+ BorderWidth,
57
+ BorderColor,
58
+ BorderTopWidth,
59
+ BorderRightWidth,
60
+ BorderBottomWidth,
61
+ BorderLeftWidth,
62
+ BorderTopColor,
63
+ BorderRightColor,
64
+ BorderBottomColor,
65
+ BorderLeftColor,
66
+ BorderRadiusTopLeft,
67
+ BorderRadiusTopRight,
68
+ BorderRadiusBottomRight,
69
+ BorderRadiusBottomLeft,
70
+ BorderRadiusTopLeftPercent,
71
+ BorderRadiusTopRightPercent,
72
+ BorderRadiusBottomRightPercent,
73
+ BorderRadiusBottomLeftPercent,
74
+ FontId,
75
+ FontSize,
76
+ FontWeight,
77
+ LineHeight,
78
+ TextAlign,
79
+ Overflow,
80
+ OverflowX,
81
+ OverflowY,
82
+ MaskRightFadeWidth,
83
+ ImageId,
84
+ ImageFit,
85
+ TransformRotate,
86
+ TransformRotateX,
87
+ TransformRotateY,
88
+ TransformTranslateX,
89
+ TransformTranslateY,
90
+ TransformTranslateZ,
91
+ TransformTranslateXPercent,
92
+ TransformTranslateYPercent,
93
+ TransformScaleX,
94
+ TransformScaleY,
95
+ TransformOriginX,
96
+ TransformOriginY,
97
+ Perspective,
98
+ PerspectiveOriginX,
99
+ PerspectiveOriginY,
100
+ FilterBlur,
101
+ BoxShadowInset,
102
+ BoxShadowOffsetX,
103
+ BoxShadowOffsetY,
104
+ BoxShadowBlur,
105
+ BoxShadowSpread,
106
+ BoxShadowColor,
107
+ BoxShadowAlpha,
108
+ TextDecoration,
109
+ TextTransform,
110
+ WhiteSpace,
111
+ TextOverflow,
112
+ Backface,
113
+ PointerEvents,
114
+ Count
115
+ };
116
+
117
+ enum class StyleDeclaration : std::uint8_t {
118
+ Unknown,
119
+ Ignored,
120
+ Custom,
121
+ Animation,
122
+ Display,
123
+ FlexDirection,
124
+ FlexWrap,
125
+ JustifyContent,
126
+ AlignItems,
127
+ JustifyItems,
128
+ AlignContent,
129
+ AlignSelf,
130
+ PlaceItems,
131
+ GridTemplateColumns,
132
+ GridTemplateRows,
133
+ Content,
134
+ Gap,
135
+ Width,
136
+ Height,
137
+ MinWidth,
138
+ MinHeight,
139
+ MaxWidth,
140
+ MaxHeight,
141
+ Flex,
142
+ FlexGrow,
143
+ FlexShrink,
144
+ FlexBasis,
145
+ Padding,
146
+ PaddingTop,
147
+ PaddingRight,
148
+ PaddingBottom,
149
+ PaddingLeft,
150
+ Margin,
151
+ MarginTop,
152
+ MarginRight,
153
+ MarginBottom,
154
+ MarginLeft,
155
+ Position,
156
+ Inset,
157
+ Top,
158
+ Right,
159
+ Bottom,
160
+ Left,
161
+ ZIndex,
162
+ ActiveBackgroundColor,
163
+ Background,
164
+ BackgroundSize,
165
+ ObjectFit,
166
+ Color,
167
+ Opacity,
168
+ BorderColor,
169
+ Border,
170
+ BorderWidth,
171
+ BorderTop,
172
+ BorderRight,
173
+ BorderBottom,
174
+ BorderLeft,
175
+ BorderTopWidth,
176
+ BorderRightWidth,
177
+ BorderBottomWidth,
178
+ BorderLeftWidth,
179
+ BorderTopColor,
180
+ BorderRightColor,
181
+ BorderBottomColor,
182
+ BorderLeftColor,
183
+ BorderRadius,
184
+ BorderTopLeftRadius,
185
+ BorderTopRightRadius,
186
+ BorderBottomRightRadius,
187
+ BorderBottomLeftRadius,
188
+ FontFamily,
189
+ FontSize,
190
+ FontWeight,
191
+ LineHeight,
192
+ TextAlign,
193
+ TextDecoration,
194
+ TextTransform,
195
+ WhiteSpace,
196
+ TextOverflow,
197
+ BackfaceVisibility,
198
+ PointerEvents,
199
+ Overflow,
200
+ OverflowX,
201
+ OverflowY,
202
+ MaskImage,
203
+ Transform,
204
+ Rotate,
205
+ Scale,
206
+ Filter,
207
+ BoxShadow,
208
+ TransformOrigin,
209
+ Perspective,
210
+ PerspectiveOrigin
211
+ };
212
+
213
+ class Style {
214
+ public:
215
+ explicit Style(int nodeId = -1) : nodeId_(nodeId) {}
216
+
217
+ int nodeId() const { return nodeId_; }
218
+ void set(Property property, int value) const;
219
+
220
+ void width(int value) const { set(Property::Width, value); }
221
+ void height(int value) const { set(Property::Height, value); }
222
+ void backgroundColor(int rgb565) const;
223
+ void color(int rgb565) const { set(Property::Color, rgb565); }
224
+ void opacity(int value) const { set(Property::Opacity, value); }
225
+ void display(int value) const { set(Property::Display, value); }
226
+ void position(int value) const { set(Property::Position, value); }
227
+ void left(int value) const { set(Property::Left, value); }
228
+ void top(int value) const { set(Property::Top, value); }
229
+ void translateX(int value) const { set(Property::TransformTranslateX, value); }
230
+ void translateY(int value) const { set(Property::TransformTranslateY, value); }
231
+ void rotateDegrees(double value) const;
232
+ void scale(double value) const;
233
+ void imageId(int value) const { set(Property::ImageId, value); }
234
+ void imageFit(int value) const { set(Property::ImageFit, value); }
235
+
236
+ // Generic string-keyed inline style access — the `CSSStyleDeclaration`
237
+ // shape (`style.setProperty(name, value)` / `style.removeProperty(name)`)
238
+ // gea's own `reactiveStyle`/`reactiveStyleProp` runtime helpers use
239
+ // (packages/gea/src/runtime/reactive-style.ts). Delegates to
240
+ // `StyleSheet`'s existing NodeHandle+string inline-style path (the same
241
+ // one the CSS parser feeds), rather than duplicating property-name
242
+ // parsing here.
243
+ void setProperty(const std::string &property, const std::string &value) const;
244
+ bool removeProperty(const std::string &property) const;
245
+
246
+ private:
247
+ int nodeId_;
248
+ };
249
+
250
+ class NodeHandle;
251
+
252
+ enum class StaticStyleSelectorKind : std::uint8_t {
253
+ Class,
254
+ Element,
255
+ Selector
256
+ };
257
+
258
+ struct StaticStyleSimpleSelectorSpec {
259
+ const char *tag = nullptr;
260
+ const char *id = nullptr;
261
+ std::initializer_list<const char *> classes = {};
262
+ bool wantsRoot = false;
263
+ bool wantsFirstChild = false;
264
+ bool wantsLastChild = false;
265
+ };
266
+
267
+ struct StaticStyleSelectorPartSpec {
268
+ StaticStyleSimpleSelectorSpec simple;
269
+ bool directParent = false;
270
+ };
271
+
272
+ enum class StaticStyleMediaFeatureKind : std::uint8_t {
273
+ AlwaysFalse,
274
+ Orientation,
275
+ Monochrome,
276
+ Width,
277
+ Height,
278
+ AspectRatio,
279
+ Resolution
280
+ };
281
+
282
+ enum class StaticStyleMediaCompare : std::uint8_t {
283
+ Equal,
284
+ Min,
285
+ Max,
286
+ Boolean
287
+ };
288
+
289
+ struct StaticStyleMediaTermSpec {
290
+ StaticStyleMediaFeatureKind kind = StaticStyleMediaFeatureKind::AlwaysFalse;
291
+ StaticStyleMediaCompare compare = StaticStyleMediaCompare::Equal;
292
+ double value = 0.0;
293
+ std::uint8_t orientation = 0;
294
+ };
295
+
296
+ struct StaticStyleMediaQuerySpec {
297
+ std::initializer_list<StaticStyleMediaTermSpec> terms = {};
298
+ bool valid = true;
299
+ };
300
+
301
+ enum class StaticStyleColorProperty : std::uint8_t {
302
+ Color,
303
+ Background,
304
+ ActiveBackground,
305
+ Border,
306
+ BorderTop,
307
+ BorderRight,
308
+ BorderBottom,
309
+ BorderLeft
310
+ };
311
+
312
+ enum class StaticStyleLengthUnit : std::uint8_t {
313
+ Raw,
314
+ Px,
315
+ Percent,
316
+ Vw,
317
+ Vh,
318
+ Vmin,
319
+ Vmax,
320
+ Dvw,
321
+ Dvh,
322
+ Auto,
323
+ Expression
324
+ };
325
+
326
+ enum class StaticStyleLengthProperty : std::uint8_t {
327
+ Gap,
328
+ Width,
329
+ Height,
330
+ MinWidth,
331
+ MinHeight,
332
+ MaxWidth,
333
+ MaxHeight,
334
+ FlexBasis,
335
+ PaddingTop,
336
+ PaddingRight,
337
+ PaddingBottom,
338
+ PaddingLeft,
339
+ MarginTop,
340
+ MarginRight,
341
+ MarginBottom,
342
+ MarginLeft,
343
+ BorderWidth,
344
+ BorderTopWidth,
345
+ BorderRightWidth,
346
+ BorderBottomWidth,
347
+ BorderLeftWidth,
348
+ FontSize,
349
+ Perspective,
350
+ MaskImage,
351
+ Top,
352
+ Right,
353
+ Bottom,
354
+ Left
355
+ };
356
+
357
+ enum class StaticStyleBorderRadiusCorner : std::uint8_t {
358
+ TopLeft,
359
+ TopRight,
360
+ BottomRight,
361
+ BottomLeft
362
+ };
363
+
364
+ enum class StaticStyleOriginProperty : std::uint8_t {
365
+ TransformOrigin,
366
+ PerspectiveOrigin
367
+ };
368
+
369
+ enum class StaticStyleGridTemplateProperty : std::uint8_t {
370
+ Columns,
371
+ Rows
372
+ };
373
+
374
+ enum class StaticStyleLengthExpressionKind : std::uint8_t {
375
+ Add,
376
+ Subtract,
377
+ Multiply,
378
+ Divide,
379
+ Min,
380
+ Max,
381
+ Clamp,
382
+ Var
383
+ };
384
+
385
+ enum class StaticStyleLineHeightKind : std::uint8_t {
386
+ Normal,
387
+ Scalar,
388
+ Percent,
389
+ Length
390
+ };
391
+
392
+ struct StaticStylePropertyValue {
393
+ Property property;
394
+ int value;
395
+ };
396
+
397
+ struct StaticStyleLengthSpec {
398
+ StaticStyleLengthUnit unit;
399
+ float value;
400
+ };
401
+
402
+ struct StaticStyleColor {
403
+ int r;
404
+ int g;
405
+ int b;
406
+ int a;
407
+ };
408
+
409
+ struct StaticStyleColorRef {
410
+ const char *varName;
411
+ StaticStyleColor fallback;
412
+ bool hasFallback;
413
+ };
414
+
415
+ struct StaticStyleLinearGradient {
416
+ int angleTenths;
417
+ StaticStyleColor from;
418
+ StaticStyleColor mid;
419
+ StaticStyleColor to;
420
+ int midStopPermille;
421
+ int toStopPermille;
422
+ bool hasMid;
423
+ };
424
+
425
+ struct StaticStyleLinearGradientRef {
426
+ int angleTenths;
427
+ StaticStyleColorRef from;
428
+ StaticStyleColorRef mid;
429
+ StaticStyleColorRef to;
430
+ int midStopPermille;
431
+ int toStopPermille;
432
+ bool hasMid;
433
+ };
434
+
435
+ struct StaticStyleRadialGradientRef {
436
+ StaticStyleColorRef from;
437
+ StaticStyleColorRef to;
438
+ int stopPermille;
439
+ int cxPermille;
440
+ int cyPermille;
441
+ int rxPermille;
442
+ int ryPermille;
443
+ bool enabled;
444
+ };
445
+
446
+ struct StaticStyleGridTemplateTrack {
447
+ int type;
448
+ int value;
449
+ StaticStyleLengthSpec length;
450
+ };
451
+
452
+ struct StaticStyleBackgroundGridLine {
453
+ bool enabled;
454
+ StaticStyleLengthSpec width;
455
+ StaticStyleColor color;
456
+ };
457
+
458
+ enum class StaticStyleAnimationDirection : std::uint8_t {
459
+ Normal,
460
+ Reverse,
461
+ Alternate,
462
+ AlternateReverse
463
+ };
464
+
465
+ enum class StaticStyleAnimationFill : std::uint8_t {
466
+ None,
467
+ Forwards,
468
+ Backwards,
469
+ Both
470
+ };
471
+
472
+ enum class StaticStyleAnimationEasingKind : std::uint8_t {
473
+ Linear,
474
+ Ease,
475
+ EaseIn,
476
+ EaseOut,
477
+ EaseInOut,
478
+ CubicBezier,
479
+ Steps
480
+ };
481
+
482
+ struct StaticStyleAnimationEasing {
483
+ StaticStyleAnimationEasingKind kind;
484
+ double x1;
485
+ double y1;
486
+ double x2;
487
+ double y2;
488
+ int steps;
489
+ };
490
+
491
+ class StyleSheet {
492
+ public:
493
+ static StyleSheet &instance();
494
+
495
+ void clear();
496
+ void beginRuleRegistrationBatch();
497
+ void endRuleRegistrationBatch();
498
+ void registerRule(const std::string &className, const std::string &property, const std::string &value, const std::string &media = std::string());
499
+ void registerElementRule(const std::string &elementName, const std::string &property, const std::string &value, const std::string &media = std::string());
500
+ void registerSelectorRule(const std::string &selector, const std::string &property, const std::string &value, const std::string &media = std::string());
501
+ void registerKeyframeRule(const std::string &name, int offsetPermille, const std::string &property, const std::string &value);
502
+ void registerStaticRule(const char *className, const char *property, const char *value, const char *media = nullptr);
503
+ void registerStaticElementRule(const char *elementName, const char *property, const char *value, const char *media = nullptr);
504
+ void registerStaticSelectorRule(const char *selector, const char *property, const char *value, const char *media = nullptr);
505
+ void registerStaticKeyframeRule(const char *name, int offsetPermille, const char *property, const char *value);
506
+ void registerStaticPropertyKeyframeRule(const char *name, int offsetPermille, Property property, int value);
507
+ void registerStaticColorKeyframeRule(const char *name,
508
+ int offsetPermille,
509
+ StaticStyleColorProperty property,
510
+ int r,
511
+ int g,
512
+ int b,
513
+ int a = 255);
514
+ void registerStaticColorVarKeyframeRule(const char *name,
515
+ int offsetPermille,
516
+ StaticStyleColorProperty property,
517
+ const char *varName,
518
+ bool hasFallback,
519
+ int r,
520
+ int g,
521
+ int b,
522
+ int a = 255);
523
+ void registerStaticLengthKeyframeRule(const char *name,
524
+ int offsetPermille,
525
+ StaticStyleLengthProperty property,
526
+ StaticStyleLengthUnit unit,
527
+ float value);
528
+ void registerStaticLengthSpecKeyframeRule(const char *name,
529
+ int offsetPermille,
530
+ StaticStyleLengthProperty property,
531
+ StaticStyleLengthSpec length);
532
+ void registerStaticFilterBlurKeyframeRule(const char *name,
533
+ int offsetPermille,
534
+ StaticStyleLengthSpec radius);
535
+ void registerStaticTransformKeyframeRule(const char *name,
536
+ int offsetPermille,
537
+ std::uint16_t flags,
538
+ int rotateX,
539
+ int rotateY,
540
+ int rotateZ,
541
+ StaticStyleLengthSpec translateX,
542
+ StaticStyleLengthSpec translateY,
543
+ StaticStyleLengthSpec translateZ,
544
+ int scaleX,
545
+ int scaleY);
546
+ void registerStaticPropertyRule(StaticStyleSelectorKind selectorKind,
547
+ const char *selector,
548
+ Property property,
549
+ int value,
550
+ const char *media = nullptr);
551
+ void registerStaticPropertyGroupRule(StaticStyleSelectorKind selectorKind,
552
+ const char *selector,
553
+ std::initializer_list<StaticStylePropertyValue> properties,
554
+ const char *media = nullptr);
555
+ std::uint16_t registerStaticSelectorPlan(const char *selector,
556
+ std::initializer_list<StaticStyleSelectorPartSpec> parts);
557
+ std::uint16_t registerStaticMediaConditionPlan(const char *condition,
558
+ std::initializer_list<StaticStyleMediaQuerySpec> queries);
559
+ void registerStaticColorRule(StaticStyleSelectorKind selectorKind,
560
+ const char *selector,
561
+ StaticStyleColorProperty property,
562
+ int r,
563
+ int g,
564
+ int b,
565
+ int a = 255,
566
+ const char *media = nullptr);
567
+ void registerStaticColorVarRule(StaticStyleSelectorKind selectorKind,
568
+ const char *selector,
569
+ StaticStyleColorProperty property,
570
+ const char *name,
571
+ bool hasFallback,
572
+ int r,
573
+ int g,
574
+ int b,
575
+ int a = 255,
576
+ const char *media = nullptr);
577
+ void registerStaticLengthRule(StaticStyleSelectorKind selectorKind,
578
+ const char *selector,
579
+ StaticStyleLengthProperty property,
580
+ StaticStyleLengthUnit unit,
581
+ float value,
582
+ const char *media = nullptr);
583
+ std::uint16_t registerStaticLengthExpression(StaticStyleLengthExpressionKind kind,
584
+ StaticStyleLengthSpec a,
585
+ StaticStyleLengthSpec b,
586
+ StaticStyleLengthSpec c,
587
+ float scalar,
588
+ const char *name,
589
+ bool hasFallback);
590
+ void registerStaticLengthSpecRule(StaticStyleSelectorKind selectorKind,
591
+ const char *selector,
592
+ StaticStyleLengthProperty property,
593
+ StaticStyleLengthSpec length,
594
+ const char *media = nullptr);
595
+ void registerStaticFontFamilyRule(StaticStyleSelectorKind selectorKind,
596
+ const char *selector,
597
+ const char *family,
598
+ const char *media = nullptr);
599
+ void registerStaticLineHeightRule(StaticStyleSelectorKind selectorKind,
600
+ const char *selector,
601
+ StaticStyleLineHeightKind kind,
602
+ StaticStyleLengthSpec value,
603
+ const char *media = nullptr);
604
+ void registerStaticFlexRule(StaticStyleSelectorKind selectorKind,
605
+ const char *selector,
606
+ int grow,
607
+ StaticStyleLengthSpec basis,
608
+ bool hasBasis,
609
+ const char *media = nullptr);
610
+ void registerStaticBorderRule(StaticStyleSelectorKind selectorKind,
611
+ const char *selector,
612
+ StaticStyleLengthSpec width,
613
+ int r,
614
+ int g,
615
+ int b,
616
+ int a = 255,
617
+ const char *media = nullptr);
618
+ void registerStaticBorderRadiusRule(StaticStyleSelectorKind selectorKind,
619
+ const char *selector,
620
+ StaticStyleLengthSpec topLeft,
621
+ StaticStyleLengthSpec topRight,
622
+ StaticStyleLengthSpec bottomRight,
623
+ StaticStyleLengthSpec bottomLeft,
624
+ const char *media = nullptr);
625
+ void registerStaticBorderRadiusCornerRule(StaticStyleSelectorKind selectorKind,
626
+ const char *selector,
627
+ StaticStyleBorderRadiusCorner corner,
628
+ StaticStyleLengthSpec radius,
629
+ const char *media = nullptr);
630
+ void registerStaticFilterBlurRule(StaticStyleSelectorKind selectorKind,
631
+ const char *selector,
632
+ StaticStyleLengthSpec radius,
633
+ const char *media = nullptr);
634
+ void registerStaticBoxShadowNoneRule(StaticStyleSelectorKind selectorKind,
635
+ const char *selector,
636
+ const char *media = nullptr);
637
+ void registerStaticBackgroundRule(StaticStyleSelectorKind selectorKind,
638
+ const char *selector,
639
+ StaticStyleLinearGradient gradient,
640
+ StaticStyleLinearGradient overlayGradient,
641
+ bool hasOverlayGradient,
642
+ StaticStyleBackgroundGridLine gridX,
643
+ StaticStyleBackgroundGridLine gridY,
644
+ const char *media = nullptr);
645
+ void registerStaticBackgroundFullRule(StaticStyleSelectorKind selectorKind,
646
+ const char *selector,
647
+ StaticStyleLinearGradientRef gradient,
648
+ StaticStyleLinearGradientRef overlayGradient,
649
+ bool hasOverlayGradient,
650
+ StaticStyleRadialGradientRef radialGradient,
651
+ StaticStyleBackgroundGridLine gridX,
652
+ StaticStyleBackgroundGridLine gridY,
653
+ const char *media = nullptr);
654
+ void registerStaticBackgroundSizeRule(StaticStyleSelectorKind selectorKind,
655
+ const char *selector,
656
+ StaticStyleLengthSpec stepX,
657
+ StaticStyleLengthSpec stepY,
658
+ const char *media = nullptr);
659
+ void registerStaticGridTemplateRule(StaticStyleSelectorKind selectorKind,
660
+ const char *selector,
661
+ StaticStyleGridTemplateProperty property,
662
+ std::initializer_list<StaticStyleGridTemplateTrack> tracks,
663
+ const char *media = nullptr);
664
+ void registerStaticAnimationRule(StaticStyleSelectorKind selectorKind,
665
+ const char *selector,
666
+ const char *name,
667
+ std::uint32_t durationMs,
668
+ std::uint32_t delayMs,
669
+ int iterations,
670
+ StaticStyleAnimationDirection direction,
671
+ StaticStyleAnimationFill fill,
672
+ StaticStyleAnimationEasing easing,
673
+ const char *media = nullptr);
674
+ void registerStaticCustomLengthRule(StaticStyleSelectorKind selectorKind,
675
+ const char *selector,
676
+ const char *name,
677
+ StaticStyleLengthSpec length,
678
+ const char *media = nullptr);
679
+ void registerStaticCustomColorRule(StaticStyleSelectorKind selectorKind,
680
+ const char *selector,
681
+ const char *name,
682
+ int r,
683
+ int g,
684
+ int b,
685
+ int a = 255,
686
+ const char *media = nullptr);
687
+ void registerStaticTransformRule(StaticStyleSelectorKind selectorKind,
688
+ const char *selector,
689
+ std::uint16_t flags,
690
+ int rotateX,
691
+ int rotateY,
692
+ int rotateZ,
693
+ StaticStyleLengthSpec translateX,
694
+ StaticStyleLengthSpec translateY,
695
+ StaticStyleLengthSpec translateZ,
696
+ int scaleX,
697
+ int scaleY,
698
+ const char *media = nullptr);
699
+ void registerStaticOriginRule(StaticStyleSelectorKind selectorKind,
700
+ const char *selector,
701
+ StaticStyleOriginProperty property,
702
+ int xPermille,
703
+ int yPermille,
704
+ const char *media = nullptr);
705
+ void applyClass(NodeHandle node, const std::string &className) const;
706
+ void setClassName(NodeHandle node, const std::string &className) const;
707
+ void applyProperty(NodeHandle node, StyleDeclaration declaration, const std::string &value) const;
708
+ void applyProperty(NodeHandle node, const char *property, const std::string &value) const;
709
+ void applyProperty(NodeHandle node, const std::string &property, const std::string &value) const;
710
+ bool applyNumberProperty(NodeHandle node, StyleDeclaration declaration, double value) const;
711
+ bool applyNumberProperty(NodeHandle node, const char *property, double value) const;
712
+ bool removeProperty(NodeHandle node, const std::string &property) const;
713
+ void recomputeSubtree(int nodeId) const;
714
+ void startCssAnimations(std::uint32_t nowMs) const;
715
+
716
+ private:
717
+ StyleSheet() = default;
718
+ };
719
+
720
+ void setViewportMetrics(int width, int height, double devicePixelRatio);
721
+ double devicePixelRatio();
722
+ void setDevicePixelRatio(double devicePixelRatio);
723
+ void applyAnimatedStyleValue(int nodeId, Property property, int value);
724
+ void setSafeAreaInsetBottom(int inset);
725
+ int safeAreaInsetBottom();
726
+
727
+ } // namespace gea::embedded::ui