@ng-native/fabric 0.16.0 → 0.17.1

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/css.d.ts CHANGED
@@ -26,8 +26,19 @@ export interface Compound {
26
26
  readonly attributes?: readonly AttributeTest[];
27
27
  /** `:is()` / `:where()` arguments: the compound matches if any of these do. */
28
28
  readonly is?: readonly (readonly Compound[])[];
29
+ /**
30
+ * `:is()` / `:where()` with an argument of more than a compound, `:is(.a + .b)`, once for each
31
+ * written: the node is the last element of one of these. Read only where `is` is set, which
32
+ * the compiler sets beside it, so a compound with no `:is()` pays nothing for it.
33
+ */
34
+ readonly isComplex?: readonly (readonly ComplexSelector[])[];
29
35
  /** `:not()` arguments: the compound matches only if none of these do. */
30
36
  readonly not?: readonly Compound[];
37
+ /**
38
+ * `:not()` with an argument of more than a compound: the node is the last of none of these.
39
+ * Read only where `not` is set, as `isComplex` is.
40
+ */
41
+ readonly notComplex?: readonly ComplexSelector[];
31
42
  /** `:host`: the node must be the host of the component whose sheet is being evaluated. */
32
43
  readonly host?: true;
33
44
  /** `:host-context()`, once for each written: the host, or one of its ancestors, must match it. */
@@ -64,6 +75,25 @@ export interface HasTest {
64
75
  /** `:has(> x)`: a child, not any descendant. */
65
76
  readonly child?: true;
66
77
  readonly any: readonly Compound[];
78
+ /**
79
+ * Arguments that are more than one compound for a descendant or a child, `:has(+ .a)` or
80
+ * `:has(.a > .b)`: some element related to the node by one of these is its last.
81
+ */
82
+ readonly relative?: readonly RelativeSelector[];
83
+ }
84
+ /** Compounds joined by combinators, matched leftwards from the last as a rule's are. */
85
+ export interface ComplexSelector {
86
+ readonly compounds: readonly Compound[];
87
+ /** Between compounds; length is `compounds.length - 1`. */
88
+ readonly combinators: readonly Combinator[];
89
+ }
90
+ /**
91
+ * A `:has()` argument, which starts at the node it is asked of: `combinators[0]` joins that node
92
+ * to `compounds[0]`, and each one after joins the compound before it to the next.
93
+ */
94
+ export interface RelativeSelector {
95
+ readonly compounds: readonly Compound[];
96
+ readonly combinators: readonly Combinator[];
67
97
  }
68
98
  /** `an + b`, counted from the start unless `fromEnd`. */
69
99
  export interface NthTest {
@@ -141,6 +171,11 @@ export interface Conditions {
141
171
  * (`Engine.remeasureText`), which `watchConditions` does after it.
142
172
  */
143
173
  readonly fontScale?: number;
174
+ /**
175
+ * The screen's pixels in a point: `PixelRatio.get()`. Nothing in the engine reads it; a
176
+ * package answering a page's `devicePixelRatio` does. Optional, and 1 when absent.
177
+ */
178
+ readonly pixelRatio?: number;
144
179
  /**
145
180
  * The direction the app is laid out in, which is the device's unless the app forced one:
146
181
  * `I18nManager.isRTL`. Optional, and left to right when absent. It decides which physical
@@ -302,6 +337,11 @@ export interface DeferredDeclaration {
302
337
  readonly scale?: number;
303
338
  readonly offset?: number;
304
339
  readonly floor?: number;
340
+ /**
341
+ * A percentage the length is added to, `calc(100% - var(--x))`: written as that sum, which
342
+ * the engine works out once the box the percentage is of has been laid out.
343
+ */
344
+ readonly percent?: number;
305
345
  /**
306
346
  * The reference is multiplied by a length, so it is a number: `calc(var(--n) * 1px)`. Without
307
347
  * this it is a length, and a number token is no such thing, as CSS types a calc().
@@ -469,6 +509,11 @@ export interface StyleSheet {
469
509
  * has to re-resolve a whole child list when it changes. It only does that where a sheet asks.
470
510
  */
471
511
  readonly structural?: true;
512
+ /**
513
+ * Some rule is for a generated box, `::before` or `::after`, which only a sheet compiled to
514
+ * draw them has. Said on the sheet so the engine reads the rules of no other for one.
515
+ */
516
+ readonly generated?: true;
472
517
  /**
473
518
  * Some rule uses `:has()`, so what a node matches can change when something beneath it does.
474
519
  * Said on the sheet for the same reason `structural` is: the cost is invalidation, and only a
@@ -549,27 +594,34 @@ export interface StyleCache {
549
594
  }
550
595
  /**
551
596
  * Whether a child is one `:empty` sees. An anchor is a comment on the web, which it does not;
552
- * nor text of no length, which a binding to nothing leaves behind.
597
+ * nor text of no length, which a binding to nothing leaves behind; nor a box a rule generated,
598
+ * which is not in the tree a selector is matched against.
553
599
  */
554
600
  export declare function fills(child: StyleTarget): boolean;
555
601
  /** What the matcher needs of a node. The engine's node satisfies this structurally. */
556
602
  export interface StyleTarget {
557
603
  readonly tag: string;
604
+ /** The name a type selector reads, where it is not `tag`: see `EngineNode.typeName`. */
605
+ readonly typeName?: string;
606
+ /** Set on a node of a library's drawing: see `EngineNode.namespace`. */
607
+ readonly namespace?: string;
558
608
  readonly parent: StyleTarget | null;
559
609
  /**
560
610
  * Needed only by the selectors that ask about a node's place among its siblings, which is why
561
611
  * it is read through the parent rather than kept as an index: an index would have to be right
562
612
  * after every insertion and removal, and this is right by construction.
563
613
  */
564
- readonly children?: readonly StyleTarget[];
614
+ readonly childList?: readonly StyleTarget[];
565
615
  /**
566
616
  * Only elements are counted by the selectors that ask about position. Text is not one, and
567
617
  * neither is the anchor a structural directive leaves behind - the same reason a browser does
568
618
  * not count a comment. Absent means element, so a hand-built target needs nothing extra.
569
619
  */
570
- readonly kind?: string;
620
+ readonly nodeKind?: string;
571
621
  readonly classes: ReadonlySet<string> | null;
572
622
  readonly props: Readonly<Record<string, unknown>>;
623
+ /** Attributes a package keeps apart from props, for selectors alone: see `attributeOf`. */
624
+ readonly keptAttributes?: Readonly<Record<string, string>>;
573
625
  /**
574
626
  * Whether `props.style` sets a property children inherit, kept by whoever sets the style so the
575
627
  * resolver reads the style only where it can matter. Absent is false.
@@ -589,9 +641,9 @@ export interface StyleTarget {
589
641
  * created it. Read from the node rather than passed in, because a node's ancestors usually
590
642
  * belong to other components and must be matched against their own sheets, not this one's.
591
643
  */
592
- readonly sheet: StyleSheet | null;
644
+ readonly templateSheet: StyleSheet | null;
593
645
  /**
594
- * The sheet of the component this node is the *host* of, if it is one. Distinct from `sheet`,
646
+ * The sheet of the component this node is the *host* of, if it is one. Distinct from `templateSheet`,
595
647
  * which is the sheet of the component that *created* it: a host node is created by the parent,
596
648
  * so those two are always different sheets and `:host` needs the second.
597
649
  */
@@ -636,6 +688,8 @@ export interface StyleTarget {
636
688
  */
637
689
  active?: boolean;
638
690
  }
691
+ /** Whether a prop of a shape in a drawing is a paint it hands down: see `inheritFrom`. */
692
+ export declare const handsDownPaint: (key: string) => boolean;
639
693
  /**
640
694
  * Deterministic work counters for the matcher.
641
695
  *
@@ -669,13 +723,31 @@ export declare const styleStats: {
669
723
  rulesFiled: number;
670
724
  /** Nodes asked whether a rule `:has()` was asked for could be for them: see `isFor`. */
671
725
  subjectTests: number;
726
+ /** Children whose place in a list `:has()` noted, to step from one to the next. */
727
+ placesIndexed: number;
672
728
  };
673
729
  export declare function resetStyleStats(): void;
730
+ /**
731
+ * A node's attribute as a selector reads it: the one a package keeps for it apart from its props,
732
+ * where it keeps one by that name, and otherwise its prop. See `Engine.keepAttribute`.
733
+ */
734
+ export declare const attributeOf: (node: StyleTarget, name: string) => unknown;
735
+ /** Note that a sheet in play draws generated boxes: see `boxesDrawn`. */
736
+ export declare function noteGeneratedBoxes(): void;
737
+ /** Keep `:has()` answers from here, or stop keeping them. */
738
+ export declare function keepHasAnswers(keep: boolean): void;
739
+ /** Drop the `:has()` answers kept, for something beneath a node changed. */
740
+ export declare function forgetHasAnswers(): void;
674
741
  /**
675
742
  * Right-to-left matching, as every CSS engine does it: the rightmost compound is the cheapest
676
743
  * filter and rejects almost everything immediately.
677
744
  */
678
745
  export declare function matches(node: StyleTarget, rule: StyleRule, sheet?: StyleSheet | null): boolean;
746
+ /**
747
+ * Whether an element's name is a generated box's, `::before` or `::after`: a child the engine
748
+ * keeps for a rule that draws one, which no selector counts among the element's children.
749
+ */
750
+ export declare const isGenerated: (name: string) => boolean;
679
751
  /** A node's first `count` elements, or its last, skipping everything that is not one. */
680
752
  export declare function elementsAtEnd<T extends StyleTarget>(siblings: readonly T[], count: number, fromEnd: boolean): T[];
681
753
  /**
@@ -728,6 +800,18 @@ export declare function placeReadElsewhere(sheet: StyleSheet): readonly PlaceRea
728
800
  * those whose change can restyle the elements after it. An id is asked as `nativeID`.
729
801
  */
730
802
  export declare function namedBeside(sheet: StyleSheet): ReadonlySet<string>;
803
+ /**
804
+ * Gives each prop in `style` that a shorthand the element sets itself covers the shorthand's
805
+ * value: one in its inline style, `inline`, or bound from a token, `bound`. The value rather than
806
+ * nothing, so a transition of the side eases to it, as in a browser. Not a prop the element sets
807
+ * as well, which Yoga reads over its shorthand as before, nor one a rule marked `!important`,
808
+ * which beats the element's own declaration. Of two shorthands over one prop, the one React Native
809
+ * reads: `paddingInline` over `paddingHorizontal`, whichever was written first.
810
+ *
811
+ * Per commit for every element with a style of its own, so it walks the props in `style`, a few,
812
+ * rather than every side and corner a shorthand covers.
813
+ */
814
+ export declare function underOwnShorthands(style: Record<string, unknown>, inline: Readonly<Record<string, unknown>>, bound: ReadonlyMap<string, unknown> | undefined, important: ReadonlySet<string> | undefined): void;
731
815
  /** One rule in a cascade: the sheet it came from, which `:host` needs, and its weight here. */
732
816
  interface RuleEntry {
733
817
  readonly rule: StyleRule;
@@ -749,8 +833,11 @@ export declare function ruleKey(rule: StyleRule): string;
749
833
  * `:is()` of compounds that each have a key: it is filed under each of theirs, since a node it
750
834
  * matches has one of them.
751
835
  *
752
- * A rule that says nothing of the node's own name can still say whose child it is, `.row > *`.
753
- * It is filed under the parent's class, and offered to the children of an element that has it.
836
+ * Two kinds of rule say nothing of the node's own name and still say whose child it is: one for
837
+ * a generated box, `.card::before`, which is `.card > ::before` here, and one for any child,
838
+ * `.row > *`. Each is filed under the parent's class, and offered to the children of an element
839
+ * that has it. Filed by the box's own name, every `::before` rule there is would be offered to
840
+ * every such box.
754
841
  */
755
842
  export declare function ruleKeys(rule: StyleRule): readonly string[];
756
843
  /** A rule in an index, and where it comes among rules of the same weight: the order it was written in. */
@@ -814,20 +901,45 @@ export interface Subjects {
814
901
  */
815
902
  export interface HasAbove {
816
903
  readonly classes: readonly string[];
904
+ /** The element the box is, where the rule names one. */
905
+ readonly type?: string;
817
906
  readonly subjects: Subjects;
907
+ /**
908
+ * The box is before the node, or before a box the node is in: `.card:has(.x) ~ .title`. What
909
+ * comes after it is matched again as well as what is under it.
910
+ */
911
+ readonly beside?: true;
818
912
  }
819
- /** Each box a sheet's rules ask `:has()` of above the node they style. */
913
+ /** Each box a sheet's rules ask `:has()` of other than the node they style. */
820
914
  export declare function hasAbove(sheet: StyleSheet): readonly HasAbove[];
915
+ /** Whether `node` can be the box a `:has()` rule asks: it has the classes and is the element. */
916
+ export declare function couldAsk(reader: HasAbove, node: StyleTarget): boolean;
917
+ /**
918
+ * Whether a sheet asks `:has()` about what comes after a node, `:has(+ .x)` or `:has(~ .x .y)`:
919
+ * then a change can change what the elements before it match, and those before what it is in.
920
+ */
921
+ export declare function hasBeside(sheet: StyleSheet): boolean;
821
922
  /** What all of `each` are for, as one. */
822
923
  export declare function joinSubjects(each: readonly Subjects[]): Subjects;
823
- /** Whether an inline style sets a property children inherit. Allocates nothing: it runs per set. */
824
- export declare function setsInherited(style: unknown): boolean;
924
+ /**
925
+ * A node's `class` attribute, as `[class^="icon-"]` reads it, before a change to its classes and
926
+ * after: undefined where it has none.
927
+ */
928
+ export interface ClassChange {
929
+ readonly was: string | undefined;
930
+ readonly now: string | undefined;
931
+ }
932
+ /**
933
+ * Whether an inline style sets a property children inherit, by a node of a library's drawing or by
934
+ * any other. Allocates nothing, and calls nothing a key: it runs per set.
935
+ */
936
+ export declare function setsInherited(style: unknown, drawing?: boolean): boolean;
825
937
  /**
826
938
  * The inherited properties a node's inline style sets, or null for none. Inline style is the
827
939
  * strongest normal declaration on its element, so what it sets is inherited, and read by
828
940
  * `color: inherit` and `currentColor`, as a rule's would be.
829
941
  */
830
- export declare function inlineInherited(style: unknown): Record<string, unknown> | null;
942
+ export declare function inlineInherited(style: unknown, drawing?: boolean): Record<string, unknown> | null;
831
943
  /**
832
944
  * The runtime half of CSS for one engine: the global sheet, the conditions media queries are
833
945
  * evaluated against, and the memo that makes resolution cost nodes x rules rather than
@@ -842,7 +954,7 @@ export declare function inlineInherited(style: unknown): Record<string, unknown>
842
954
  *
843
955
  * Correctness first. Walking up meant matching every ancestor against the *starting node's*
844
956
  * sheet, but an ancestor almost always belongs to a different component, so a component's rules
845
- * reached nodes it did not own while a parent's real values never arrived. Reading `sheet` off
957
+ * reached nodes it did not own while a parent's real values never arrived. Reading `templateSheet` off
846
958
  * each node fixes both directions at once.
847
959
  *
848
960
  * Cost second. Walking up re-derived, for every node, everything its parent had already worked
@@ -934,8 +1046,8 @@ export declare class StyleResolver {
934
1046
  * them could match. Emptied by anything else that moves the generation on.
935
1047
  */
936
1048
  private readonly additions;
937
- /** Whether a sheet could match a node: one of its rules is written for it. */
938
- couldMatch(sheet: StyleSheet, node: StyleTarget): boolean;
1049
+ /** What the rules of several sheets are for, as one: see `isFor`. */
1050
+ subjectsOfAll(sheets: readonly StyleSheet[]): Subjects;
939
1051
  /** How far each class named by the sheets met so far reaches: see `classReach`. */
940
1052
  private readonly reach;
941
1053
  /** The tests of the `class` attribute itself in those sheets, which any class may answer. */
@@ -947,6 +1059,8 @@ export declare class StyleResolver {
947
1059
  */
948
1060
  private readonly deepSheets;
949
1061
  private readonly deepIndexes;
1062
+ /** Each component sheet's rules for a box of its host: see `hostBoxIndex`. */
1063
+ private readonly hostBoxIndexes;
950
1064
  /**
951
1065
  * Read the classes a sheet names, once, as soon as any node is given it. One `scoped` to a
952
1066
  * component or a host asks of its elements for good, global or not.
@@ -980,9 +1094,11 @@ export declare class StyleResolver {
980
1094
  * elements under it to match again, by what rules are for; or null, where no rule names any
981
1095
  * of them and nothing is styled again.
982
1096
  */
983
- reachOf(classes: Iterable<string>): true | Subjects | null;
1097
+ reachOf(classes: Iterable<string>, attribute?: ClassChange): true | Subjects | null;
984
1098
  /** How far a class reaches by its name, and by each test of the class attribute it answers. */
985
1099
  private reachesOf;
1100
+ /** Whether a sheet tests the `class` attribute as a whole: see `ClassChange`. */
1101
+ get testsClassAttribute(): boolean;
986
1102
  /** Whether one of the rules `subjects` stands for could be for a node. */
987
1103
  isFor(subjects: Subjects, node: StyleTarget): boolean;
988
1104
  /**
@@ -1019,9 +1135,9 @@ export declare class StyleResolver {
1019
1135
  */
1020
1136
  private cached;
1021
1137
  /**
1022
- * Set by the engine once a sheet uses `:has()`, styles a pressed element or asks about a place
1023
- * in a child list. Until then no cache keeps the rules it matched, so an app that never asks
1024
- * pays nothing for it.
1138
+ * Set by the engine while a sheet in play uses `:has()` or styles a pressed element, and once
1139
+ * one asks about a place in a child list. Otherwise no cache keeps the rules it matched, so an
1140
+ * app that never asks pays nothing for it.
1025
1141
  */
1026
1142
  tracksHas: boolean;
1027
1143
  /**
@@ -1103,6 +1219,13 @@ export declare class StyleResolver {
1103
1219
  * a node is tried against its own component's rules already, those among them.
1104
1220
  */
1105
1221
  private reachedFromAbove;
1222
+ /**
1223
+ * A sheet's rules for a box of its host alone, `:host::before` and `:host(.x)::after`, filed as
1224
+ * a component's own are. Its other rules for a box are for the elements of its template, which
1225
+ * is how emulated encapsulation scopes them on the web: `.icon::before` in it never reaches the
1226
+ * box of a host its parent puts the class `icon` on.
1227
+ */
1228
+ private hostBoxIndex;
1106
1229
  /** A sheet's `::ng-deep` rules alone, filed as a component's own are. */
1107
1230
  private deepIndex;
1108
1231
  /** Weakest first: by layer where any sheet has one, then by weight, then as they were filed. */