@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/color-mix.js +1 -16
- package/dist/color-mix.js.map +1 -1
- package/dist/css.d.ts +299 -28
- package/dist/css.js +1093 -122
- package/dist/css.js.map +1 -1
- package/dist/engine.d.ts +267 -3
- package/dist/engine.js +1209 -76
- package/dist/engine.js.map +1 -1
- package/dist/inline-token.js +27 -15
- package/dist/inline-token.js.map +1 -1
- package/dist/inline-transform.js +21 -3
- package/dist/inline-transform.js.map +1 -1
- package/dist/native-drive.d.ts +21 -0
- package/dist/native-drive.js +65 -0
- package/dist/native-drive.js.map +1 -1
- package/dist/premultiplied-stops.d.ts +7 -0
- package/dist/premultiplied-stops.js +131 -0
- package/dist/premultiplied-stops.js.map +1 -0
- package/dist/scroll-animation.d.ts +24 -0
- package/dist/scroll-animation.js +82 -4
- package/dist/scroll-animation.js.map +1 -1
- package/dist/transition.d.ts +15 -0
- package/dist/transition.js +134 -11
- package/dist/transition.js.map +1 -1
- package/package.json +1 -1
package/dist/css.d.ts
CHANGED
|
@@ -37,6 +37,11 @@ export interface Compound {
|
|
|
37
37
|
* What Tailwind's `group-*` variants compile to.
|
|
38
38
|
*/
|
|
39
39
|
readonly ancestors?: readonly Compound[];
|
|
40
|
+
/**
|
|
41
|
+
* `:is(<compound> > *)`: every one of these must match the node's parent. What Tailwind's `*:`
|
|
42
|
+
* variant compiles to.
|
|
43
|
+
*/
|
|
44
|
+
readonly parents?: readonly Compound[];
|
|
40
45
|
/** Interaction state the engine tracks: `:focus` and `:active`. */
|
|
41
46
|
readonly pseudo?: readonly ('focus' | 'active')[];
|
|
42
47
|
/**
|
|
@@ -46,6 +51,14 @@ export interface Compound {
|
|
|
46
51
|
readonly nth?: readonly NthTest[];
|
|
47
52
|
/** `:empty`: no children at all, text included. */
|
|
48
53
|
readonly empty?: true;
|
|
54
|
+
/** `:has()`: every one of these must find a match beneath the node. */
|
|
55
|
+
readonly has?: readonly HasTest[];
|
|
56
|
+
}
|
|
57
|
+
/** One `:has()`: some element beneath the node, or some child of it, matches one of `any`. */
|
|
58
|
+
export interface HasTest {
|
|
59
|
+
/** `:has(> x)`: a child, not any descendant. */
|
|
60
|
+
readonly child?: true;
|
|
61
|
+
readonly any: readonly Compound[];
|
|
49
62
|
}
|
|
50
63
|
/** `an + b`, counted from the start unless `fromEnd`. */
|
|
51
64
|
export interface NthTest {
|
|
@@ -73,6 +86,15 @@ export interface StyleRule {
|
|
|
73
86
|
readonly importantTokens?: readonly string[];
|
|
74
87
|
/** Declarations whose value is a `var()`, resolved once the token map is known. */
|
|
75
88
|
readonly deferred?: readonly DeferredDeclaration[];
|
|
89
|
+
/**
|
|
90
|
+
* The corners and edges the rule's plain declarations wrote, in the order it wrote them, where
|
|
91
|
+
* it wrote one in both its logical form and its physical one. The cascade settles the two as
|
|
92
|
+
* one property, and a value settled on device is in a list of its own, with no order between
|
|
93
|
+
* it and the rest.
|
|
94
|
+
*/
|
|
95
|
+
readonly sides?: readonly string[];
|
|
96
|
+
/** The same for the rule's important declarations. */
|
|
97
|
+
readonly importantSides?: readonly string[];
|
|
76
98
|
/** The media query guarding this rule, if any. */
|
|
77
99
|
readonly condition?: MediaCondition;
|
|
78
100
|
/** Memo of the last condition evaluation, and the conditions version it was made against. */
|
|
@@ -88,7 +110,8 @@ export type MediaCondition = {
|
|
|
88
110
|
readonly op: 'gt' | 'gte' | 'lt' | 'lte' | 'eq';
|
|
89
111
|
readonly value: number;
|
|
90
112
|
} | {
|
|
91
|
-
|
|
113
|
+
/** `direction` is not a media feature: it is what `:dir()` asks, of the app as a whole. */
|
|
114
|
+
readonly feature: 'orientation' | 'prefers-color-scheme' | 'prefers-reduced-motion' | 'direction';
|
|
92
115
|
readonly value: string;
|
|
93
116
|
};
|
|
94
117
|
/** What media queries are evaluated against. Pushed in by the host: the engine imports no RN. */
|
|
@@ -109,6 +132,12 @@ export interface Conditions {
|
|
|
109
132
|
* (`Engine.remeasureText`), which `watchConditions` does after it.
|
|
110
133
|
*/
|
|
111
134
|
readonly fontScale?: number;
|
|
135
|
+
/**
|
|
136
|
+
* The direction the app is laid out in, which is the device's unless the app forced one:
|
|
137
|
+
* `I18nManager.isRTL`. Optional, and left to right when absent. It decides which physical
|
|
138
|
+
* corner or edge a logical one is, where an element has both and no `direction` of its own.
|
|
139
|
+
*/
|
|
140
|
+
readonly direction?: 'ltr' | 'rtl';
|
|
112
141
|
}
|
|
113
142
|
/** A run of CSS whitespace: spaces, tabs, newlines, carriage returns and form feeds, and no other. */
|
|
114
143
|
export declare const CSS_SPACE: RegExp;
|
|
@@ -193,6 +222,11 @@ export interface DeferredDeclaration {
|
|
|
193
222
|
* unambiguous given a single-valued token, so `padding: var(--gap)` writes all four.
|
|
194
223
|
*/
|
|
195
224
|
readonly props: readonly string[];
|
|
225
|
+
/**
|
|
226
|
+
* `inherit`, written for these props: each is the parent's value for it, or nothing where the
|
|
227
|
+
* parent has none.
|
|
228
|
+
*/
|
|
229
|
+
readonly inherit?: true;
|
|
196
230
|
/** The element a bound declaration is on, by name, for a message about it to say. */
|
|
197
231
|
readonly on?: string;
|
|
198
232
|
/** A `var()` reference. Exactly one of this and `compute` is present. */
|
|
@@ -296,6 +330,8 @@ export interface LineTemplate {
|
|
|
296
330
|
/** `color-mix(in srgb, var(--tint) 35%, transparent)`: the colour, written as a function. */
|
|
297
331
|
readonly colour?: unknown;
|
|
298
332
|
readonly style?: string;
|
|
333
|
+
/** Each side's own style, which the line's style is written to as well: see `settleBorders`. */
|
|
334
|
+
readonly marks?: readonly string[];
|
|
299
335
|
}
|
|
300
336
|
/**
|
|
301
337
|
* A colour a deferred value is made of: settled at build time, a token, or a `color-mix()` of two
|
|
@@ -341,11 +377,21 @@ export type ColourExpression = {
|
|
|
341
377
|
readonly space: MixSpace;
|
|
342
378
|
readonly hue?: HueMethod;
|
|
343
379
|
readonly a: ColourExpression;
|
|
344
|
-
readonly aPercentage?:
|
|
380
|
+
readonly aPercentage?: MixShare;
|
|
345
381
|
readonly b: ColourExpression;
|
|
346
|
-
readonly bPercentage?:
|
|
382
|
+
readonly bPercentage?: MixShare;
|
|
347
383
|
};
|
|
348
384
|
};
|
|
385
|
+
/**
|
|
386
|
+
* The share of a colour in a mix: a percentage, or a token multiplied into one, as
|
|
387
|
+
* `calc(var(--opacity) * 100%)` is the token times a hundred, with the number the token falls
|
|
388
|
+
* back to where it wrote one.
|
|
389
|
+
*/
|
|
390
|
+
export type MixShare = number | {
|
|
391
|
+
readonly reference: string;
|
|
392
|
+
readonly scale: number;
|
|
393
|
+
readonly fallback?: number;
|
|
394
|
+
};
|
|
349
395
|
/** One component's compiled styles, pre-sorted by specificity then source order. */
|
|
350
396
|
/**
|
|
351
397
|
* A gradient with holes in it: everything but the stop colours is settled at build time.
|
|
@@ -394,6 +440,12 @@ export interface StyleSheet {
|
|
|
394
440
|
* has to re-resolve a whole child list when it changes. It only does that where a sheet asks.
|
|
395
441
|
*/
|
|
396
442
|
readonly structural?: true;
|
|
443
|
+
/**
|
|
444
|
+
* Some rule uses `:has()`, so what a node matches can change when something beneath it does.
|
|
445
|
+
* Said on the sheet for the same reason `structural` is: the cost is invalidation, and only a
|
|
446
|
+
* sheet that asks has the engine match a changed node's ancestors again.
|
|
447
|
+
*/
|
|
448
|
+
readonly has?: true;
|
|
397
449
|
/**
|
|
398
450
|
* The `@font-face` rules the sheet declares, each `source` the bundler's `require` of the file.
|
|
399
451
|
* The engine does not read them: `loadFonts()` in `@ng-native/expo/fonts` registers them with
|
|
@@ -432,7 +484,28 @@ export interface StyleCache {
|
|
|
432
484
|
* values do, and by the same copy-on-write rule, so a subtree that defines none shares one map.
|
|
433
485
|
*/
|
|
434
486
|
tokens: Readonly<Record<string, TokenValue>>;
|
|
487
|
+
/**
|
|
488
|
+
* The rules the node matched, kept only while a sheet uses `:has()`: what a node whose
|
|
489
|
+
* subtree changed is compared against, to tell whether it has to be restyled.
|
|
490
|
+
*/
|
|
491
|
+
matched?: readonly StyleRule[];
|
|
492
|
+
/**
|
|
493
|
+
* Set once a child takes a value from this node's own style, an `inherit` for a property CSS
|
|
494
|
+
* does not hand down: a change to the node's inline style then restyles it, and its children
|
|
495
|
+
* with it, where otherwise an inline style changes nothing a child resolves to.
|
|
496
|
+
*/
|
|
497
|
+
heirs?: true;
|
|
498
|
+
/**
|
|
499
|
+
* The properties a rule declared `!important`, where any did: an inline style is the last of
|
|
500
|
+
* the plain declarations, so for these what the rules say stands over it.
|
|
501
|
+
*/
|
|
502
|
+
important?: ReadonlySet<string>;
|
|
435
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Whether a child is one `:empty` sees. An anchor is a comment on the web, which it does not;
|
|
506
|
+
* nor text of no length, which a binding to nothing leaves behind.
|
|
507
|
+
*/
|
|
508
|
+
export declare function fills(child: StyleTarget): boolean;
|
|
436
509
|
/** What the matcher needs of a node. The engine's node satisfies this structurally. */
|
|
437
510
|
export interface StyleTarget {
|
|
438
511
|
readonly name: string;
|
|
@@ -487,6 +560,22 @@ export interface StyleTarget {
|
|
|
487
560
|
styleCache: StyleCache | null;
|
|
488
561
|
/** Set when something that could change what this node matches has changed. */
|
|
489
562
|
styleDirty: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Set when something beneath this node changed and a sheet uses `:has()`: the node is matched
|
|
565
|
+
* again, and restyled only if the rules it matches came out different. Absent on a hand-built
|
|
566
|
+
* target.
|
|
567
|
+
*/
|
|
568
|
+
hasDirty?: boolean;
|
|
569
|
+
/**
|
|
570
|
+
* Set by the engine when the node's own interaction state changed and nothing else about it
|
|
571
|
+
* did: a press began or ended on it or under it. It is matched again, and keeps the style it
|
|
572
|
+
* has, and everything under it, when it matches the rules it did. Not for an element a rule
|
|
573
|
+
* asks about from another one, which is restyled: see `usesActive`.
|
|
574
|
+
*
|
|
575
|
+
* Set as well when its place among its siblings changed and nothing else about it did, which
|
|
576
|
+
* is the same case: what it is asked about from another element is `placeReadElsewhere`.
|
|
577
|
+
*/
|
|
578
|
+
stateDirty?: boolean;
|
|
490
579
|
/** `:focus`. Set by the engine from the native focus and blur events. */
|
|
491
580
|
focused?: boolean;
|
|
492
581
|
/**
|
|
@@ -505,6 +594,18 @@ export interface StyleTarget {
|
|
|
505
594
|
* The cost is one integer increment per comparison, against a Set lookup and several property
|
|
506
595
|
* reads, so it does not distort what it measures.
|
|
507
596
|
*/
|
|
597
|
+
/**
|
|
598
|
+
* What a sheet asks about a pressed element. `own` is whether a rule styles one, `.button:active`,
|
|
599
|
+
* which matching the pressed elements again answers. `elsewhere` is each compound that asks about
|
|
600
|
+
* a pressed element from another one: `.card:active .title`, `.a:active + .b`, or `:active`
|
|
601
|
+
* inside `:not()`, `:is()` or `:has()`. An element such a compound could be is restyled with
|
|
602
|
+
* everything under it when it is pressed, as what it changes is not itself alone.
|
|
603
|
+
*/
|
|
604
|
+
export declare function usesActive(sheet: StyleSheet): ActiveUse;
|
|
605
|
+
export interface ActiveUse {
|
|
606
|
+
readonly own: boolean;
|
|
607
|
+
readonly elsewhere: readonly Compound[];
|
|
608
|
+
}
|
|
508
609
|
export declare const styleStats: {
|
|
509
610
|
/** Calls to `matchesCompound`, the innermost unit of matching work. */
|
|
510
611
|
compoundTests: number;
|
|
@@ -512,6 +613,8 @@ export declare const styleStats: {
|
|
|
512
613
|
ruleTests: number;
|
|
513
614
|
/** Nodes cascaded, as opposed to handed back from the memo. */
|
|
514
615
|
nodesResolved: number;
|
|
616
|
+
/** Rules filed by key selector: each sheet's once, however many sheets come after it. */
|
|
617
|
+
rulesFiled: number;
|
|
515
618
|
};
|
|
516
619
|
export declare function resetStyleStats(): void;
|
|
517
620
|
/**
|
|
@@ -519,6 +622,44 @@ export declare function resetStyleStats(): void;
|
|
|
519
622
|
* filter and rejects almost everything immediately.
|
|
520
623
|
*/
|
|
521
624
|
export declare function matches(node: StyleTarget, rule: StyleRule, sheet?: StyleSheet | null): boolean;
|
|
625
|
+
/** A node's first `count` elements, or its last, skipping everything that is not one. */
|
|
626
|
+
export declare function elementsAtEnd<T extends StyleTarget>(siblings: readonly T[], count: number, fromEnd: boolean): T[];
|
|
627
|
+
/**
|
|
628
|
+
* Which way from a change in a child list a sheet's rules can match differently, past the
|
|
629
|
+
* elements at its two ends. An element's place from the start hangs on the elements before it
|
|
630
|
+
* and on none after, so a change moves the ones after it; its place from the end is the other
|
|
631
|
+
* way about.
|
|
632
|
+
*/
|
|
633
|
+
export interface SiblingReach {
|
|
634
|
+
/**
|
|
635
|
+
* How many elements after a change it reaches. All of them, `Infinity`, where it counts from
|
|
636
|
+
* the start (`:nth-child(odd)`) or asks about any element before (`~`). Where it asks only
|
|
637
|
+
* about the element just before (`+`), as many as its longest run of them steps along: one for
|
|
638
|
+
* `.a + .b`, two for `.a + .b + .c`. Zero where it asks none of these.
|
|
639
|
+
*/
|
|
640
|
+
readonly after: number;
|
|
641
|
+
/** It counts from the end (`:nth-last-child(2)`). */
|
|
642
|
+
readonly before: boolean;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* How far a sheet asks about a child list beyond which element is first and which is last.
|
|
646
|
+
* Where no sheet reaches either way, only the elements at the two ends can match differently.
|
|
647
|
+
*/
|
|
648
|
+
export declare function siblingReach(sheet: StyleSheet): SiblingReach;
|
|
649
|
+
/**
|
|
650
|
+
* Each compound in a sheet whose element's place among its siblings is read from another
|
|
651
|
+
* element: one with something under it in the rule, `.row:nth-child(odd) .label` and
|
|
652
|
+
* `.a + .b .c`, or one an `:is()` or `:host-context()` looks for above the element styled.
|
|
653
|
+
*
|
|
654
|
+
* An element whose place changed is matched again, and where it matches the rules it did, it
|
|
655
|
+
* and everything under it are left as they were: its own rules are all that its place can
|
|
656
|
+
* change. Not an element one of these could be. What is under that one can match differently
|
|
657
|
+
* though it matches the same, so it is styled again with everything under it.
|
|
658
|
+
*
|
|
659
|
+
* A place read by the element a rule styles, or by the elements before it that the rule steps
|
|
660
|
+
* from (`.a:first-child + .b`), is that element's own: the rules it matches say.
|
|
661
|
+
*/
|
|
662
|
+
export declare function placeReadElsewhere(sheet: StyleSheet): readonly Compound[];
|
|
522
663
|
/** One rule in a cascade: the sheet it came from, which `:host` needs, and its weight here. */
|
|
523
664
|
interface RuleEntry {
|
|
524
665
|
readonly rule: StyleRule;
|
|
@@ -535,25 +676,50 @@ interface RuleEntry {
|
|
|
535
676
|
* is offered to everything, because the alternative is a rule that silently stops applying.
|
|
536
677
|
*/
|
|
537
678
|
export declare function ruleKey(rule: StyleRule): string;
|
|
538
|
-
/**
|
|
679
|
+
/**
|
|
680
|
+
* Every bucket a rule is filed under. One, but for a rule whose rightmost compound is only an
|
|
681
|
+
* `:is()` of compounds that each have a key: it is filed under each of theirs, since a node it
|
|
682
|
+
* matches has one of them.
|
|
683
|
+
*
|
|
684
|
+
* A rule that says nothing of the node's own name can still say whose child it is, `.row > *`.
|
|
685
|
+
* It is filed under the parent's class, and offered to the children of an element that has it.
|
|
686
|
+
*/
|
|
687
|
+
export declare function ruleKeys(rule: StyleRule): readonly string[];
|
|
688
|
+
/** A rule in an index, and where it comes among rules of the same weight: the order it was written in. */
|
|
539
689
|
interface IndexedEntry {
|
|
540
690
|
readonly entry: RuleEntry;
|
|
541
691
|
readonly at: number;
|
|
542
692
|
}
|
|
543
693
|
export interface RuleIndex {
|
|
544
|
-
readonly buckets:
|
|
545
|
-
readonly universal:
|
|
694
|
+
readonly buckets: Map<string, IndexedEntry[]>;
|
|
695
|
+
readonly universal: IndexedEntry[];
|
|
546
696
|
}
|
|
547
|
-
/** File a merged, sorted rule list by key selector. Done once per sheet pair, not per node. */
|
|
548
|
-
export declare function indexRules(entries: readonly RuleEntry[]): RuleIndex;
|
|
549
697
|
/**
|
|
550
|
-
*
|
|
698
|
+
* File rules by key selector, each at `from` and on: its place among every rule there is, which
|
|
699
|
+
* settles the order of two of the same weight. Into an index there already where one is given,
|
|
700
|
+
* so a sheet that arrives later is added to what is filed and nothing is filed again.
|
|
701
|
+
*/
|
|
702
|
+
export declare function indexRules(entries: readonly RuleEntry[], into?: RuleIndex, from?: number): RuleIndex;
|
|
703
|
+
/**
|
|
704
|
+
* The rules worth trying against a node, in cascade order: `order` says which of two comes
|
|
705
|
+
* first, and with none it is the order they were filed in.
|
|
551
706
|
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
* lists are short by construction, which is the entire point of the index.
|
|
707
|
+
* From each index, only the buckets the node's name, id and classes reach, which is the entire
|
|
708
|
+
* point of the index: the lists are short by construction, so sorting them is cheap.
|
|
555
709
|
*/
|
|
556
|
-
export declare function candidateRules(node: StyleTarget,
|
|
710
|
+
export declare function candidateRules(node: StyleTarget, indexes: RuleIndex | readonly RuleIndex[], order?: (a: IndexedEntry, b: IndexedEntry) => number): RuleEntry[];
|
|
711
|
+
/** What a sheet's rules are written for: the last compound of each, by its class or its name. */
|
|
712
|
+
export interface Subjects {
|
|
713
|
+
readonly classes: Set<string>;
|
|
714
|
+
readonly types: Set<string>;
|
|
715
|
+
/**
|
|
716
|
+
* The classes of the boxes that rules for anything are written inside: `.dialog > :first-child`
|
|
717
|
+
* is for any element, but only one that has an element with `dialog` over it.
|
|
718
|
+
*/
|
|
719
|
+
readonly inside: Set<string>;
|
|
720
|
+
/** A rule for anything anywhere: no class, no name, and no such box to be in. */
|
|
721
|
+
any: boolean;
|
|
722
|
+
}
|
|
557
723
|
/** Whether an inline style sets a property children inherit. Allocates nothing: it runs per set. */
|
|
558
724
|
export declare function setsInherited(style: unknown): boolean;
|
|
559
725
|
/**
|
|
@@ -598,7 +764,12 @@ export declare class StyleResolver {
|
|
|
598
764
|
* selector. Keyed by the creating sheet and then the hosted one, so a component's nodes share a
|
|
599
765
|
* single index.
|
|
600
766
|
*/
|
|
601
|
-
|
|
767
|
+
/** The global sheet and every sheet added to it, filed by key selector. See `rulesFor`. */
|
|
768
|
+
private filed;
|
|
769
|
+
/** How many of the added sheets `filed` holds: one added since is filed at the next read. */
|
|
770
|
+
private filedAdded;
|
|
771
|
+
/** A component's own sheet, indexed once for each place it can take: a host's, or its creator's. */
|
|
772
|
+
private readonly ownIndexes;
|
|
602
773
|
/**
|
|
603
774
|
* Whether any sheet merged so far has a rule in a cascade layer. Until one does, rules are
|
|
604
775
|
* ordered by weight alone and the cascade does not look for layers, which is nearly every app.
|
|
@@ -657,6 +828,35 @@ export declare class StyleResolver {
|
|
|
657
828
|
* swap of the component's CSS edits the sheet where it is.
|
|
658
829
|
*/
|
|
659
830
|
addGlobalSheet(sheet: StyleSheet, replacing?: StyleSheet): boolean;
|
|
831
|
+
/**
|
|
832
|
+
* The sheets added one after another with nothing else changed between them, each with the
|
|
833
|
+
* generation it began and ended: a cache made before them still stands for a node none of
|
|
834
|
+
* them could match. Emptied by anything else that moves the generation on.
|
|
835
|
+
*/
|
|
836
|
+
private readonly additions;
|
|
837
|
+
/** Whether a sheet could match a node: one of its rules is written for it. */
|
|
838
|
+
couldMatch(sheet: StyleSheet, node: StyleTarget): boolean;
|
|
839
|
+
/** How far each class named by the sheets met so far reaches: see `classReach`. */
|
|
840
|
+
private readonly reach;
|
|
841
|
+
/** The tests of the `class` attribute itself in those sheets, which any class may answer. */
|
|
842
|
+
private readonly classTests;
|
|
843
|
+
private readonly noted;
|
|
844
|
+
/** Read the classes a sheet names, once, as soon as any node is given it. */
|
|
845
|
+
noteSheet(sheet: StyleSheet | null | undefined): void;
|
|
846
|
+
private noteReach;
|
|
847
|
+
/**
|
|
848
|
+
* What classes coming to an element or going from it can restyle: `true` for it and all
|
|
849
|
+
* under it and after it, as any change to it does; the elements under it to restyle, by what
|
|
850
|
+
* rules are for; or null, where no rule names any of them and nothing is styled again.
|
|
851
|
+
*/
|
|
852
|
+
reachOf(classes: Iterable<string>): true | Subjects | null;
|
|
853
|
+
/** Whether one of the rules `subjects` stands for could be for a node. */
|
|
854
|
+
isFor(subjects: Subjects, node: StyleTarget): boolean;
|
|
855
|
+
/**
|
|
856
|
+
* Whether a cache is of this generation, or of one before sheets that could not match the
|
|
857
|
+
* node were added, which leaves it as it was: it is then brought up to this one.
|
|
858
|
+
*/
|
|
859
|
+
private current;
|
|
660
860
|
/** Stop matching a sheet `addGlobalSheet` added; false when it is not one. */
|
|
661
861
|
removeGlobalSheet(sheet: StyleSheet): boolean;
|
|
662
862
|
setConditions(next: Conditions): void;
|
|
@@ -668,6 +868,37 @@ export declare class StyleResolver {
|
|
|
668
868
|
* resolves at most once however many descendants ask for its inherited values.
|
|
669
869
|
*/
|
|
670
870
|
resolve(node: StyleTarget, epoch: number): StyleCache;
|
|
871
|
+
/**
|
|
872
|
+
* A cache of a node just styled, with a context of its own. It keeps the rules the node
|
|
873
|
+
* matched, for the node to be compared with, once a sheet has a use for them: see `tracksHas`.
|
|
874
|
+
*/
|
|
875
|
+
private cached;
|
|
876
|
+
/**
|
|
877
|
+
* Set by the engine once a sheet uses `:has()`, styles a pressed element or asks about a place
|
|
878
|
+
* in a child list. Until then no cache keeps the rules it matched, so an app that never asks
|
|
879
|
+
* pays nothing for it.
|
|
880
|
+
*/
|
|
881
|
+
tracksHas: boolean;
|
|
882
|
+
/**
|
|
883
|
+
* The cache of a node whose subtree changed, and nothing else, when it matches the rules it
|
|
884
|
+
* did: keeping the object is what leaves everything under it alone. Nothing when it has to be
|
|
885
|
+
* resolved, as it does with no record of what it matched, made before any sheet asked.
|
|
886
|
+
*/
|
|
887
|
+
private keptBeneath;
|
|
888
|
+
/** The rules a node matches now, weakest first. */
|
|
889
|
+
private matchedBy;
|
|
890
|
+
/**
|
|
891
|
+
* The rules `keptBeneath` found the node being resolved to match, where they are other than
|
|
892
|
+
* it matched before: it is styled from them next, rather than matched a second time.
|
|
893
|
+
*/
|
|
894
|
+
private justMatched;
|
|
895
|
+
/** A cache that still stands for a node marked for its subtree or its state alone. */
|
|
896
|
+
private kept;
|
|
897
|
+
/**
|
|
898
|
+
* The cache of a node whose pressed state changed and nothing else, where no rule can match
|
|
899
|
+
* it at all: it has no style of its own to change, so it and all under it stay as they are.
|
|
900
|
+
*/
|
|
901
|
+
private keptUnmatched;
|
|
671
902
|
/**
|
|
672
903
|
* Whether a node's last answer still stands under a parent that resolved to `parentContext`,
|
|
673
904
|
* without resolving it. What lets a commit step over a clean child in one comparison.
|
|
@@ -694,26 +925,34 @@ export declare class StyleResolver {
|
|
|
694
925
|
*/
|
|
695
926
|
private unstyled;
|
|
696
927
|
/**
|
|
697
|
-
* The rules worth trying against a node.
|
|
928
|
+
* The rules worth trying against a node, in cascade order.
|
|
698
929
|
*
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
930
|
+
* Every sheet is filed once, by key selector: the app's global sheet and each sheet added to it
|
|
931
|
+
* in one index, and a component's own in one of its own. What comes back is only the buckets
|
|
932
|
+
* this node can reach. A global utility sheet is hundreds of rules and a screen is a thousand
|
|
933
|
+
* nodes, and the difference is between a million match attempts and a few thousand. A library
|
|
934
|
+
* adds a sheet for each of its components as the component first renders, dozens on one
|
|
935
|
+
* screen, so one more is added to what is filed and nothing is filed again.
|
|
936
|
+
*
|
|
937
|
+
* Sheets are filed in the order a document holds them, which is the order of two rules of the
|
|
938
|
+
* same weight, and where a layer gets its place: the app's global sheet, the host's own, the
|
|
939
|
+
* creating component's, then each added sheet as it came. The component layers get a small
|
|
940
|
+
* specificity bump, so the encapsulation attribute Angular adds on the web does not have to
|
|
941
|
+
* be written.
|
|
711
942
|
*
|
|
712
943
|
* A sheet added with `addGlobalSheet` comes last, with no bump: a browser adds a None
|
|
713
944
|
* component's CSS when the component first renders, after the styles of the components around
|
|
714
945
|
* it, so it loses to their extra attribute and wins a tie with them.
|
|
715
946
|
*/
|
|
716
|
-
private
|
|
947
|
+
private rulesFor;
|
|
948
|
+
/** Weakest first: by layer where any sheet has one, then by weight, then as they were filed. */
|
|
949
|
+
private readonly cascadeOrder;
|
|
950
|
+
/** A component's sheet as the rules of a host or of a creator, which differ only in their place. */
|
|
951
|
+
private ownIndex;
|
|
952
|
+
/** The app's global sheet and every sheet added to it, with any added since the last read. */
|
|
953
|
+
private sharedIndex;
|
|
954
|
+
/** A sheet's rules at their weight here, with its layers given their places. */
|
|
955
|
+
private entries;
|
|
717
956
|
/**
|
|
718
957
|
* Gives each of a sheet's layers its place among every sheet's, the first time the sheet is
|
|
719
958
|
* merged, and each of its layered rules that place. Sheets are merged in the order a document
|
|
@@ -741,6 +980,16 @@ export declare class StyleResolver {
|
|
|
741
980
|
private matched;
|
|
742
981
|
/** The declarations of the rules a node matched. The list is sorted, so later simply wins. */
|
|
743
982
|
private cascade;
|
|
983
|
+
/**
|
|
984
|
+
* An inline style over the style the cascade settled, both already in `style`: a corner or an
|
|
985
|
+
* edge the inline style sets takes the other form of it out, as a later rule would.
|
|
986
|
+
*/
|
|
987
|
+
overOtherForms(inline: Readonly<Record<string, unknown>>, style: Record<string, unknown>): void;
|
|
988
|
+
/**
|
|
989
|
+
* The direction an element is laid out in: the last `direction` its own rules give it, the one
|
|
990
|
+
* it inherits, or the app's. A logical corner is a different physical one in each.
|
|
991
|
+
*/
|
|
992
|
+
private directionOf;
|
|
744
993
|
/**
|
|
745
994
|
* Whether a rule's media query holds, memoised per rule.
|
|
746
995
|
*
|
|
@@ -761,6 +1010,19 @@ export declare class StyleResolver {
|
|
|
761
1010
|
* undefined, which is what a browser does with a value it cannot resolve.
|
|
762
1011
|
*/
|
|
763
1012
|
private applyDeferred;
|
|
1013
|
+
/** Note what the node being resolved takes an `inherit` from, and that its parent has an heir. */
|
|
1014
|
+
private heir;
|
|
1015
|
+
/** What the parent of the node being resolved came to: an `inherit` takes its values from it. */
|
|
1016
|
+
private parentOf;
|
|
1017
|
+
/** That parent's inline style, which is over what its rules gave it. */
|
|
1018
|
+
private parentInline;
|
|
1019
|
+
/** What the parent's inline style sets, under what its rules marked important, as on the parent. */
|
|
1020
|
+
private parentSet;
|
|
1021
|
+
/**
|
|
1022
|
+
* `inherit`: each prop as the parent has it, handed down or its own, and gone where the parent
|
|
1023
|
+
* has none, which is what a weaker rule's value for it gives way to.
|
|
1024
|
+
*/
|
|
1025
|
+
private inherit;
|
|
764
1026
|
/** One deferred declaration's value, from the tokens in scope and the node's own style. */
|
|
765
1027
|
private settled;
|
|
766
1028
|
/** A line's longhands from its tokens, with a width in `em` worked out against the font size. */
|
|
@@ -812,6 +1074,15 @@ interface CalcMarker {
|
|
|
812
1074
|
readonly expression: CalcExpression;
|
|
813
1075
|
readonly kind: 'length' | 'angle' | 'time' | 'number';
|
|
814
1076
|
}
|
|
1077
|
+
/**
|
|
1078
|
+
* A colour at a fraction of its opacity.
|
|
1079
|
+
*
|
|
1080
|
+
* Multiplied rather than replaced, so a token that was already translucent stays relatively so -
|
|
1081
|
+
* `rgba(0, 0, 0, 0.5)` faded to 90% is 45% opaque, which is what a browser computes for the same
|
|
1082
|
+
* mix. A value that is not one of ours is returned untouched: it may be a platform colour, and a
|
|
1083
|
+
* colour nobody can parse is better painted as it stands than dropped.
|
|
1084
|
+
*/
|
|
1085
|
+
export declare function faded(value: unknown, fraction: number): unknown;
|
|
815
1086
|
/**
|
|
816
1087
|
* Where a component's compiled sheet lives: a static on the component class, written by the
|
|
817
1088
|
* Metro transformer at build time.
|