@ng-native/fabric 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css.d.ts +47 -5
- package/dist/css.js +219 -51
- package/dist/css.js.map +1 -1
- package/dist/defer-triggers.js +2 -8
- package/dist/defer-triggers.js.map +1 -1
- package/dist/engine.d.ts +62 -17
- package/dist/engine.js +222 -51
- package/dist/engine.js.map +1 -1
- package/dist/fabric.d.ts +1 -1
- package/dist/fabric.js +25 -0
- package/dist/fabric.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/inline-derived-token.js +56 -7
- package/dist/inline-derived-token.js.map +1 -1
- package/dist/node-global.d.ts +9 -0
- package/dist/node-global.js +41 -0
- package/dist/node-global.js.map +1 -0
- package/dist/relative-colour.d.ts +2 -2
- package/dist/relative-colour.js +4 -0
- package/dist/relative-colour.js.map +1 -1
- package/package.json +1 -1
package/dist/defer-triggers.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* `installDeferTriggers` runs once, from `mount()`, before anything renders.
|
|
12
12
|
*/
|
|
13
13
|
import { isEngineNode, viewNameOf } from "./engine.js";
|
|
14
|
+
import { letEngineNodesPass } from "./node-global.js";
|
|
14
15
|
/** The views a node scrolls inside of, and whose scrolling can bring it into view. */
|
|
15
16
|
const SCROLLERS = new Set(['ScrollView', 'AndroidHorizontalScrollView']);
|
|
16
17
|
/**
|
|
@@ -137,14 +138,7 @@ export function installDeferTriggers() {
|
|
|
137
138
|
const scope = globalThis;
|
|
138
139
|
const existing = scope['Element'];
|
|
139
140
|
if (existing) {
|
|
140
|
-
|
|
141
|
-
const own = existing[Symbol.hasInstance];
|
|
142
|
-
Object.defineProperty(existing, Symbol.hasInstance, {
|
|
143
|
-
configurable: true,
|
|
144
|
-
value(value) {
|
|
145
|
-
return (this === existing && isEngineNode(value)) || own.call(this, value);
|
|
146
|
-
},
|
|
147
|
-
});
|
|
141
|
+
letEngineNodesPass(existing);
|
|
148
142
|
}
|
|
149
143
|
else {
|
|
150
144
|
scope['Element'] = class Element {
|
|
@@ -1 +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,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;YACvC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,SAAsB,CAAC;YACtC,CAAC,CAAC,CAAE,SAAgC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,MAAkB;QACxB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO;QACrC,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,IAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1E,KAAK,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAA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AAI,CAAC;QAE5C,YAAY,QAAkB,EAAE,OAAiB;YAC/C,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACzB,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClC,CAAC;QAEQ,OAAO,CAAC,MAAkB;YACjC,IAAI,YAAY,CAAC,MAAM,CAAC;gBAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;;gBAC3C,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjE,CAAC;QAEQ,SAAS,CAAC,MAAkB;YACnC,IAAI,YAAY,CAAC,MAAM,CAAC;gBAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;;gBAC7C,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC;QAEQ,UAAU;YACjB,KAAK,CAAC,UAAU,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK,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\n// Never reset: the globals it patches stay patched for the life of the process.\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 // Its own check if it defines one, and the ordinary prototype walk if not.\n const own = existing[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"]}
|
|
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;AAC1F,OAAO,EAAE,kBAAkB,EAAoB,MAAM,kBAAkB,CAAC;AAExE,sFAAsF;AACtF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAkBzE;;;;;;;;GAQG;AACH,MAAM,O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ourcesContent":["/**\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';\nimport { letEngineNodesPass, type Constructor } from './node-global.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\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\n// Never reset: the globals it patches stay patched for the life of the process.\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 letEngineNodesPass(existing);\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"]}
|
package/dist/engine.d.ts
CHANGED
|
@@ -307,8 +307,18 @@ export interface EngineNode extends HostNode {
|
|
|
307
307
|
nativeView?: true;
|
|
308
308
|
/** Props kept for selectors to match and left out of what is committed. See `keepAsAttribute`. */
|
|
309
309
|
attributeOnly?: Set<string>;
|
|
310
|
+
/**
|
|
311
|
+
* Set by whoever needs to know which props have been written: each `setProp` with a value adds
|
|
312
|
+
* its key, even one equal to the value already there, and one with `undefined` or `null` takes
|
|
313
|
+
* it out. The native stack outlet tells a page's own binding from a value it carried this way.
|
|
314
|
+
*/
|
|
315
|
+
writes?: Set<string>;
|
|
310
316
|
/** The child this node's background is painted on instead of itself. See `paintOn`. */
|
|
311
317
|
paintsOn?: EngineNode;
|
|
318
|
+
/** What this node's background colour is handed to instead of painted. See `takePaint`. */
|
|
319
|
+
paintTaker?: (color: unknown) => void;
|
|
320
|
+
/** The background colour `paintTaker` was last handed, or is about to be. */
|
|
321
|
+
paintTaken?: unknown;
|
|
312
322
|
/**
|
|
313
323
|
* Style weaker than every sheet, where no rule and no inline style says otherwise. What lets the
|
|
314
324
|
* root component's host fill the surface by default and still give way to its own `:host`. See
|
|
@@ -831,8 +841,10 @@ export declare class Engine implements HostEngine {
|
|
|
831
841
|
* element matched again, and one named as what a rule's element is inside, `.animating .close`
|
|
832
842
|
* or `.close:is(.animating *)`, the elements under the node that such rules are for. What is
|
|
833
843
|
* under any of those is styled again from the rules it matched, for what it inherits: a `dark`
|
|
834
|
-
* class on the root finds no rule again for an element no `dark` rule is for.
|
|
835
|
-
* has
|
|
844
|
+
* class on the root finds no rule again for an element no `dark` rule is for. One named in
|
|
845
|
+
* `:has()`, or answering a test of the class attribute there, has the boxes above the node
|
|
846
|
+
* asked again, and one named only in `:has(> )` the box right above it. Any other class has the node and everything under it matched again, as any
|
|
847
|
+
* other change to it does.
|
|
836
848
|
*
|
|
837
849
|
* A sheet that names a class later restyles what it is for as it arrives, and a node not yet
|
|
838
850
|
* committed is styled when it is, with the class as it is then.
|
|
@@ -969,6 +981,17 @@ export declare class Engine implements HostEngine {
|
|
|
969
981
|
* needs, as `<gradient-text>` is.
|
|
970
982
|
*/
|
|
971
983
|
paintOn(node: EngineNode, child: EngineNode): void;
|
|
984
|
+
/**
|
|
985
|
+
* Hand a node's background colour to `listener` instead of painting it: what its stylesheets,
|
|
986
|
+
* tokens and inline style resolve `background-color` to, or undefined for none. Called after
|
|
987
|
+
* each commit that changes it, the first one included. What a component needs whose colour is
|
|
988
|
+
* drawn by a native view the node is not, from a prop of that view's, as a bottom sheet's is.
|
|
989
|
+
* The function returned stops it, and the node paints its own background again.
|
|
990
|
+
*/
|
|
991
|
+
takePaint(node: EngineNode, listener: (color: unknown) => void): () => void;
|
|
992
|
+
/** Nodes whose background colour is to be handed over once the commit running ends. */
|
|
993
|
+
private readonly paintReports;
|
|
994
|
+
private reportPaint;
|
|
972
995
|
/**
|
|
973
996
|
* Keep a prop the node already has as an attribute: on the node for a selector such as
|
|
974
997
|
* `:host([variant='primary'])` to match, and left out of what is committed to the native view.
|
|
@@ -1018,8 +1041,9 @@ export declare class Engine implements HostEngine {
|
|
|
1018
1041
|
private watchHas;
|
|
1019
1042
|
/**
|
|
1020
1043
|
* Something at or beneath `from` changed: every node from there up may match a `:has()` rule
|
|
1021
|
-
* it did not, or stop matching one. They are matched again rather than
|
|
1022
|
-
* which would restyle everything under them. Only sheets that use
|
|
1044
|
+
* it did not, or stop matching one, up to `upTo` and not it. They are matched again rather than
|
|
1045
|
+
* marked for restyling, which would restyle everything under them. Only sheets that use
|
|
1046
|
+
* `:has()` pay.
|
|
1023
1047
|
*/
|
|
1024
1048
|
private markBeneath;
|
|
1025
1049
|
/**
|
|
@@ -1033,8 +1057,18 @@ export declare class Engine implements HostEngine {
|
|
|
1033
1057
|
* Have matched again what is under each box that changed beneath and that such a rule could
|
|
1034
1058
|
* be asking: the nodes the rule is for, and no other. Once for a commit, however many changes
|
|
1035
1059
|
* there were beneath the box: a table gains its rows one at a time.
|
|
1060
|
+
*
|
|
1061
|
+
* A rule asked of a box above is walked under the highest box that asks it, which reaches what
|
|
1062
|
+
* is under the boxes beneath that one as well: a rule `:has()` asks of any box is asked by every
|
|
1063
|
+
* box from the change up to the root, and walked once, from the root. The rules a box asks are
|
|
1064
|
+
* walked together, the tree beneath it once.
|
|
1036
1065
|
*/
|
|
1037
1066
|
private markUnderHas;
|
|
1067
|
+
/**
|
|
1068
|
+
* `markUnderHas` for one box: the rules it asks that no box above it was walked for, walked
|
|
1069
|
+
* together. What was walked under it and above it, which is `above` where it asks no more.
|
|
1070
|
+
*/
|
|
1071
|
+
private markUnderBox;
|
|
1038
1072
|
/**
|
|
1039
1073
|
* What `node` matches changed, which the elements after it can read: as many of them as a rule
|
|
1040
1074
|
* steps along from one, every one for a `~`, and none where no sheet steps at all.
|
|
@@ -1097,14 +1131,14 @@ export declare class Engine implements HostEngine {
|
|
|
1097
1131
|
/** The first commit whose new views have not been drawn yet, while `commitUnseen` runs. */
|
|
1098
1132
|
private unseen;
|
|
1099
1133
|
/**
|
|
1100
|
-
* A commit for what changed
|
|
1101
|
-
*
|
|
1134
|
+
* A commit for what changed after earlier commits, before a frame has drawn them. `since` is
|
|
1135
|
+
* how many commits there had been before the first of them (`stats.commits`).
|
|
1102
1136
|
*
|
|
1103
1137
|
* A view those commits created has not been seen in the style they gave it, so what this one
|
|
1104
|
-
* gives it is where it starts, and no transition runs toward it. That is what a browser
|
|
1105
|
-
*
|
|
1106
|
-
* is built on: Angular adds the enter class after the render pass that created
|
|
1107
|
-
* takes it off a frame later, which is the one change the transition is for.
|
|
1138
|
+
* gives it is where it starts, and no transition runs toward it. That is what a browser does
|
|
1139
|
+
* with a class added to an element before the frame after it was inserted, and what
|
|
1140
|
+
* `animate.enter` is built on: Angular adds the enter class after the render pass that created
|
|
1141
|
+
* the element, and takes it off a frame later, which is the one change the transition is for.
|
|
1108
1142
|
*/
|
|
1109
1143
|
commitUnseen(since: number): boolean;
|
|
1110
1144
|
/** Nodes that asked for `@keyframes` this commit had not met, by the name they asked for. */
|
|
@@ -1211,6 +1245,8 @@ export declare class Engine implements HostEngine {
|
|
|
1211
1245
|
* its parent's: the cascade's, and over it the parent's inline style.
|
|
1212
1246
|
*/
|
|
1213
1247
|
private movePaint;
|
|
1248
|
+
/** Note the background colour a node that hands it over resolves to, where it changed. */
|
|
1249
|
+
private takenPaint;
|
|
1214
1250
|
/**
|
|
1215
1251
|
* A container whose direction or alignment changed since a child with a `fit-content` size
|
|
1216
1252
|
* read it, or whose height stopped or started being one a percentage is taken of since a child
|
|
@@ -1462,7 +1498,8 @@ export declare class Engine implements HostEngine {
|
|
|
1462
1498
|
/**
|
|
1463
1499
|
* Commit where it ends each transition of a size or a place that just started, for native to
|
|
1464
1500
|
* move the view there: a layout animation, which the commit asks for once it is known that
|
|
1465
|
-
* nothing else in it moves. One still on its way is committed where it ends too.
|
|
1501
|
+
* nothing else in it moves. One still on its way is committed where it ends too. On a host
|
|
1502
|
+
* with no layout animation they are eased from JavaScript, but for one sent on again and again.
|
|
1466
1503
|
*
|
|
1467
1504
|
* A width eased from JavaScript is a commit a frame, and a commit lays the whole screen out.
|
|
1468
1505
|
*/
|
|
@@ -1472,10 +1509,11 @@ export declare class Engine implements HostEngine {
|
|
|
1472
1509
|
/**
|
|
1473
1510
|
* Whether a transition of a size is one sent on again and again, each before the last had
|
|
1474
1511
|
* ended: a progress bar that steps every 50ms and eases each step over 150. Native moves the
|
|
1475
|
-
* view, and lays the screen out, every frame while a layout animation runs,
|
|
1476
|
-
* every
|
|
1477
|
-
*
|
|
1478
|
-
*
|
|
1512
|
+
* view, and lays the screen out, every frame while a layout animation runs, and JavaScript
|
|
1513
|
+
* commits every frame while it eases one, so one started at every step is one that never
|
|
1514
|
+
* stops. The first, and one sent back before it ends, are played; from the second sent on in
|
|
1515
|
+
* a row, each is committed where it ends, and the steps are the motion. Played again once the
|
|
1516
|
+
* size has been left alone for as long as it lasts.
|
|
1479
1517
|
*/
|
|
1480
1518
|
private sentOnAgain;
|
|
1481
1519
|
/** The animations this commit lays out at their last frame, for native to move the views to. */
|
|
@@ -1564,7 +1602,11 @@ export declare class Engine implements HostEngine {
|
|
|
1564
1602
|
* device the platform pumps this from `requestAnimationFrame` for as long as it returns true.
|
|
1565
1603
|
*/
|
|
1566
1604
|
advanceAnimations(now?: number): boolean;
|
|
1567
|
-
/**
|
|
1605
|
+
/**
|
|
1606
|
+
* The host's conversions, applied to a copy. A removed prop travels as `cleared` says, null for
|
|
1607
|
+
* nearly every one. On an update a colour dropped as unreadable is null too: JSI leaves out an
|
|
1608
|
+
* undefined key, and Fabric keeps what a clone leaves out.
|
|
1609
|
+
*/
|
|
1568
1610
|
private processed;
|
|
1569
1611
|
/** Copy a list of shadow-like objects, running each `color` through the host's converter. */
|
|
1570
1612
|
private processNestedColors;
|
|
@@ -1876,9 +1918,12 @@ export declare class Engine implements HostEngine {
|
|
|
1876
1918
|
private isAttached;
|
|
1877
1919
|
/** The host's `resolveAssetSource`, for a component that needs an asset's size up front. */
|
|
1878
1920
|
resolveAsset(value: unknown): unknown;
|
|
1921
|
+
/** A colour prop as `processed` sends it: one dropped as unreadable is null on an update. */
|
|
1922
|
+
private colourProp;
|
|
1879
1923
|
/**
|
|
1880
1924
|
* A colour prop as native takes it. A shape's `fill` or `stroke` the cascade settled from a
|
|
1881
|
-
* token is the solid brush react-native-svg takes,
|
|
1925
|
+
* token is the solid brush react-native-svg takes, `none` no paint at all, and one the host
|
|
1926
|
+
* reads no colour in no paint of the shape's own.
|
|
1882
1927
|
*/
|
|
1883
1928
|
private painted;
|
|
1884
1929
|
/**
|