@ng-native/fabric 0.0.1 → 0.1.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/LICENSE +21 -0
- package/README.md +54 -1
- package/dist/color-mix.d.ts +20 -0
- package/dist/color-mix.js +306 -0
- package/dist/color-mix.js.map +1 -0
- package/dist/css.d.ts +615 -0
- package/dist/css.js +1405 -0
- package/dist/css.js.map +1 -0
- package/dist/defer-triggers.d.ts +53 -0
- package/dist/defer-triggers.js +184 -0
- package/dist/defer-triggers.js.map +1 -0
- package/dist/engine.d.ts +1066 -0
- package/dist/engine.js +2764 -0
- package/dist/engine.js.map +1 -0
- package/dist/fabric.d.ts +20 -0
- package/dist/fabric.js +44 -0
- package/dist/fabric.js.map +1 -0
- package/dist/forms-inputs.d.ts +15 -0
- package/dist/forms-inputs.js +54 -0
- package/dist/forms-inputs.js.map +1 -0
- package/dist/host.d.ts +133 -0
- package/dist/host.js +55 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/inline-token.d.ts +12 -0
- package/dist/inline-token.js +52 -0
- package/dist/inline-token.js.map +1 -0
- package/dist/inline-transform.d.ts +14 -0
- package/dist/inline-transform.js +41 -0
- package/dist/inline-transform.js.map +1 -0
- package/dist/native-drive.d.ts +100 -0
- package/dist/native-drive.js +318 -0
- package/dist/native-drive.js.map +1 -0
- package/dist/relative-colour.d.ts +17 -0
- package/dist/relative-colour.js +71 -0
- package/dist/relative-colour.js.map +1 -0
- package/dist/scroll-animation.d.ts +41 -0
- package/dist/scroll-animation.js +169 -0
- package/dist/scroll-animation.js.map +1 -0
- package/dist/transition.d.ts +139 -0
- package/dist/transition.js +569 -0
- package/dist/transition.js.map +1 -0
- package/package.json +43 -3
package/dist/css.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../src/css.ts"],"names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K,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC;AAC3F,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAE7C,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,MAAM,KAAK,GAAI,IAAuC,EAAE,CAAC,aAAa,CAAC,CAAC;IACxE,OAAQ,KAAgC,IAAI,IAAI,CAAC;AACnD,CAAC","sourcesContent":["/**\n * Runtime half of the CSS system: selector matching and the cascade.\n *\n * All the expensive work happened at build time (parsing, longhand expansion, value conversion,\n * specificity maths, sorting), so this only walks a pre-sorted rule list and merges. It is\n * framework-agnostic and knows nothing about Angular.\n */\nimport { type HueMethod, type MixSpace, mixColours } from './color-mix.ts';\nimport { type Channel, relativeColour } from './relative-colour.ts';\nimport type { Keyframe } from './transition.ts';\n\n/** One `[name]` or `[name op \"value\"]` test. */\nexport interface AttributeTest {\n readonly name: string;\n /** Absent means a presence test. */\n readonly operator?: 'equal' | 'prefix' | 'suffix' | 'substring' | 'includes' | 'dash-match';\n readonly value?: string;\n /** The `i` flag: the value is compared without case, and is written here in lower case. */\n readonly insensitive?: true;\n}\n\nexport interface Compound {\n readonly type?: string;\n readonly id?: string;\n /** `:root`: the node at the top of the tree. */\n readonly root?: true;\n readonly classes: readonly string[];\n readonly attributes?: readonly AttributeTest[];\n /** `:is()` / `:where()` arguments: the compound matches if any of these do. */\n readonly is?: readonly (readonly Compound[])[];\n /** `:not()` arguments: the compound matches only if none of these do. */\n readonly not?: readonly Compound[];\n /** `:host`: the node must be the host of the component whose sheet is being evaluated. */\n readonly host?: true;\n /** `:host-context()`: the host, or one of its ancestors, must match one of these. */\n readonly hostContext?: readonly Compound[];\n /**\n * `:is(<compound> *)`: every one of these must match some ancestor, the node itself excluded.\n * What Tailwind's `group-*` variants compile to.\n */\n readonly ancestors?: readonly Compound[];\n /** Interaction state the engine tracks: `:focus` and `:active`. */\n readonly pseudo?: readonly ('focus' | 'active')[];\n /**\n * `:first-child` and its family, reduced to the counting tests CSS defines them as. More than\n * one because `:only-child` is two: first from the start and first from the end.\n */\n readonly nth?: readonly NthTest[];\n /** `:empty`: no children at all, text included. */\n readonly empty?: true;\n}\n\n/** `an + b`, counted from the start unless `fromEnd`. */\nexport interface NthTest {\n readonly a: number;\n readonly b: number;\n readonly fromEnd?: true;\n}\n\nexport type Combinator = 'descendant' | 'child' | 'next-sibling' | 'later-sibling';\n\nexport interface StyleRule {\n readonly compounds: readonly Compound[];\n /** Between compounds; length is `compounds.length - 1`. */\n readonly combinators: readonly Combinator[];\n readonly specificity: number;\n readonly order: number;\n readonly declarations: Readonly<Record<string, unknown>>;\n readonly important?: Readonly<Record<string, unknown>>;\n /** Custom properties this rule defines, pre-converted into every form a use site might want. */\n readonly tokens?: Readonly<Record<string, TokenValue>>;\n /** Declarations whose value is a `var()`, resolved once the token map is known. */\n readonly deferred?: readonly DeferredDeclaration[];\n /** The media query guarding this rule, if any. */\n readonly condition?: MediaCondition;\n /** Memo of the last condition evaluation, and the conditions version it was made against. */\n activeAt?: number;\n active?: boolean;\n}\n\nexport type MediaCondition =\n | { readonly all: readonly MediaCondition[] }\n | { readonly any: readonly MediaCondition[] }\n | {\n readonly feature: 'width' | 'height';\n readonly op: 'gt' | 'gte' | 'lt' | 'lte' | 'eq';\n readonly value: number;\n }\n | {\n readonly feature: 'orientation' | 'prefers-color-scheme' | 'prefers-reduced-motion';\n readonly value: string;\n };\n\n/** What media queries are evaluated against. Pushed in by the host: the engine imports no RN. */\nexport interface Conditions {\n readonly width: number;\n readonly height: number;\n readonly colorScheme: 'light' | 'dark';\n /**\n * The user asked for less animation. Optional because it is a preference rather than a\n * measurement: an app that never asks the platform gets `no-preference`, which is what a\n * platform that cannot answer means anyway.\n */\n readonly reducedMotion?: boolean;\n}\n\n/** A custom property's value, in each form it can legally take. Absent forms are unusable. */\nexport interface TokenValue {\n readonly length?: number | string;\n /** An angle, in degrees whatever unit it was written in. */\n readonly angle?: number;\n /** A time, in milliseconds whatever unit it was written in. */\n readonly time?: number;\n readonly color?: string;\n readonly keyword?: string;\n readonly number?: number;\n /** A font weight, as the string `fontWeight` takes. */\n readonly weight?: string;\n /** The first family of a font stack. A single word is read from `keyword` instead. */\n readonly family?: string;\n /**\n * A bare number as a line-height: a multiple of the font size, settled where it is used. A\n * length is read from `length` instead.\n */\n readonly lineHeight?: { readonly __defer: DeferredDeclaration['compute'] };\n /** A whole shadow list, in the processed shape `boxShadow` takes. */\n readonly shadow?: readonly unknown[];\n /** One filter function, as the one-entry list `filter` takes: a slot of Tailwind's filters. */\n readonly filter?: readonly unknown[];\n /** One transform function, as the one-entry list `transform` takes: a 3D rotation or skew. */\n readonly transform?: readonly unknown[];\n /** One font variant, as the one-entry list `fontVariant` takes: a numeric variant's slot. */\n readonly fontVariant?: readonly string[];\n /** Bare colour channels, `13, 110, 253`, for an `rgba(var(--x), <alpha>)` to finish. */\n readonly channels?: readonly number[];\n /**\n * Defined as `rgba(var(--channels), <alpha>)`: a colour made of a channels token and an alpha\n * written or tokened. Settled on the node that defines it, as an `hsl` one is.\n */\n readonly deferredColour?: Extract<ColourExpression, { channels: unknown }>;\n /**\n * Defined as another token, `var(--name)`. Resolved on the node that defines it, against the\n * tokens in scope there, and passed down resolved - which is what a browser does.\n */\n readonly alias?: string;\n /** What an alias becomes when the token it names is not defined. */\n readonly fallback?: TokenValue;\n /**\n * Defined as `hsl(var(--h), var(--s), var(--l))`, or `hsla()` with an alpha: how Bulma writes\n * every colour. Resolved into `color` on the node that defines it, alongside its aliases, so a\n * use site never has to know a token was ever built this way.\n */\n readonly hsl?: {\n readonly h: HslChannel;\n readonly s: HslChannel;\n readonly l: HslChannel;\n readonly alpha?: HslChannel;\n };\n}\n\n/** One channel of an `hsl()` token: settled at build time, or a token to read at match time. */\nexport type HslChannel = number | { readonly reference: string; readonly fallback?: number };\n\n/** The forms a token can be read in: one per kind of value a use site can need. */\nexport type TokenKind =\n | 'length'\n | 'color'\n | 'keyword'\n | 'number'\n | 'weight'\n | 'family'\n | 'lineHeight'\n | 'shadow'\n | 'filter'\n | 'transform'\n | 'fontVariant'\n | 'channels';\n\n/**\n * Where a form a token does not have can be read from instead. A length is already a\n * line-height and a single word is already a family, so neither is stored twice in every token\n * that happens to be one. The compiler reads fallbacks with the same table.\n */\nconst STAND_IN: Partial<Record<TokenKind, TokenKind>> = { lineHeight: 'length', family: 'keyword' };\n\nfunction formOf(token: TokenValue | undefined, kind: TokenKind): unknown {\n if (!token) return undefined;\n const stand = STAND_IN[kind];\n return token[kind] ?? (stand ? token[stand] : undefined);\n}\n\nexport interface DeferredDeclaration {\n /**\n * The React Native style properties this lands in. Usually one, but a four-sided shorthand is\n * unambiguous given a single-valued token, so `padding: var(--gap)` writes all four.\n */\n readonly props: readonly string[];\n /** A `var()` reference. Exactly one of this and `compute` is present. */\n readonly kind?: TokenKind;\n readonly reference?: string;\n /**\n * The tokens a fallback that is itself a `var()` names, tried in turn when `reference` is not\n * defined: `var(--a, var(--b, green))` is `--a`, then `--b`, then `green`.\n */\n readonly alternatives?: readonly string[];\n readonly fallback?: unknown;\n /**\n * What to write when the reference resolves, whatever it resolves to: `flex: var(--grow)` sets a\n * shrink of 1 and a basis of 0%, but only when there is a grow for them to go with.\n */\n readonly whenSet?: unknown;\n /**\n * What to write when the reference resolves to nothing: the property's initial value, which is\n * what a browser gives a property whose `var()` cannot be substituted. Only where it differs\n * from leaving the property out: `flex-shrink` starts at 1 in CSS and at 0 in Yoga.\n */\n readonly unset?: unknown;\n /**\n * For a colour built from `channels`, the token its alpha comes from:\n * `rgba(var(--bs-primary-rgb), var(--bs-bg-opacity))`. A written alpha is an `adjust` instead.\n */\n readonly alpha?: { readonly reference: string; readonly fallback?: number };\n /**\n * A gradient whose stops are custom properties, filled in once a node's tokens are known. What\n * a utility framework's `from-*` and `to-*` classes compile to, since the class that paints the\n * gradient is not the class that supplies its colours.\n */\n readonly gradient?: GradientTemplate | readonly GradientTemplate[];\n /**\n * Arithmetic around the reference, settled at build time. `value * scale + offset`, then no\n * smaller than `floor`. What `calc(var(--x) + 12px)` and `max(var(--x), 16px)` become.\n */\n readonly adjust?: {\n readonly scale?: number;\n readonly offset?: number;\n readonly floor?: number;\n /**\n * A fraction to multiply the resolved colour's alpha by. What\n * `color-mix(in oklab, var(--x) 90%, transparent)` becomes, which is Tailwind's `/90`.\n */\n readonly alpha?: number;\n };\n /** Declared `!important`: ranked with the important declarations, not the plain ones. */\n readonly important?: true;\n /**\n * A length relative to the viewport or to the font size in scope, plus an absolute `offset`\n * when it came from a sum: `calc(1.375rem + 1.5vw)` is 1.5vw with 22 added.\n */\n readonly compute?: {\n readonly unit: 'em' | 'vw' | 'vh' | 'vmin' | 'vmax';\n readonly factor: number;\n readonly offset?: number;\n };\n /**\n * A structured value - a transform list, a shadow, a filter - with lengths like `compute`'s\n * somewhere inside it, each marked `{ __defer: compute }`. Filled in where it is used.\n */\n readonly within?: unknown;\n}\n\n/**\n * A colour a deferred value is made of: settled at build time, a token, or a `color-mix()` of two\n * such, worked out once the tokens are known. What a gradient stop, a shadow's colour or a colour\n * property with a `var()` in a mix becomes.\n */\nexport type ColourExpression =\n | { readonly color: string }\n | {\n readonly reference: string;\n readonly alternatives?: readonly string[];\n readonly fallback?: string;\n }\n | {\n /** A token of bare channels, as `rgba(var(--channels), <alpha>)` reads it. */\n readonly channels: { readonly reference: string; readonly fallback?: readonly number[] };\n readonly alpha?: number | { readonly reference: string; readonly fallback?: number };\n }\n | { readonly hsl: NonNullable<TokenValue['hsl']> }\n | {\n /** `oklch(from <colour> <channel> <channel> <channel> [/ <alpha>])`. */\n readonly relative: {\n readonly space: MixSpace;\n readonly from: ColourExpression;\n readonly channels: readonly [Channel, Channel, Channel];\n readonly alpha?: Channel;\n };\n }\n | {\n readonly mix: {\n readonly space: MixSpace;\n readonly hue?: HueMethod;\n readonly a: ColourExpression;\n readonly aPercentage?: number;\n readonly b: ColourExpression;\n readonly bPercentage?: number;\n };\n };\n\n/** One component's compiled styles, pre-sorted by specificity then source order. */\n/**\n * A gradient with holes in it: everything but the stop colours is settled at build time.\n *\n * The shape is React Native's own processed one, so filling it in is a copy with the references\n * resolved rather than a translation.\n */\nexport interface GradientTemplate {\n readonly type: 'linear-gradient' | 'radial-gradient';\n readonly colorStops: readonly {\n /** The custom property holding this stop's colour. A stop with no colour is not painted. */\n readonly reference?: string;\n /** A colour made from tokens and literals instead, such as a `color-mix()` of one. */\n readonly colour?: ColourExpression;\n readonly positionReference?: string;\n readonly position?: string | number;\n }[];\n /**\n * A radial gradient's centre, by the edges native measures from: each offset written, or a\n * token with what is written beside its name to use when it is not set.\n */\n readonly position?: Readonly<\n Record<\n string,\n string | number | { readonly reference: string; readonly fallback?: string | number }\n >\n >;\n}\n\nexport interface StyleSheet {\n readonly rules: readonly StyleRule[];\n /**\n * `@keyframes` by name. Global within a sheet, as they are within a document; the engine keeps\n * one registry across every sheet it sees, so a name defined in a global stylesheet is usable\n * from a component's.\n */\n readonly keyframes?: Readonly<Record<string, readonly Keyframe[]>>;\n /**\n * Whether any rule here asks about a node's position among its siblings.\n *\n * Said on the sheet because what these cost is not matching but invalidation: adding a row\n * changes what its neighbours match while nothing about those neighbours moved, so the engine\n * has to re-resolve a whole child list when it changes. It only does that where a sheet asks.\n */\n readonly structural?: true;\n}\n\n/**\n * What one node resolved to. `style` is what it renders with; `inherited` is what its children\n * start from, which is the parent's own `inherited` plus whatever inheritable values this node\n * set. Keeping the two apart is what lets resolution go downwards.\n */\nexport interface StyleCache {\n epoch: number;\n /**\n * Identity token standing for \"the ancestor chain, as far as matching is concerned\". A node\n * mints a fresh one whenever it recomputes, and reuses its previous one when it does not, so a\n * descendant can tell whether anything above it moved with a single reference comparison.\n *\n * It has to cover more than the inherited values. `.wrap.dark .label` and\n * `:host-context(.dark) .label` both change what a descendant matches when a class toggles on\n * an ancestor, while nothing inherited changes at all, so watching the inherited map alone\n * leaves those stale.\n */\n context: object;\n /** The parent's `context` this was computed from. */\n parentContext: object;\n /** The conditions version this was resolved under. */\n generation: number;\n style: Record<string, unknown>;\n inherited: Record<string, unknown>;\n /**\n * Custom properties in scope for this node and its descendants. Cascades exactly as inherited\n * values do, and by the same copy-on-write rule, so a subtree that defines none shares one map.\n */\n tokens: Readonly<Record<string, TokenValue>>;\n}\n\n/** What the matcher needs of a node. The engine's node satisfies this structurally. */\nexport interface StyleTarget {\n readonly name: string;\n readonly parent: StyleTarget | null;\n /**\n * Needed only by the selectors that ask about a node's place among its siblings, which is why\n * it is read through the parent rather than kept as an index: an index would have to be right\n * after every insertion and removal, and this is right by construction.\n */\n readonly children?: readonly StyleTarget[];\n /**\n * Only elements are counted by the selectors that ask about position. Text is not one, and\n * neither is the anchor a structural directive leaves behind - the same reason a browser does\n * not count a comment. Absent means element, so a hand-built target needs nothing extra.\n */\n readonly kind?: string;\n readonly classes: ReadonlySet<string> | null;\n readonly props: Readonly<Record<string, unknown>>;\n /**\n * The sheet this node's own rules come from, which is the sheet of the component whose renderer\n * created it. Read from the node rather than passed in, because a node's ancestors usually\n * belong to other components and must be matched against their own sheets, not this one's.\n */\n readonly sheet: StyleSheet | null;\n /**\n * The sheet of the component this node is the *host* of, if it is one. Distinct from `sheet`,\n * which is the sheet of the component that *created* it: a host node is created by the parent,\n * so those two are always different sheets and `:host` needs the second.\n */\n hostSheet: StyleSheet | null;\n /**\n * Custom properties set on the node itself, `[style.--tint]` or `style=\"--tint: red\"`, already\n * converted (`inline-token.ts`). In scope for its own rules and its descendants', and stronger\n * than any rule's, as inline style is on the web. Absent on a hand-built target.\n */\n readonly customProperties?: Readonly<Record<string, TokenValue>> | null;\n /** Memo slot, owned by the resolver. */\n styleCache: StyleCache | null;\n /** Set when something that could change what this node matches has changed. */\n styleDirty: boolean;\n /** `:focus`. Set by the engine from the native focus and blur events. */\n focused?: boolean;\n /**\n * `:active`. Set by the engine on the responder and every one of its ancestors, because a press\n * activates the whole chain on the web too, not only the deepest element under the finger.\n */\n active?: boolean;\n}\n\n/**\n * Properties CSS inherits that mean something on native.\n *\n * RN does not inherit these: a `color` on a view has no effect on a text inside it, only a text\n * inside a text inherits. CSS authors expect otherwise, and a stylesheet written against that\n * expectation would silently lose every colour, so the cascade emulates inheritance for exactly\n * this set. NativeScript does the same.\n */\nconst INHERITED = new Set([\n 'color',\n // Yoga inherits it for layout already; carried here as well so a paragraph can align by it.\n 'direction',\n 'fontFamily',\n 'fontSize',\n 'fontStyle',\n 'fontWeight',\n 'fontVariant',\n 'letterSpacing',\n 'lineHeight',\n 'textAlign',\n 'textTransform',\n 'textDecorationLine',\n 'writingDirection',\n // CSS inherits a text shadow, and `user-select: auto` takes the parent's, so a card's\n // `text-shadow-md` or `select-none` reaches the text inside it.\n 'textShadowOffset',\n 'textShadowRadius',\n 'textShadowColor',\n 'selectable',\n]);\n\n/**\n * `border-style: none`, which the compiler writes as a style native does not have. On the web it\n * makes every border width 0, whichever rule set the width, so `border-hidden border-x` draws no\n * side. Settled here, once the cascade has picked a style, and not sent on.\n */\nfunction drawNoBorder(own: Record<string, unknown>): void {\n delete own['borderStyle'];\n for (const key of Object.keys(own)) if (/^border\\w*Width$/.test(key)) own[key] = 0;\n own['borderWidth'] = 0;\n}\n\n/**\n * Deterministic work counters for the matcher.\n *\n * Wall-clock is noise; a compound comparison is not. Asserting on these catches an algorithmic\n * regression (a walk that became quadratic, a cache that stopped hitting) in a way that a timing\n * assertion never could without being flaky. `test/css-cost.test.ts` holds the baselines.\n *\n * The cost is one integer increment per comparison, against a Set lookup and several property\n * reads, so it does not distort what it measures.\n */\nexport const styleStats = {\n /** Calls to `matchesCompound`, the innermost unit of matching work. */\n compoundTests: 0,\n /** Rules considered, i.e. calls to `matches`. */\n ruleTests: 0,\n /** Nodes cascaded, as opposed to handed back from the memo. */\n nodesResolved: 0,\n};\n\nexport function resetStyleStats(): void {\n styleStats.compoundTests = 0;\n styleStats.ruleTests = 0;\n styleStats.nodesResolved = 0;\n}\n\n/** A prop's value as an attribute test compares it: in lower case, under the i flag. */\nconst attributeText = (actual: unknown, test: AttributeTest): string =>\n test.insensitive ? String(actual).toLowerCase() : String(actual);\n\n/**\n * `[disabled]`, and the value operators.\n *\n * A prop set to `false` or `null` counts as absent, matching the web, where an attribute is either\n * present or not and a `disabled` binding that evaluates false removes it. Everything else is\n * compared as a string, so `[tabIndex=\"0\"]` works against a numeric prop.\n */\nfunction matchesAttribute(node: StyleTarget, test: AttributeTest): boolean {\n const actual = node.props[test.name];\n if (actual === undefined || actual === null || actual === false) return false;\n if (test.operator === undefined) return true;\n\n const value = attributeText(actual, test);\n switch (test.operator) {\n case 'equal':\n return value === test.value;\n case 'prefix':\n return value.startsWith(test.value!);\n case 'suffix':\n return value.endsWith(test.value!);\n case 'substring':\n return value.includes(test.value!);\n case 'includes':\n // `~=` matches one whole word of a space-separated list.\n return value.split(/\\s+/).includes(test.value!);\n case 'dash-match':\n // `|=` matches the value itself or the value followed by a hyphen, as `lang` uses.\n return value === test.value || value.startsWith(`${test.value}-`);\n }\n}\n\n/*\n * Exempt from the complexity limit deliberately. This is a flat conjunction of independent\n * guards, not nested logic: cyclomatic complexity scores the two the same, and they are not the\n * same thing. It is also the hottest function in the matcher, called tens of thousands of times\n * per commit, so splitting each guard into its own call would cost more than it reads better.\n */\n// eslint-disable-next-line complexity\nfunction matchesCompound(node: StyleTarget, compound: Compound, sheet: StyleSheet | null): boolean {\n styleStats.compoundTests++;\n if (compound.host !== undefined && node.hostSheet !== sheet) return false;\n if (compound.root !== undefined && node.parent !== null) return false;\n if (compound.pseudo !== undefined) {\n for (const state of compound.pseudo) {\n if (state === 'focus' ? !node.focused : !node.active) return false;\n }\n }\n if (compound.type !== undefined && compound.type !== node.name) return false;\n if (compound.id !== undefined && node.props['nativeID'] !== compound.id) return false;\n for (const className of compound.classes) {\n if (!node.classes?.has(className)) return false;\n }\n if (compound.attributes) {\n for (const test of compound.attributes) {\n if (!matchesAttribute(node, test)) return false;\n }\n }\n // An anchor is a comment on the web, and :empty does not see comments.\n if (compound.empty !== undefined && node.children?.some((child) => child.kind !== 'anchor')) {\n return false;\n }\n if (compound.nth !== undefined) {\n for (const test of compound.nth) {\n if (!matchesNth(node, test)) return false;\n }\n }\n if (compound.not) {\n for (const excluded of compound.not) {\n if (matchesCompound(node, excluded, sheet)) return false;\n }\n }\n if (compound.is) {\n for (const alternatives of compound.is) {\n if (!alternatives.some((option) => matchesCompound(node, option, sheet))) return false;\n }\n }\n if (compound.ancestors) {\n for (const ancestor of compound.ancestors) {\n let found = false;\n // From the parent: a descendant combinator never matches the node against itself.\n for (let n = node.parent; n && !found; n = n.parent) {\n found = matchesCompound(n, ancestor, sheet);\n }\n if (!found) return false;\n }\n }\n if (compound.hostContext) {\n // The host itself counts, as it does on the web.\n let found = false;\n for (let n: StyleTarget | null = node; n && !found; n = n.parent) {\n found = compound.hostContext.some((option) => matchesCompound(n!, option, sheet));\n }\n if (!found) return false;\n }\n return true;\n}\n\n/**\n * Right-to-left matching, as every CSS engine does it: the rightmost compound is the cheapest\n * filter and rejects almost everything immediately.\n */\nexport function matches(\n node: StyleTarget,\n rule: StyleRule,\n sheet: StyleSheet | null = null,\n): boolean {\n styleStats.ruleTests++;\n const last = rule.compounds.length - 1;\n const subject = rule.compounds[last]!;\n // From the sheet of the component this node hosts, only a :host rule reaches it. Its other\n // rules are for the elements inside that component, which is how emulated encapsulation scopes\n // them on the web; without this, a class the parent puts on the host picks up the child's rule\n // of the same name.\n if (\n sheet !== null &&\n sheet === node.hostSheet &&\n sheet !== node.sheet &&\n subject.host === undefined\n ) {\n return false;\n }\n if (!matchesCompound(node, subject, sheet)) return false;\n return matchPrefix(node, rule, last - 1, sheet);\n}\n\n/**\n * Match the part of a selector to the left of an already-matched compound.\n *\n * `index` is the compound still to match, counting leftwards, and `from` is where to start\n * looking. A descendant combinator tries every ancestor and, crucially, keeps trying when the\n * rest of the selector does not work out from there. Taking the first ancestor that fits and\n * committing to it misses `.a > .b .c` whenever the nearest `.b` fails the child combinator while\n * a further one satisfies it, which is what the browser differential suite caught.\n */\nfunction matchPrefix(\n matched: StyleTarget,\n rule: StyleRule,\n index: number,\n sheet: StyleSheet | null,\n): boolean {\n if (index < 0) return true;\n\n const compound = rule.compounds[index]!;\n // `combinators[index]` joins this compound to the one on its right.\n switch (rule.combinators[index]) {\n case 'child':\n return matchStep(matched.parent, rule, index, compound, sheet);\n case 'next-sibling':\n return matchStep(previousElement(matched), rule, index, compound, sheet);\n case 'later-sibling':\n return matchAny(previousElement(matched), previousElement, rule, index, compound, sheet);\n default:\n return matchAny(matched.parent, (node) => node.parent, rule, index, compound, sheet);\n }\n}\n\n/** A combinator with exactly one candidate: the parent, or the sibling immediately before. */\nfunction matchStep(\n candidate: StyleTarget | null,\n rule: StyleRule,\n index: number,\n compound: Compound,\n sheet: StyleSheet | null,\n): boolean {\n if (!candidate || !matchesCompound(candidate, compound, sheet)) return false;\n return matchPrefix(candidate, rule, index - 1, sheet);\n}\n\n/**\n * A combinator with many candidates: every ancestor, or every earlier sibling.\n *\n * Crucially it keeps trying when the rest of the selector does not work out from a candidate that\n * fits. Taking the first and committing to it misses `.a > .b .c` whenever the nearest `.b` fails\n * the child combinator while a further one satisfies it, which is what the browser differential\n * suite caught.\n */\nfunction matchAny(\n first: StyleTarget | null,\n next: (node: StyleTarget) => StyleTarget | null,\n rule: StyleRule,\n index: number,\n compound: Compound,\n sheet: StyleSheet | null,\n): boolean {\n for (let candidate = first; candidate; candidate = next(candidate)) {\n if (\n matchesCompound(candidate, compound, sheet) &&\n matchPrefix(candidate, rule, index - 1, sheet)\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** Whether a node is one of the children CSS counts. Text and anchors are children, not elements. */\nconst isElement = (node: StyleTarget) => node.kind === undefined || node.kind === 'element';\n\n/** The element before this one, skipping everything that is not one. */\nfunction previousElement(node: StyleTarget): StyleTarget | null {\n const siblings = node.parent?.children;\n if (!siblings) return null;\n for (let i = siblings.indexOf(node) - 1; i >= 0; i--) {\n if (isElement(siblings[i]!)) return siblings[i]!;\n }\n return null;\n}\n\n/**\n * Whether a node's position satisfies `an + b`.\n *\n * ponytail: the general case counts the node's siblings, so a rule like `:nth-child(2n)` over a\n * long list is quadratic in it. The two that matter - first and last - are answered without\n * counting, and the rest wait for a list that is actually slow.\n */\nfunction matchesNth(node: StyleTarget, test: NthTest): boolean {\n const siblings = node.parent?.children;\n if (!siblings) return false;\n\n if (test.a === 0 && test.b === 1) {\n return (test.fromEnd ? lastElement(siblings) : firstElement(siblings)) === node;\n }\n\n const from = countPosition(node, siblings, test.fromEnd === true);\n if (from === 0) return false;\n // `an + b` for some whole number of steps, which is what CSS counts from.\n if (test.a === 0) return from === test.b;\n const steps = (from - test.b) / test.a;\n return Number.isInteger(steps) && steps >= 0;\n}\n\n/** Which element this is among its siblings, counting from one end or the other. Zero if absent. */\n/**\n * Drop from the pending deferred set every property a later rule has now set outright.\n *\n * Per property rather than per declaration: one deferred declaration can cover four sides, and a\n * later `padding-left` should take only that side away from it.\n */\nfunction overriddenBy(\n deferred: DeferredDeclaration[],\n declarations: Readonly<Record<string, unknown>>,\n important: boolean,\n): DeferredDeclaration[] | null {\n const kept: DeferredDeclaration[] = [];\n for (const declaration of deferred) {\n // A plain declaration cannot take anything from an important one.\n if (declaration.important && !important) {\n kept.push(declaration);\n continue;\n }\n const props = declaration.props.filter((prop) => !(prop in declarations));\n if (props.length === declaration.props.length) kept.push(declaration);\n else if (props.length) kept.push({ ...declaration, props });\n }\n return kept.length ? kept : null;\n}\n\n/**\n * The deferred values still standing once `rule` has been applied, plus its own.\n *\n * A plain declaration from this rule beats a `var()` from an earlier one. Deferred values are\n * resolved after the cascade has run, so without this a token would win whatever the cascade\n * said: `.row { background: var(--surface) }` would repaint over\n * `.row:nth-child(odd) { background: ... }`, which is a rule with a pseudo-class on top of the\n * same class and should win. An important one survives a plain declaration, and only an important\n * declaration takes it away.\n */\nfunction carryDeferred(\n deferred: DeferredDeclaration[] | null,\n rule: StyleRule,\n): DeferredDeclaration[] | null {\n let kept = deferred;\n if (kept && Object.keys(rule.declarations).length) {\n kept = overriddenBy(kept, rule.declarations, false);\n }\n if (kept && rule.important) kept = overriddenBy(kept, rule.important, true);\n if (rule.deferred) (kept ??= []).push(...rule.deferred);\n return kept;\n}\n\nfunction countPosition(\n node: StyleTarget,\n siblings: readonly StyleTarget[],\n fromEnd: boolean,\n): number {\n let position = 0;\n let seen = 0;\n for (const sibling of siblings) {\n if (!isElement(sibling)) continue;\n seen++;\n if (sibling === node) position = seen;\n }\n if (position === 0) return 0;\n return fromEnd ? seen - position + 1 : position;\n}\n\nfunction firstElement(siblings: readonly StyleTarget[]): StyleTarget | null {\n for (const sibling of siblings) if (isElement(sibling)) return sibling;\n return null;\n}\n\nfunction lastElement(siblings: readonly StyleTarget[]): StyleTarget | null {\n for (let i = siblings.length - 1; i >= 0; i--) {\n if (isElement(siblings[i]!)) return siblings[i]!;\n }\n return null;\n}\n\n/**\n * How much specificity a component's own rules gain over the application's global sheet.\n *\n * One class, which is precisely what Angular's emulated encapsulation already grants them by\n * rewriting a component rule to carry an `[_ngcontent-x]` attribute. Matching that keeps the\n * precedence people already have in their fingers rather than inventing a rule for native.\n */\nconst COMPONENT_SPECIFICITY_BUMP = 1_000;\n\n/** One rule in a cascade: the sheet it came from, which `:host` needs, and its weight here. */\ninterface RuleEntry {\n readonly rule: StyleRule;\n readonly sheet: StyleSheet;\n readonly weight: number;\n}\n\n/**\n * The bucket a rule is filed under: the most selective simple selector in its rightmost compound,\n * which is what a browser calls the key selector.\n *\n * Matching counts leftwards from that compound, so if it cannot match a node then nothing to its\n * left needs looking at. Anything that could match a node whose name, id and classes say nothing -\n * an attribute test, `:host`, `:is()`, a bare pseudo-class, `*` - goes in the universal bucket and\n * is offered to everything, because the alternative is a rule that silently stops applying.\n */\nexport function ruleKey(rule: StyleRule): string {\n const key = rule.compounds[rule.compounds.length - 1];\n if (!key) return UNIVERSAL;\n if (key.classes.length) return `class:${key.classes[0]}`;\n if (key.id !== undefined) return `id:${key.id}`;\n if (key.type !== undefined) return `type:${key.type}`;\n return UNIVERSAL;\n}\n\nconst UNIVERSAL = '*';\n\n/** Where a rule sits in the merged, weight-sorted list. The cascade depends on that order. */\ninterface IndexedEntry {\n readonly entry: RuleEntry;\n readonly at: number;\n}\n\nexport interface RuleIndex {\n readonly buckets: ReadonlyMap<string, readonly IndexedEntry[]>;\n readonly universal: readonly IndexedEntry[];\n}\n\n/** File a merged, sorted rule list by key selector. Done once per sheet pair, not per node. */\nexport function indexRules(entries: readonly RuleEntry[]): RuleIndex {\n const buckets = new Map<string, IndexedEntry[]>();\n const universal: IndexedEntry[] = [];\n entries.forEach((entry, at) => {\n const key = ruleKey(entry.rule);\n if (key === UNIVERSAL) {\n universal.push({ entry, at });\n return;\n }\n let bucket = buckets.get(key);\n if (!bucket) buckets.set(key, (bucket = []));\n bucket.push({ entry, at });\n });\n return { buckets, universal };\n}\n\n/**\n * The rules worth trying against a node, in the order they were merged in.\n *\n * Each bucket is already in order, so the collected list only needs sorting when more than one\n * contributed - which for a node with one class and a name is the common case, and cheap: the\n * lists are short by construction, which is the entire point of the index.\n */\nexport function candidateRules(node: StyleTarget, index: RuleIndex): RuleEntry[] {\n const found: IndexedEntry[][] = [];\n if (index.universal.length) found.push(index.universal as IndexedEntry[]);\n const byName = index.buckets.get(`type:${node.name}`);\n if (byName) found.push(byName as IndexedEntry[]);\n const id = node.props['nativeID'];\n if (typeof id === 'string') {\n const byId = index.buckets.get(`id:${id}`);\n if (byId) found.push(byId as IndexedEntry[]);\n }\n if (node.classes) {\n for (const name of node.classes) {\n const byClass = index.buckets.get(`class:${name}`);\n if (byClass) found.push(byClass as IndexedEntry[]);\n }\n }\n if (!found.length) return [];\n if (found.length === 1) return found[0]!.map((indexed) => indexed.entry);\n const merged = found.flat();\n merged.sort((a, b) => a.at - b.at);\n return merged.map((indexed) => indexed.entry);\n}\n\n/** What the rules matching one node add up to. */\ninterface CascadeResult {\n readonly declarations: Record<string, unknown>;\n /** The important declarations alone, which a deferred value that is not important cannot beat. */\n readonly important: Record<string, unknown> | null;\n readonly tokens: Record<string, TokenValue> | null;\n readonly deferred: DeferredDeclaration[] | null;\n}\n\n/** What `em` falls back to when nothing in scope has set a font size. The web's default. */\nconst DEFAULT_FONT_SIZE = 16;\n\n/** Shared empty result. Never handed out anywhere that mutates it. */\nconst EMPTY: Record<string, unknown> = {};\n\n/** Stands in for the parent of a root node, so the comparison needs no null case. */\nconst ROOT_CONTEXT: object = {};\n\n/** Shared empty token map, for the overwhelmingly common case of a subtree defining none. */\nconst NO_TOKENS: Readonly<Record<string, TokenValue>> = {};\n\n/** Stands in for \"created by a component with no sheet\" as a cache key. */\nconst NO_SHEET: StyleSheet = { rules: [] };\n\n/**\n * Conditions generations are unique across every resolver in the process, not merely\n * increasing within one, because the memo they stamp lives on the compiled rule and a sheet is\n * shared by every engine that mounts the component.\n */\nlet generations = 0;\n\nfunction emptyCacheFor(epoch: number, generation: number): StyleCache {\n return {\n epoch,\n generation,\n context: ROOT_CONTEXT,\n parentContext: ROOT_CONTEXT,\n style: EMPTY,\n inherited: EMPTY,\n tokens: NO_TOKENS,\n };\n}\n\n/**\n * What this node's children inherit: the parent's map, overlaid with any inheritable value the\n * node set itself. Copied on first write only, so a node that sets none hands the same object on\n * and a whole subtree can share it.\n */\nfunction inheritFrom(\n parentInherited: Record<string, unknown>,\n own: Record<string, unknown>,\n): Record<string, unknown> {\n let inherited = parentInherited;\n for (const key of Object.keys(own)) {\n if (!INHERITED.has(key)) continue;\n if (inherited === parentInherited) inherited = { ...parentInherited };\n inherited[key] = own[key];\n }\n return inherited;\n}\n\n/**\n * The runtime half of CSS for one engine: the global sheet, the conditions media queries are\n * evaluated against, and the memo that makes resolution cost nodes x rules rather than\n * nodes x rules x depth.\n *\n * One per engine rather than module state, so two surfaces in one process (or two engines in\n * one test) cannot overwrite each other's sheet or viewport.\n *\n * Inherited state is pushed **down** rather than walked up: a node takes what its parent already\n * resolved and overlays its own declarations. That is how real CSS engines do it, and it matters\n * for two separate reasons.\n *\n * Correctness first. Walking up meant matching every ancestor against the *starting node's*\n * sheet, but an ancestor almost always belongs to a different component, so a component's rules\n * reached nodes it did not own while a parent's real values never arrived. Reading `sheet` off\n * each node fixes both directions at once.\n *\n * Cost second. Walking up re-derived, for every node, everything its parent had already worked\n * out. Memoising by epoch makes it nodes x rules, and a node that sets no inheritable value hands\n * its parent's map straight on rather than copying it, so the common case allocates nothing.\n */\nexport class StyleResolver {\n private conditions: Conditions;\n /**\n * Bumped whenever the conditions move. Every cached result and every per-rule condition memo\n * is stamped with it, so a rotation or a theme switch invalidates the lot in one assignment\n * rather than walking the tree.\n */\n private generation = ++generations;\n private emptyCache = emptyCacheFor(-1, -1);\n /**\n * The rules a node is matched against, merged across the global sheet, the sheet of the\n * component it hosts and the sheet that created it, sorted once by weight and then filed by key\n * selector. Keyed by the creating sheet and then the hosted one, so a component's nodes share a\n * single index.\n */\n private readonly merged = new WeakMap<StyleSheet, Map<StyleSheet | null, RuleIndex>>();\n\n /**\n * The application-level sheet, if any: the one set of rules allowed to match a node whatever\n * component created it, which is what resets, utility classes and `:root` tokens all need.\n */\n private readonly globalSheet: StyleSheet | null;\n\n /**\n * Custom properties the host supplies rather than the stylesheet: the safe-area insets, and\n * whatever else is a property of the device instead of the design.\n *\n * Seeded rather than forced. They stand in for the root's inherited tokens, so a `:root` rule\n * in the app's own sheet overrides them the way it would override anything it inherited, and an\n * app that wants to pin an inset for a tablet layout or a screenshot still can.\n */\n private tokensOnRoot: Readonly<Record<string, TokenValue>> = NO_TOKENS;\n\n /** What the host has supplied so far, so a second source can add to it rather than replace it. */\n get rootTokens(): Readonly<Record<string, TokenValue>> {\n return this.tokensOnRoot;\n }\n\n /**\n * Told of a `var()` that names a custom property nothing in scope defines and has no fallback,\n * which is dropped. Set only in development, where it is how the engine says so.\n */\n onUndefinedToken: ((name: string, props: readonly string[]) => void) | null = null;\n\n constructor(globalSheet: StyleSheet | null, conditions: Conditions) {\n this.globalSheet = globalSheet;\n this.conditions = conditions;\n }\n\n setConditions(next: Conditions): void {\n this.conditions = next;\n this.generation = ++generations;\n }\n\n setRootTokens(next: Readonly<Record<string, TokenValue>>): void {\n this.tokensOnRoot = next;\n this.generation = ++generations;\n }\n\n /**\n * Resolve a node, memoised for the life of one epoch.\n *\n * `epoch` scopes the memo. The engine bumps it once per commit, so within a commit each node\n * resolves at most once however many descendants ask for its inherited values.\n */\n resolve(node: StyleTarget, epoch: number): StyleCache {\n const cached = node.styleCache;\n // Within one commit a node is asked for its inherited map once per descendant, so this is the\n // hot path and it must not walk anywhere.\n if (cached !== null && cached.epoch === epoch) return cached;\n\n const parent = node.parent ? this.resolve(node.parent, epoch) : null;\n const parentContext = parent ? parent.context : ROOT_CONTEXT;\n\n // Across commits: nothing about this node changed and nothing above it moved, so the last\n // answer still holds. Reusing the object, rather than recomputing an equal one, is what lets\n // a descendant tell \"unchanged\" from \"changed\" by reference alone.\n if (this.reusable(cached, node, parentContext)) {\n cached.epoch = epoch;\n return cached;\n }\n\n const parentInherited = parent ? parent.inherited : EMPTY;\n\n if (this.hasNoRules(node)) {\n return this.unstyled(node, epoch, parent, parentContext, parentInherited);\n }\n\n styleStats.nodesResolved++;\n\n const result = this.cascade(node, this.rulesFor(node));\n\n // Tokens are in scope for this node's own declarations as well as its descendants', so they\n // are merged before any `var()` here is resolved.\n const parentTokens = parent ? parent.tokens : this.tokensOnRoot;\n const tokens = tokensInScope(parentTokens, result.tokens, node.customProperties);\n\n const own = result.declarations;\n if (result.deferred) {\n this.applyDeferred(result.deferred, own, tokens, parentInherited, result.important);\n }\n if (own['borderStyle'] === 'none') drawNoBorder(own);\n\n const cache: StyleCache = {\n epoch,\n generation: this.generation,\n context: {},\n parentContext,\n style: { ...parentInherited, ...own },\n inherited: inheritFrom(parentInherited, own),\n tokens,\n };\n node.styleCache = cache;\n node.styleDirty = false;\n return cache;\n }\n\n /**\n * Whether a node's last answer still stands under a parent that resolved to `parentContext`,\n * without resolving it. What lets a commit step over a clean child in one comparison.\n */\n holds(node: StyleTarget, parentContext: object): boolean {\n return this.reusable(node.styleCache, node, parentContext);\n }\n\n /**\n * Whether a previous result still stands: nothing about the node changed, nothing above it\n * moved, and the conditions have not.\n */\n private reusable(\n cached: StyleCache | null,\n node: StyleTarget,\n parentContext: object,\n ): cached is StyleCache {\n return (\n cached !== null &&\n !node.styleDirty &&\n cached.parentContext === parentContext &&\n cached.generation === this.generation\n );\n }\n\n /**\n * Nothing anywhere can match this node, and it sets no custom property of its own, so its style\n * is whatever it inherits.\n */\n private hasNoRules(node: StyleTarget): boolean {\n return (\n node.sheet === null &&\n node.hostSheet === null &&\n this.globalSheet === null &&\n !node.customProperties\n );\n }\n\n /**\n * A node with no rules anywhere: it renders with what it inherits and passes the same map on.\n *\n * It still mints a context, because a rule further down may match on one of *its* classes.\n * When there is nothing to inherit either, one shared cache object serves every such node, so\n * an application that writes no CSS allocates nothing per node.\n */\n private unstyled(\n node: StyleTarget,\n epoch: number,\n parent: StyleCache | null,\n parentContext: object,\n parentInherited: Record<string, unknown>,\n ): StyleCache {\n if (parentInherited === EMPTY && parentContext === ROOT_CONTEXT && !node.styleDirty) {\n if (this.emptyCache.epoch !== epoch || this.emptyCache.generation !== this.generation) {\n this.emptyCache = emptyCacheFor(epoch, this.generation);\n }\n node.styleCache = this.emptyCache;\n return this.emptyCache;\n }\n\n const passthrough: StyleCache = {\n epoch,\n generation: this.generation,\n context: {},\n parentContext,\n style: parentInherited,\n inherited: parentInherited,\n tokens: parent ? parent.tokens : this.tokensOnRoot,\n };\n node.styleCache = passthrough;\n node.styleDirty = false;\n return passthrough;\n }\n\n /**\n * The rules worth trying against a node.\n *\n * The merged list is built once per (creating sheet, hosted sheet) pair and indexed by key\n * selector; what comes back here is only the buckets this node can reach. For a component's own\n * sheet that changes little, but a global utility sheet is hundreds of rules and a screen is a\n * thousand nodes, and the difference is between a million match attempts and a few thousand.\n */\n private rulesFor(node: StyleTarget): readonly RuleEntry[] {\n const creator = node.sheet ?? NO_SHEET;\n let byHost = this.merged.get(creator);\n if (!byHost) this.merged.set(creator, (byHost = new Map()));\n let index = byHost.get(node.hostSheet);\n if (!index) {\n byHost.set(node.hostSheet, (index = indexRules(this.merge(node.sheet, node.hostSheet))));\n }\n return candidateRules(node, index);\n }\n\n /**\n * Weakest first. A host node is matched against two component sheets: the one belonging to the\n * component it hosts, whose `:host` rules exist to reach exactly this node, and the one that\n * created it. Both carry the bump; the creator comes later and so wins a tie, as the outer\n * document does over `:host` on the web. The sort is stable, so within one sheet source order\n * survives and a later sheet wins equal weight.\n */\n private merge(sheet: StyleSheet | null, hostSheet: StyleSheet | null): RuleEntry[] {\n const entries: RuleEntry[] = [];\n const add = (from: StyleSheet | null, bump: number): void => {\n if (!from) return;\n for (const rule of from.rules) {\n entries.push({ rule, sheet: from, weight: rule.specificity + bump });\n }\n };\n add(this.globalSheet, 0);\n add(hostSheet, COMPONENT_SPECIFICITY_BUMP);\n add(sheet, COMPONENT_SPECIFICITY_BUMP);\n return entries.sort((a, b) => a.weight - b.weight);\n }\n\n /** The declarations that apply to a node. The list is sorted, so later simply wins. */\n private cascade(node: StyleTarget, entries: readonly RuleEntry[]): CascadeResult {\n const normal: Record<string, unknown> = {};\n const important: Record<string, unknown> = {};\n let hasImportant = false;\n let tokens: Record<string, TokenValue> | null = null;\n let deferred: DeferredDeclaration[] | null = null;\n\n for (const { rule, sheet } of entries) {\n if (!this.conditionHolds(rule) || !matches(node, rule, sheet)) continue;\n Object.assign(normal, rule.declarations);\n if (rule.important) {\n Object.assign(important, rule.important);\n hasImportant = true;\n }\n if (rule.tokens) Object.assign((tokens ??= {}), rule.tokens);\n deferred = carryDeferred(deferred, rule);\n }\n\n return {\n declarations: hasImportant ? { ...normal, ...important } : normal,\n important: hasImportant ? important : null,\n tokens,\n deferred,\n };\n }\n\n /**\n * Whether a rule's media query holds, memoised per rule.\n *\n * Conditions are the same for every node, so this is answered once per rule per change rather\n * than once per rule per node.\n */\n private conditionHolds(rule: StyleRule): boolean {\n if (rule.condition === undefined) return true;\n if (rule.activeAt !== this.generation) {\n rule.activeAt = this.generation;\n rule.active = this.evaluate(rule.condition);\n }\n return rule.active!;\n }\n\n private evaluate(condition: MediaCondition): boolean {\n if ('all' in condition) return condition.all.every((part) => this.evaluate(part));\n if ('any' in condition) return condition.any.some((part) => this.evaluate(part));\n\n if (!('op' in condition)) return this.preference(condition.feature) === condition.value;\n\n const { width, height } = this.conditions;\n const actual = condition.feature === 'width' ? width : height;\n const { op, value } = condition;\n if (op === 'gt') return actual > value;\n if (op === 'gte') return actual >= value;\n if (op === 'lt') return actual < value;\n if (op === 'lte') return actual <= value;\n return actual === value;\n }\n\n /** What the device answers for a feature that is a keyword rather than a measurement. */\n private preference(feature: 'orientation' | 'prefers-color-scheme' | 'prefers-reduced-motion') {\n const { width, height, colorScheme, reducedMotion } = this.conditions;\n if (feature === 'orientation') return width > height ? 'landscape' : 'portrait';\n if (feature === 'prefers-color-scheme') return colorScheme;\n return reducedMotion ? 'reduce' : 'no-preference';\n }\n\n /** A length relative to the viewport, in points. */\n private viewportLength(unit: 'vw' | 'vh' | 'vmin' | 'vmax', factor: number): number {\n const { width, height } = this.conditions;\n const basis = {\n vw: width,\n vh: height,\n vmin: Math.min(width, height),\n vmax: Math.max(width, height),\n };\n return (factor * basis[unit]) / 100;\n }\n\n /**\n * Write the declarations that could not be settled at build time: a `var()` reference, or a\n * length relative to the viewport or to the font size in scope.\n *\n * A declaration with no token and no usable fallback is dropped rather than written as\n * undefined, which is what a browser does with a value it cannot resolve.\n */\n private applyDeferred(\n deferred: readonly DeferredDeclaration[],\n own: Record<string, unknown>,\n tokens: Readonly<Record<string, TokenValue>>,\n parentInherited: Record<string, unknown>,\n important: Record<string, unknown> | null,\n ): void {\n for (const declaration of settlingOrder(deferred)) {\n const settled = this.settled(declaration, own, parentInherited, tokens);\n if (settled === undefined && this.onUndefinedToken) {\n this.reportUndefined(declaration, tokens);\n }\n const value = settled ?? declaration.unset;\n if (value === undefined) continue;\n for (const prop of declaration.props) {\n if (!declaration.important && important && prop in important) continue;\n own[prop] = value;\n }\n }\n }\n\n /** One deferred declaration's value, from the tokens in scope and the node's own style. */\n private settled(\n declaration: DeferredDeclaration,\n own: Record<string, unknown>,\n parentInherited: Record<string, unknown>,\n tokens: Readonly<Record<string, TokenValue>>,\n ): unknown {\n if (declaration.within !== undefined) {\n return this.settledWithin(declaration.within, declaration, own, parentInherited, tokens);\n }\n if (declaration.compute) return this.computed(declaration, own, parentInherited);\n const value = referenced(declaration, tokens);\n if (declaration.whenSet !== undefined)\n return value === undefined ? undefined : declaration.whenSet;\n // A token defined in `em` or a viewport unit cannot be settled where it is defined: a\n // browser substitutes it and works it out where it is used, so the same here.\n const pending = (value as { __defer?: DeferredDeclaration['compute'] } | null)?.__defer;\n if (pending) return this.computed({ ...declaration, compute: pending }, own, parentInherited);\n // A token can hold a structured value with markers of its own: a shadow token whose colour\n // is another token, as Tailwind's rings are.\n return typeof value === 'object' && value !== null\n ? this.settledWithin(value, declaration, own, parentInherited, tokens)\n : value;\n }\n\n /** A reference with nothing defined for it and nothing to fall back to. */\n private reportUndefined(\n declaration: DeferredDeclaration,\n tokens: Readonly<Record<string, TokenValue>>,\n ): void {\n const name = declaration.reference;\n if (name === undefined || declaration.fallback !== undefined || name in tokens) return;\n if (declaration.alternatives?.some((alternative) => alternative in tokens)) return;\n this.onUndefinedToken!(name, declaration.props);\n }\n\n /**\n * A structured value with every deferred length and colour inside it settled, or undefined when\n * a colour in it cannot be: a shadow with no colour is not a shadow, as CSS reads it.\n */\n private settledWithin(\n value: unknown,\n declaration: DeferredDeclaration,\n own: Record<string, unknown>,\n parentInherited: Record<string, unknown>,\n tokens: Readonly<Record<string, TokenValue>>,\n ): unknown {\n const filled = this.filledIn(value, declaration, own, parentInherited, tokens);\n if (filled === UNSETTLED) return undefined;\n // As the compiler drops a shadow nobody can see: Tailwind composes five, four of them nothing.\n return declaration.props.includes('boxShadow') && Array.isArray(filled)\n ? filled.filter((shadow) => !invisible((shadow as { color?: unknown }).color))\n : filled;\n }\n\n /** A structured value with every deferred length and colour inside it settled. */\n private filledIn(\n value: unknown,\n declaration: DeferredDeclaration,\n own: Record<string, unknown>,\n parentInherited: Record<string, unknown>,\n tokens: Readonly<Record<string, TokenValue>>,\n ): unknown {\n if (!needsFilling(value)) return value;\n const fill = (part: unknown) => this.filledIn(part, declaration, own, parentInherited, tokens);\n if (Array.isArray(value)) return this.filledList(value, fill, tokens);\n const marked = settledMarker(value, tokens);\n // `currentcolor` is the colour in scope, which only the node knows: Tailwind's ring default.\n if (marked === 'currentcolor') return own['color'] ?? parentInherited['color'] ?? 'black';\n if (marked !== NOT_A_MARKER) return marked ?? UNSETTLED;\n const pending = (value as { __defer?: DeferredDeclaration['compute'] }).__defer;\n if (pending) return this.computed({ ...declaration, compute: pending }, own, parentInherited);\n const out: Record<string, unknown> = {};\n for (const [key, part] of Object.entries(value)) {\n const filled = fill(part);\n if (filled === UNSETTLED) return UNSETTLED;\n out[key] = filled;\n }\n return out;\n }\n\n /**\n * A list's parts filled in, a whole shadow or filter token standing for however many entries it\n * holds: none, for an empty filter slot.\n */\n private filledList(\n value: readonly unknown[],\n fill: (part: unknown) => unknown,\n tokens: Readonly<Record<string, TokenValue>>,\n ): unknown {\n const parts: unknown[] = [];\n for (const part of value) {\n const slot = slotOf(part);\n if (!slot) {\n const filled = fill(part);\n if (filled === UNSETTLED) return UNSETTLED;\n parts.push(filled);\n continue;\n }\n const filled = fill(formOf(tokens[slot.marker.reference], slot.kind) ?? slot.marker.fallback);\n if (filled === UNSETTLED || !Array.isArray(filled)) return UNSETTLED;\n parts.push(...filled);\n }\n return parts;\n }\n\n /** A length relative to the viewport or to the font size in scope. */\n private computed(\n declaration: DeferredDeclaration,\n own: Record<string, unknown>,\n parentInherited: Record<string, unknown>,\n ): unknown {\n const { unit, factor, offset = 0 } = declaration.compute!;\n if (unit !== 'em') return this.viewportLength(unit, factor) + offset;\n // The font size in scope. On `font-size` itself that is the inherited size rather than the\n // one being computed, which is what makes a nested `1.5em` compound as on the web.\n const base = declaration.props.includes('fontSize')\n ? parentInherited['fontSize']\n : (own['fontSize'] ?? parentInherited['fontSize']);\n return factor * (typeof base === 'number' ? base : DEFAULT_FONT_SIZE) + offset;\n }\n}\n\n/**\n * The order a node's deferred declarations are settled in.\n *\n * Plain ones first and important ones after, so an important one wins whatever order they matched\n * in; and a plain one never writes over an important declaration. The font size before everything\n * else, because an em anywhere on the node is measured against it, whichever rule it came from:\n * '.x { padding: 1em } .y { font-size: 2em }'. Then the colour, because a `currentcolor` anywhere\n * on the node is the node's own colour: a ring's default, beside a `color: var(--c)`.\n */\nfunction settlingOrder(deferred: readonly DeferredDeclaration[]): readonly DeferredDeclaration[] {\n const byImportance = deferred.some((one) => one.important)\n ? [...deferred.filter((one) => !one.important), ...deferred.filter((one) => one.important)]\n : deferred;\n const rank = (one: DeferredDeclaration) =>\n one.props.includes('fontSize') ? 0 : one.props.includes('color') ? 1 : 2;\n return byImportance.some((one) => rank(one) < 2)\n ? [0, 1, 2].flatMap((wanted) => byImportance.filter((one) => rank(one) === wanted))\n : byImportance;\n}\n\n/**\n * The aliases, hsl() colours and channel colours among a node's own definitions, resolved against everything in\n * scope on it. Done once, where they are defined, so a descendant only ever sees values. A name\n * that resolves to nothing - undefined, part of a cycle, or an hsl() missing a channel - is\n * dropped, as a browser treats it as unset.\n *\n * Aliases first: an hsl() channel that names a plain token reads it whichever order these run in,\n * but an alias that names an hsl() token needs the hsl() already turned into a colour.\n */\n/**\n * The tokens in scope at a node: its parent's, overlaid with what its rules define, overlaid with\n * what it sets itself, which wins as inline style does.\n */\nfunction tokensInScope(\n parentTokens: Readonly<Record<string, TokenValue>>,\n ruleTokens: Readonly<Record<string, TokenValue>> | null,\n custom: Readonly<Record<string, TokenValue>> | null | undefined,\n): Readonly<Record<string, TokenValue>> {\n const own = custom ? { ...ruleTokens, ...custom } : ruleTokens;\n return own ? resolveAliases(own, { ...parentTokens, ...own }) : parentTokens;\n}\n\nfunction resolveAliases(\n own: Readonly<Record<string, TokenValue>>,\n merged: Record<string, TokenValue>,\n): Record<string, TokenValue> {\n const names = Object.keys(own);\n for (const name of names) {\n if (own[name]!.alias) settle(merged, name, followAlias(name, merged, new Set()));\n }\n for (const name of names) {\n const { hsl, deferredColour } = own[name]!;\n if (hsl) settle(merged, name, colourToken(resolveHsl(hsl, merged)));\n if (deferredColour) settle(merged, name, colourToken(channelsColour(deferredColour, merged)));\n }\n // An alias to one of those copied it unsettled above: follow it again, now it is a colour.\n for (const name of names) {\n const target = own[name]!.alias;\n if (!target || !(own[target]?.hsl || own[target]?.deferredColour)) continue;\n settle(merged, name, followAlias(name, { ...merged, [name]: own[name]! }, new Set()));\n }\n return merged;\n}\n\n/** A token set to what it resolved to, or removed when it resolved to nothing, as CSS unsets it. */\nfunction settle(\n merged: Record<string, TokenValue>,\n name: string,\n value: TokenValue | undefined,\n): void {\n if (value) merged[name] = value;\n else delete merged[name];\n}\n\nconst colourToken = (color: string | undefined): TokenValue | undefined =>\n color === undefined ? undefined : { color };\n\n/** An `hsl()` token's channels, read from the tokens in scope, as the colour they make. */\nfunction resolveHsl(\n hsl: NonNullable<TokenValue['hsl']>,\n tokens: Readonly<Record<string, TokenValue>>,\n): string | undefined {\n const h = hslChannel(hsl.h, tokens);\n const s = hslChannel(hsl.s, tokens);\n const l = hslChannel(hsl.l, tokens);\n const alpha = hsl.alpha === undefined ? 1 : hslChannel(hsl.alpha, tokens);\n if (h === undefined || s === undefined || l === undefined || alpha === undefined) {\n return undefined;\n }\n return hslToRgb(h, s, l, alpha);\n}\n\nfunction hslChannel(\n channel: HslChannel,\n tokens: Readonly<Record<string, TokenValue>>,\n): number | undefined {\n return typeof channel === 'number'\n ? channel\n : (tokens[channel.reference]?.number ?? channel.fallback);\n}\n\n/**\n * `hsl(h, s, l)` converted to sRGB, printed the same way `fromChannels` prints an rgba() built\n * from tokens: a use site never has to know which of the two ever built a colour.\n *\n * `h` is degrees; `s` and `l` are fractions, which is what a percentage token already reads as\n * (see `formOf`), so nothing here rescales them.\n */\nfunction hslToRgb(h: number, s: number, l: number, alpha: number): string {\n const hue = ((h % 360) + 360) % 360;\n const chroma = (1 - Math.abs(2 * l - 1)) * s;\n const x = chroma * (1 - Math.abs(((hue / 60) % 2) - 1));\n const m = l - chroma / 2;\n const [r1, g1, b1] =\n hue < 60\n ? [chroma, x, 0]\n : hue < 120\n ? [x, chroma, 0]\n : hue < 180\n ? [0, chroma, x]\n : hue < 240\n ? [0, x, chroma]\n : hue < 300\n ? [x, 0, chroma]\n : [chroma, 0, x];\n const r = Math.round((r1 + m) * 255);\n const g = Math.round((g1 + m) * 255);\n const b = Math.round((b1 + m) * 255);\n return alpha >= 1\n ? `rgb(${r}, ${g}, ${b})`\n : `rgba(${r}, ${g}, ${b}, ${Math.round(alpha * 1000) / 1000})`;\n}\n\nfunction followAlias(\n name: string,\n tokens: Readonly<Record<string, TokenValue>>,\n seen: Set<string>,\n): TokenValue | undefined {\n const value = tokens[name];\n if (!value?.alias) return value;\n if (seen.has(name)) return undefined;\n seen.add(name);\n return followAlias(value.alias, tokens, seen) ?? value.fallback;\n}\n\n/** What a `var()` resolves to: a gradient's stops, or one value with its arithmetic applied. */\nfunction referenced(\n declaration: DeferredDeclaration,\n tokens: Readonly<Record<string, TokenValue>>,\n): unknown {\n if (declaration.gradient) return paintLayers(declaration.gradient, tokens);\n let value = formOf(tokens[declaration.reference!], declaration.kind!);\n // `calc(var(--n) * 1px)`: the arithmetic gives a unitless token its unit, which is the usual\n // way to turn a count into a length. So a length with arithmetic reads the bare number too.\n if (value === undefined && declaration.adjust && declaration.kind === 'length') {\n value = tokens[declaration.reference!]?.number;\n }\n for (const alternative of declaration.alternatives ?? []) {\n if (value !== undefined) break;\n value = formOf(tokens[alternative], declaration.kind!);\n }\n value ??= declaration.fallback;\n const base =\n declaration.kind === 'channels' ? fromChannels(value, declaration.alpha, tokens) : value;\n return declaration.adjust ? adjusted(base, declaration.adjust) : base;\n}\n\n/** `13, 110, 253` as the colour it is, at the alpha the token beside it says, if one does. */\nfunction fromChannels(\n value: unknown,\n alpha: DeferredDeclaration['alpha'],\n tokens: Readonly<Record<string, TokenValue>>,\n): string | undefined {\n if (!Array.isArray(value) || value.length !== 3) return undefined;\n // An alpha naming a token nothing set, with no fallback, is no colour: CSS drops it.\n const opacity = alpha ? (tokens[alpha.reference]?.number ?? alpha.fallback) : 1;\n if (opacity === undefined) return undefined;\n const [r, g, b] = value as number[];\n return opacity >= 1\n ? `rgb(${r}, ${g}, ${b})`\n : `rgba(${r}, ${g}, ${b}, ${Math.round(opacity * 1000) / 1000})`;\n}\n\n/** One template, or a layered background of several: every layer painted, or, as CSS would, none. */\nfunction paintLayers(\n gradient: GradientTemplate | readonly GradientTemplate[],\n tokens: Readonly<Record<string, TokenValue>>,\n): unknown {\n if (!Array.isArray(gradient)) return paintGradient(gradient as GradientTemplate, tokens);\n const painted: unknown[] = [];\n for (const layer of gradient as readonly GradientTemplate[]) {\n const one = paintGradient(layer, tokens) as unknown[] | undefined;\n if (!one) return undefined;\n painted.push(...one);\n }\n return painted;\n}\n\n/**\n * A gradient template with its stops filled in from the cascade.\n *\n * A stop whose colour is not defined anywhere is dropped rather than painted transparent: that is\n * what makes an optional middle colour optional, and it is what a browser does with the same\n * stylesheet. Fewer than two colours is not a gradient, and paints nothing at all.\n */\nfunction paintGradient(\n template: GradientTemplate,\n tokens: Readonly<Record<string, TokenValue>>,\n): unknown {\n const colorStops = paintedStops(template, tokens);\n if (colorStops.length < 2) return undefined;\n const position = template.position && placed(template.position, tokens);\n if (position === null) return undefined;\n return [{ ...template, colorStops, ...(position ? { position } : {}) }];\n}\n\n/** A template's stops with their tokens read, leaving out any whose colour is not set. */\nfunction paintedStops(\n template: GradientTemplate,\n tokens: Readonly<Record<string, TokenValue>>,\n): { color: string; position: string | number | null }[] {\n const colorStops = [];\n for (const stop of template.colorStops) {\n const color = stop.colour ? resolveColour(stop.colour, tokens) : tokens[stop.reference!]?.color;\n if (color === undefined) continue;\n const position = stop.positionReference\n ? (tokens[stop.positionReference]?.length ?? stop.position)\n : stop.position;\n // Written even when there is none: Fabric looks the key up before it looks at the value, and\n // silently skips a stop that has not got one.\n colorStops.push({ color, position: (position as string | number | undefined) ?? null });\n }\n return colorStops;\n}\n\n/**\n * A radial gradient's centre with any token in it read, or null when a token it needs is not set\n * and has nothing written beside it: CSS would not paint the gradient then, and neither does this.\n */\nfunction placed(\n position: NonNullable<GradientTemplate['position']>,\n tokens: Readonly<Record<string, TokenValue>>,\n): Record<string, unknown> | null {\n const out: Record<string, unknown> = {};\n for (const [edge, offset] of Object.entries(position)) {\n if (offset === null || typeof offset !== 'object') {\n out[edge] = offset;\n continue;\n }\n const { reference, fallback } = offset as { reference: string; fallback?: string | number };\n const value = tokens[reference]?.length ?? fallback;\n if (value === undefined || typeof value === 'object') return null;\n out[edge] = value;\n }\n return out;\n}\n\n/**\n * A colour expression with its tokens looked up and any mix in it worked out. Undefined when a\n * token it needs is not defined anywhere and has nothing to fall back to.\n */\nfunction resolveColour(\n expression: ColourExpression,\n tokens: Readonly<Record<string, TokenValue>>,\n): string | undefined {\n if ('color' in expression) return expression.color;\n if ('channels' in expression) return channelsColour(expression, tokens);\n if ('hsl' in expression) return resolveHsl(expression.hsl, tokens);\n if ('reference' in expression) return tokenColour(expression, tokens);\n if ('relative' in expression) {\n const { space, from, channels, alpha } = expression.relative;\n const origin = resolveColour(from, tokens);\n return origin === undefined ? undefined : relativeColour(space, origin, channels, alpha);\n }\n const { space, hue, a, aPercentage, b, bPercentage } = expression.mix;\n const first = resolveColour(a, tokens);\n const second = resolveColour(b, tokens);\n if (first === undefined || second === undefined) return undefined;\n return mixColours(\n space,\n { colour: first, percentage: aPercentage },\n { colour: second, percentage: bPercentage },\n hue,\n );\n}\n\n/** A length in a structured value that is a token, with the arithmetic around it. */\ninterface LengthMarker {\n readonly reference: string;\n readonly adjust?: DeferredDeclaration['adjust'];\n readonly fallback?: number;\n}\n\n/**\n * Arithmetic with tokens in it, as the compiler leaves it: numbers, token references and\n * `[op, a, b]`, in points, degrees or plain numbers as the slot it fills counts.\n */\ntype CalcExpression =\n | number\n | { readonly reference: string; readonly fallback?: number }\n | readonly ['+' | '-' | '*' | '/', CalcExpression, CalcExpression];\n\ninterface CalcMarker {\n readonly expression: CalcExpression;\n readonly kind: 'length' | 'angle' | 'time' | 'number';\n}\n\n/** A calc marker worked out, as its slot takes it; undefined when a token in it is not set. */\nfunction resolveCalc(\n marker: CalcMarker,\n tokens: Readonly<Record<string, TokenValue>>,\n): number | string | undefined {\n const percentage = wholePercentage(marker, tokens);\n if (percentage !== undefined) return percentage;\n if (bareNumberAsLength(marker, tokens) || notAnAngle(marker, tokens)) return undefined;\n const value = calculated(marker.expression, marker.kind, tokens);\n if (value === undefined || !Number.isFinite(value)) return undefined;\n const rounded = Math.round(value * 1000) / 1000;\n return marker.kind === 'angle' ? `${rounded}deg` : rounded;\n}\n\n/**\n * Whether a length is one token holding a bare number other than 0: `--tw-translate-x: 3`, from\n * `translate-x-[3]`, which a browser drops. Inside arithmetic a bare number is a factor, and fine.\n */\nfunction bareNumberAsLength(\n marker: CalcMarker,\n tokens: Readonly<Record<string, TokenValue>>,\n): boolean {\n if (marker.kind !== 'length' || typeof marker.expression !== 'object') return false;\n if (Array.isArray(marker.expression)) return false;\n const token = tokens[(marker.expression as { reference: string }).reference];\n return (\n token !== undefined &&\n token.length === undefined &&\n token.number !== undefined &&\n token.number !== 0\n );\n}\n\n/**\n * Whether an angle is one token that holds no angle: `--tw-rotate: 3` or `37%`, from\n * `rotate-[3]`, which a browser drops, taking the whole transform with it. A bare 0 is an angle;\n * `0%` is not.\n */\nfunction notAnAngle(marker: CalcMarker, tokens: Readonly<Record<string, TokenValue>>): boolean {\n if (marker.kind !== 'angle' || typeof marker.expression !== 'object') return false;\n if (Array.isArray(marker.expression)) return false;\n const token = tokens[(marker.expression as { reference: string }).reference];\n if (token === undefined || token.angle !== undefined) return false;\n // `0%` has a number 0 as well, and is still a percentage, which no angle is.\n return token.number !== 0 || typeof token.length === 'string';\n}\n\n/**\n * A length that is one token holding a percentage, `translate-x-1/2`'s 50%, passed on as it is:\n * a share of a box nobody has laid out yet can be used, but not added to or scaled here.\n */\nfunction wholePercentage(\n marker: CalcMarker,\n tokens: Readonly<Record<string, TokenValue>>,\n): string | undefined {\n if (marker.kind !== 'length' || typeof marker.expression !== 'object') return undefined;\n if (Array.isArray(marker.expression)) return undefined;\n const leaf = marker.expression as { reference: string };\n const value = formOf(tokens[leaf.reference], 'length');\n return typeof value === 'string' && value.endsWith('%') ? value : undefined;\n}\n\nfunction calculated(\n expression: CalcExpression,\n kind: CalcMarker['kind'],\n tokens: Readonly<Record<string, TokenValue>>,\n): number | undefined {\n if (typeof expression === 'number') return expression;\n if (!Array.isArray(expression)) {\n const leaf = expression as Exclude<CalcExpression, number | readonly unknown[]>;\n return tokenNumber(tokens[leaf.reference], kind) ?? leaf.fallback;\n }\n const [op, a, b] = expression as readonly [string, CalcExpression, CalcExpression];\n const left = calculated(a, kind, tokens);\n const right = calculated(b, kind, tokens);\n if (left === undefined || right === undefined) return undefined;\n if (op === '+') return left + right;\n if (op === '-') return left - right;\n if (op === '*') return left * right;\n return left / right;\n}\n\n/** Where each kind of slot reads a token from, before its bare number. */\nconst FORM_OF_KIND: Record<\n Exclude<CalcMarker['kind'], 'number'>,\n (token: TokenValue) => unknown\n> = {\n length: (token) => token.length,\n angle: (token) => token.angle,\n time: (token) => token.time,\n};\n\n/**\n * A token as a number in a slot of this kind: its length in points or its angle in degrees, or\n * a bare number, which multiplies (`calc(var(--n) * 1px)`). A length that is not points, a\n * percentage, is not one, and is not read as the bare number it also is.\n */\nfunction tokenNumber(token: TokenValue | undefined, kind: CalcMarker['kind']): number | undefined {\n if (!token) return undefined;\n const own = kind === 'number' ? undefined : FORM_OF_KIND[kind](token);\n if (own !== undefined) return typeof own === 'number' ? own : undefined;\n // An angle is a number of degrees to a hue, and neither a length nor a factor: `30deg` as a\n // translate moved a box thirty points, and as a scale made it thirty times the size, where a\n // browser drops the declaration.\n if (token.angle !== undefined) return undefined;\n return token.number;\n}\n\n/** A whole shadow, filter or transform token in a list, and the entries to use when it is unset. */\ninterface ShadowsMarker {\n readonly reference: string;\n readonly fallback?: readonly unknown[];\n}\n\n/** The slot a list entry can be instead of an entry: one per list property that has them. */\nconst SLOT_KINDS = {\n __shadows: 'shadow',\n __filters: 'filter',\n __transforms: 'transform',\n __variants: 'fontVariant',\n} as const satisfies Record<string, TokenKind>;\n\nconst SLOT_ENTRIES = Object.entries(SLOT_KINDS);\n\n/** The slot a list entry is, and the form of token that fills it; undefined for an entry. */\nfunction slotOf(part: unknown): { marker: ShadowsMarker; kind: TokenKind } | undefined {\n if (part === null || typeof part !== 'object') return undefined;\n for (const [key, kind] of SLOT_ENTRIES) {\n const marker = (part as Record<string, ShadowsMarker | undefined>)[key];\n if (marker) return { marker, kind };\n }\n return undefined;\n}\n\nfunction resolveLength(\n marker: LengthMarker,\n tokens: Readonly<Record<string, TokenValue>>,\n): number | undefined {\n const value = formOf(tokens[marker.reference], 'length') ?? marker.fallback;\n if (typeof value !== 'number') return undefined;\n return marker.adjust ? (adjusted(value, marker.adjust) as number) : value;\n}\n\n/** A colour at no opacity at all. */\nfunction invisible(colour: unknown): boolean {\n if (colour === 'transparent') return true;\n const parts = typeof colour === 'string' ? RGB.exec(colour) : null;\n return parts?.[4] !== undefined && Number(parts[4]) === 0;\n}\n\n/**\n * Whether a compiled value has something in it to settle: a marker, slot or deferred length at\n * any depth. One with none is used as it is. Asked of values from the sheet, which never change,\n * so the answer is kept: Tailwind's reset fills three of a shadow's five slots with one on every\n * node.\n */\nfunction needsFilling(value: unknown): value is object {\n if (value === null || typeof value !== 'object') return false;\n let answer = NEEDS_FILLING.get(value);\n if (answer === undefined) {\n answer = Object.entries(value).some(\n ([key, part]) => key.startsWith('__') || needsFilling(part),\n );\n NEEDS_FILLING.set(value, answer);\n }\n return answer;\n}\nconst NEEDS_FILLING = new WeakMap<object, boolean>();\n\n/** What `settledMarker` says of a part that is not a token's marker at all. */\nconst NOT_A_MARKER = Symbol('not a marker');\n\n/** A colour, length or calc marker settled from the tokens, or undefined when one cannot be. */\nfunction settledMarker(value: object, tokens: Readonly<Record<string, TokenValue>>): unknown {\n const colour = colourMarker(value);\n if (colour) return resolveColour(colour, tokens);\n // Whether a shadow is inset, from a token that is the word or nothing: `ring-inset`.\n const inset = (value as { __inset?: { reference: string } }).__inset;\n if (inset) return formOf(tokens[inset.reference], 'keyword') === 'inset';\n const token = (value as { __length?: LengthMarker }).__length;\n if (token) return resolveLength(token, tokens);\n const sum = (value as { __calc?: CalcMarker }).__calc;\n if (sum) return resolveCalc(sum, tokens);\n return NOT_A_MARKER;\n}\n\n/** What a colour that cannot be settled makes of the whole value it is in. */\nconst UNSETTLED = Symbol('unsettled');\n\n/** `rgba(var(--channels), <alpha>)`: the token's channels, at the alpha written or tokened. */\nfunction channelsColour(\n expression: Extract<ColourExpression, { channels: unknown }>,\n tokens: Readonly<Record<string, TokenValue>>,\n): string | undefined {\n const value =\n formOf(tokens[expression.channels.reference], 'channels') ?? expression.channels.fallback;\n const { alpha } = expression;\n if (typeof alpha !== 'number') return fromChannels(value, alpha, tokens);\n const opaque = fromChannels(value, undefined, tokens);\n return opaque === undefined ? undefined : (faded(opaque, alpha) as string);\n}\n\n/** A token's colour, or the first of its alternatives that is defined, or its fallback. */\nfunction tokenColour(\n expression: Extract<ColourExpression, { reference: string }>,\n tokens: Readonly<Record<string, TokenValue>>,\n): string | undefined {\n let value = formOf(tokens[expression.reference], 'color');\n for (const alternative of expression.alternatives ?? []) {\n if (value !== undefined) break;\n value = formOf(tokens[alternative], 'color');\n }\n return (value as string | undefined) ?? expression.fallback;\n}\n\n/** A marker the compiler leaves in a structured value for a colour only the device can settle. */\nfunction colourMarker(value: unknown): ColourExpression | undefined {\n return (value as { __colour?: ColourExpression } | null)?.__colour;\n}\n\n/**\n * A resolved length, moved by the arithmetic that surrounded its `var()`.\n *\n * A non-numeric value is left alone rather than coerced: the token was a keyword or a percentage\n * the app meant, and turning it into NaN would be a silent layout rather than a visible one.\n */\nfunction adjusted(value: unknown, adjust: NonNullable<DeferredDeclaration['adjust']>): unknown {\n if (adjust.alpha !== undefined) return faded(value, adjust.alpha);\n if (typeof value !== 'number') return value;\n const scaled = value * (adjust.scale ?? 1) + (adjust.offset ?? 0);\n return adjust.floor === undefined ? scaled : Math.max(scaled, adjust.floor);\n}\n\n/** `rgb(r, g, b)` and `rgba(r, g, b, a)`, which is every colour the compiler emits. */\nconst RGB = /^rgba?\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*(?:,\\s*([\\d.]+)\\s*)?\\)$/;\n\n/**\n * A colour at a fraction of its opacity.\n *\n * Multiplied rather than replaced, so a token that was already translucent stays relatively so -\n * `rgba(0, 0, 0, 0.5)` faded to 90% is 45% opaque, which is what a browser computes for the same\n * mix. A value that is not one of ours is returned untouched: it may be a platform colour, and a\n * colour nobody can parse is better painted as it stands than dropped.\n */\nfunction faded(value: unknown, fraction: number): unknown {\n if (typeof value !== 'string') return value;\n const parts = RGB.exec(value);\n if (!parts) return value;\n const alpha = (parts[4] === undefined ? 1 : Number(parts[4])) * fraction;\n return `rgba(${parts[1]}, ${parts[2]}, ${parts[3]}, ${Math.round(alpha * 1000) / 1000})`;\n}\n\n/**\n * Where a component's compiled sheet lives: a static on the component class, written by the\n * Metro transformer at build time.\n *\n * `RendererFactory2.createRenderer(host, type)` receives the component definition, and a\n * definition references its class, so a renderer can find its own sheet with no registry and no\n * generated id. That is also how encapsulation is scoped for free: a component's renderer only\n * ever matches that component's rules, so its elements cannot be styled by anyone else's CSS.\n */\nexport const NATIVE_STYLES = 'ɵnativeStyles';\n\nexport function styleSheetOf(type: unknown): StyleSheet | null {\n const sheet = (type as Record<string, unknown> | null)?.[NATIVE_STYLES];\n return (sheet as StyleSheet | undefined) ?? null;\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Angular's `@defer (on interaction | hover | viewport)` asks of a trigger element, for the
|
|
3
|
+
* engine's nodes.
|
|
4
|
+
*
|
|
5
|
+
* Angular registers those three triggers on the element itself rather than through `Renderer2`:
|
|
6
|
+
* it asserts in development that the element is an `Element`, listens with `addEventListener`,
|
|
7
|
+
* and watches for visibility with a global `IntersectionObserver`. An engine node was none of
|
|
8
|
+
* those, so the placeholder stayed forever and every render logged an assertion. The listeners
|
|
9
|
+
* are on the node (`addEventListener` in `engine.ts`); this is the other two.
|
|
10
|
+
*
|
|
11
|
+
* `installDeferTriggers` runs once, from `mount()`, before anything renders.
|
|
12
|
+
*/
|
|
13
|
+
import { type EngineNode } from './engine.ts';
|
|
14
|
+
interface Entry {
|
|
15
|
+
readonly target: EngineNode;
|
|
16
|
+
readonly isIntersecting: boolean;
|
|
17
|
+
readonly intersectionRatio: number;
|
|
18
|
+
}
|
|
19
|
+
type Callback = (entries: Entry[], observer: EngineIntersectionObserver) => void;
|
|
20
|
+
interface Options {
|
|
21
|
+
readonly threshold?: number | readonly number[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Visibility for engine nodes, from the layout and scroll events native already sends.
|
|
25
|
+
*
|
|
26
|
+
* A node is checked when it is observed, when it is laid out, and whenever a scroll view it sits
|
|
27
|
+
* in scrolls. The check measures the node in window coordinates, clips it by each scroll view
|
|
28
|
+
* around it and by the window, and reports it intersecting once the visible share reaches the
|
|
29
|
+
* threshold: any of it by default, as the web does, and a node of no size counts once its position
|
|
30
|
+
* is inside. `root` and `rootMargin` are not applied; the root is always the window.
|
|
31
|
+
*/
|
|
32
|
+
export declare class EngineIntersectionObserver {
|
|
33
|
+
private readonly callback;
|
|
34
|
+
private readonly threshold;
|
|
35
|
+
private readonly watched;
|
|
36
|
+
constructor(callback: Callback, options?: Options);
|
|
37
|
+
observe(target: EngineNode): void;
|
|
38
|
+
unobserve(target: EngineNode): void;
|
|
39
|
+
disconnect(): void;
|
|
40
|
+
takeRecords(): Entry[];
|
|
41
|
+
private check;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Let an engine node pass Angular's development check that a trigger is an `Element`, and give
|
|
45
|
+
* `@defer (on viewport)` an `IntersectionObserver` that can watch one.
|
|
46
|
+
*
|
|
47
|
+
* React Native defines a global `Element` for its own DOM-like nodes, so an engine node is made to
|
|
48
|
+
* answer `instanceof Element` as well, and nothing else about that class changes. Node has none,
|
|
49
|
+
* and gets one that only engine nodes are instances of. An `IntersectionObserver` React Native
|
|
50
|
+
* already has is kept for its own nodes; engine nodes are watched by the one above.
|
|
51
|
+
*/
|
|
52
|
+
export declare function installDeferTriggers(): void;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Angular's `@defer (on interaction | hover | viewport)` asks of a trigger element, for the
|
|
3
|
+
* engine's nodes.
|
|
4
|
+
*
|
|
5
|
+
* Angular registers those three triggers on the element itself rather than through `Renderer2`:
|
|
6
|
+
* it asserts in development that the element is an `Element`, listens with `addEventListener`,
|
|
7
|
+
* and watches for visibility with a global `IntersectionObserver`. An engine node was none of
|
|
8
|
+
* those, so the placeholder stayed forever and every render logged an assertion. The listeners
|
|
9
|
+
* are on the node (`addEventListener` in `engine.ts`); this is the other two.
|
|
10
|
+
*
|
|
11
|
+
* `installDeferTriggers` runs once, from `mount()`, before anything renders.
|
|
12
|
+
*/
|
|
13
|
+
import { isEngineNode, viewNameOf } from "./engine.js";
|
|
14
|
+
/** The views a node scrolls inside of, and whose scrolling can bring it into view. */
|
|
15
|
+
const SCROLLERS = new Set(['ScrollView', 'AndroidHorizontalScrollView']);
|
|
16
|
+
/**
|
|
17
|
+
* Visibility for engine nodes, from the layout and scroll events native already sends.
|
|
18
|
+
*
|
|
19
|
+
* A node is checked when it is observed, when it is laid out, and whenever a scroll view it sits
|
|
20
|
+
* in scrolls. The check measures the node in window coordinates, clips it by each scroll view
|
|
21
|
+
* around it and by the window, and reports it intersecting once the visible share reaches the
|
|
22
|
+
* threshold: any of it by default, as the web does, and a node of no size counts once its position
|
|
23
|
+
* is inside. `root` and `rootMargin` are not applied; the root is always the window.
|
|
24
|
+
*/
|
|
25
|
+
export class EngineIntersectionObserver {
|
|
26
|
+
callback;
|
|
27
|
+
threshold;
|
|
28
|
+
watched = new Map();
|
|
29
|
+
constructor(callback, options) {
|
|
30
|
+
this.callback = callback;
|
|
31
|
+
const threshold = options?.threshold;
|
|
32
|
+
this.threshold = Array.isArray(threshold)
|
|
33
|
+
? Math.min(...threshold)
|
|
34
|
+
: (threshold ?? 0);
|
|
35
|
+
}
|
|
36
|
+
observe(target) {
|
|
37
|
+
if (this.watched.has(target))
|
|
38
|
+
return;
|
|
39
|
+
const check = () => this.check(target);
|
|
40
|
+
const stops = [target.host.setEventListener(target, 'topLayout', check)];
|
|
41
|
+
for (let at = target.parent; at; at = at.parent) {
|
|
42
|
+
if (!SCROLLERS.has(viewNameOf(at)))
|
|
43
|
+
continue;
|
|
44
|
+
stops.push(at.host.setEventListener(at, 'topScroll', check));
|
|
45
|
+
}
|
|
46
|
+
this.watched.set(target, { stops });
|
|
47
|
+
// A node laid out before it was observed sends no layout event of its own. Measured now,
|
|
48
|
+
// after the commit that mounted it, and in a microtask, as an observer never calls back from
|
|
49
|
+
// inside `observe`.
|
|
50
|
+
queueMicrotask(check);
|
|
51
|
+
}
|
|
52
|
+
unobserve(target) {
|
|
53
|
+
const watched = this.watched.get(target);
|
|
54
|
+
if (!watched)
|
|
55
|
+
return;
|
|
56
|
+
for (const stop of watched.stops)
|
|
57
|
+
stop();
|
|
58
|
+
this.watched.delete(target);
|
|
59
|
+
}
|
|
60
|
+
disconnect() {
|
|
61
|
+
for (const target of [...this.watched.keys()])
|
|
62
|
+
this.unobserve(target);
|
|
63
|
+
}
|
|
64
|
+
takeRecords() {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
check(target) {
|
|
68
|
+
if (!this.watched.has(target))
|
|
69
|
+
return;
|
|
70
|
+
const ratio = visibleShare(target);
|
|
71
|
+
if (ratio === null)
|
|
72
|
+
return;
|
|
73
|
+
const isIntersecting = this.threshold > 0 ? ratio >= this.threshold : ratio >= 0;
|
|
74
|
+
if (isIntersecting)
|
|
75
|
+
this.callback([{ target, isIntersecting, intersectionRatio: ratio }], this);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const box = (frame) => ({
|
|
79
|
+
left: frame.x,
|
|
80
|
+
top: frame.y,
|
|
81
|
+
right: frame.x + frame.width,
|
|
82
|
+
bottom: frame.y + frame.height,
|
|
83
|
+
});
|
|
84
|
+
function measured(node) {
|
|
85
|
+
let found = null;
|
|
86
|
+
node.host.measure(node, (frame) => (found = box(frame)));
|
|
87
|
+
return found;
|
|
88
|
+
}
|
|
89
|
+
function clip(into, by) {
|
|
90
|
+
into.left = Math.max(into.left, by.left);
|
|
91
|
+
into.top = Math.max(into.top, by.top);
|
|
92
|
+
into.right = Math.min(into.right, by.right);
|
|
93
|
+
into.bottom = Math.min(into.bottom, by.bottom);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* How much of the node is on screen, from 0 to 1; below 0 when none of it is, and null when it
|
|
97
|
+
* has not been measured. Measuring is synchronous on the new architecture.
|
|
98
|
+
*/
|
|
99
|
+
function visibleShare(target) {
|
|
100
|
+
const frame = measured(target);
|
|
101
|
+
if (!frame)
|
|
102
|
+
return null;
|
|
103
|
+
const visible = { ...frame };
|
|
104
|
+
for (let at = target.parent; at; at = at.parent) {
|
|
105
|
+
if (!SCROLLERS.has(viewNameOf(at)))
|
|
106
|
+
continue;
|
|
107
|
+
const scroller = measured(at);
|
|
108
|
+
if (scroller)
|
|
109
|
+
clip(visible, scroller);
|
|
110
|
+
}
|
|
111
|
+
const window = target.host.viewport;
|
|
112
|
+
if (window && window.width > 0 && window.height > 0) {
|
|
113
|
+
clip(visible, { left: 0, top: 0, right: window.width, bottom: window.height });
|
|
114
|
+
}
|
|
115
|
+
const width = visible.right - visible.left;
|
|
116
|
+
const height = visible.bottom - visible.top;
|
|
117
|
+
if (width < 0 || height < 0)
|
|
118
|
+
return -1;
|
|
119
|
+
const area = (frame.right - frame.left) * (frame.bottom - frame.top);
|
|
120
|
+
return area > 0 ? (width * height) / area : 1;
|
|
121
|
+
}
|
|
122
|
+
let installed = false;
|
|
123
|
+
/**
|
|
124
|
+
* Let an engine node pass Angular's development check that a trigger is an `Element`, and give
|
|
125
|
+
* `@defer (on viewport)` an `IntersectionObserver` that can watch one.
|
|
126
|
+
*
|
|
127
|
+
* React Native defines a global `Element` for its own DOM-like nodes, so an engine node is made to
|
|
128
|
+
* answer `instanceof Element` as well, and nothing else about that class changes. Node has none,
|
|
129
|
+
* and gets one that only engine nodes are instances of. An `IntersectionObserver` React Native
|
|
130
|
+
* already has is kept for its own nodes; engine nodes are watched by the one above.
|
|
131
|
+
*/
|
|
132
|
+
export function installDeferTriggers() {
|
|
133
|
+
if (installed)
|
|
134
|
+
return;
|
|
135
|
+
installed = true;
|
|
136
|
+
const scope = globalThis;
|
|
137
|
+
const existing = scope['Element'];
|
|
138
|
+
if (existing) {
|
|
139
|
+
const own = Function.prototype[Symbol.hasInstance];
|
|
140
|
+
Object.defineProperty(existing, Symbol.hasInstance, {
|
|
141
|
+
configurable: true,
|
|
142
|
+
value(value) {
|
|
143
|
+
return (this === existing && isEngineNode(value)) || own.call(this, value);
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
scope['Element'] = class Element {
|
|
149
|
+
static [Symbol.hasInstance](value) {
|
|
150
|
+
return isEngineNode(value);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const native = scope['IntersectionObserver'];
|
|
155
|
+
if (!native) {
|
|
156
|
+
scope['IntersectionObserver'] = EngineIntersectionObserver;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
scope['IntersectionObserver'] = class extends EngineIntersectionObserver {
|
|
160
|
+
args;
|
|
161
|
+
other = null;
|
|
162
|
+
constructor(callback, options) {
|
|
163
|
+
super(callback, options);
|
|
164
|
+
this.args = [callback, options];
|
|
165
|
+
}
|
|
166
|
+
observe(target) {
|
|
167
|
+
if (isEngineNode(target))
|
|
168
|
+
super.observe(target);
|
|
169
|
+
else
|
|
170
|
+
(this.other ??= new native(...this.args)).observe(target);
|
|
171
|
+
}
|
|
172
|
+
unobserve(target) {
|
|
173
|
+
if (isEngineNode(target))
|
|
174
|
+
super.unobserve(target);
|
|
175
|
+
else
|
|
176
|
+
this.other?.unobserve(target);
|
|
177
|
+
}
|
|
178
|
+
disconnect() {
|
|
179
|
+
super.disconnect();
|
|
180
|
+
this.other?.disconnect();
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=defer-triggers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defer-triggers.js","sourceRoot":"","sources":["../src/defer-triggers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAqC,MAAM,aAAa,CAAC;AAE1F,sFAAsF;AACtF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAkBzE;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA0B;IACpB,QAAQ,CAAW;IACnB,SAAS,CAAS;IAClB,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE1D,YAAY,QAAkB,EAAE,OAAiB;QAC/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,CAAC;QACrC,IAAI,CAAC,S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K,EAAE,UAAU,EAAE,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * What Angular's `@defer (on interaction | hover | viewport)` asks of a trigger element, for the\n * engine's nodes.\n *\n * Angular registers those three triggers on the element itself rather than through `Renderer2`:\n * it asserts in development that the element is an `Element`, listens with `addEventListener`,\n * and watches for visibility with a global `IntersectionObserver`. An engine node was none of\n * those, so the placeholder stayed forever and every render logged an assertion. The listeners\n * are on the node (`addEventListener` in `engine.ts`); this is the other two.\n *\n * `installDeferTriggers` runs once, from `mount()`, before anything renders.\n */\nimport { isEngineNode, viewNameOf, type EngineNode, type WindowFrame } from './engine.ts';\n\n/** The views a node scrolls inside of, and whose scrolling can bring it into view. */\nconst SCROLLERS = new Set(['ScrollView', 'AndroidHorizontalScrollView']);\n\ninterface Entry {\n readonly target: EngineNode;\n readonly isIntersecting: boolean;\n readonly intersectionRatio: number;\n}\n\ntype Callback = (entries: Entry[], observer: EngineIntersectionObserver) => void;\n\ninterface Options {\n readonly threshold?: number | readonly number[];\n}\n\ninterface Watched {\n readonly stops: (() => void)[];\n}\n\n/**\n * Visibility for engine nodes, from the layout and scroll events native already sends.\n *\n * A node is checked when it is observed, when it is laid out, and whenever a scroll view it sits\n * in scrolls. The check measures the node in window coordinates, clips it by each scroll view\n * around it and by the window, and reports it intersecting once the visible share reaches the\n * threshold: any of it by default, as the web does, and a node of no size counts once its position\n * is inside. `root` and `rootMargin` are not applied; the root is always the window.\n */\nexport class EngineIntersectionObserver {\n private readonly callback: Callback;\n private readonly threshold: number;\n private readonly watched = new Map<EngineNode, Watched>();\n\n constructor(callback: Callback, options?: Options) {\n this.callback = callback;\n const threshold = options?.threshold;\n this.threshold = Array.isArray(threshold)\n ? Math.min(...(threshold as number[]))\n : ((threshold as number | undefined) ?? 0);\n }\n\n observe(target: EngineNode): void {\n if (this.watched.has(target)) return;\n const check = () => this.check(target);\n const stops = [target.host!.setEventListener(target, 'topLayout', check)];\n for (let at = target.parent; at; at = at.parent) {\n if (!SCROLLERS.has(viewNameOf(at))) continue;\n stops.push(at.host!.setEventListener(at, 'topScroll', check));\n }\n this.watched.set(target, { stops });\n // A node laid out before it was observed sends no layout event of its own. Measured now,\n // after the commit that mounted it, and in a microtask, as an observer never calls back from\n // inside `observe`.\n queueMicrotask(check);\n }\n\n unobserve(target: EngineNode): void {\n const watched = this.watched.get(target);\n if (!watched) return;\n for (const stop of watched.stops) stop();\n this.watched.delete(target);\n }\n\n disconnect(): void {\n for (const target of [...this.watched.keys()]) this.unobserve(target);\n }\n\n takeRecords(): Entry[] {\n return [];\n }\n\n private check(target: EngineNode): void {\n if (!this.watched.has(target)) return;\n const ratio = visibleShare(target);\n if (ratio === null) return;\n const isIntersecting = this.threshold > 0 ? ratio >= this.threshold : ratio >= 0;\n if (isIntersecting) this.callback([{ target, isIntersecting, intersectionRatio: ratio }], this);\n }\n}\n\n/** A frame as its four edges. */\ninterface Box {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nconst box = (frame: WindowFrame): Box => ({\n left: frame.x,\n top: frame.y,\n right: frame.x + frame.width,\n bottom: frame.y + frame.height,\n});\n\nfunction measured(node: EngineNode): Box | null {\n let found: Box | null = null;\n node.host!.measure(node, (frame) => (found = box(frame)));\n return found;\n}\n\nfunction clip(into: Box, by: Box): void {\n into.left = Math.max(into.left, by.left);\n into.top = Math.max(into.top, by.top);\n into.right = Math.min(into.right, by.right);\n into.bottom = Math.min(into.bottom, by.bottom);\n}\n\n/**\n * How much of the node is on screen, from 0 to 1; below 0 when none of it is, and null when it\n * has not been measured. Measuring is synchronous on the new architecture.\n */\nfunction visibleShare(target: EngineNode): number | null {\n const frame = measured(target);\n if (!frame) return null;\n const visible = { ...frame };\n for (let at = target.parent; at; at = at.parent) {\n if (!SCROLLERS.has(viewNameOf(at))) continue;\n const scroller = measured(at);\n if (scroller) clip(visible, scroller);\n }\n const window = (target.host as { viewport?: { width: number; height: number } }).viewport;\n if (window && window.width > 0 && window.height > 0) {\n clip(visible, { left: 0, top: 0, right: window.width, bottom: window.height });\n }\n const width = visible.right - visible.left;\n const height = visible.bottom - visible.top;\n if (width < 0 || height < 0) return -1;\n const area = (frame.right - frame.left) * (frame.bottom - frame.top);\n return area > 0 ? (width * height) / area : 1;\n}\n\ntype Constructor = abstract new (...args: never[]) => object;\n\n/** React Native's own `IntersectionObserver`, when its feature flag has installed one. */\ninterface NativeObserver {\n observe(target: unknown): void;\n unobserve(target: unknown): void;\n disconnect(): void;\n}\ntype NativeObserverClass = new (callback: unknown, options?: unknown) => NativeObserver;\n\nlet installed = false;\n\n/**\n * Let an engine node pass Angular's development check that a trigger is an `Element`, and give\n * `@defer (on viewport)` an `IntersectionObserver` that can watch one.\n *\n * React Native defines a global `Element` for its own DOM-like nodes, so an engine node is made to\n * answer `instanceof Element` as well, and nothing else about that class changes. Node has none,\n * and gets one that only engine nodes are instances of. An `IntersectionObserver` React Native\n * already has is kept for its own nodes; engine nodes are watched by the one above.\n */\nexport function installDeferTriggers(): void {\n if (installed) return;\n installed = true;\n const scope = globalThis as unknown as Record<string, unknown>;\n\n const existing = scope['Element'] as Constructor | undefined;\n if (existing) {\n const own = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(existing, Symbol.hasInstance, {\n configurable: true,\n value(this: Constructor, value: unknown): boolean {\n return (this === existing && isEngineNode(value)) || own.call(this, value);\n },\n });\n } else {\n scope['Element'] = class Element {\n static [Symbol.hasInstance](value: unknown): boolean {\n return isEngineNode(value);\n }\n };\n }\n\n const native = scope['IntersectionObserver'] as NativeObserverClass | undefined;\n if (!native) {\n scope['IntersectionObserver'] = EngineIntersectionObserver;\n return;\n }\n scope['IntersectionObserver'] = class extends EngineIntersectionObserver {\n private readonly args: [unknown, unknown];\n private other: NativeObserver | null = null;\n\n constructor(callback: Callback, options?: Options) {\n super(callback, options);\n this.args = [callback, options];\n }\n\n override observe(target: EngineNode): void {\n if (isEngineNode(target)) super.observe(target);\n else (this.other ??= new native(...this.args)).observe(target);\n }\n\n override unobserve(target: EngineNode): void {\n if (isEngineNode(target)) super.unobserve(target);\n else this.other?.unobserve(target);\n }\n\n override disconnect(): void {\n super.disconnect();\n this.other?.disconnect();\n }\n };\n}\n"]}
|