@ng-native/fabric 0.4.0 → 0.6.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
@@ -194,6 +194,10 @@ export interface EngineNode extends HostNode {
194
194
  styleCache: StyleCache | null;
195
195
  /** Set when something that could change what this node matches has changed. */
196
196
  styleDirty: boolean;
197
+ /** See `StyleTarget.hasDirty`. */
198
+ hasDirty: boolean;
199
+ /** See `StyleTarget.stateDirty`. */
200
+ stateDirty: boolean;
197
201
  /** A family left out while it loads. See `loadingFamilies`. */
198
202
  heldFamily?: string;
199
203
  /** See `StyleTarget.inlineInherits`. */
@@ -230,6 +234,18 @@ export interface EngineNode extends HostNode {
230
234
  ownStyle?: object;
231
235
  /** The resolved style this node was last committed with, for the skip check in `reconcile`. */
232
236
  styleCommitted: StyleCache | null;
237
+ /**
238
+ * How this node laid its children out when one of them last had a `fit-content` size, as
239
+ * `containerOf` says it. Set by such a child, and compared on each reconcile so the children
240
+ * are worked out again when the direction or alignment changes. Unset on every other node.
241
+ */
242
+ fitContainer?: string;
243
+ /**
244
+ * Whether this node had a height a percentage could be taken of, when a box beneath it with a
245
+ * percentage height last asked, as `definiteHeight` says it. Compared on each reconcile so its
246
+ * children are worked out again when it changes. Unset on every other node.
247
+ */
248
+ heightBasis?: boolean;
233
249
  /**
234
250
  * Per-property transition state, for every property this node has ever seen a `transition` for.
235
251
  * A finished entry stays, because its target is what the next change is measured against.
@@ -267,6 +283,10 @@ export interface EngineNode extends HostNode {
267
283
  componentHost?: true;
268
284
  /** See `keepNativeView`. */
269
285
  nativeView?: true;
286
+ /** Props kept for selectors to match and left out of what is committed. See `keepAsAttribute`. */
287
+ attributeOnly?: Set<string>;
288
+ /** The child this node's background is painted on instead of itself. See `paintOn`. */
289
+ paintsOn?: EngineNode;
270
290
  /**
271
291
  * Style weaker than every sheet, where no rule and no inline style says otherwise. What lets the
272
292
  * root component's host fill the surface by default and still give way to its own `:host`. See
@@ -426,6 +446,8 @@ export interface ViewNameNode {
426
446
  readonly nativeView?: boolean;
427
447
  /** What it holds, which decides whether one of HTML's text elements is text or a view. */
428
448
  readonly children?: readonly ViewNameNode[];
449
+ /** Set on the paragraph the engine makes for a run of text written straight into a view. */
450
+ readonly anonymous?: boolean;
429
451
  }
430
452
  /**
431
453
  * The native view a node commits as: `Paragraph` for a `<text>`, `VirtualText` for one nested in
@@ -567,6 +589,16 @@ export declare class Engine implements HostEngine {
567
589
  * does, a child list can move without anything else needing to be looked at again.
568
590
  */
569
591
  private structuralSheets;
592
+ /** How many children after a change in a list one of them reaches. See `siblingReach`. */
593
+ private structuralAfter;
594
+ /** Whether one of them reaches the children before it. */
595
+ private structuralBefore;
596
+ /** The compounds of theirs that read an element's place from under it. See `markPlace`. */
597
+ private readonly placeElsewhere;
598
+ /** The sheets `watchStructure` has read, which it is asked about once an element. */
599
+ private readonly watchedStructure;
600
+ /** Whether any sheet uses `:has()`. See `markBeneath`. */
601
+ private hasSheets;
570
602
  private readonly resolveAssetSource;
571
603
  constructor(fabric: FabricUIManager, rootTag: number, options?: EngineOptions);
572
604
  /**
@@ -590,6 +622,25 @@ export declare class Engine implements HostEngine {
590
622
  * binding, so nothing marks an Angular view dirty and no change-detection pass would follow.
591
623
  */
592
624
  private setActiveChain;
625
+ /** Whether any sheet styles a pressed element, and each compound that asks about one from another. */
626
+ private activeUse;
627
+ /** What each sheet in play asks about a pressed element: `activeUse` is all of them together. */
628
+ private readonly activeBySheet;
629
+ /** Note what a sheet in play asks about a pressed element. See `markActive`. */
630
+ private watchActive;
631
+ /** A sheet has left play, by a hot swap or by being removed: what it asked goes with it. */
632
+ private unwatchActive;
633
+ private countActive;
634
+ /**
635
+ * A press began or ended on `node` or under it, which is all that changed about it. A press
636
+ * reaches every ancestor up to the root, and marking each as restyled would style the whole
637
+ * screen again, twice a press. So each is only matched again, and keeps its style and all
638
+ * that is under it unless it now matches other rules. An element a rule asks about from
639
+ * inside or beside it, `.card:active .title`, changes more than itself, and is restyled with
640
+ * everything under it as any other change is. With no rule for a pressed element at all there
641
+ * is nothing to match.
642
+ */
643
+ private markActive;
593
644
  /**
594
645
  * Custom properties the device knows and the stylesheet cannot, once they change.
595
646
  *
@@ -604,6 +655,12 @@ export declare class Engine implements HostEngine {
604
655
  * `replacing` is a sheet added before that this one takes the place of, after a hot swap.
605
656
  */
606
657
  addGlobalSheet(sheet: StyleSheet, replacing?: StyleSheet): boolean;
658
+ /**
659
+ * Have styled again each node a sheet just added could match. The rest keep the style they
660
+ * have, which the resolver lets stand for a node none of the sheet's rules is written for,
661
+ * so a commit steps over them: the walk here is what finds the ones it must not step over.
662
+ */
663
+ private markWrittenFor;
607
664
  /**
608
665
  * Stop matching a sheet `addGlobalSheet` added, and restyle everything; false, and nothing
609
666
  * done, when it is not one. A hot swap that leaves a None component no rules, or makes it scoped.
@@ -700,6 +757,21 @@ export declare class Engine implements HostEngine {
700
757
  createElement(name: string, sheet?: StyleSheet | null): EngineNode;
701
758
  addClass(node: EngineNode, name: string): void;
702
759
  removeClass(node: EngineNode, name: string): void;
760
+ /**
761
+ * Mark a node whose classes changed, by what the rules that name those classes can restyle.
762
+ *
763
+ * A class no selector names changes no style: a library's own marker, of an overlay that is
764
+ * animating or a control that was touched. One named only as what a rule's element is
765
+ * inside, `.animating .close`, restyles the elements under the node that such rules are for.
766
+ * Either way a whole subtree is not styled again for a class that has no say in it. Any other
767
+ * class restyles the node and everything under it, as any other change to it does.
768
+ *
769
+ * A sheet that names a class later restyles what it is for as it arrives, and a node not yet
770
+ * committed is styled when it is, with the class as it is then.
771
+ */
772
+ private markClasses;
773
+ /** Have styled again each element under a node that one of `subjects`' rules could be for. */
774
+ private markUnder;
703
775
  /**
704
776
  * The sheet of the component `node` hosts, whose `:host` rules it matches. Set again when a hot
705
777
  * swap replaces the component's sheet, which recreates the views inside but not the host, so the
@@ -765,6 +837,20 @@ export declare class Engine implements HostEngine {
765
837
  parentNode(node: EngineNode): EngineNode | null;
766
838
  nextSibling(node: EngineNode): EngineNode | null;
767
839
  setProp(node: EngineNode, key: string, value: unknown): void;
840
+ /**
841
+ * Paint a node's background on one of its children instead of on the node: the node keeps its
842
+ * `background-color` and `background-image` in the cascade, where a stylesheet wrote them, and
843
+ * the child is the view that draws them. What a view that masks its children and not itself
844
+ * needs, as `<gradient-text>` is.
845
+ */
846
+ paintOn(node: EngineNode, child: EngineNode): void;
847
+ /**
848
+ * Keep a prop the node already has as an attribute: on the node for a selector such as
849
+ * `:host([variant='primary'])` to match, and left out of what is committed to the native view.
850
+ * It is committed again once the prop is next written. What the platform adapter does with a
851
+ * static attribute that is an input of the host's component.
852
+ */
853
+ keepAsAttribute(node: EngineNode, key: string): void;
768
854
  /**
769
855
  * Whether a node's inline style can change what it or anything below it resolves to: it sets,
770
856
  * or until now set, a property its children inherit.
@@ -796,11 +882,50 @@ export declare class Engine implements HostEngine {
796
882
  */
797
883
  setCustomProperty(node: EngineNode, name: string, value: unknown): void;
798
884
  setText(node: EngineNode, value: string): void;
885
+ private markFilled;
799
886
  setEventListener(node: EngineNode, topLevelType: string, fn: (event: unknown) => void): () => void;
800
887
  private markProps;
888
+ /** Start matching ancestors again on a change, once a sheet that uses `:has()` is in play. */
889
+ private watchHas;
890
+ /**
891
+ * Something at or beneath `from` changed: every node from there up may match a `:has()` rule
892
+ * it did not, or stop matching one. They are matched again rather than marked for restyling,
893
+ * which would restyle everything under them. Only sheets that use `:has()` pay.
894
+ */
895
+ private markBeneath;
801
896
  private markLaterSiblings;
802
- /** `node`'s child list changed: `moved` came into it or went out of it. */
897
+ /** `node`'s child list changed: `moved` came into it at `at`, or went out of it from there. */
803
898
  private markStructure;
899
+ /**
900
+ * Mark the children whose place in a child list that changed at `at` a sheet could read
901
+ * differently. The two at each end always, which are the old first and last and the new. Those
902
+ * from `at` on where some sheet counts from the start or asks about any one before, since a
903
+ * child's place from the start hangs only on those before it; and those before `at` where one
904
+ * counts from the end. Styling one again resolves everything under it again, so a long list
905
+ * gaining a row at its end is not the whole list.
906
+ *
907
+ * Where the sheets ask no further than the element just before (`+`), a rule steps a known
908
+ * number of elements along from one whose own match changed, and those are all there is to
909
+ * mark: that many after the change, and that many after the two at the start, either of which
910
+ * may have stopped or started being first. Nothing comes after the two at the end.
911
+ */
912
+ private markRepositioned;
913
+ /**
914
+ * A child's place in its list changed, which is all that changed about it. It is matched
915
+ * again, and keeps its style and all that is under it unless it now matches other rules: its
916
+ * place is read by the rules that style it and by no other. Not where a rule reads the place
917
+ * of an element like it from under it, `.row:nth-child(odd) .label`: that changes more than
918
+ * the element itself, which is then styled again with everything under it, as is a child
919
+ * that is no element.
920
+ */
921
+ private markPlace;
922
+ /**
923
+ * Whether a rule could read this element's place from another element. By its classes alone,
924
+ * which every such compound it could be asks for: a compound with none could be any element.
925
+ */
926
+ private placeReadFromUnder;
927
+ /** Note what a sheet coming into play asks about a child list. None is unset: see `structural`. */
928
+ private watchStructure;
804
929
  /** Walk up until we hit a node already known to have a dirty subtree. */
805
930
  private markPath;
806
931
  private isClean;
@@ -811,6 +936,15 @@ export declare class Engine implements HostEngine {
811
936
  * optimisation.
812
937
  */
813
938
  commit(): boolean;
939
+ private beforeCommit;
940
+ private announceCommit;
941
+ /**
942
+ * Run `run` once, as the next commit hands its tree to the host and before the host has it: the
943
+ * moment for something the host applies to its next commit, which is only this one from here.
944
+ * A pass that changes nothing commits nothing and runs nothing, so a request waits until it is
945
+ * taken back with the function returned. A later request replaces an earlier one.
946
+ */
947
+ beforeNextCommit(run: () => void): () => void;
814
948
  /** The first commit whose new views have not been drawn yet, while `commitUnseen` runs. */
815
949
  private unseen;
816
950
  /**
@@ -864,19 +998,45 @@ export declare class Engine implements HostEngine {
864
998
  * a tree that changes halfway through being walked is the one thing a commit cannot survive.
865
999
  */
866
1000
  private flushTransitionEvents;
1001
+ /**
1002
+ * The nodes whose animation has ended with no fill and is still held at its last frame, until
1003
+ * its `animationend` has been heard. A browser runs that listener before it paints again, and
1004
+ * an exit animation's listener takes the element away: it is never seen back at rest. Here the
1005
+ * listener runs after the commit, so the commit that ends the animation paints the last frame,
1006
+ * and the element goes back to rest once the listener has run and left it there.
1007
+ */
1008
+ private readonly lettingGo;
1009
+ private letGo;
867
1010
  /** Anchors take part in sibling ordering but never reach Fabric. */
868
1011
  private visibleChildren;
869
1012
  /**
870
1013
  * Everything a node renders with, unprocessed. Precedence, weakest first: native defaults, the
871
1014
  * node's `defaultStyle`, matched CSS, explicit props, inline style, a component's
872
- * `styleOverride`. Inline wins over CSS for the same reason it does on the web.
1015
+ * `styleOverride`. Inline wins over CSS as it does on the web, but for a declaration marked
1016
+ * `!important`, which stands over it: see `inlineOf`.
873
1017
  *
874
1018
  * Raw, because this is what the next commit diffs against. Colours and asset ids are converted
875
1019
  * on the way out instead (`processed`), and only for the keys that changed: the converters
876
1020
  * return fresh objects, so diffing their output would re-send every image and shadow on every
877
1021
  * unrelated change.
878
1022
  */
1023
+ /** What a touch on an element that keeps a drag holds off, while it lasts: see `holdSwipe`. */
1024
+ private heldFor;
879
1025
  private mergeProps;
1026
+ /**
1027
+ * Leave a node's background out of what it commits when a child paints it, and give that child
1028
+ * its parent's: the cascade's, and over it the parent's inline style.
1029
+ */
1030
+ private movePaint;
1031
+ /**
1032
+ * A container whose direction or alignment changed since a child with a `fit-content` size
1033
+ * read it, or whose height stopped or started being one a percentage is taken of since a child
1034
+ * with a percentage height asked: those children are merged again. A change to a container
1035
+ * marks nothing beneath it, since none of these is inherited.
1036
+ */
1037
+ private refitChildren;
1038
+ /** Have a container's children merged again, through any `display: contents` among them. */
1039
+ private refit;
880
1040
  /**
881
1041
  * The text size cap that lays a paragraph or text input out again once a face it names has
882
1042
  * registered: a step per face above the app's own cap where it set one (below 1 is none, on
@@ -956,6 +1116,51 @@ export declare class Engine implements HostEngine {
956
1116
  * asks for another by name, or its keyframes went, as a browser fires it.
957
1117
  */
958
1118
  private cancelPlaying;
1119
+ /** Stop on native each animation whose view has left the tree. */
1120
+ private releasePlayedNatively;
1121
+ /** Every node whose animation native is playing, with no frame of it in JavaScript. */
1122
+ private readonly playedNatively;
1123
+ /**
1124
+ * Hand an animation that has just started to native, where native can play it: one that moves
1125
+ * only opacity and transforms, starts at once, and repeats a whole number of times. Native then
1126
+ * runs it frame by frame, and JavaScript hears of it again when it ends. Anything else is
1127
+ * played from here, a commit a frame. See `NativeScrollDriver.play`.
1128
+ */
1129
+ /**
1130
+ * The nodes whose animation moves them by a share of their own size and had no size yet when
1131
+ * it started, each with the style it rests at: asked again once the commit has laid them out.
1132
+ */
1133
+ private readonly unsized;
1134
+ /**
1135
+ * An animation's frames as native can interpolate them: a move by a share of the box,
1136
+ * `translateX(200%)`, as the points that is of the size the view is laid out at. Nothing where
1137
+ * the view has no size yet, which is every view until its first commit: it is played from
1138
+ * JavaScript, and handed over once that commit has laid it out. See `playSized`.
1139
+ *
1140
+ * ponytail: the size it had when it started. A box that changes size goes on moving by the
1141
+ * points of the old one until the animation starts again; restart it from the box's layout
1142
+ * event if a bar that resizes mid-animation comes up.
1143
+ */
1144
+ private sized;
1145
+ /**
1146
+ * Hand to native each animation that was waiting for its view to have a size. The commit just
1147
+ * made painted its first frame, so its clock starts here: no frame of it has been seen move.
1148
+ */
1149
+ private playSized;
1150
+ private playNatively;
1151
+ /**
1152
+ * Native reached the end of an animation it was playing. The frame it ends at, or the resting
1153
+ * style where it does not fill, is committed before the view is let go, so nothing shows of
1154
+ * the frame it started at, which is what the view had been committed with.
1155
+ */
1156
+ private endedNatively;
1157
+ /** Take an animation back from native, which stops it there. The caller plays it on, or not. */
1158
+ private stopNative;
1159
+ /**
1160
+ * Play on from JavaScript an animation native was playing, from where its clock has got to:
1161
+ * what a pause, other frames or a view made again need, none of which native can be told of.
1162
+ */
1163
+ private backToScript;
959
1164
  /** Start the clock on an animation, unless the node is already playing this one. */
960
1165
  private startPlaying;
961
1166
  /**
@@ -1009,6 +1214,13 @@ export declare class Engine implements HostEngine {
1009
1214
  private reportHeld;
1010
1215
  private reportMissingKeyframes;
1011
1216
  private transitioned;
1217
+ /**
1218
+ * Whether an animation that has finished goes on holding its last frame. With a forwards fill
1219
+ * it does, for good: without one the element falls back to whatever the cascade gives it, and
1220
+ * 'backwards' fills the start only. Heard, it holds until whoever listens has been told: see
1221
+ * `lettingGo`.
1222
+ */
1223
+ private keeps;
1012
1224
  /** One `@keyframes` player, one frame on. */
1013
1225
  private advancePlayer;
1014
1226
  /**
@@ -1047,7 +1259,8 @@ export declare class Engine implements HostEngine {
1047
1259
  *
1048
1260
  * A stop's colour is a colour like any other, but it is two levels down and nothing else looks
1049
1261
  * there: without this the device is handed the string `rgb(255, 0, 0)` where it wants a number,
1050
- * and paints nothing.
1262
+ * and paints nothing. The stops are first rewritten so native's interpolation paints what
1263
+ * CSS's premultiplied one does (see `premultipliedStops`).
1051
1264
  */
1052
1265
  private processGradients;
1053
1266
  private clearFlags;
@@ -1103,6 +1316,20 @@ export declare class Engine implements HostEngine {
1103
1316
  * when it is shown again, as Modal.js creates it afresh. Committed again, it ignores every touch.
1104
1317
  */
1105
1318
  private withheld;
1319
+ /**
1320
+ * Whether an element is `display: none`, which has no box and so no view, nor has anything
1321
+ * in it. A view that is committed and not displayed looks the same, but Yoga marks one as
1322
+ * laid out each time it measures what holds it, and React Native clears the mark only where it
1323
+ * reads that parent's layout: a debug build stops at the mark, on a later commit that has the
1324
+ * parent's layout already. Shown again it is made again, as an element put back in the tree
1325
+ * is: what its views held of their own, a scroll offset, is not kept.
1326
+ */
1327
+ private undisplayed;
1328
+ /**
1329
+ * Whether a node hoisted into `target` is not displayed where it was written: it, or a box
1330
+ * between it and the child of `target` it was written in. That child is asked before this is.
1331
+ */
1332
+ private undisplayedUnder;
1106
1333
  /**
1107
1334
  * `reconcileChildren` for a node other nodes hoist into: its own children, each followed by
1108
1335
  * the hoisted nodes written inside it, then those written in it directly, then the views it
@@ -1340,6 +1567,43 @@ export declare class Engine implements HostEngine {
1340
1567
  * bubble for the rest, as in the DOM.
1341
1568
  */
1342
1569
  dispatchEvent(instanceHandle: unknown, topLevelType: string, nativeEvent: unknown): void;
1570
+ /** The screen whose swipe back is held off while a finger is on what keeps a sideways drag. */
1571
+ private swipeHeld;
1572
+ /**
1573
+ * Hold a screen's swipe back off for a touch that starts on an element whose `touch-action`
1574
+ * keeps a drag to the side for itself, and give it back when the last finger lifts. From iOS
1575
+ * 26 the swipe starts anywhere on a screen once a finger has moved a little to the right, and
1576
+ * takes the touch from whatever was following it: a slider's thumb stops and the screen
1577
+ * leaves. The screen is told before the finger has moved that far.
1578
+ */
1579
+ private holdSwipe;
1580
+ /**
1581
+ * A touch on an element that keeps a drag to the side: where it began, and whether native's
1582
+ * own gestures are held off for it. Held from the start where the element keeps a drag down
1583
+ * the page too (`none`); from the moment the finger sets off across where it leaves that one
1584
+ * to the page (`pan-y`), and never for that touch where it sets off down.
1585
+ */
1586
+ private drag;
1587
+ private holdFrom;
1588
+ /** The scroll view whose scrolling is off while a drag over it is an element's own. */
1589
+ private scrollHeld;
1590
+ /**
1591
+ * Stop the scroll view a node is in from scrolling, until the touch ends. Telling native who
1592
+ * holds the touch does this on Android. On iOS a scroll view is held off only by a responder
1593
+ * that is over it, never one inside it, so it is told not to scroll.
1594
+ */
1595
+ private holdScroll;
1596
+ /** Settle which way a drag set off, and hold native's own off one that set off across. */
1597
+ private settleDrag;
1598
+ /** Give the swipe back once the last finger has lifted. */
1599
+ private releaseSwipe;
1600
+ /**
1601
+ * Commit a screen or a scroll view again now, not with whatever next changes: the swipe begins
1602
+ * once the finger has moved ten points or so, which is a frame or two after it came down.
1603
+ */
1604
+ private tellScreen;
1605
+ /** The screen of a native stack a node is on, or nothing where it is on none. */
1606
+ private screenOf;
1343
1607
  /** A presented modal host has finished leaving, so a hidden one can come out of the tree. */
1344
1608
  private dismissed;
1345
1609
  private reportEventError;