@ng-native/fabric 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/engine.d.ts CHANGED
@@ -303,6 +303,10 @@ export interface EngineNode extends HostNode {
303
303
  committedUnder: EngineNode | null;
304
304
  /** The hoisted views this node keeps committed for, by element name. See `HoistOptions`. */
305
305
  kept?: Map<string, KeptHoist>;
306
+ /** On a text field, the row aligned by baseline that takes a baseline from it: `lineBaseline`. */
307
+ onBaseline?: EngineNode;
308
+ /** On such a row, the fields it has marked, which it unmarks when they are no longer its own. */
309
+ baselineFields?: Set<EngineNode>;
306
310
  /** Commit this node again with its children so Fabric measures it again. `remeasureText`. */
307
311
  remeasure?: true;
308
312
  /**
@@ -589,6 +593,14 @@ export declare class Engine implements HostEngine {
589
593
  * does, a child list can move without anything else needing to be looked at again.
590
594
  */
591
595
  private structuralSheets;
596
+ /** How many children after a change in a list one of them reaches. See `siblingReach`. */
597
+ private structuralAfter;
598
+ /** Whether one of them reaches the children before it. */
599
+ private structuralBefore;
600
+ /** The compounds of theirs that read an element's place from under it. See `markPlace`. */
601
+ private readonly placeElsewhere;
602
+ /** The sheets `watchStructure` has read, which it is asked about once an element. */
603
+ private readonly watchedStructure;
592
604
  /** Whether any sheet uses `:has()`. See `markBeneath`. */
593
605
  private hasSheets;
594
606
  private readonly resolveAssetSource;
@@ -647,6 +659,12 @@ export declare class Engine implements HostEngine {
647
659
  * `replacing` is a sheet added before that this one takes the place of, after a hot swap.
648
660
  */
649
661
  addGlobalSheet(sheet: StyleSheet, replacing?: StyleSheet): boolean;
662
+ /**
663
+ * Have styled again each node a sheet just added could match. The rest keep the style they
664
+ * have, which the resolver lets stand for a node none of the sheet's rules is written for,
665
+ * so a commit steps over them: the walk here is what finds the ones it must not step over.
666
+ */
667
+ private markWrittenFor;
650
668
  /**
651
669
  * Stop matching a sheet `addGlobalSheet` added, and restyle everything; false, and nothing
652
670
  * done, when it is not one. A hot swap that leaves a None component no rules, or makes it scoped.
@@ -743,6 +761,21 @@ export declare class Engine implements HostEngine {
743
761
  createElement(name: string, sheet?: StyleSheet | null): EngineNode;
744
762
  addClass(node: EngineNode, name: string): void;
745
763
  removeClass(node: EngineNode, name: string): void;
764
+ /**
765
+ * Mark a node whose classes changed, by what the rules that name those classes can restyle.
766
+ *
767
+ * A class no selector names changes no style: a library's own marker, of an overlay that is
768
+ * animating or a control that was touched. One named only as what a rule's element is
769
+ * inside, `.animating .close`, restyles the elements under the node that such rules are for.
770
+ * Either way a whole subtree is not styled again for a class that has no say in it. Any other
771
+ * class restyles the node and everything under it, as any other change to it does.
772
+ *
773
+ * A sheet that names a class later restyles what it is for as it arrives, and a node not yet
774
+ * committed is styled when it is, with the class as it is then.
775
+ */
776
+ private markClasses;
777
+ /** Have styled again each element under a node that one of `subjects`' rules could be for. */
778
+ private markUnder;
746
779
  /**
747
780
  * The sheet of the component `node` hosts, whose `:host` rules it matches. Set again when a hot
748
781
  * swap replaces the component's sheet, which recreates the views inside but not the host, so the
@@ -853,6 +886,7 @@ export declare class Engine implements HostEngine {
853
886
  */
854
887
  setCustomProperty(node: EngineNode, name: string, value: unknown): void;
855
888
  setText(node: EngineNode, value: string): void;
889
+ private markFilled;
856
890
  setEventListener(node: EngineNode, topLevelType: string, fn: (event: unknown) => void): () => void;
857
891
  private markProps;
858
892
  /** Start matching ancestors again on a change, once a sheet that uses `:has()` is in play. */
@@ -864,8 +898,38 @@ export declare class Engine implements HostEngine {
864
898
  */
865
899
  private markBeneath;
866
900
  private markLaterSiblings;
867
- /** `node`'s child list changed: `moved` came into it or went out of it. */
901
+ /** `node`'s child list changed: `moved` came into it at `at`, or went out of it from there. */
868
902
  private markStructure;
903
+ /**
904
+ * Mark the children whose place in a child list that changed at `at` a sheet could read
905
+ * differently. The two at each end always, which are the old first and last and the new. Those
906
+ * from `at` on where some sheet counts from the start or asks about any one before, since a
907
+ * child's place from the start hangs only on those before it; and those before `at` where one
908
+ * counts from the end. Styling one again resolves everything under it again, so a long list
909
+ * gaining a row at its end is not the whole list.
910
+ *
911
+ * Where the sheets ask no further than the element just before (`+`), a rule steps a known
912
+ * number of elements along from one whose own match changed, and those are all there is to
913
+ * mark: that many after the change, and that many after the two at the start, either of which
914
+ * may have stopped or started being first. Nothing comes after the two at the end.
915
+ */
916
+ private markRepositioned;
917
+ /**
918
+ * A child's place in its list changed, which is all that changed about it. It is matched
919
+ * again, and keeps its style and all that is under it unless it now matches other rules: its
920
+ * place is read by the rules that style it and by no other. Not where a rule reads the place
921
+ * of an element like it from under it, `.row:nth-child(odd) .label`: that changes more than
922
+ * the element itself, which is then styled again with everything under it, as is a child
923
+ * that is no element.
924
+ */
925
+ private markPlace;
926
+ /**
927
+ * Whether a rule could read this element's place from another element. By its classes alone,
928
+ * which every such compound it could be asks for: a compound with none could be any element.
929
+ */
930
+ private placeReadFromUnder;
931
+ /** Note what a sheet coming into play asks about a child list. None is unset: see `structural`. */
932
+ private watchStructure;
869
933
  /** Walk up until we hit a node already known to have a dirty subtree. */
870
934
  private markPath;
871
935
  private isClean;
@@ -876,6 +940,15 @@ export declare class Engine implements HostEngine {
876
940
  * optimisation.
877
941
  */
878
942
  commit(): boolean;
943
+ private beforeCommit;
944
+ private announceCommit;
945
+ /**
946
+ * Run `run` once, as the next commit hands its tree to the host and before the host has it: the
947
+ * moment for something the host applies to its next commit, which is only this one from here.
948
+ * A pass that changes nothing commits nothing and runs nothing, so a request waits until it is
949
+ * taken back with the function returned. A later request replaces an earlier one.
950
+ */
951
+ beforeNextCommit(run: () => void): () => void;
879
952
  /** The first commit whose new views have not been drawn yet, while `commitUnseen` runs. */
880
953
  private unseen;
881
954
  /**
@@ -929,18 +1002,30 @@ export declare class Engine implements HostEngine {
929
1002
  * a tree that changes halfway through being walked is the one thing a commit cannot survive.
930
1003
  */
931
1004
  private flushTransitionEvents;
1005
+ /**
1006
+ * The nodes whose animation has ended with no fill and is still held at its last frame, until
1007
+ * its `animationend` has been heard. A browser runs that listener before it paints again, and
1008
+ * an exit animation's listener takes the element away: it is never seen back at rest. Here the
1009
+ * listener runs after the commit, so the commit that ends the animation paints the last frame,
1010
+ * and the element goes back to rest once the listener has run and left it there.
1011
+ */
1012
+ private readonly lettingGo;
1013
+ private letGo;
932
1014
  /** Anchors take part in sibling ordering but never reach Fabric. */
933
1015
  private visibleChildren;
934
1016
  /**
935
1017
  * Everything a node renders with, unprocessed. Precedence, weakest first: native defaults, the
936
1018
  * node's `defaultStyle`, matched CSS, explicit props, inline style, a component's
937
- * `styleOverride`. Inline wins over CSS for the same reason it does on the web.
1019
+ * `styleOverride`. Inline wins over CSS as it does on the web, but for a declaration marked
1020
+ * `!important`, which stands over it: see `inlineOf`.
938
1021
  *
939
1022
  * Raw, because this is what the next commit diffs against. Colours and asset ids are converted
940
1023
  * on the way out instead (`processed`), and only for the keys that changed: the converters
941
1024
  * return fresh objects, so diffing their output would re-send every image and shadow on every
942
1025
  * unrelated change.
943
1026
  */
1027
+ /** What a touch on an element that keeps a drag holds off, while it lasts: see `holdSwipe`. */
1028
+ private heldFor;
944
1029
  private mergeProps;
945
1030
  /**
946
1031
  * Leave a node's background out of what it commits when a child paints it, and give that child
@@ -1045,6 +1130,27 @@ export declare class Engine implements HostEngine {
1045
1130
  * runs it frame by frame, and JavaScript hears of it again when it ends. Anything else is
1046
1131
  * played from here, a commit a frame. See `NativeScrollDriver.play`.
1047
1132
  */
1133
+ /**
1134
+ * The nodes whose animation moves them by a share of their own size and had no size yet when
1135
+ * it started, each with the style it rests at: asked again once the commit has laid them out.
1136
+ */
1137
+ private readonly unsized;
1138
+ /**
1139
+ * An animation's frames as native can interpolate them: a move by a share of the box,
1140
+ * `translateX(200%)`, as the points that is of the size the view is laid out at. Nothing where
1141
+ * the view has no size yet, which is every view until its first commit: it is played from
1142
+ * JavaScript, and handed over once that commit has laid it out. See `playSized`.
1143
+ *
1144
+ * ponytail: the size it had when it started. A box that changes size goes on moving by the
1145
+ * points of the old one until the animation starts again; restart it from the box's layout
1146
+ * event if a bar that resizes mid-animation comes up.
1147
+ */
1148
+ private sized;
1149
+ /**
1150
+ * Hand to native each animation that was waiting for its view to have a size. The commit just
1151
+ * made painted its first frame, so its clock starts here: no frame of it has been seen move.
1152
+ */
1153
+ private playSized;
1048
1154
  private playNatively;
1049
1155
  /**
1050
1156
  * Native reached the end of an animation it was playing. The frame it ends at, or the resting
@@ -1112,6 +1218,13 @@ export declare class Engine implements HostEngine {
1112
1218
  private reportHeld;
1113
1219
  private reportMissingKeyframes;
1114
1220
  private transitioned;
1221
+ /**
1222
+ * Whether an animation that has finished goes on holding its last frame. With a forwards fill
1223
+ * it does, for good: without one the element falls back to whatever the cascade gives it, and
1224
+ * 'backwards' fills the start only. Heard, it holds until whoever listens has been told: see
1225
+ * `lettingGo`.
1226
+ */
1227
+ private keeps;
1115
1228
  /** One `@keyframes` player, one frame on. */
1116
1229
  private advancePlayer;
1117
1230
  /**
@@ -1145,6 +1258,27 @@ export declare class Engine implements HostEngine {
1145
1258
  * that colour as a number and throws on a string, taking the whole surface down with it.
1146
1259
  */
1147
1260
  private processFilters;
1261
+ /**
1262
+ * Mark the text field each box of a row aligned by baseline takes its baseline from, before
1263
+ * the field is merged, and unmark it when the row is aligned another way.
1264
+ */
1265
+ private noteBaselineFields;
1266
+ private onBaselineOf;
1267
+ /**
1268
+ * Have the text a row aligned by baseline takes a baseline from measured again, where that
1269
+ * text is inside one of the row's boxes and the row is committed again. React Native keeps
1270
+ * what a paragraph measured on the one copy of its node that was measured, and Yoga copies a
1271
+ * node it lays out around: a row that is laid out again asks a box for its baseline, the box
1272
+ * asks the paragraph in it, and a copy that was never measured works it out then, on a node
1273
+ * that is by then not to be changed. A debug build stops there. Committed to be measured
1274
+ * again (`remeasure`), the paragraph is measured in this commit and has the answer.
1275
+ *
1276
+ * ponytail: the first box in the flow at each level, which is the one Yoga asks unless
1277
+ * another is aligned by baseline itself. A row a commit lays out again without the engine
1278
+ * cloning it, as its room changing does, is not reached: clone on a layout event if one is
1279
+ * seen to stop there.
1280
+ */
1281
+ private freshBaselines;
1148
1282
  /**
1149
1283
  * Copy a list of gradients, running every stop's colour through the host's converter.
1150
1284
  *
@@ -1207,6 +1341,20 @@ export declare class Engine implements HostEngine {
1207
1341
  * when it is shown again, as Modal.js creates it afresh. Committed again, it ignores every touch.
1208
1342
  */
1209
1343
  private withheld;
1344
+ /**
1345
+ * Whether an element is `display: none`, which has no box and so no view, nor has anything
1346
+ * in it. A view that is committed and not displayed looks the same, but Yoga marks one as
1347
+ * laid out each time it measures what holds it, and React Native clears the mark only where it
1348
+ * reads that parent's layout: a debug build stops at the mark, on a later commit that has the
1349
+ * parent's layout already. Shown again it is made again, as an element put back in the tree
1350
+ * is: what its views held of their own, a scroll offset, is not kept.
1351
+ */
1352
+ private undisplayed;
1353
+ /**
1354
+ * Whether a node hoisted into `target` is not displayed where it was written: it, or a box
1355
+ * between it and the child of `target` it was written in. That child is asked before this is.
1356
+ */
1357
+ private undisplayedUnder;
1210
1358
  /**
1211
1359
  * `reconcileChildren` for a node other nodes hoist into: its own children, each followed by
1212
1360
  * the hoisted nodes written inside it, then those written in it directly, then the views it
@@ -1444,6 +1592,43 @@ export declare class Engine implements HostEngine {
1444
1592
  * bubble for the rest, as in the DOM.
1445
1593
  */
1446
1594
  dispatchEvent(instanceHandle: unknown, topLevelType: string, nativeEvent: unknown): void;
1595
+ /** The screen whose swipe back is held off while a finger is on what keeps a sideways drag. */
1596
+ private swipeHeld;
1597
+ /**
1598
+ * Hold a screen's swipe back off for a touch that starts on an element whose `touch-action`
1599
+ * keeps a drag to the side for itself, and give it back when the last finger lifts. From iOS
1600
+ * 26 the swipe starts anywhere on a screen once a finger has moved a little to the right, and
1601
+ * takes the touch from whatever was following it: a slider's thumb stops and the screen
1602
+ * leaves. The screen is told before the finger has moved that far.
1603
+ */
1604
+ private holdSwipe;
1605
+ /**
1606
+ * A touch on an element that keeps a drag to the side: where it began, and whether native's
1607
+ * own gestures are held off for it. Held from the start where the element keeps a drag down
1608
+ * the page too (`none`); from the moment the finger sets off across where it leaves that one
1609
+ * to the page (`pan-y`), and never for that touch where it sets off down.
1610
+ */
1611
+ private drag;
1612
+ private holdFrom;
1613
+ /** The scroll view whose scrolling is off while a drag over it is an element's own. */
1614
+ private scrollHeld;
1615
+ /**
1616
+ * Stop the scroll view a node is in from scrolling, until the touch ends. Telling native who
1617
+ * holds the touch does this on Android. On iOS a scroll view is held off only by a responder
1618
+ * that is over it, never one inside it, so it is told not to scroll.
1619
+ */
1620
+ private holdScroll;
1621
+ /** Settle which way a drag set off, and hold native's own off one that set off across. */
1622
+ private settleDrag;
1623
+ /** Give the swipe back once the last finger has lifted. */
1624
+ private releaseSwipe;
1625
+ /**
1626
+ * Commit a screen or a scroll view again now, not with whatever next changes: the swipe begins
1627
+ * once the finger has moved ten points or so, which is a frame or two after it came down.
1628
+ */
1629
+ private tellScreen;
1630
+ /** The screen of a native stack a node is on, or nothing where it is on none. */
1631
+ private screenOf;
1447
1632
  /** A presented modal host has finished leaving, so a hidden one can come out of the tree. */
1448
1633
  private dismissed;
1449
1634
  private reportEventError;