@silkui/core 0.1.6 → 0.1.9

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/README.md CHANGED
@@ -59,7 +59,9 @@ mount(createBox({ position: "absolute", inset: 0, display: "flex", alignItems: "
59
59
  | --- | --- |
60
60
  | `createBox(style?, ...children)` | A box with `style` as its base look. Strings among the children become text nodes |
61
61
  | `createText(data?)` | A text node. It takes its look from its parent |
62
- | `createInput(style?)` | An editable text field. `value`, `selectionStart`, `selectionEnd` and `setSelectionRange` work as on an `<input>` |
62
+ | `createInput(style?)` | An editable text field. `value`, `selectionStart`, `selectionEnd`, `selectionDirection`, `setSelectionRange`, `select` and `setRangeText` work as on an `<input>`, in UTF-16 string indices |
63
+ | `createRange()`, `new Range()`, `new StaticRange(init)` | DOM Standard ranges over the app's nodes. Live ranges follow insertions, removals and text edits (`insertData`, `splitText`, `normalize` and the rest of Text's methods) |
64
+ | `createDocumentFragment()` | Nodes held outside the tree, as `DocumentFragment`; `cloneContents` and `extractContents` return one |
63
65
  | `createRichInput(style?)` | A text field with marks and inline atoms (see below) |
64
66
  | `createImage(src, style?)` | An image, as an `<img>`: `src` is a `data:` URL, a file or an `http(s):` address. An SVG file draws as an inline `<svg>` |
65
67
  | `createSvgElement(tag)` | `document.createElementNS` for SVG: an `Svg` root for `"svg"`, else an `SvgElement` (`path`, `g`, ...) to append inside one |
@@ -173,6 +175,22 @@ the host runs the app, its tree and its JavaScript in one process. In a web-canv
173
175
  is the wasm tree's memory only, without the page's JavaScript heap. It is `null` when the
174
176
  host cannot say.
175
177
 
178
+ `frameStats()` says what reached the screen since its last call: frames presented, presents
179
+ per second, painted frames the GPU never drew, and the milliseconds between presents. Count
180
+ frames with it rather than with `requestAnimationFrame`, which runs once per frame the app
181
+ paints, not per frame the display shows.
182
+
183
+ ```ts
184
+ import { frameStats } from "@silkui/core";
185
+
186
+ setInterval(() => {
187
+ const { fps, dropped, p95 } = frameStats();
188
+ }, 1000);
189
+ ```
190
+
191
+ Intervals are taken where the render thread presents, and a gap over a second (an idle
192
+ window) is left out of the percentiles. It is `null` in a browser build.
193
+
176
194
  ### Attributes and accessibility
177
195
 
178
196
  `setAttribute(name, value)` sets the tree's attributes: `tabIndex`, `disabled`, `label`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silkui/core",
3
- "version": "0.1.6",
3
+ "version": "0.1.9",
4
4
  "description": "The node and event API of a Silk UI tree for JavaScript applications that run on the embedded SilkJS engine",
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.d.ts CHANGED
@@ -37,7 +37,12 @@ export interface Look {
37
37
  }
38
38
 
39
39
  export type Listener<E extends Event = Event> = ((this: Node, event: E) => void) | { handleEvent(event: E): void };
40
- export type ListenerOptions = boolean | { capture?: boolean; once?: boolean };
40
+ /** What `signal` needs from an `AbortSignal`. */
41
+ export interface ListenerSignal {
42
+ readonly aborted: boolean;
43
+ addEventListener(type: "abort", listener: () => void, options?: { once?: boolean }): void;
44
+ }
45
+ export type ListenerOptions = boolean | { capture?: boolean; once?: boolean; signal?: ListenerSignal };
41
46
 
42
47
  /** Live tokens in a node's class attribute. */
43
48
  export class ClassList implements Iterable<string> {
@@ -74,8 +79,17 @@ export class Node {
74
79
  readonly lastChild: Node | null;
75
80
  readonly nextSibling: Node | null;
76
81
  readonly previousSibling: Node | null;
82
+ /** 1 for an element, 3 for text, 11 for a document fragment, as in the DOM. */
83
+ readonly nodeType: 1 | 3 | 11;
84
+ hasChildNodes(): boolean;
85
+ /** A copy with the same looks and attributes, and with `deep` copies of the children. */
86
+ cloneNode(deep?: boolean): this;
87
+ /** Joins adjacent text children and drops empty ones, in the whole subtree. */
88
+ normalize(): void;
77
89
  /** Whether `other` is this node or inside it. */
78
90
  contains(other: Node | null): boolean;
91
+ /** Puts `node` where `child` is and detaches `child`. */
92
+ replaceChild<T extends Node>(node: Node, child: T): T;
79
93
  /** Inserts `child` before `before`, or last without it. A child already in the tree moves. */
80
94
  insertBefore<T extends Node>(child: T, before?: Node | null): T;
81
95
  appendChild<T extends Node>(child: T): T;
@@ -104,26 +118,200 @@ export class Node {
104
118
  set tabIndex(value: number);
105
119
  set disabled(value: boolean);
106
120
  focus(): void;
121
+ /** As DOM `setPointerCapture`: throws `NotFoundError` for a pointer that is not down. */
122
+ setPointerCapture(pointerId: number): void;
123
+ releasePointerCapture(pointerId: number): void;
124
+ hasPointerCapture(pointerId: number): boolean;
107
125
  scrollTo(x: number, y: number): void;
126
+ scrollTo(options: ScrollToOptions): void;
127
+ scroll(x: number, y: number): void;
128
+ scroll(options: ScrollToOptions): void;
129
+ scrollBy(x: number, y: number): void;
130
+ scrollBy(options: ScrollToOptions): void;
131
+ /** `true` or nothing aligns to the start, `false` to the end. */
132
+ scrollIntoView(options?: boolean | ScrollIntoViewOptions): void;
133
+ scrollIntoViewIfNeeded(center?: boolean): void;
134
+ /** Layout reads: each lays out first when something changed, as a browser does. */
135
+ getBoundingClientRect(): DOMRect;
136
+ getClientRects(): DOMRect[] & { item(index: number): DOMRect | null };
137
+ readonly clientLeft: number;
138
+ readonly clientTop: number;
139
+ readonly clientWidth: number;
140
+ readonly clientHeight: number;
141
+ readonly scrollWidth: number;
142
+ readonly scrollHeight: number;
143
+ scrollLeft: number;
144
+ scrollTop: number;
145
+ readonly offsetParent: Node | null;
146
+ readonly offsetLeft: number;
147
+ readonly offsetTop: number;
148
+ readonly offsetWidth: number;
149
+ readonly offsetHeight: number;
150
+ /** Whether this node matches CSS `selector`, by the stylesheet matcher. Throws a SyntaxError for an invalid selector. */
151
+ matches(selector: string): boolean;
152
+ webkitMatchesSelector(selector: string): boolean;
153
+ /** This node or its nearest ancestor that matches `selector`. */
154
+ closest(selector: string): Node | null;
155
+ /** The first descendant, in tree order, that matches `selector`. */
156
+ querySelector(selector: string): Node | null;
157
+ /** Every descendant that matches `selector`, in tree order (a static list). */
158
+ querySelectorAll(selector: string): Node[];
108
159
  addEventListener<K extends keyof EventMap>(type: K, listener: Listener<EventMap[K]>, options?: ListenerOptions): void;
160
+ /** The app's own event types, sent with `dispatchEvent`. */
161
+ addEventListener(type: string, listener: (event: globalThis.Event) => void, options?: ListenerOptions): void;
109
162
  removeEventListener<K extends keyof EventMap>(type: K, listener: Listener<EventMap[K]>, options?: ListenerOptions): void;
163
+ removeEventListener(type: string, listener: (event: globalThis.Event) => void, options?: ListenerOptions): void;
164
+ /** Sends `event` through the tree from this node, as on the web. False when a listener prevented the default. */
165
+ dispatchEvent(event: globalThis.Event): boolean;
110
166
  }
111
167
 
112
168
  /** A text leaf. It takes its look from its parent. */
113
169
  export class Text extends Node {
114
170
  constructor(data?: string);
115
171
  data: string;
172
+ nodeValue: string;
116
173
  textContent: string;
174
+ /** In UTF-16 code units. */
175
+ readonly length: number;
176
+ substringData(offset: number, count: number): string;
177
+ appendData(data: string): void;
178
+ insertData(offset: number, data: string): void;
179
+ deleteData(offset: number, count: number): void;
180
+ replaceData(offset: number, count: number, data: string): void;
181
+ /** Splits at `offset`: this keeps the text before it, and a new next sibling the rest. */
182
+ splitText(offset: number): Text;
183
+ }
184
+
185
+ /** Nodes held together outside the tree. Inserting it inserts its children and empties it. */
186
+ export class DocumentFragment extends Node {
187
+ constructor();
188
+ }
189
+
190
+ export function createDocumentFragment(): DocumentFragment;
191
+
192
+ /** Two boundary points: a node and an offset (a child index, or UTF-16 units in text). */
193
+ export abstract class AbstractRange {
194
+ readonly startContainer: Node;
195
+ readonly startOffset: number;
196
+ readonly endContainer: Node;
197
+ readonly endOffset: number;
198
+ readonly collapsed: boolean;
199
+ }
200
+
201
+ export interface StaticRangeInit {
202
+ startContainer: Node;
203
+ startOffset: number;
204
+ endContainer: Node;
205
+ endOffset: number;
206
+ }
207
+
208
+ /** A range that does not follow changes to the tree. */
209
+ export class StaticRange extends AbstractRange {
210
+ constructor(init: StaticRangeInit);
211
+ }
212
+
213
+ /** A live range over the app's nodes, as the DOM Standard defines it. */
214
+ export class Range extends AbstractRange {
215
+ static readonly START_TO_START: 0;
216
+ static readonly START_TO_END: 1;
217
+ static readonly END_TO_END: 2;
218
+ static readonly END_TO_START: 3;
219
+ readonly START_TO_START: 0;
220
+ readonly START_TO_END: 1;
221
+ readonly END_TO_END: 2;
222
+ readonly END_TO_START: 3;
223
+ /** Collapsed at the start of the mounted root. */
224
+ constructor();
225
+ readonly commonAncestorContainer: Node;
226
+ setStart(node: Node, offset: number): void;
227
+ setEnd(node: Node, offset: number): void;
228
+ setStartBefore(node: Node): void;
229
+ setStartAfter(node: Node): void;
230
+ setEndBefore(node: Node): void;
231
+ setEndAfter(node: Node): void;
232
+ collapse(toStart?: boolean): void;
233
+ selectNode(node: Node): void;
234
+ selectNodeContents(node: Node): void;
235
+ compareBoundaryPoints(how: 0 | 1 | 2 | 3, sourceRange: Range): -1 | 0 | 1;
236
+ comparePoint(node: Node, offset: number): -1 | 0 | 1;
237
+ isPointInRange(node: Node, offset: number): boolean;
238
+ intersectsNode(node: Node): boolean;
239
+ cloneRange(): Range;
240
+ detach(): void;
241
+ deleteContents(): void;
242
+ extractContents(): DocumentFragment;
243
+ cloneContents(): DocumentFragment;
244
+ insertNode(node: Node): void;
245
+ surroundContents(newParent: Node): void;
246
+ toString(): string;
247
+ getClientRects(): DOMRect[];
248
+ getBoundingClientRect(): DOMRect;
249
+ }
250
+
251
+ /** A new live range, collapsed at the start of the root. */
252
+ export function createRange(): Range;
253
+
254
+ /**
255
+ * The document's selection, which the tree keeps (presses, drags, keys) and scripts can read
256
+ * and change. Its ranges are live, in tree order: one, or one per piece seen when the
257
+ * selection crosses children that layout reorders.
258
+ */
259
+ export class Selection {
260
+ private constructor();
261
+ readonly anchorNode: Node | null;
262
+ readonly anchorOffset: number;
263
+ readonly focusNode: Node | null;
264
+ readonly focusOffset: number;
265
+ readonly isCollapsed: boolean;
266
+ readonly rangeCount: number;
267
+ readonly type: "None" | "Caret" | "Range";
268
+ readonly direction: "forward" | "backward" | "none";
269
+ getRangeAt(index: number): Range;
270
+ addRange(range: Range): void;
271
+ removeRange(range: Range): void;
272
+ removeAllRanges(): void;
273
+ empty(): void;
274
+ collapse(node: Node | null, offset?: number): void;
275
+ setPosition(node: Node | null, offset?: number): void;
276
+ collapseToStart(): void;
277
+ collapseToEnd(): void;
278
+ extend(node: Node, offset?: number): void;
279
+ setBaseAndExtent(anchorNode: Node, anchorOffset: number, focusNode: Node, focusOffset: number): void;
280
+ selectAllChildren(node: Node): void;
281
+ deleteFromDocument(): void;
282
+ containsNode(node: Node, allowPartialContainment?: boolean): boolean;
283
+ getComposedRanges(): StaticRange[];
284
+ /** The selected text as copying gives it. */
285
+ toString(): string;
117
286
  }
118
287
 
119
- /** An editable text field. `value` follows what the user types. */
288
+ /** The document's selection. Also installed as `globalThis.getSelection`. */
289
+ export function getSelection(): Selection;
290
+
291
+ /**
292
+ * An editable text field. `value` follows what the user types. Selection offsets are UTF-16
293
+ * string indices, as on the web.
294
+ */
120
295
  export class Input extends Node {
121
296
  constructor();
297
+ /** Setting a different value puts the caret at its end. */
122
298
  value: string;
123
- readonly selectionStart: number;
124
- readonly selectionEnd: number;
125
- /** Selects from `anchor` to `focus`, as UTF-8 byte offsets in the value. */
126
- setSelectionRange(anchor: number, focus: number): void;
299
+ selectionStart: number;
300
+ selectionEnd: number;
301
+ selectionDirection: "forward" | "backward" | "none";
302
+ /** Selects `start` to `end`; with `direction` "backward" the caret sits at `start`. */
303
+ setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
304
+ /** Selects the whole value. */
305
+ select(): void;
306
+ /** Replaces the selection with `replacement`. */
307
+ setRangeText(replacement: string): void;
308
+ /** Replaces `start` to `end` with `replacement` and places the selection by `selectionMode`. */
309
+ setRangeText(
310
+ replacement: string,
311
+ start: number,
312
+ end: number,
313
+ selectionMode?: "select" | "start" | "end" | "preserve",
314
+ ): void;
127
315
  }
128
316
 
129
317
  /** An inline atom of a rich input: a mention or a chip. */
@@ -169,8 +357,6 @@ export class RichInput extends Input {
169
357
  toggleMark(name: string): void;
170
358
  /** Replaces the text from `start` to `end` with `atom`. */
171
359
  insertAtom(start: number, end: number, atom: RichAtom): void;
172
- /** Selects from `anchor` to `focus`, as string indices. */
173
- setSelectionRange(anchor: number, focus: number): void;
174
360
  }
175
361
 
176
362
  /**
@@ -256,6 +442,26 @@ export interface PointerEvent extends ModifierEvent {
256
442
  readonly clientY: number;
257
443
  readonly x: number;
258
444
  readonly y: number;
445
+ /** 1 for the mouse, 2 and up for touches. */
446
+ readonly pointerId: number;
447
+ readonly pointerType: "mouse" | "pen" | "touch";
448
+ readonly isPrimary: boolean;
449
+ /** -1 for `pointermove`, as on the web. */
450
+ readonly button: number;
451
+ readonly buttons: number;
452
+ /** 0.5 while a button is down, 0 otherwise: no host reports pressure yet. */
453
+ readonly pressure: number;
454
+ readonly tangentialPressure: number;
455
+ readonly tiltX: number;
456
+ readonly tiltY: number;
457
+ readonly twist: number;
458
+ readonly altitudeAngle: number;
459
+ readonly azimuthAngle: number;
460
+ readonly width: number;
461
+ readonly height: number;
462
+ /** The event itself for `pointermove` (each host move is its own event), empty otherwise. */
463
+ getCoalescedEvents(): PointerEvent[];
464
+ getPredictedEvents(): PointerEvent[];
259
465
  }
260
466
 
261
467
  /** `pointerdown`, `pointerup` and `click`. */
@@ -265,6 +471,48 @@ export interface PointerButtonEvent extends PointerEvent {
265
471
  readonly detail: number;
266
472
  }
267
473
 
474
+ /** A compatibility mouse event, after the pointer event of a mouse, or before a tap's click. */
475
+ export interface MouseEvent extends ModifierEvent {
476
+ readonly clientX: number;
477
+ readonly clientY: number;
478
+ readonly x: number;
479
+ readonly y: number;
480
+ readonly button: number;
481
+ readonly buttons: number;
482
+ readonly detail: number;
483
+ }
484
+
485
+ /** One finger, as DOM `Touch`. No host reports contact size or force yet. */
486
+ export interface Touch {
487
+ readonly identifier: number;
488
+ /** The node the finger went down on, for as long as it stays down. */
489
+ readonly target: Node;
490
+ readonly clientX: number;
491
+ readonly clientY: number;
492
+ readonly pageX: number;
493
+ readonly pageY: number;
494
+ readonly screenX: number;
495
+ readonly screenY: number;
496
+ readonly radiusX: number;
497
+ readonly radiusY: number;
498
+ readonly rotationAngle: number;
499
+ readonly force: number;
500
+ }
501
+
502
+ export interface TouchList extends ReadonlyArray<Touch> {
503
+ item(index: number): Touch | null;
504
+ }
505
+
506
+ /**
507
+ * As DOM `TouchEvent`, after the finger's pointer event. Preventing `touchstart` or a
508
+ * `touchmove` before the tree pans keeps the gesture: no pan and no click.
509
+ */
510
+ export interface TouchEvent extends ModifierEvent {
511
+ readonly touches: TouchList;
512
+ readonly targetTouches: TouchList;
513
+ readonly changedTouches: TouchList;
514
+ }
515
+
268
516
  export interface WheelEvent extends PointerEvent {
269
517
  readonly deltaX: number;
270
518
  readonly deltaY: number;
@@ -324,6 +572,19 @@ export interface EventMap {
324
572
  pointerenter: PointerEvent;
325
573
  pointerleave: PointerEvent;
326
574
  pointercancel: PointerEvent;
575
+ pointerover: PointerEvent;
576
+ pointerout: PointerEvent;
577
+ touchstart: TouchEvent;
578
+ touchmove: TouchEvent;
579
+ touchend: TouchEvent;
580
+ touchcancel: TouchEvent;
581
+ mousedown: MouseEvent;
582
+ mouseup: MouseEvent;
583
+ mousemove: MouseEvent;
584
+ mouseover: MouseEvent;
585
+ mouseout: MouseEvent;
586
+ mouseenter: MouseEvent;
587
+ mouseleave: MouseEvent;
327
588
  wheel: WheelEvent;
328
589
  keydown: KeyboardEvent;
329
590
  keyup: KeyboardEvent;
@@ -501,3 +762,145 @@ export interface MemoryUsage {
501
762
  * to call every second; `null` when the host cannot say.
502
763
  */
503
764
  export function memoryUsage(): MemoryUsage | null;
765
+
766
+ /**
767
+ * The values the tree resolved for `node`, read one property at a time: typed and animated
768
+ * properties as they are now, box sizes, margins, padding and border widths as laid out, the
769
+ * rest as cascaded with lengths in pixels. Shorthands, custom properties and pseudo-elements
770
+ * read "". Also installed as `globalThis.getComputedStyle`.
771
+ */
772
+ export function getComputedStyle(node: Node | { node: Node }, pseudo?: string | null): ComputedStyle;
773
+
774
+ /**
775
+ * `CSS.supports`, answered as the tree's `@supports` answers. Also installed as
776
+ * `globalThis.CSS.supports`.
777
+ */
778
+ export function supports(property: string, value: string): boolean;
779
+ export function supports(conditionText: string): boolean;
780
+
781
+ /** What `getComputedStyle` returns: read-only, live, a value per camelCase property name. */
782
+ export type ComputedStyle = {
783
+ getPropertyValue(name: string): string;
784
+ getPropertyPriority(name: string): string;
785
+ item(index: number): string;
786
+ readonly cssText: string;
787
+ readonly length: number;
788
+ } & { readonly [property: string]: string };
789
+
790
+ /** What the window put on screen over a stretch of time; see `frameStats`. */
791
+ export interface FrameStats {
792
+ /** Frames presented. */
793
+ frames: number;
794
+ /** `frames` per second over the stretch. */
795
+ fps: number;
796
+ /** Painted frames a newer frame replaced before the GPU drew them. */
797
+ dropped: number;
798
+ /** Milliseconds between presents: median, 95th and 99th percentile, longest. */
799
+ p50: number;
800
+ p95: number;
801
+ p99: number;
802
+ max: number;
803
+ }
804
+
805
+ /**
806
+ * The frames the window presented since the last call (since the app started, the first
807
+ * time), which `requestAnimationFrame` cannot count. Cheap enough to call every second;
808
+ * `null` in a browser build.
809
+ */
810
+ export function frameStats(): FrameStats | null;
811
+
812
+ export type ScrollBehavior = "auto" | "instant" | "smooth";
813
+ export type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
814
+
815
+ export interface ScrollToOptions {
816
+ left?: number;
817
+ top?: number;
818
+ /** `auto` follows the node's `scroll-behavior`. */
819
+ behavior?: ScrollBehavior;
820
+ }
821
+
822
+ export interface ScrollIntoViewOptions {
823
+ block?: ScrollLogicalPosition;
824
+ inline?: ScrollLogicalPosition;
825
+ behavior?: ScrollBehavior;
826
+ }
827
+
828
+ /** As `DOMRect` on the web. Also installed as `globalThis.DOMRect` when there is none. */
829
+ export class DOMRect {
830
+ constructor(x?: number, y?: number, width?: number, height?: number);
831
+ x: number;
832
+ y: number;
833
+ width: number;
834
+ height: number;
835
+ readonly left: number;
836
+ readonly top: number;
837
+ readonly right: number;
838
+ readonly bottom: number;
839
+ toJSON(): { x: number; y: number; width: number; height: number; top: number; right: number; bottom: number; left: number };
840
+ }
841
+
842
+ /** The topmost node at window point `x`, `y`. */
843
+ export function elementFromPoint(x: number, y: number): Node | null;
844
+ /** Every node at window point `x`, `y`, topmost first. */
845
+ export function elementsFromPoint(x: number, y: number): Node[];
846
+ /** The text position at window point `x`, `y`, the offset in UTF-16 units. */
847
+ export function caretPositionFromPoint(x: number, y: number): { offsetNode: Node | null; offset: number; getClientRect(): DOMRect } | null;
848
+ /** `Range.getClientRects` for the text from (`startNode`, `startOffset`) to (`endNode`, `endOffset`), offsets in UTF-16 units. */
849
+ export function rangeClientRects(startNode: Node, startOffset: number, endNode: Node, endOffset: number): DOMRect[];
850
+ /** `Range.getBoundingClientRect` for the same range. */
851
+ export function rangeBoundingClientRect(startNode: Node, startOffset: number, endNode: Node, endOffset: number): DOMRect;
852
+
853
+ type Observable = Node | { node: Node };
854
+
855
+ export interface IntersectionObserverInit {
856
+ /** A node, or null for the window. */
857
+ root?: Observable | null;
858
+ rootMargin?: string;
859
+ scrollMargin?: string;
860
+ threshold?: number | number[];
861
+ }
862
+
863
+ export class IntersectionObserverEntry {
864
+ readonly time: number;
865
+ readonly target: Observable;
866
+ readonly isIntersecting: boolean;
867
+ readonly isVisible: boolean;
868
+ readonly intersectionRatio: number;
869
+ readonly boundingClientRect: DOMRect;
870
+ readonly intersectionRect: DOMRect;
871
+ readonly rootBounds: DOMRect | null;
872
+ }
873
+
874
+ /** As on the web. Entries come after a layout or scroll in which a target crossed a threshold. Also installed as `globalThis.IntersectionObserver`. */
875
+ export class IntersectionObserver {
876
+ constructor(callback: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void, options?: IntersectionObserverInit);
877
+ readonly root: Observable | null;
878
+ readonly rootMargin: string;
879
+ readonly scrollMargin: string;
880
+ readonly thresholds: readonly number[];
881
+ observe(target: Observable): void;
882
+ unobserve(target: Observable): void;
883
+ disconnect(): void;
884
+ takeRecords(): IntersectionObserverEntry[];
885
+ }
886
+
887
+ export interface ResizeObserverSize {
888
+ readonly inlineSize: number;
889
+ readonly blockSize: number;
890
+ }
891
+
892
+ export class ResizeObserverEntry {
893
+ readonly target: Observable;
894
+ readonly contentRect: DOMRect;
895
+ readonly borderBoxSize: readonly ResizeObserverSize[];
896
+ readonly contentBoxSize: readonly ResizeObserverSize[];
897
+ readonly devicePixelContentBoxSize: readonly ResizeObserverSize[];
898
+ }
899
+
900
+ /** As on the web. Entries come after a layout that changed an observed box. Also installed as `globalThis.ResizeObserver`. */
901
+ export class ResizeObserver {
902
+ constructor(callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void);
903
+ observe(target: Observable, options?: { box?: "content-box" | "border-box" | "device-pixel-content-box" }): void;
904
+ unobserve(target: Observable): void;
905
+ disconnect(): void;
906
+ }