@ghia/native 0.0.0-stage → 0.11.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 +201 -0
- package/browser.mjs +7 -0
- package/dist/aria.d.ts +72 -0
- package/dist/aria.d.ts.map +1 -0
- package/dist/aria.js +2 -0
- package/dist/aria.js.map +1 -0
- package/dist/automation/client.d.ts +243 -0
- package/dist/automation/client.d.ts.map +1 -0
- package/dist/automation/client.js +801 -0
- package/dist/automation/client.js.map +1 -0
- package/dist/automation/index.d.ts +5 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +4 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/protocol.d.ts +309 -0
- package/dist/automation/protocol.d.ts.map +1 -0
- package/dist/automation/protocol.js +320 -0
- package/dist/automation/protocol.js.map +1 -0
- package/dist/blob-images.d.ts +32 -0
- package/dist/blob-images.d.ts.map +1 -0
- package/dist/blob-images.js +55 -0
- package/dist/blob-images.js.map +1 -0
- package/dist/bounds.d.ts +61 -0
- package/dist/bounds.d.ts.map +1 -0
- package/dist/bounds.js +85 -0
- package/dist/bounds.js.map +1 -0
- package/dist/clipboard-global.d.ts +11 -0
- package/dist/clipboard-global.d.ts.map +1 -0
- package/dist/clipboard-global.js +2 -0
- package/dist/clipboard-global.js.map +1 -0
- package/dist/clipboard.d.ts +19 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +41 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/cpu-throttle.d.ts +6 -0
- package/dist/cpu-throttle.d.ts.map +1 -0
- package/dist/cpu-throttle.js +42 -0
- package/dist/cpu-throttle.js.map +1 -0
- package/dist/events/data-transfer.d.ts +23 -0
- package/dist/events/data-transfer.d.ts.map +1 -0
- package/dist/events/data-transfer.js +97 -0
- package/dist/events/data-transfer.js.map +1 -0
- package/dist/events/dispatch.d.ts +144 -0
- package/dist/events/dispatch.d.ts.map +1 -0
- package/dist/events/dispatch.js +241 -0
- package/dist/events/dispatch.js.map +1 -0
- package/dist/events/drag.d.ts +21 -0
- package/dist/events/drag.d.ts.map +1 -0
- package/dist/events/drag.js +111 -0
- package/dist/events/drag.js.map +1 -0
- package/dist/events/event-props.d.ts +19 -0
- package/dist/events/event-props.d.ts.map +1 -0
- package/dist/events/event-props.js +104 -0
- package/dist/events/event-props.js.map +1 -0
- package/dist/events/keyboard-defaults.d.ts +18 -0
- package/dist/events/keyboard-defaults.d.ts.map +1 -0
- package/dist/events/keyboard-defaults.js +121 -0
- package/dist/events/keyboard-defaults.js.map +1 -0
- package/dist/events/listeners.d.ts +18 -0
- package/dist/events/listeners.d.ts.map +1 -0
- package/dist/events/listeners.js +49 -0
- package/dist/events/listeners.js.map +1 -0
- package/dist/events/route.d.ts +17 -0
- package/dist/events/route.d.ts.map +1 -0
- package/dist/events/route.js +36 -0
- package/dist/events/route.js.map +1 -0
- package/dist/events/types.d.ts +269 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +2 -0
- package/dist/events/types.js.map +1 -0
- package/dist/events/window-target.d.ts +120 -0
- package/dist/events/window-target.d.ts.map +1 -0
- package/dist/events/window-target.js +311 -0
- package/dist/events/window-target.js.map +1 -0
- package/dist/eyedropper.d.ts +33 -0
- package/dist/eyedropper.d.ts.map +1 -0
- package/dist/eyedropper.js +66 -0
- package/dist/eyedropper.js.map +1 -0
- package/dist/focus.d.ts +18 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +26 -0
- package/dist/focus.js.map +1 -0
- package/dist/fonts.d.ts +12 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +17 -0
- package/dist/fonts.js.map +1 -0
- package/dist/forms.d.ts +10 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +9 -0
- package/dist/forms.js.map +1 -0
- package/dist/host-runtime.d.ts +108 -0
- package/dist/host-runtime.d.ts.map +1 -0
- package/dist/host-runtime.js +213 -0
- package/dist/host-runtime.js.map +1 -0
- package/dist/host.d.ts +2403 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +30 -0
- package/dist/host.js.map +1 -0
- package/dist/idle-gc.d.ts +36 -0
- package/dist/idle-gc.d.ts.map +1 -0
- package/dist/idle-gc.js +70 -0
- package/dist/idle-gc.js.map +1 -0
- package/dist/keyframes.d.ts +108 -0
- package/dist/keyframes.d.ts.map +1 -0
- package/dist/keyframes.js +107 -0
- package/dist/keyframes.js.map +1 -0
- package/dist/layout-animation.d.ts +38 -0
- package/dist/layout-animation.d.ts.map +1 -0
- package/dist/layout-animation.js +41 -0
- package/dist/layout-animation.js.map +1 -0
- package/dist/match-media.d.ts +62 -0
- package/dist/match-media.d.ts.map +1 -0
- package/dist/match-media.js +272 -0
- package/dist/match-media.js.map +1 -0
- package/dist/media-query.d.ts +21 -0
- package/dist/media-query.d.ts.map +1 -0
- package/dist/media-query.js +599 -0
- package/dist/media-query.js.map +1 -0
- package/dist/motion-bindings.d.ts +36 -0
- package/dist/motion-bindings.d.ts.map +1 -0
- package/dist/motion-bindings.js +107 -0
- package/dist/motion-bindings.js.map +1 -0
- package/dist/motion-config.d.ts +20 -0
- package/dist/motion-config.d.ts.map +1 -0
- package/dist/motion-config.js +51 -0
- package/dist/motion-config.js.map +1 -0
- package/dist/motion-span.d.ts +57 -0
- package/dist/motion-span.d.ts.map +1 -0
- package/dist/motion-span.js +150 -0
- package/dist/motion-span.js.map +1 -0
- package/dist/motion-value.d.ts +269 -0
- package/dist/motion-value.d.ts.map +1 -0
- package/dist/motion-value.js +941 -0
- package/dist/motion-value.js.map +1 -0
- package/dist/motion-variants.d.ts +190 -0
- package/dist/motion-variants.d.ts.map +1 -0
- package/dist/motion-variants.js +249 -0
- package/dist/motion-variants.js.map +1 -0
- package/dist/mutations.d.ts +65 -0
- package/dist/mutations.d.ts.map +1 -0
- package/dist/mutations.js +320 -0
- package/dist/mutations.js.map +1 -0
- package/dist/nativeview.d.ts +10 -0
- package/dist/nativeview.d.ts.map +1 -0
- package/dist/nativeview.js +92 -0
- package/dist/nativeview.js.map +1 -0
- package/dist/observers.d.ts +92 -0
- package/dist/observers.d.ts.map +1 -0
- package/dist/observers.js +579 -0
- package/dist/observers.js.map +1 -0
- package/dist/presence.d.ts +63 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +54 -0
- package/dist/presence.js.map +1 -0
- package/dist/renderer-state.d.ts +155 -0
- package/dist/renderer-state.d.ts.map +1 -0
- package/dist/renderer-state.js +302 -0
- package/dist/renderer-state.js.map +1 -0
- package/dist/reorder.d.ts +63 -0
- package/dist/reorder.d.ts.map +1 -0
- package/dist/reorder.js +303 -0
- package/dist/reorder.js.map +1 -0
- package/dist/runtime.d.ts +23 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +157 -0
- package/dist/runtime.js.map +1 -0
- package/dist/screen.d.ts +8 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +16 -0
- package/dist/screen.js.map +1 -0
- package/dist/scroll.d.ts +79 -0
- package/dist/scroll.d.ts.map +1 -0
- package/dist/scroll.js +170 -0
- package/dist/scroll.js.map +1 -0
- package/dist/style-images.d.ts +20 -0
- package/dist/style-images.d.ts.map +1 -0
- package/dist/style-images.js +57 -0
- package/dist/style-images.js.map +1 -0
- package/dist/svg.d.ts +16 -0
- package/dist/svg.d.ts.map +1 -0
- package/dist/svg.js +119 -0
- package/dist/svg.js.map +1 -0
- package/dist/testing.d.ts +811 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +1187 -0
- package/dist/testing.js.map +1 -0
- package/dist/text-match.d.ts +8 -0
- package/dist/text-match.d.ts.map +1 -0
- package/dist/text-match.js +10 -0
- package/dist/text-match.js.map +1 -0
- package/dist/text-selection.d.ts +34 -0
- package/dist/text-selection.d.ts.map +1 -0
- package/dist/text-selection.js +23 -0
- package/dist/text-selection.js.map +1 -0
- package/dist/universal-style.d.ts +22 -0
- package/dist/universal-style.d.ts.map +1 -0
- package/dist/universal-style.js +58 -0
- package/dist/universal-style.js.map +1 -0
- package/dist/web-animations.d.ts +300 -0
- package/dist/web-animations.d.ts.map +1 -0
- package/dist/web-animations.js +1032 -0
- package/dist/web-animations.js.map +1 -0
- package/dist/webview.d.ts +39 -0
- package/dist/webview.d.ts.map +1 -0
- package/dist/webview.js +26 -0
- package/dist/webview.js.map +1 -0
- package/gpuix-native.darwin-arm64.node +4 -0
- package/index.cjs +789 -0
- package/index.d.ts +2603 -0
- package/index.js +729 -0
- package/package.json +94 -3
- package/README.md +0 -3
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,2403 @@
|
|
|
1
|
+
import type { AriaProps } from "./aria.js";
|
|
2
|
+
import type { DebugFrameOverlayStats, EdgeInsets, ElementBounds, EventPayload, GpuixRenderer, HighlightMatch, PathPromptOptions, WindowInsets as NativeWindowInsets } from "../index.js";
|
|
3
|
+
import type { DomEvent, RootEvent } from "./events/dispatch.js";
|
|
4
|
+
import type { AnimationEventProps, CompositionEventProps, ContentVisibilityEventProps, HostInputEvent, PointerEventProps } from "./events/types.js";
|
|
5
|
+
import type { ScrollEvent } from "./scroll.js";
|
|
6
|
+
import type { MotionValue } from "./motion-value.js";
|
|
7
|
+
import type { MotionGestureName } from "./motion-variants.js";
|
|
8
|
+
export type { DebugFrameOverlayStats, EdgeInsets, ElementBounds, HighlightMatch, NativeWindowInsets, PathPromptOptions, };
|
|
9
|
+
export * from "./events/listeners.js";
|
|
10
|
+
export * from "./events/types.js";
|
|
11
|
+
export type { AriaProps };
|
|
12
|
+
export * from "./clipboard.js";
|
|
13
|
+
export { document, GpuixDocument, forgetElementSource, GpuixEventTarget, installElementSource, syncWindowEventListeners, window, type AddEventListenerOptions, type WindowEventListener, } from "./events/window-target.js";
|
|
14
|
+
export { preventEventDefault, type DomEvent, type RootEvent } from "./events/dispatch.js";
|
|
15
|
+
export * from "./focus.js";
|
|
16
|
+
export * from "./forms.js";
|
|
17
|
+
export * from "./bounds.js";
|
|
18
|
+
export * from "./host-runtime.js";
|
|
19
|
+
export * from "./keyframes.js";
|
|
20
|
+
export * from "./layout-animation.js";
|
|
21
|
+
export * from "./match-media.js";
|
|
22
|
+
export * from "./motion-bindings.js";
|
|
23
|
+
export * from "./motion-config.js";
|
|
24
|
+
export * from "./motion-span.js";
|
|
25
|
+
export * from "./motion-variants.js";
|
|
26
|
+
export * from "./motion-value.js";
|
|
27
|
+
export * from "./mutations.js";
|
|
28
|
+
export * from "./observers.js";
|
|
29
|
+
export * from "./presence.js";
|
|
30
|
+
export * from "./renderer-state.js";
|
|
31
|
+
export * from "./text-selection.js";
|
|
32
|
+
export * from "./nativeview.js";
|
|
33
|
+
export * from "./webview.js";
|
|
34
|
+
export * from "./scroll.js";
|
|
35
|
+
export * from "./reorder.js";
|
|
36
|
+
export * from "./svg.js";
|
|
37
|
+
export * from "./universal-style.js";
|
|
38
|
+
export * from "./web-animations.js";
|
|
39
|
+
/**
|
|
40
|
+
* A number is px. A string is a CSS length: `px`, `in`, `cm`, `mm`, `q`, `pt`, `pc`, `%`,
|
|
41
|
+
* `em` (this element's font size), `rem` (the root's), `vw`, `vh`, `vmin`, `vmax`, or a
|
|
42
|
+
* `calc()` of them with `+`, `-` and `*` or `/` by numbers (`"calc(100% - 20px)"`), plus
|
|
43
|
+
* `"auto"`, `"anchor-size(...)"` and the size keywords (`"min-content"`, `"max-content"`,
|
|
44
|
+
* `"fit-content"`) where the property accepts them. Resolved natively on
|
|
45
|
+
* every layout, so `vw` follows a resize and `em` follows `fontSize`. Motion animates every
|
|
46
|
+
* length: see `MotionStyle`.
|
|
47
|
+
*/
|
|
48
|
+
export type DimensionValue = number | string;
|
|
49
|
+
/** A CSS `<line-style>`, the value of `borderStyle` and its per-side longhands. */
|
|
50
|
+
export type LineStyle = "none" | "hidden" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset";
|
|
51
|
+
/** A CSS `<outline-style>`, the value of `outlineStyle`: a `LineStyle` but `hidden`, or `auto`,
|
|
52
|
+
* which is painted as `solid`. */
|
|
53
|
+
export type OutlineStyle = Exclude<LineStyle, "hidden"> | "auto";
|
|
54
|
+
/**
|
|
55
|
+
* Every `StyleDesc` longhand whose value is a number, a length, a colour or a
|
|
56
|
+
* shadow list can be animated, plus the `padding`, `margin`, `borderWidth`,
|
|
57
|
+
* `borderRadius`, `borderColor`, `gap`, `inset` and `flex` shorthands, which expand to their longhands.
|
|
58
|
+
* `flex` is `flexGrow`, `flexShrink` and `flexBasis`, as CSS animates it: `"1 1 0px"` to
|
|
59
|
+
* `"3 1 100px"` is `"2 1 50px"` halfway, and a lone number is `n 1 0%`.
|
|
60
|
+
* A shorthand written with several values (`padding: "0.5em 0.75em"`, `gap: "4px 8px"`,
|
|
61
|
+
* `borderRadius: "10px 20px / 5px"`) gives each side, axis or corner its own value, and
|
|
62
|
+
* each animates on its own; keyframes of such strings split frame by frame.
|
|
63
|
+
* Discrete properties (`display`, `position`, ...) are an error.
|
|
64
|
+
*
|
|
65
|
+
* A length is its px and its percentage, whatever it is written as, and two lengths
|
|
66
|
+
* blend part by part, as Chrome blends them: `calc(100% - 20px)` to `calc(50% + 10px)`
|
|
67
|
+
* is `calc(75% - 5px)` halfway, and `20px` to `50%` is `calc(10px + 25%)`. `em`, `rem`
|
|
68
|
+
* and the viewport units are px by then, from the element's font size and the window.
|
|
69
|
+
* (A motion value keeps its `em` and `rem` until it is applied, so one value bound to two
|
|
70
|
+
* elements is two sizes.)
|
|
71
|
+
* The percentage stays a share of its basis (the containing block, or the border box for
|
|
72
|
+
* a corner radius), so a parent that resizes mid-animation is followed exactly, and a
|
|
73
|
+
* spring or a retarget keeps its speed on each part. This holds for the sizes, the
|
|
74
|
+
* insets, the margins, `padding`, `flexBasis`, the gaps, the border widths, `outlineWidth`,
|
|
75
|
+
* `outlineOffset`, the corner radii and `fontSize`. Where CSS takes no percentage (the
|
|
76
|
+
* border widths and the outline) a percentage is an error; a `fontSize` percentage is of
|
|
77
|
+
* the parent's font size, so it is px. A target that is negative whatever the basis is an
|
|
78
|
+
* error, and one that only comes out negative is clamped. A corner moves
|
|
79
|
+
* both its radii (`"50%"` is an ellipse on a wide box, as in CSS), so `"10px / 20px"`
|
|
80
|
+
* to `"30px / 40px"` is `"20px / 30px"` halfway. The margins, the insets and `flexBasis` also take
|
|
81
|
+
* `"auto"`, which CSS cannot interpolate with a length: the pair is discrete, so it flips
|
|
82
|
+
* at the halfway point of the eased progress, and a CSS transition runs it only under
|
|
83
|
+
* `transition-behavior: allow-discrete`. An unset margin is `0` and an unset inset is `auto`.
|
|
84
|
+
* `width` and `height` also take `"auto"`, the size the content
|
|
85
|
+
* wants (the min and max sizes do not). The width is measured by an extra layout of the
|
|
86
|
+
* tree while the element animates it, one frame late like the height. The size keywords
|
|
87
|
+
* (`min-content` and the like) are an error, and a CSS transition or animation to or from
|
|
88
|
+
* `auto` needs `interpolateSize: "allow-keywords"`.
|
|
89
|
+
*
|
|
90
|
+
* Each property takes a target or keyframes (`opacity: [0, 1, 0.5]`); see
|
|
91
|
+
* `MotionKeyframes`.
|
|
92
|
+
*/
|
|
93
|
+
export type MotionStyle = {
|
|
94
|
+
[Property in keyof MotionStyleTargets]?: MotionKeyframes<NonNullable<MotionStyleTargets[Property]>>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* One target, or keyframes: a list the property animates through, over one
|
|
98
|
+
* `duration` (spread by `times`). A `null` stands for the keyframe before it, or
|
|
99
|
+
* for the value the property starts from when it comes first. A list is
|
|
100
|
+
* keyframes unless it is itself one value of the property (`BoxShadow[]`, a
|
|
101
|
+
* `strokeDasharray` list of numbers), in which case keyframes are a list of
|
|
102
|
+
* those. Springs animate between two keyframes.
|
|
103
|
+
*/
|
|
104
|
+
export type MotionKeyframes<Value> = Value | Array<Value | null>;
|
|
105
|
+
export type MotionStyleTargets = Pick<StyleDesc, "inset" | "top" | "right" | "bottom" | "left" | "flex" | "flexGrow" | "flexShrink" | "flexBasis" | "gap" | "rowGap" | "columnGap" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "opacity" | "backgroundColor" | "color" | "borderWidth" | "borderTopWidth" | "borderRightWidth" | "borderBottomWidth" | "borderLeftWidth" | "borderColor" | "borderTopColor" | "borderRightColor" | "borderBottomColor" | "borderLeftColor" | "borderRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "boxShadow" | "filter" | "aspectRatio" | "outlineWidth" | "outlineColor" | "outlineOffset" | "textDecorationColor" | "textUnderlineOffset" | "textDecorationThickness" | "fontSize" | "fontWeight" | "fontVariationSettings" | "lineHeight" | "scrollbarColor" | "scrollbarWidth" | "selectionColor"> & MotionTransformKeys & {
|
|
106
|
+
width?: MotionLength | "auto";
|
|
107
|
+
height?: MotionLength | "auto";
|
|
108
|
+
minWidth?: MotionLength;
|
|
109
|
+
minHeight?: MotionLength;
|
|
110
|
+
maxWidth?: MotionLength;
|
|
111
|
+
maxHeight?: MotionLength;
|
|
112
|
+
};
|
|
113
|
+
/** Pixels, or a CSS length such as `"50%"`, `"1.5em"` or `"calc(100% - 20px)"`. */
|
|
114
|
+
export type MotionLength = DimensionValue;
|
|
115
|
+
/**
|
|
116
|
+
* Motion's transform keys, composed in Motion's order (`transformPerspective`, `x`, `y`, `z`, `translateX`,
|
|
117
|
+
* `translateY`, `translateZ`, `scale`, `scaleX`, `scaleY`, `scaleZ`, `rotate`, `rotateX`, `rotateY`, `rotateZ`,
|
|
118
|
+
* `skew`, `skewX`, `skewY`) around the origin. They replace
|
|
119
|
+
* `transform`, as Motion's do, and the element is a stacking context and the containing block of its
|
|
120
|
+
* absolute and fixed descendants whenever one is set. On a `motion.*` component `scale` and `rotate`
|
|
121
|
+
* are these and not the CSS properties of the same names. They animate with tweens, springs and
|
|
122
|
+
* keyframes, and a motion value can drive each. Layout is not affected.
|
|
123
|
+
*
|
|
124
|
+
* `transform` is not one of the keys: as a target (`animate`, `initial`, variants, keyframes, `exit`,
|
|
125
|
+
* the gestures) it is the list the element is drawn with, and the keys beside it are ignored, as in
|
|
126
|
+
* Motion. A static `style.transform` is replaced by the keys instead.
|
|
127
|
+
*/
|
|
128
|
+
export interface MotionTransformKeys {
|
|
129
|
+
/** A number is px; a string is a CSS length, and `%` is of the element's own border box. */
|
|
130
|
+
x?: MotionLength;
|
|
131
|
+
y?: MotionLength;
|
|
132
|
+
translateX?: MotionLength;
|
|
133
|
+
translateY?: MotionLength;
|
|
134
|
+
scale?: number;
|
|
135
|
+
scaleX?: number;
|
|
136
|
+
scaleY?: number;
|
|
137
|
+
/** Along z, so only seen where the element is in a 3D rendering context or under a perspective. */
|
|
138
|
+
scaleZ?: number;
|
|
139
|
+
/** A number is degrees; a string is a CSS angle (`"0.25turn"`). */
|
|
140
|
+
rotate?: number | string;
|
|
141
|
+
rotateZ?: number | string;
|
|
142
|
+
skew?: number | string;
|
|
143
|
+
skewX?: number | string;
|
|
144
|
+
skewY?: number | string;
|
|
145
|
+
/** A number is a fraction of the border box (`0.5` is the middle, the default); a string is a CSS length. */
|
|
146
|
+
originX?: number | string;
|
|
147
|
+
originY?: number | string;
|
|
148
|
+
/** Along z: a number is px; a string a CSS length without `%`. */
|
|
149
|
+
originZ?: number | string;
|
|
150
|
+
/** Along z, toward the viewer: a number is px; a string is a CSS length without `%`. Seen with a
|
|
151
|
+
* `perspective` on the parent, or `transformPerspective` here. */
|
|
152
|
+
z?: MotionLength;
|
|
153
|
+
translateZ?: MotionLength;
|
|
154
|
+
/** A number is degrees; a string is a CSS angle. */
|
|
155
|
+
rotateX?: number | string;
|
|
156
|
+
rotateY?: number | string;
|
|
157
|
+
/** `perspective(<n>px)` first in the list, so this element's own transform is seen from `n` px. A
|
|
158
|
+
* number is px. Not the CSS `perspective` property, which is the style `perspective`. */
|
|
159
|
+
transformPerspective?: number;
|
|
160
|
+
/**
|
|
161
|
+
* A CSS transform list or `none`. Animating it blends the two lists as a CSS transition does
|
|
162
|
+
* (function by function while they pair up, as matrices from the first that does not), and a
|
|
163
|
+
* list that is not `none` is a stacking context and a containing block even if it moves nothing.
|
|
164
|
+
*/
|
|
165
|
+
transform?: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* `StyleDesc` where each animatable property may hold a motion value instead.
|
|
169
|
+
* The adapter binds it to the element rather than sending it as style.
|
|
170
|
+
*/
|
|
171
|
+
export type MotionValueStyle = Omit<StyleDesc, Exclude<keyof MotionStyle, "flex">> & {
|
|
172
|
+
[Property in Exclude<keyof MotionStyle, "flex" | keyof MotionTransformKeys>]?: StyleDesc[Property] | MotionValue;
|
|
173
|
+
} & {
|
|
174
|
+
[Property in keyof MotionTransformKeys]?: (Property extends keyof StyleDesc ? StyleDesc[Property] : MotionTransformKeys[Property]) | MotionValue;
|
|
175
|
+
};
|
|
176
|
+
export type MotionEase = "linear" | "ease" | "easeIn" | "easeOut" | "easeInOut" | [number, number, number, number]
|
|
177
|
+
/** A CSS `<easing-function>`, as `transitionTimingFunction` takes. */
|
|
178
|
+
| "ease-in" | "ease-out" | "ease-in-out" | "step-start" | "step-end" | `cubic-bezier(${string})` | `steps(${string})` | `linear(${string})`;
|
|
179
|
+
/** How a transition plays again once it reaches its last keyframe. */
|
|
180
|
+
export interface MotionRepeatOptions {
|
|
181
|
+
/**
|
|
182
|
+
* Extra iterations after the first. `Infinity` loops for ever, and the
|
|
183
|
+
* animation never completes.
|
|
184
|
+
*/
|
|
185
|
+
repeat?: number;
|
|
186
|
+
/**
|
|
187
|
+
* `"loop"` plays every iteration from the first keyframe; `"reverse"` plays
|
|
188
|
+
* odd iterations backwards in time, so their easing runs backwards too;
|
|
189
|
+
* `"mirror"` plays them through the keyframes in reverse order, with the same
|
|
190
|
+
* timing and easing as the first.
|
|
191
|
+
*/
|
|
192
|
+
repeatType?: "loop" | "reverse" | "mirror";
|
|
193
|
+
/** Seconds held at the end of each iteration before the next. */
|
|
194
|
+
repeatDelay?: number;
|
|
195
|
+
}
|
|
196
|
+
export interface MotionTweenTransition extends MotionRepeatOptions {
|
|
197
|
+
type?: "tween";
|
|
198
|
+
/** Duration in seconds, of one iteration. */
|
|
199
|
+
duration?: number;
|
|
200
|
+
/** Delay in seconds. */
|
|
201
|
+
delay?: number;
|
|
202
|
+
/** One easing, or one per keyframe segment. */
|
|
203
|
+
ease?: MotionEase | MotionEase[];
|
|
204
|
+
/**
|
|
205
|
+
* Where each keyframe sits in an iteration, from 0 to 1 and ascending: one
|
|
206
|
+
* per keyframe. Evenly spaced when omitted.
|
|
207
|
+
*/
|
|
208
|
+
times?: number[];
|
|
209
|
+
stiffness?: never;
|
|
210
|
+
damping?: never;
|
|
211
|
+
mass?: never;
|
|
212
|
+
bounce?: never;
|
|
213
|
+
restSpeed?: never;
|
|
214
|
+
restDelta?: never;
|
|
215
|
+
}
|
|
216
|
+
interface MotionSpringBase extends MotionRepeatOptions {
|
|
217
|
+
type: "spring";
|
|
218
|
+
/** Delay in seconds. The spring holds its start until the delay passes. */
|
|
219
|
+
delay?: number;
|
|
220
|
+
ease?: never;
|
|
221
|
+
/** A spring only animates between two keyframes. */
|
|
222
|
+
times?: never;
|
|
223
|
+
/** Speed, in units per second, below which the spring may settle. */
|
|
224
|
+
restSpeed?: number;
|
|
225
|
+
/** Distance from the target, in units, within which the spring may settle. */
|
|
226
|
+
restDelta?: number;
|
|
227
|
+
}
|
|
228
|
+
/** A spring described by its physics. Defaults to stiffness 100, damping 10, mass 1. */
|
|
229
|
+
export interface MotionSpringPhysicsTransition extends MotionSpringBase {
|
|
230
|
+
stiffness?: number;
|
|
231
|
+
damping?: number;
|
|
232
|
+
mass?: number;
|
|
233
|
+
duration?: never;
|
|
234
|
+
bounce?: never;
|
|
235
|
+
}
|
|
236
|
+
/** A spring described by how long it takes to settle and how much it overshoots. */
|
|
237
|
+
export interface MotionSpringDurationTransition extends MotionSpringBase {
|
|
238
|
+
/** Seconds to settle, 0.01 to 10. Defaults to 0.8. */
|
|
239
|
+
duration?: number;
|
|
240
|
+
/** 0 is critically damped; toward 1 it oscillates longer. Defaults to 0.3. */
|
|
241
|
+
bounce?: number;
|
|
242
|
+
stiffness?: never;
|
|
243
|
+
damping?: never;
|
|
244
|
+
mass?: never;
|
|
245
|
+
}
|
|
246
|
+
export type MotionSpringTransition = MotionSpringPhysicsTransition | MotionSpringDurationTransition;
|
|
247
|
+
export type MotionCurve = MotionTweenTransition | MotionSpringTransition;
|
|
248
|
+
/**
|
|
249
|
+
* One curve for every property, or a curve per property as in Framer Motion.
|
|
250
|
+
* A property resolves to `transition[property]`, then `transition.default`,
|
|
251
|
+
* then the curve fields at the top level. Each level replaces the next as a
|
|
252
|
+
* whole. A shorthand key (`padding`) sets all its longhands, and a longhand
|
|
253
|
+
* beside it wins.
|
|
254
|
+
*
|
|
255
|
+
* A level that holds only `delay` and the repeat fields describes no curve, and
|
|
256
|
+
* Motion's default for the key runs: a spring for a transform key (`x`, `y`,
|
|
257
|
+
* `rotate`, `skew`, ... and `scale`, which is critically damped towards 0),
|
|
258
|
+
* `easeOut` over 0.8 s for more than two keyframes, otherwise
|
|
259
|
+
* `cubic-bezier(0.25, 0.1, 0.35, 1)` over 0.3 s. An entry for another key makes
|
|
260
|
+
* the rest of the transition describe the curve, so a key without an entry runs
|
|
261
|
+
* a 0.3 s `easeOut` tween.
|
|
262
|
+
*/
|
|
263
|
+
export type MotionTransition = MotionCurve & {
|
|
264
|
+
default?: MotionCurve;
|
|
265
|
+
/** The glide of the `layout` and `layoutId` props. Falls back to the rest of this transition, then to a 0.45 s tween. */
|
|
266
|
+
layout?: MotionCurve;
|
|
267
|
+
} & {
|
|
268
|
+
[Property in keyof MotionStyle]?: MotionCurve;
|
|
269
|
+
};
|
|
270
|
+
export interface MotionProps {
|
|
271
|
+
initial?: MotionStyle | false;
|
|
272
|
+
/** Left out by an element that only has `layout`. */
|
|
273
|
+
animate?: MotionStyle;
|
|
274
|
+
/** Target applied while this node is leaving `AnimatePresence`. */
|
|
275
|
+
exit?: MotionStyle;
|
|
276
|
+
/**
|
|
277
|
+
* The transition of that exit: `exit`'s own, else the component's. Native does not read it; the
|
|
278
|
+
* Solid `AnimatePresence` plays the exit with it.
|
|
279
|
+
*/
|
|
280
|
+
exitTransition?: MotionTransition;
|
|
281
|
+
transition?: MotionTransition;
|
|
282
|
+
/**
|
|
283
|
+
* What the element animates to while the pointer is over it, a press that began on it goes on,
|
|
284
|
+
* it has `:focus-visible` focus, or `inView` is true. Each takes the `transition` of its own
|
|
285
|
+
* animation. Several at once apply in this order of priority: in view, hover, tap, focus.
|
|
286
|
+
*/
|
|
287
|
+
whileHover?: MotionStyle & {
|
|
288
|
+
transition?: MotionTransition;
|
|
289
|
+
};
|
|
290
|
+
whileTap?: MotionStyle & {
|
|
291
|
+
transition?: MotionTransition;
|
|
292
|
+
};
|
|
293
|
+
whileFocus?: MotionStyle & {
|
|
294
|
+
transition?: MotionTransition;
|
|
295
|
+
};
|
|
296
|
+
whileInView?: MotionStyle & {
|
|
297
|
+
transition?: MotionTransition;
|
|
298
|
+
};
|
|
299
|
+
/** Whether the element is in view, which `whileInView` waits for. */
|
|
300
|
+
inView?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* The gestures (`"whileHover"`, ...) whose target above answers to the nearest ancestor with
|
|
303
|
+
* `controls` instead of this element: the variant names that ancestor's `while*` gave it.
|
|
304
|
+
*/
|
|
305
|
+
inherit?: MotionGestureName[];
|
|
306
|
+
/** The gestures this element hands down as variant names. Its presence makes it a controller. */
|
|
307
|
+
controls?: MotionGestureName[];
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* The attributes of an SVG shape (`motion.path`, `motion.circle`, ...) that can
|
|
311
|
+
* animate. They go through the same engine as `MotionStyle`: tweens, springs,
|
|
312
|
+
* per-key transitions, and Oklab colours.
|
|
313
|
+
*
|
|
314
|
+
* `pathLength`, `pathOffset` and `pathSpacing` are Framer's normalised draw
|
|
315
|
+
* keys, each a fraction of the shape's length: `pathLength` is how much is
|
|
316
|
+
* stroked, `pathOffset` shifts where the stroke starts, `pathSpacing` is the
|
|
317
|
+
* gap after it (default 1, so one dash). They set the dash for you, so use them
|
|
318
|
+
* instead of `strokeDasharray` and `strokeDashoffset`. A bare `pathLength`
|
|
319
|
+
* *prop* is the DOM attribute instead: it declares a length that dash values
|
|
320
|
+
* are measured in.
|
|
321
|
+
*
|
|
322
|
+
* `d` morphs when both paths use the same commands, after relative commands are
|
|
323
|
+
* made absolute; otherwise it switches halfway. `strokeDasharray` lists of
|
|
324
|
+
* different lengths are repeated to a common length.
|
|
325
|
+
*/
|
|
326
|
+
export type SvgMotionStyle = {
|
|
327
|
+
[Attribute in keyof SvgMotionTargets]?: MotionKeyframes<NonNullable<SvgMotionTargets[Attribute]>>;
|
|
328
|
+
};
|
|
329
|
+
interface SvgMotionTargets {
|
|
330
|
+
pathLength?: number;
|
|
331
|
+
pathOffset?: number;
|
|
332
|
+
pathSpacing?: number;
|
|
333
|
+
strokeDasharray?: number | string | number[];
|
|
334
|
+
strokeDashoffset?: number;
|
|
335
|
+
strokeWidth?: number;
|
|
336
|
+
fill?: string;
|
|
337
|
+
stroke?: string;
|
|
338
|
+
opacity?: number;
|
|
339
|
+
fillOpacity?: number;
|
|
340
|
+
strokeOpacity?: number;
|
|
341
|
+
cx?: number;
|
|
342
|
+
cy?: number;
|
|
343
|
+
r?: number;
|
|
344
|
+
rx?: number;
|
|
345
|
+
ry?: number;
|
|
346
|
+
x?: number;
|
|
347
|
+
y?: number;
|
|
348
|
+
width?: number;
|
|
349
|
+
height?: number;
|
|
350
|
+
x1?: number;
|
|
351
|
+
y1?: number;
|
|
352
|
+
x2?: number;
|
|
353
|
+
y2?: number;
|
|
354
|
+
d?: string;
|
|
355
|
+
/** `<feGaussianBlur>` and `<feDropShadow>`; a single number. */
|
|
356
|
+
stdDeviation?: number;
|
|
357
|
+
/** `<feOffset>`, `<feDropShadow>`, `<text>` and `<tspan>`; a single number. */
|
|
358
|
+
dx?: number;
|
|
359
|
+
dy?: number;
|
|
360
|
+
floodColor?: string;
|
|
361
|
+
floodOpacity?: number;
|
|
362
|
+
stopColor?: string;
|
|
363
|
+
stopOpacity?: number;
|
|
364
|
+
strokeMiterlimit?: number;
|
|
365
|
+
refX?: number;
|
|
366
|
+
refY?: number;
|
|
367
|
+
fontSize?: number;
|
|
368
|
+
letterSpacing?: number;
|
|
369
|
+
}
|
|
370
|
+
/** Same resolution as `MotionTransition`, keyed by `SvgMotionStyle`. */
|
|
371
|
+
export type SvgMotionTransition = MotionCurve & {
|
|
372
|
+
default?: MotionCurve;
|
|
373
|
+
} & {
|
|
374
|
+
[Attribute in keyof SvgMotionStyle]?: MotionCurve;
|
|
375
|
+
};
|
|
376
|
+
export interface SvgMotionProps {
|
|
377
|
+
initial?: SvgMotionStyle | false;
|
|
378
|
+
animate: SvgMotionStyle;
|
|
379
|
+
/** Target applied while this node is leaving `AnimatePresence`. */
|
|
380
|
+
exit?: SvgMotionStyle;
|
|
381
|
+
/** The transition of that exit; see `MotionProps.exitTransition`. */
|
|
382
|
+
exitTransition?: SvgMotionTransition;
|
|
383
|
+
transition?: SvgMotionTransition;
|
|
384
|
+
whileHover?: SvgMotionStyle & {
|
|
385
|
+
transition?: SvgMotionTransition;
|
|
386
|
+
};
|
|
387
|
+
whileTap?: SvgMotionStyle & {
|
|
388
|
+
transition?: SvgMotionTransition;
|
|
389
|
+
};
|
|
390
|
+
whileFocus?: SvgMotionStyle & {
|
|
391
|
+
transition?: SvgMotionTransition;
|
|
392
|
+
};
|
|
393
|
+
whileInView?: SvgMotionStyle & {
|
|
394
|
+
transition?: SvgMotionTransition;
|
|
395
|
+
};
|
|
396
|
+
inView?: boolean;
|
|
397
|
+
inherit?: MotionGestureName[];
|
|
398
|
+
controls?: MotionGestureName[];
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* CSS `cursor` keywords GPUI can paint. An unlisted keyword is ignored, like
|
|
402
|
+
* every other invalid style value.
|
|
403
|
+
*/
|
|
404
|
+
export type CursorValue = "default" | "auto" | "pointer" | "text" | "vertical-text" | "crosshair" | "grab" | "grabbing" | "move" | "all-scroll" | "col-resize" | "row-resize" | "ew-resize" | "ns-resize" | "nwse-resize" | "nesw-resize" | "n-resize" | "e-resize" | "s-resize" | "w-resize" | "ne-resize" | "nw-resize" | "se-resize" | "sw-resize" | "not-allowed" | "no-drop" | "alias" | "copy" | "context-menu" | "none";
|
|
405
|
+
export interface BoxShadow {
|
|
406
|
+
offsetX: number;
|
|
407
|
+
offsetY: number;
|
|
408
|
+
blurRadius: number;
|
|
409
|
+
spreadRadius: number;
|
|
410
|
+
color: string;
|
|
411
|
+
/** Draw inside the border box, like CSS `inset`. */
|
|
412
|
+
inset?: boolean;
|
|
413
|
+
}
|
|
414
|
+
export interface LinearGradientStop {
|
|
415
|
+
color: string;
|
|
416
|
+
/** Position along the gradient from 0 to 1. */
|
|
417
|
+
position: number;
|
|
418
|
+
}
|
|
419
|
+
export interface LinearGradientBackground {
|
|
420
|
+
type: "linear-gradient";
|
|
421
|
+
/** CSS angle in degrees. 0 points up and values increase clockwise. */
|
|
422
|
+
angle: number;
|
|
423
|
+
stops: [LinearGradientStop, LinearGradientStop];
|
|
424
|
+
colorSpace?: "srgb" | "oklab";
|
|
425
|
+
}
|
|
426
|
+
export interface StyleDesc {
|
|
427
|
+
/** `"flex"`, `"grid"`, `"block"` (the default), `"none"`, which builds no box at all, or
|
|
428
|
+
* `"contents"`, which builds no box either and lays its children out as the parent's own.
|
|
429
|
+
* `"inline-block"`, `"inline-flex"`, `"inline-grid"` and `"inline-table"` put the box on a line of
|
|
430
|
+
* text as one unit, as CSS does (an atomic inline); where the parent lays out items, or the box is
|
|
431
|
+
* `position: absolute` or `fixed`, they are `"block"`, `"flex"`, `"grid"` and `"table"`.
|
|
432
|
+
* The table values: `"table"`, `"table-row-group"`, `"table-header-group"`,
|
|
433
|
+
* `"table-footer-group"`, `"table-row"`, `"table-cell"`, `"table-caption"`, `"table-column"`
|
|
434
|
+
* and `"table-column-group"` (see docs/reference.md's Tables section; `colSpan`, `rowSpan` and
|
|
435
|
+
* `span` are props of the element). */
|
|
436
|
+
display?: string;
|
|
437
|
+
visibility?: string;
|
|
438
|
+
/** CSS `flex`. A number `n` is `n 1 0%` (React DOM sends a numeric `flex` unitless, so
|
|
439
|
+
* `flex: 1` is `"1"`); `"none"` is `0 0 auto`, `"auto"` is `1 1 auto`, `"initial"` is
|
|
440
|
+
* `0 1 auto`. Otherwise `<grow> <shrink>? || <basis>`: `"2 3"` (over a `0%` basis),
|
|
441
|
+
* `"2 100px"`, `"100px 2"`, `"1 1 0"`, and a lone basis (`"100px"`, `"50%"`,
|
|
442
|
+
* `"fit-content"`) is `1 1 <basis>`. The basis takes what `flexBasis` does, so not
|
|
443
|
+
* `content`. A unitless `0` is a factor unless two factors come before it. `flexGrow`,
|
|
444
|
+
* `flexShrink` and `flexBasis` win over it. As an `animate`, `initial`, `exit` or keyframes
|
|
445
|
+
* target it animates those three, and `transition: flex` covers them; a motion value cannot
|
|
446
|
+
* be bound to it (bind the three). */
|
|
447
|
+
flex?: number | string;
|
|
448
|
+
/** CSS `flex-flow`: `"<direction> || <wrap>"` in either order (`"column wrap"`,
|
|
449
|
+
* `"wrap-reverse"`); a missing part is `row` or `nowrap`. `flexDirection` and `flexWrap`
|
|
450
|
+
* win over it. */
|
|
451
|
+
flexFlow?: string;
|
|
452
|
+
/** `"row"`, `"row-reverse"`, `"column"` or `"column-reverse"`. */
|
|
453
|
+
flexDirection?: string;
|
|
454
|
+
/** `"nowrap"`, `"wrap"` or `"wrap-reverse"`. */
|
|
455
|
+
flexWrap?: string;
|
|
456
|
+
flexGrow?: number;
|
|
457
|
+
flexShrink?: number;
|
|
458
|
+
/** A length (see `DimensionValue`; a percentage is of the container's main size) or `"auto"`,
|
|
459
|
+
* which uses the item's `width` (or `height` in a column). Also `"min-content"`,
|
|
460
|
+
* `"max-content"`, `"fit-content"` and `"fit-content(<length>)"` as for `width`, measured
|
|
461
|
+
* the same way and winning over `width`, but only in a `row` or `row-reverse` flex container;
|
|
462
|
+
* in a column they are `"auto"`, as in CSS. `"fit-content"` is `"max-content"` here, which
|
|
463
|
+
* the item's `flexShrink` narrows to the container, so with `flexShrink: 0` it overflows. */
|
|
464
|
+
flexBasis?: DimensionValue;
|
|
465
|
+
alignItems?: string;
|
|
466
|
+
alignSelf?: string;
|
|
467
|
+
alignContent?: string;
|
|
468
|
+
justifyContent?: string;
|
|
469
|
+
/** CSS `place-items`, `place-content` and `place-self`: `"<align> <justify>"`, and one value
|
|
470
|
+
* is both (`"center"`, `"center end"`, `"space-between center"`). Each value is one the
|
|
471
|
+
* longhand takes, including `safe` and `unsafe` before a position and `first` or `last`
|
|
472
|
+
* before `baseline`, so `placeItems: "left"` or `placeContent: "auto"` throws as in CSS
|
|
473
|
+
* (`left` and `right` are for the justify value only). The `align*` and `justify*`
|
|
474
|
+
* longhands win over them. */
|
|
475
|
+
placeItems?: string;
|
|
476
|
+
placeContent?: string;
|
|
477
|
+
placeSelf?: string;
|
|
478
|
+
/** A length for both gaps, or `"<row> <column>"`: `"4px 8px"` is a 4px gap between rows and an
|
|
479
|
+
* 8px gap between columns (see `DimensionValue`; a percentage is of the container's content
|
|
480
|
+
* box). Not `"auto"`. `rowGap` and `columnGap` win over `gap`. */
|
|
481
|
+
gap?: DimensionValue;
|
|
482
|
+
rowGap?: DimensionValue;
|
|
483
|
+
columnGap?: DimensionValue;
|
|
484
|
+
/** Reorders the children of a flex or grid container, lowest first. Ties keep document
|
|
485
|
+
* order. Layout and paint follow it; focus order stays in the document order. */
|
|
486
|
+
order?: number;
|
|
487
|
+
justifyItems?: string;
|
|
488
|
+
justifySelf?: string;
|
|
489
|
+
/** A CSS track list (`"1fr 200px"`, `"repeat(auto-fill, minmax(120px, 1fr))"`,
|
|
490
|
+
* `"[sidebar] 240px [main] 1fr"`, `"none"`) or a column count `n`, which means
|
|
491
|
+
* `repeat(n, minmax(0, 1fr))`. Units are px, `%`, `fr`; `auto`, `min-content`,
|
|
492
|
+
* `max-content`, `minmax()`, `fit-content()` and `repeat()` are supported. */
|
|
493
|
+
gridTemplateColumns?: number | string;
|
|
494
|
+
gridTemplateRows?: number | string;
|
|
495
|
+
gridColumnMin?: "zero" | "min-content" | "max-content";
|
|
496
|
+
gridRowMin?: "zero" | "min-content" | "max-content";
|
|
497
|
+
/** Size of implicitly created columns / rows: a CSS track size list or a pixel count. */
|
|
498
|
+
gridAutoColumns?: number | string;
|
|
499
|
+
gridAutoRows?: number | string;
|
|
500
|
+
/** `"row"`, `"column"`, optionally followed by `"dense"`. */
|
|
501
|
+
gridAutoFlow?: string;
|
|
502
|
+
/** Quoted rows of area names: `'"header header" "side main"'`. Use `.` for an empty cell. */
|
|
503
|
+
gridTemplateAreas?: string;
|
|
504
|
+
/** Item placement: a line number (negative counts from the end), `"span 2"`, a line or
|
|
505
|
+
* area name, or a pair such as `"1 / 3"`. */
|
|
506
|
+
gridColumn?: number | string;
|
|
507
|
+
gridRow?: number | string;
|
|
508
|
+
gridColumnStart?: number | string;
|
|
509
|
+
gridColumnEnd?: number | string;
|
|
510
|
+
gridRowStart?: number | string;
|
|
511
|
+
gridRowEnd?: number | string;
|
|
512
|
+
/** An area name, or `"row-start / column-start / row-end / column-end"`. */
|
|
513
|
+
gridArea?: number | string;
|
|
514
|
+
/** A length (see `DimensionValue`; a percentage is of the containing block), `"auto"`, or on a
|
|
515
|
+
* direct child of `<anchored>` the trigger's border box:
|
|
516
|
+
* `"anchor-size(width)"` / `"anchor-size(height)"`. Margins and `top` / `right` / `bottom` /
|
|
517
|
+
* `left` take it too. Resolved natively on every layout.
|
|
518
|
+
*
|
|
519
|
+
* `width`, `minWidth` and `maxWidth` also take `"min-content"` (the widest word of the text, with
|
|
520
|
+
* the space after it), `"max-content"` (the content on one line), `"fit-content"`
|
|
521
|
+
* (`min(max-content, max(min-content, available width))`) and `"fit-content(<length>)"` (a
|
|
522
|
+
* length or percentage in place of the available width, never negative). As `minWidth`,
|
|
523
|
+
* `fit-content` is `min-content`; as `maxWidth` it is `max-content`. Each keyword node costs an
|
|
524
|
+
* extra layout of its subtree every frame, so put it on the few boxes that need it. A later
|
|
525
|
+
* style (`hover`, `focusVisible`) replaces the keyword with a length or `auto` and the other
|
|
526
|
+
* way round. The same keywords on `height`, `minHeight` and `maxHeight` are `auto`, as in
|
|
527
|
+
* CSS. Margins and insets reject them. */
|
|
528
|
+
width?: DimensionValue;
|
|
529
|
+
height?: DimensionValue;
|
|
530
|
+
minWidth?: DimensionValue;
|
|
531
|
+
minHeight?: DimensionValue;
|
|
532
|
+
maxWidth?: DimensionValue;
|
|
533
|
+
maxHeight?: DimensionValue;
|
|
534
|
+
/** One to four lengths in CSS order (see `DimensionValue`; a percentage is of the containing
|
|
535
|
+
* block's width, on all four sides): `"8px"`, `"8px 12px"` (top and bottom, then left and
|
|
536
|
+
* right), `"1px 2px 3px"` (top, left and right, bottom), `"1px 2px 3px 4px"` (top, right,
|
|
537
|
+
* bottom, left). A `calc()` is one value however many spaces it holds. Not `"auto"`. The
|
|
538
|
+
* sides win over `padding`. */
|
|
539
|
+
padding?: DimensionValue;
|
|
540
|
+
/** `paddingBlock` is the top and the bottom, `paddingInline` the left and the right (gpuix lays
|
|
541
|
+
* out left to right and horizontally): one value for both ends or `"<start> <end>"`.
|
|
542
|
+
* They win over `padding` and the side longhands win over them. The same holds for
|
|
543
|
+
* `marginBlock`, `marginInline`, `insetBlock` and `insetInline`. */
|
|
544
|
+
paddingBlock?: DimensionValue;
|
|
545
|
+
paddingInline?: DimensionValue;
|
|
546
|
+
paddingTop?: DimensionValue;
|
|
547
|
+
paddingRight?: DimensionValue;
|
|
548
|
+
paddingBottom?: DimensionValue;
|
|
549
|
+
paddingLeft?: DimensionValue;
|
|
550
|
+
/** One to four lengths in CSS order, as for `padding`, each of which may be `"auto"` (which
|
|
551
|
+
* absorbs free space in flex layouts): `"0 auto"` centres a box with a width. A percentage
|
|
552
|
+
* is of the containing block's width. The sides win over `margin`. */
|
|
553
|
+
margin?: DimensionValue;
|
|
554
|
+
/** One or two lengths or `"auto"`, as for `paddingBlock`. */
|
|
555
|
+
marginBlock?: DimensionValue;
|
|
556
|
+
marginInline?: DimensionValue;
|
|
557
|
+
marginTop?: DimensionValue;
|
|
558
|
+
marginRight?: DimensionValue;
|
|
559
|
+
marginBottom?: DimensionValue;
|
|
560
|
+
marginLeft?: DimensionValue;
|
|
561
|
+
/** `"static"` (the default), `"relative"`, `"absolute"`, `"fixed"` or `"sticky"`. An absolute box
|
|
562
|
+
* resolves `top`/`right`/`bottom`/`left` and percentage sizes against the padding box
|
|
563
|
+
* of its nearest non-static ancestor (a sticky one counts), a fixed one against the window.
|
|
564
|
+
* `"sticky"` lays out like `"relative"` with the insets ignored and then stays inside the
|
|
565
|
+
* scrollport of its nearest scroll container (or the window) less that container's padding,
|
|
566
|
+
* inset by `top`, `right`, `bottom` and `left`, without leaving its parent's content box. */
|
|
567
|
+
position?: string;
|
|
568
|
+
/** Paint and hit-test order among positioned siblings (`position` other than static).
|
|
569
|
+
* Negative paints below in-flow siblings, positive above. Only reorders siblings of the same
|
|
570
|
+
* parent, never against cousins. */
|
|
571
|
+
zIndex?: number;
|
|
572
|
+
/** One to four lengths or `"auto"` in CSS order, as for `margin`, for `top`, `right`, `bottom`
|
|
573
|
+
* and `left`: `"10px 20px"` is 10px from the top and bottom and 20px from the left and right.
|
|
574
|
+
* A percentage is of the containing block. `top`, `right`, `bottom` and `left` win over
|
|
575
|
+
* `inset`. */
|
|
576
|
+
inset?: DimensionValue;
|
|
577
|
+
/** `insetBlock` is `top` and `bottom`, `insetInline` is `left` and `right`: one or two lengths
|
|
578
|
+
* or `"auto"`, as for `paddingBlock`. */
|
|
579
|
+
insetBlock?: DimensionValue;
|
|
580
|
+
insetInline?: DimensionValue;
|
|
581
|
+
/** A length (see `DimensionValue`; a percentage is of the containing block) or `"auto"`. */
|
|
582
|
+
top?: DimensionValue;
|
|
583
|
+
right?: DimensionValue;
|
|
584
|
+
bottom?: DimensionValue;
|
|
585
|
+
left?: DimensionValue;
|
|
586
|
+
/** The CSS shorthand (`"linear-gradient(...) center / cover no-repeat, #fff"`: layers
|
|
587
|
+
* then a final colour), a plain colour, or the two-stop object form. The
|
|
588
|
+
* `background*` longhands below override parts of the shorthand. */
|
|
589
|
+
background?: string | LinearGradientBackground;
|
|
590
|
+
backgroundColor?: string;
|
|
591
|
+
/** Comma list of `linear-`, `radial-`, `conic-gradient()` and `repeating-` forms
|
|
592
|
+
* (any number of stops and colour hints, `in srgb | oklab`), `none`, or `url()`
|
|
593
|
+
* (valid but not drawn). The first layer is on top. */
|
|
594
|
+
backgroundImage?: string;
|
|
595
|
+
/** CSS lists, one entry per layer, repeating to cover the layers. */
|
|
596
|
+
backgroundSize?: string;
|
|
597
|
+
backgroundPosition?: string;
|
|
598
|
+
backgroundRepeat?: string;
|
|
599
|
+
backgroundOrigin?: "border-box" | "padding-box" | "content-box" | string;
|
|
600
|
+
/** `text` paints the layer through the glyphs of the element and its
|
|
601
|
+
* descendants. The box values clip the gradient layers only; `backgroundColor`
|
|
602
|
+
* is clipped to the glyphs when the last layer's clip is `text`. */
|
|
603
|
+
backgroundClip?: "border-box" | "padding-box" | "content-box" | "text" | string;
|
|
604
|
+
/** Text colour, inherited. Every colour prop accepts CSS colours: hex, named,
|
|
605
|
+
* `rgb()`, `hsl()`, `hwb()`, `lab()`, `lch()`, `oklab()`, `oklch()`, relative
|
|
606
|
+
* colours, and the context-aware forms below, which nest freely:
|
|
607
|
+
* - `currentColor`: this element's computed `color`, so `borderColor:
|
|
608
|
+
* "currentColor"` follows the text.
|
|
609
|
+
* - `light-dark(a, b)`: `a` under a light `colorScheme`, `b` under a dark one.
|
|
610
|
+
* - `color-mix(in oklab, a 30%, b)`: any of srgb, srgb-linear, display-p3,
|
|
611
|
+
* a98-rgb, prophoto-rgb, rec2020, xyz, xyz-d50, xyz-d65, lab, lch, oklab,
|
|
612
|
+
* oklch, hsl, hwb, with `shorter|longer|increasing|decreasing hue` for the
|
|
613
|
+
* polar ones.
|
|
614
|
+
* - `color(display-p3 1 0 0)`: the same spaces, clipped to sRGB.
|
|
615
|
+
* An invalid colour is ignored. */
|
|
616
|
+
color?: string;
|
|
617
|
+
/** CSS `color-scheme`, inherited: `"normal"` (light), `"light"`, `"dark"`,
|
|
618
|
+
* `"light dark"` (follows the window appearance), `"only light"`, `"only dark"`.
|
|
619
|
+
* It picks the side of `light-dark()` and sets the default text colour (CSS
|
|
620
|
+
* `CanvasText`): black under a light scheme, white under a dark one, until some
|
|
621
|
+
* element declares a `color`. */
|
|
622
|
+
colorScheme?: string;
|
|
623
|
+
opacity?: number;
|
|
624
|
+
/** One to four lengths in CSS order, as for `padding`, each a length (see `DimensionValue`)
|
|
625
|
+
* with no percentage, or `"thin"` (1px), `"medium"` (3px) or `"thick"` (5px):
|
|
626
|
+
* `"1px 2px 3px 4px"`, `"thin thick"`. A negative width is 0. The sides win over
|
|
627
|
+
* `borderWidth`. A side only has a width when its line style is visible: with no
|
|
628
|
+
* `borderStyle` (or `border*` shorthand or side style) it is `none` and the width is 0, as
|
|
629
|
+
* in CSS. */
|
|
630
|
+
borderWidth?: DimensionValue;
|
|
631
|
+
borderTopWidth?: DimensionValue;
|
|
632
|
+
borderRightWidth?: DimensionValue;
|
|
633
|
+
borderBottomWidth?: DimensionValue;
|
|
634
|
+
borderLeftWidth?: DimensionValue;
|
|
635
|
+
/** One to four colours, like CSS: `"red"`, `"red blue"` (top-bottom, left-right),
|
|
636
|
+
* `"red blue green"`, `"red blue green white"` (top, right, bottom, left). One
|
|
637
|
+
* invalid colour ignores the whole value. */
|
|
638
|
+
borderColor?: string;
|
|
639
|
+
borderTopColor?: string;
|
|
640
|
+
borderRightColor?: string;
|
|
641
|
+
borderBottomColor?: string;
|
|
642
|
+
borderLeftColor?: string;
|
|
643
|
+
/** CSS shorthands: `"1px solid red"`, `"2px dashed"`, `"none"`. Width, style
|
|
644
|
+
* (any `LineStyle`) and colour in any order; no style means `none`, which has no
|
|
645
|
+
* width, a missing colour is `currentColor`, a missing width is `medium` (3px).
|
|
646
|
+
* `border` sets all sides, then `borderTop` ... `borderLeft` override one, then
|
|
647
|
+
* `borderStyle`, then the longhands (`borderWidth`, `borderColor`,
|
|
648
|
+
* `borderTopStyle`, ...) override those. */
|
|
649
|
+
border?: string;
|
|
650
|
+
/** `borderBlock` sets the top and the bottom, `borderInline` the left and the right, written
|
|
651
|
+
* like `border`. They win over `border`, and `borderTop` ... `borderLeft` win over them. */
|
|
652
|
+
borderBlock?: string;
|
|
653
|
+
borderInline?: string;
|
|
654
|
+
borderTop?: string;
|
|
655
|
+
borderRight?: string;
|
|
656
|
+
borderBottom?: string;
|
|
657
|
+
borderLeft?: string;
|
|
658
|
+
/** A number (px) or the CSS string: one to four lengths or percentages in the
|
|
659
|
+
* order top-left, top-right, bottom-right, bottom-left (`"8px"`, `"50%"`,
|
|
660
|
+
* `"10px 20px"`), then optionally `/` and one to four vertical radii
|
|
661
|
+
* (`"10px 20px / 5px"`, `"50% / 10px 20px"`). A percentage is of the border
|
|
662
|
+
* box, the width for the horizontal radius and the height for the vertical
|
|
663
|
+
* one, so `"50%"` on a wide box is an ellipse. Lengths take any unit (`px`,
|
|
664
|
+
* `em`, `rem`, `vw`, `vh`, `vmin`, `vmax`, `in`, ...) or a `calc()`; `em` is
|
|
665
|
+
* the element's font size. A negative or invalid value throws. Radii that add up to more than a side are scaled down
|
|
666
|
+
* together, as in CSS. The corner longhands win over it. */
|
|
667
|
+
borderRadius?: number | string;
|
|
668
|
+
/** A number (px), or `"<horizontal> [<vertical>]"`: `"20px"`, `"20px 10px"`,
|
|
669
|
+
* `"50%"`, `"50% 20px"`. A zero in either radius makes the corner square. */
|
|
670
|
+
borderTopLeftRadius?: number | string;
|
|
671
|
+
borderTopRightRadius?: number | string;
|
|
672
|
+
borderBottomLeftRadius?: number | string;
|
|
673
|
+
borderBottomRightRadius?: number | string;
|
|
674
|
+
/** One shadow, a list painted in the order given, or the CSS string
|
|
675
|
+
* (`"0 1px 2px rgba(0,0,0,.2), inset 0 0 0 1px red"`). In the string, lengths
|
|
676
|
+
* are `px` (or a bare `0`), `inset` and the colour may lead or trail the
|
|
677
|
+
* lengths, and a layer without a colour is `currentColor`, as in CSS. An
|
|
678
|
+
* invalid string paints no shadow. */
|
|
679
|
+
boxShadow?: BoxShadow | BoxShadow[] | string;
|
|
680
|
+
/** CSS `filter`: a space-separated list of `blur()`, `brightness()`,
|
|
681
|
+
* `contrast()`, `grayscale()`, `hue-rotate()`, `invert()`, `opacity()`,
|
|
682
|
+
* `saturate()`, `sepia()` and `drop-shadow()`, applied in order to the element
|
|
683
|
+
* and everything in it, or `"none"`. Amounts are numbers or percentages;
|
|
684
|
+
* lengths are `px` (or a bare `0`); angles are `deg`, `rad`, `turn` or `grad`.
|
|
685
|
+
* A `drop-shadow()` colour defaults to `currentColor`. An invalid string is
|
|
686
|
+
* ignored, as in CSS. `url()` references are not supported. */
|
|
687
|
+
filter?: string;
|
|
688
|
+
/** CSS `backdrop-filter`: the same functions as `filter`, applied to what is
|
|
689
|
+
* painted behind the element, within its border box. The element's own
|
|
690
|
+
* background should be translucent for the effect to show. */
|
|
691
|
+
backdropFilter?: string;
|
|
692
|
+
/** CSS `mask-image`: a comma list of `linear-`, `radial-`, `conic-gradient()` and
|
|
693
|
+
* `repeating-` forms, `none`, or `url()` (an image, loaded as `backgroundImage`
|
|
694
|
+
* loads it). The element and everything in it is multiplied by the layers, the
|
|
695
|
+
* first on top, each read by its `maskMode` and combined with the ones below by
|
|
696
|
+
* its `maskComposite`. A `url()` image that has not loaded, or failed to, is a
|
|
697
|
+
* transparent layer, so the element is hidden until it does. `image-set()` is
|
|
698
|
+
* not supported. */
|
|
699
|
+
maskImage?: string;
|
|
700
|
+
/** CSS lists, one entry per layer, repeating to cover the layers. Unlike
|
|
701
|
+
* `backgroundOrigin`, `maskOrigin` starts at `border-box`. `fill-box` is
|
|
702
|
+
* `content-box` and `stroke-box` and `view-box` are `border-box`. `no-clip`
|
|
703
|
+
* and `margin-box` are not supported, so a list using them is ignored. */
|
|
704
|
+
maskSize?: string;
|
|
705
|
+
maskPosition?: string;
|
|
706
|
+
maskRepeat?: string;
|
|
707
|
+
maskOrigin?: "border-box" | "padding-box" | "content-box" | string;
|
|
708
|
+
maskClip?: "border-box" | "padding-box" | "content-box" | string;
|
|
709
|
+
/** CSS `mask-mode`, one entry per layer, repeating to cover the layers: `alpha`
|
|
710
|
+
* reads a layer's alpha, `luminance` its luminance scaled by its alpha, and
|
|
711
|
+
* `match-source` (the default) is alpha for a gradient and an image alike. */
|
|
712
|
+
maskMode?: "match-source" | "alpha" | "luminance" | string;
|
|
713
|
+
/** CSS `mask-composite`, one entry per layer, repeating to cover the layers: how
|
|
714
|
+
* a layer combines with the ones below it. The bottom layer's is ignored. The
|
|
715
|
+
* legacy `-webkit-mask-composite` keywords are not supported. */
|
|
716
|
+
maskComposite?: "add" | "subtract" | "intersect" | "exclude" | string;
|
|
717
|
+
/** CSS `mask` shorthand: layers, `position / size`, repeat, origin / clip boxes,
|
|
718
|
+
* and a mode and a composite keyword, in any order. The longhands win over it.
|
|
719
|
+
* An invalid string is ignored. It does not touch `maskBorder`. */
|
|
720
|
+
mask?: string;
|
|
721
|
+
/** CSS `mask-border-source`: one `linear-`, `radial-`, `conic-gradient()` (or `repeating-`
|
|
722
|
+
* form) or `url()` image, or `none`. The element is multiplied by a nine-slice of the image
|
|
723
|
+
* drawn around its border box (and `maskBorderOutset`), as another layer added to the
|
|
724
|
+
* `maskImage` ones; see `maskBorder`. A gradient is as large as the border image area. A
|
|
725
|
+
* `url()` that has not loaded, or failed to, masks the element out like a `maskImage` one.
|
|
726
|
+
* Chrome only knows the prefixed `-webkit-mask-box-image-*` forms of these. */
|
|
727
|
+
maskBorderSource?: string;
|
|
728
|
+
/** CSS `mask-border-slice`: one to four numbers (pixels of the image) or percentages, clockwise
|
|
729
|
+
* from the top like `margin`, and `fill` before or after them to draw the middle slice too.
|
|
730
|
+
* Starts at `0`, and unlike `-webkit-mask-box-image` does not imply `fill`. */
|
|
731
|
+
maskBorderSlice?: string;
|
|
732
|
+
/** CSS `mask-border-width`: one to four lengths, percentages of the border image area, numbers
|
|
733
|
+
* (times the element's border width) or `auto` (the size of the slice, the default). */
|
|
734
|
+
maskBorderWidth?: string;
|
|
735
|
+
/** CSS `mask-border-outset`: one to four lengths or numbers (times the border width) that grow
|
|
736
|
+
* the border image area past the border box. */
|
|
737
|
+
maskBorderOutset?: string;
|
|
738
|
+
/** CSS `mask-border-repeat`: one or two of `stretch` (the default), `repeat` (whole slices,
|
|
739
|
+
* centred and cut off at the ends), `round` (rescaled to a whole number) and `space` (whole
|
|
740
|
+
* slices with equal gaps around and between them), for the horizontal and the vertical edges. */
|
|
741
|
+
maskBorderRepeat?: "stretch" | "repeat" | "round" | "space" | string;
|
|
742
|
+
/** CSS `mask-border-mode`: `alpha` (the default) reads the alpha of the image, `luminance` its
|
|
743
|
+
* luminance scaled by its alpha. */
|
|
744
|
+
maskBorderMode?: "alpha" | "luminance";
|
|
745
|
+
/** CSS `mask-border` shorthand: `<source> || <slice> [ / <width>? [ / <outset> ]? ]? ||
|
|
746
|
+
* <repeat> || <mode>`, with what it leaves out at its initial value. The longhands win over
|
|
747
|
+
* it. An invalid string is ignored. */
|
|
748
|
+
maskBorder?: string;
|
|
749
|
+
/** CSS `clip-path`: `inset()`, `rect()`, `xywh()`, `circle()`, `ellipse()`, `polygon()` or
|
|
750
|
+
* `path()`, or `none`, with an optional `border-box` (default), `padding-box` or
|
|
751
|
+
* `content-box` before or after the shape. The element and everything in it is
|
|
752
|
+
* clipped to the shape, and so is hit testing. `margin-box`, `stroke-box` and
|
|
753
|
+
* `view-box` are `border-box` and `fill-box` is `content-box`. `url()` and a box
|
|
754
|
+
* with no shape are invalid, so the value is ignored. */
|
|
755
|
+
clipPath?: string;
|
|
756
|
+
/** CSS `transform`: a space-separated list of `translate()`, `translateX()`, `translateY()`,
|
|
757
|
+
* `scale()`, `scaleX()`, `scaleY()`, `rotate()`, `skew()`, `skewX()`, `skewY()` and
|
|
758
|
+
* `matrix()`, or `"none"`. Moves, scales, rotates and skews the element and everything in it,
|
|
759
|
+
* hit testing and `getBoundingClientRect()` included, around `transformOrigin`; layout is
|
|
760
|
+
* not affected. Translations take lengths (`px`, `em`, `rem`, `vw`, `vh`, `calc()`) and
|
|
761
|
+
* percentages of the element's own border box; angles are `deg`, `rad`, `grad` or `turn`
|
|
762
|
+
* (or a bare `0`). The 3D forms are CSS Transforms 2's: `translate3d()`, `translateZ()`,
|
|
763
|
+
* `scale3d()`, `scaleZ()`, `rotateX()`, `rotateY()`, `rotate3d()`, `perspective()` and
|
|
764
|
+
* `matrix3d()` (`rotateZ()` is `rotate()`); see `perspective`. An invalid string is ignored, as
|
|
765
|
+
* in CSS.
|
|
766
|
+
*
|
|
767
|
+
* A transform other than `none` (and a `perspective`, and `transformStyle: "preserve-3d"`) makes
|
|
768
|
+
* the element a stacking context and the containing block of its absolute and fixed descendants. It does nothing to a non-atomic inline
|
|
769
|
+
* element (a `<span>` in a line of text). A pure translation keeps text sharp; rotated and
|
|
770
|
+
* scaled text is resampled and may look softer. */
|
|
771
|
+
transform?: string;
|
|
772
|
+
/** CSS `translate`, `rotate` and `scale`: the individual transform properties, applied
|
|
773
|
+
* around `transformOrigin` as translate, then rotate, then scale, then `transform`.
|
|
774
|
+
* `translate` is one or two lengths or percentages; `rotate` an angle (a number is
|
|
775
|
+
* degrees, or `x`, `y`, `z` or three numbers for an axis, then the angle); `scale` one to
|
|
776
|
+
* three numbers or percentages (a number is the factor). `translate` takes a length along z
|
|
777
|
+
* as a third value. */
|
|
778
|
+
translate?: string;
|
|
779
|
+
rotate?: number | string;
|
|
780
|
+
scale?: number | string;
|
|
781
|
+
/** CSS `transform-origin`: one or two of `left`, `center`, `right`, `top`, `bottom`, lengths
|
|
782
|
+
* and percentages, `50% 50%` by default, and a length along z. */
|
|
783
|
+
transformOrigin?: string;
|
|
784
|
+
/** CSS `perspective`: `"none"` or a length from 0 up (a number is px). The children are seen from
|
|
785
|
+
* that far in front of this element's plane, so a `rotateX()`, `rotateY()` or `translateZ()` of
|
|
786
|
+
* theirs shows in depth. Not inherited: it reaches the children, not their descendants, unless
|
|
787
|
+
* `transformStyle` is `preserve-3d`. A perspective makes the element a stacking context and the
|
|
788
|
+
* containing block of its absolute and fixed descendants. */
|
|
789
|
+
perspective?: number | string;
|
|
790
|
+
/** CSS `perspective-origin`: where the viewer looks at the box, like `transformOrigin` without z.
|
|
791
|
+
* `50% 50%` by default. */
|
|
792
|
+
perspectiveOrigin?: string;
|
|
793
|
+
/** CSS `transform-style`: `"preserve-3d"` makes the children planes of the same 3D rendering
|
|
794
|
+
* context as this element, so their depth accumulates through it; `"flat"` (the default)
|
|
795
|
+
* flattens them onto the element. A grouping property makes the used value `flat`: `overflow` other
|
|
796
|
+
* than `visible`, `opacity` below 1, `filter`, `backdropFilter`, `clipPath` and a mask. Planes
|
|
797
|
+
* are painted in tree order, not sorted by depth, and are not cut where they intersect.
|
|
798
|
+
* `preserve-3d` makes a stacking context and a containing block even where it is overridden. */
|
|
799
|
+
transformStyle?: "flat" | "preserve-3d";
|
|
800
|
+
/** CSS `backface-visibility`: `"hidden"` draws and hits nothing of the element, and what is in
|
|
801
|
+
* it, while its back faces the viewer. */
|
|
802
|
+
backfaceVisibility?: "visible" | "hidden";
|
|
803
|
+
/** One to four line styles, like `borderColor`: `"dotted"`, `"dotted dashed"` (top-bottom,
|
|
804
|
+
* left-right), ... A `none` or `hidden` side has no width. One invalid keyword ignores the
|
|
805
|
+
* whole value. A side that no `border*` value gives a style is `none`, as in CSS:
|
|
806
|
+
* no width, nothing painted. A visible style with no width is `medium` (3px). */
|
|
807
|
+
borderStyle?: LineStyle | (string & {});
|
|
808
|
+
borderTopStyle?: LineStyle;
|
|
809
|
+
borderRightStyle?: LineStyle;
|
|
810
|
+
borderBottomStyle?: LineStyle;
|
|
811
|
+
borderLeftStyle?: LineStyle;
|
|
812
|
+
/** Width divided by height, as a number or a CSS ratio (`"16 / 9"`, `"1"`). Fills in
|
|
813
|
+
* whichever axis has no definite size. An `<img>` uses its intrinsic ratio unless this is set. */
|
|
814
|
+
aspectRatio?: number | string;
|
|
815
|
+
/** CSS `outline`: a line outside the border box. Takes no layout space, so it
|
|
816
|
+
* can appear on focus without moving anything. As in CSS the style is `none` unless
|
|
817
|
+
* `outline` or `outlineStyle` gives one, so a ring needs `outlineStyle: "solid"` (or
|
|
818
|
+
* `outline: "2px solid red"`); the width is then `medium` (3px) and the colour
|
|
819
|
+
* `currentColor` unless given. Width, style and colour of the shorthand come in any
|
|
820
|
+
* order, `hidden` is an error, and `outlineWidth`, `outlineStyle` and `outlineColor`
|
|
821
|
+
* win over it. `auto` is painted as `solid`. `outlineOffset` is not part of it. */
|
|
822
|
+
outline?: string;
|
|
823
|
+
outlineWidth?: DimensionValue;
|
|
824
|
+
outlineStyle?: OutlineStyle | (string & {});
|
|
825
|
+
outlineColor?: string;
|
|
826
|
+
/** Gap between the border box and the outline: a length (see `DimensionValue`) with no
|
|
827
|
+
* percentage. Negative draws it inside. `outlineWidth` takes what `borderWidth` does. */
|
|
828
|
+
outlineOffset?: DimensionValue;
|
|
829
|
+
fontSize?: number | string;
|
|
830
|
+
fontFamily?: string;
|
|
831
|
+
fontWeight?: string | number;
|
|
832
|
+
/** CSS `font-style`, inherited. Applies to the element and to inline runs. */
|
|
833
|
+
fontStyle?: "normal" | "italic" | "oblique";
|
|
834
|
+
/** CSS `text-align`, inherited: `start` (the default) and `end` are the left or the right of the
|
|
835
|
+
* element's own `direction`, `left`, `right`, `center`. */
|
|
836
|
+
textAlign?: string;
|
|
837
|
+
/** CSS `direction`, inherited. `"rtl"` mirrors what runs along the inline axis: the columns of a
|
|
838
|
+
* table and of a grid, a row flex container's main axis, the side `textAlign: "start"` is,
|
|
839
|
+
* where a block narrower than its parent sits, and the side of a vertical scrollbar. Physical
|
|
840
|
+
* properties (`left`, `borderLeft`, `marginLeft`) do not swap. Not animatable. */
|
|
841
|
+
direction?: "ltr" | "rtl";
|
|
842
|
+
/** CSS `line-height`, inherited. A number multiplies the element's font size, as in CSS and React DOM:
|
|
843
|
+
* `1.5` is one and a half times the font size, and a child with another `fontSize` gets its own multiple.
|
|
844
|
+
* `"normal"` is the font's default leading. A string with a unit is a length (see `DimensionValue`),
|
|
845
|
+
* where `%` and `em` are of this element's font size: `"24px"`, `"150%"`, `"1.5em"`. A length is
|
|
846
|
+
* resolved here and inherited as px. Negative is an error. Motion animates only a number. */
|
|
847
|
+
lineHeight?: number | string;
|
|
848
|
+
/** CSS `white-space`, inherited. `normal` and `nowrap` collapse spaces and turn
|
|
849
|
+
* a newline into a space, `pre-line` collapses spaces and keeps newlines,
|
|
850
|
+
* `pre-wrap`, `break-spaces` and `pre` keep both. `nowrap` and `pre` do not
|
|
851
|
+
* wrap. `break-spaces` breaks after every space, and its spaces never hang. */
|
|
852
|
+
whiteSpace?: "normal" | "nowrap" | "pre" | "pre-wrap" | "pre-line" | "break-spaces";
|
|
853
|
+
/** CSS `tab-size`, inherited, 8 by default. A number is that many spaces and a
|
|
854
|
+
* string is a CSS length such as `"40px"`. A tab that `whiteSpace` keeps
|
|
855
|
+
* advances to the next multiple of it, counted from the start of each line of
|
|
856
|
+
* text, so a wrapped line counts again from its own start. Only a container
|
|
857
|
+
* sets it: a `<span>` inside a paragraph uses the paragraph's. Negative
|
|
858
|
+
* values and percentages throw. */
|
|
859
|
+
tabSize?: number | string;
|
|
860
|
+
/** CSS `word-break`, inherited, `"normal"` by default. `"break-all"` also
|
|
861
|
+
* breaks between any two letters, so a line is filled to its edge;
|
|
862
|
+
* `"keep-all"` does not break between CJK characters; `"break-word"` is
|
|
863
|
+
* `"normal"` with `overflowWrap: "anywhere"`. Only a container sets it: a
|
|
864
|
+
* `<span>` inside a paragraph uses the paragraph's. */
|
|
865
|
+
wordBreak?: "normal" | "break-all" | "keep-all" | "break-word";
|
|
866
|
+
/** CSS `overflow-wrap`, inherited, `"normal"` by default: a word longer than
|
|
867
|
+
* its line overflows it. `"break-word"` and `"anywhere"` break such a word
|
|
868
|
+
* where it overflows, when no earlier place on the line will do. Only a
|
|
869
|
+
* container sets it. */
|
|
870
|
+
overflowWrap?: "normal" | "break-word" | "anywhere";
|
|
871
|
+
/** CSS `table-layout` of a `display: "table"` element, not inherited. `"fixed"` sizes the columns
|
|
872
|
+
* from the first row and the `table-column`s alone, and needs a `width` on the table (else it
|
|
873
|
+
* is `"auto"`). */
|
|
874
|
+
tableLayout?: "auto" | "fixed";
|
|
875
|
+
/** CSS `border-spacing`, inherited: the gap between the cells of a `display: "table"` element
|
|
876
|
+
* and between the cells and its border. One length is both axes; two, as in `"4px 8px"`, are the
|
|
877
|
+
* horizontal then the vertical one. A number is px; any length unit works, no percentage and
|
|
878
|
+
* nothing negative. It is 0 with `borderCollapse: "collapse"`. Anything else throws. */
|
|
879
|
+
borderSpacing?: number | (string & {});
|
|
880
|
+
/** CSS `border-collapse`, inherited. `"collapse"` shares each edge of a table's grid between
|
|
881
|
+
* the borders that meet there (the wider wins, `hidden` removes it) and has the table paint
|
|
882
|
+
* it once, centred on the grid line; the table's `borderSpacing`, `padding` and
|
|
883
|
+
* `borderRadius` and `emptyCells` then do nothing. */
|
|
884
|
+
borderCollapse?: "separate" | "collapse";
|
|
885
|
+
/** CSS `caption-side`, inherited from the table to its `table-caption` children. */
|
|
886
|
+
captionSide?: "top" | "bottom";
|
|
887
|
+
/** CSS `empty-cells`, inherited. `"hide"` leaves a `table-cell` with nothing in it unpainted
|
|
888
|
+
* (no background, border or shadow), unless the table collapses its borders. */
|
|
889
|
+
emptyCells?: "show" | "hide";
|
|
890
|
+
/** CSS `vertical-align`, not inherited: where an inline box sits on its line (CSS 2.1 §10.8.1).
|
|
891
|
+
* `"baseline"`, `"sub"`, `"super"`, `"text-top"`, `"text-bottom"` and `"middle"` are relative to the
|
|
892
|
+
* parent's text; `"top"` and `"bottom"` align the box with the line box. A number is px and a string
|
|
893
|
+
* with a unit is a length that raises the box's baseline (negative lowers it); a `%` is of the
|
|
894
|
+
* element's own `lineHeight`. Anything else throws. On a `display: "table-cell"` it places the
|
|
895
|
+
* content in the row: `"top"`, `"middle"`, `"bottom"` or `"baseline"` (the default); every other
|
|
896
|
+
* value is `"baseline"` there. */
|
|
897
|
+
verticalAlign?: "baseline" | "sub" | "super" | "text-top" | "text-bottom" | "middle" | "top" | "bottom" | number | (string & {});
|
|
898
|
+
/** CSS `text-box`: `"normal"` (no trim, `auto` edge) or a `textBoxTrim` and a `textBoxEdge`
|
|
899
|
+
* in either order, e.g. `"trim-both cap alphabetic"`. A trim left out is `trim-both`, not
|
|
900
|
+
* `none`, and an edge left out is `auto`. `textBoxTrim` and `textBoxEdge` laid over it win.
|
|
901
|
+
* An invalid value is ignored. */
|
|
902
|
+
textBox?: string;
|
|
903
|
+
/** CSS `text-box-trim`, `"none"` by default and not inherited. On a block container,
|
|
904
|
+
* `"trim-start"` cuts the space above the first line of text down to the `textBoxEdge`
|
|
905
|
+
* over edge, `"trim-end"` the space below the last line down to the under edge, and
|
|
906
|
+
* `"trim-both"` does both. The container gets shorter by what was cut and what follows
|
|
907
|
+
* moves up; its padding and border stay, the trim is inside them, and ink the edge
|
|
908
|
+
* leaves out (a tall letter above `cap`) overflows. Only those two lines are trimmed. The
|
|
909
|
+
* trim goes through block children down to their first or last line, but stops at one
|
|
910
|
+
* with padding or a border on that side or with no line of text to start with, and
|
|
911
|
+
* an absolutely positioned child is not a first or last child. A flex or grid
|
|
912
|
+
* container trims nothing and passes nothing down. `"none"` on a descendant does not
|
|
913
|
+
* take off a trim from above. */
|
|
914
|
+
textBoxTrim?: "none" | "trim-start" | "trim-end" | "trim-both";
|
|
915
|
+
/** CSS `text-box-edge`, inherited, `"auto"` by default, which is `"text"`. The metric a
|
|
916
|
+
* `textBoxTrim` cuts to: `<over> <under>`, where over is `"text"` (the font's ascent: only
|
|
917
|
+
* the half-leading above is cut), `"cap"` (cap height) or `"ex"` (x-height), and under
|
|
918
|
+
* is `"text"` (the descent: only the half-leading below is cut) or `"alphabetic"` (the
|
|
919
|
+
* baseline). One value is both where it can be (`"text"` is `"text text"`), otherwise
|
|
920
|
+
* the under edge is `"text"` (`"cap"` is `"cap text"`). The metrics are those of the font
|
|
921
|
+
* of the block that holds the line. */
|
|
922
|
+
textBoxEdge?: string;
|
|
923
|
+
/** CSS `text-wrap`, inherited, the shorthand of `textWrapMode` and
|
|
924
|
+
* `textWrapStyle`: a mode, a style, or both in either order (`"nowrap"`,
|
|
925
|
+
* `"balance"`, `"nowrap pretty"`). What it leaves out is the longhand's initial
|
|
926
|
+
* value, so `"balance"` also turns wrapping back on. A longhand declared on the
|
|
927
|
+
* same element wins over it; so does it over `whiteSpace`. Only a container sets
|
|
928
|
+
* it: a `<span>` inside a paragraph uses the paragraph's. */
|
|
929
|
+
textWrap?: "wrap" | "nowrap" | "balance" | "pretty" | "stable" | `${"wrap" | "nowrap"} ${"auto" | "balance" | "pretty" | "stable"}` | `${"auto" | "balance" | "pretty" | "stable"} ${"wrap" | "nowrap"}`;
|
|
930
|
+
/** CSS `text-wrap-mode`, inherited, `"wrap"` by default. `"nowrap"` keeps the text
|
|
931
|
+
* on one line, as the wrapping part of `whiteSpace` does, and wins over it when
|
|
932
|
+
* both are declared on the same element; it leaves what `whiteSpace` does to
|
|
933
|
+
* spaces and newlines alone, so `whiteSpace: "pre"` with `textWrapMode: "wrap"`
|
|
934
|
+
* is `pre-wrap`. */
|
|
935
|
+
textWrapMode?: "wrap" | "nowrap";
|
|
936
|
+
/** CSS `text-wrap-style`, inherited, `"auto"` by default. `"balance"` evens out
|
|
937
|
+
* the lines of a paragraph of at most 6 lines (each run of text between `\n`
|
|
938
|
+
* lines counts as one), and `"pretty"` keeps the last line from being a single
|
|
939
|
+
* short word, both without making more lines than `"auto"` does. The text is
|
|
940
|
+
* as wide as it is with `"auto"`: only the breaks move, so `textAlign` still
|
|
941
|
+
* aligns within the full width. `"stable"` is `"auto"`. Not applied to text with
|
|
942
|
+
* a tab, `whiteSpace: "break-spaces"` or `lineClamp`, or where a word is wider
|
|
943
|
+
* than its line. */
|
|
944
|
+
textWrapStyle?: "auto" | "balance" | "pretty" | "stable";
|
|
945
|
+
textOverflow?: "ellipsis" | "ellipsis-start";
|
|
946
|
+
lineClamp?: number;
|
|
947
|
+
/** CSS `text-decoration`: lines, a style, a colour and a thickness in any order,
|
|
948
|
+
* e.g. `"underline line-through"` or `"underline wavy red 2px"`. Lines are
|
|
949
|
+
* `underline`, `line-through`, `overline` and `none`; the style, colour and
|
|
950
|
+
* thickness apply to every line the declaration names. Styles are `solid`,
|
|
951
|
+
* `double`, `dotted`, `dashed` and `wavy`. A thickness is `auto`, `from-font`
|
|
952
|
+
* or a length (`"2px"`, `"0.1em"`, a percentage of `1em`). A descendant
|
|
953
|
+
* cannot take a line off. */
|
|
954
|
+
textDecoration?: string;
|
|
955
|
+
/** CSS `text-decoration-line`, laid over `textDecoration`. */
|
|
956
|
+
textDecorationLine?: string;
|
|
957
|
+
/** CSS `text-decoration-style` (see `textDecoration`). */
|
|
958
|
+
textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | "wavy";
|
|
959
|
+
/** CSS `text-decoration-color`; `currentColor` is the element's own colour. */
|
|
960
|
+
textDecorationColor?: string;
|
|
961
|
+
/** CSS `text-decoration-thickness`: `auto` (a tenth of the font size, as Chrome
|
|
962
|
+
* computes it), `from-font` (the font's underline thickness, `auto` when it has
|
|
963
|
+
* none) or a length such as `"2px"` or `"0.1em"`; a percentage is of `1em`.
|
|
964
|
+
* Resolved at the declaring element, and the same for every line it draws. `auto`
|
|
965
|
+
* and `from-font` stay fractional, a solid or double line floors them to a device
|
|
966
|
+
* pixel (at least one) when it paints and a dotted or dashed one rounds them. */
|
|
967
|
+
textDecorationThickness?: string;
|
|
968
|
+
/** CSS `text-underline-offset`, inherited: how far below the alphabetic baseline
|
|
969
|
+
* the top edge of an underline sits. `auto` (the default) leaves a gap of half
|
|
970
|
+
* the thickness, rounded up, and at least a pixel, as Chrome does; a length
|
|
971
|
+
* (a number is px, `"0.25em"`, `calc()`) replaces that gap, so `0` puts the line
|
|
972
|
+
* on the baseline and a negative one above it. A percentage is of `1em`. The box
|
|
973
|
+
* that declares the underline decides: its own value or the one it inherits, and a
|
|
974
|
+
* descendant's offset does not move the line of an ancestor. `em` resolves where
|
|
975
|
+
* the value is set and descendants inherit the px, a percentage is of the font size
|
|
976
|
+
* of the box that draws the line. Underlines only; not animatable. */
|
|
977
|
+
textUnderlineOffset?: "auto" | number | (string & {});
|
|
978
|
+
/** CSS `font-variant-numeric`, inherited: `tabular-nums`, `proportional-nums`,
|
|
979
|
+
* `lining-nums`, `oldstyle-nums`, `slashed-zero`, `diagonal-fractions`,
|
|
980
|
+
* `stacked-fractions`, `ordinal`, or `normal`. One keyword per group (figure,
|
|
981
|
+
* spacing, fraction), combined with spaces. Needs a font with the feature.
|
|
982
|
+
* Not available inside a state style. */
|
|
983
|
+
fontVariantNumeric?: string;
|
|
984
|
+
/** CSS `font-feature-settings`, inherited: `'"tnum" 1, "liga" 0'`. A tag is four
|
|
985
|
+
* characters; the value is an integer, `on`, `off`, or omitted (1). Wins over
|
|
986
|
+
* `fontVariantNumeric` on a tag both name. Not available inside a state style. */
|
|
987
|
+
fontFeatureSettings?: string;
|
|
988
|
+
/** CSS `font-variation-settings`, inherited: `'"wght" 650, "wdth" 90'`, or `normal`. A
|
|
989
|
+
* tag is four characters and the value a number, clamped to the font's range for that
|
|
990
|
+
* axis; an axis the font does not have is ignored, and a tag named twice takes its last
|
|
991
|
+
* value. On a variable font `fontWeight` already sets `wght` (to any weight, not only the
|
|
992
|
+
* named ones), and a `wght` here wins over it. A value CSS does not have throws, as
|
|
993
|
+
* `textWrap` does. Animates per axis between two values that name the same axes
|
|
994
|
+
* (in any order); otherwise, and against `normal`, it flips halfway, and a CSS
|
|
995
|
+
* transition runs that only with `transitionBehavior: "allow-discrete"`. Not
|
|
996
|
+
* available inside a state style. */
|
|
997
|
+
fontVariationSettings?: string;
|
|
998
|
+
/** CSS `-webkit-font-smoothing`, inherited, as Chrome has it on macOS. `"antialiased"` draws glyphs
|
|
999
|
+
* as plain coverage, the same ink for dark and light text; `"auto"` (default) keeps the platform's
|
|
1000
|
+
* CoreGraphics smoothing, which thickens strokes (light text most). `"subpixel-antialiased"` is
|
|
1001
|
+
* `"auto"`: current macOS has no subpixel text. A value CSS does not have is ignored. Does not
|
|
1002
|
+
* animate. */
|
|
1003
|
+
WebkitFontSmoothing?: "auto" | "antialiased" | "subpixel-antialiased";
|
|
1004
|
+
/** `"visible"` (default); `"clip"` clips; `"hidden"` clips and is a scroll container that
|
|
1005
|
+
* only code scrolls (`scrollTo`, `scrollTop`, `scrollIntoView`), not the wheel or the keys;
|
|
1006
|
+
* `"scroll"` and `"auto"` scroll for the user too (scrollbars are overlays, so they differ
|
|
1007
|
+
* in nothing). Overflow never changes `display` or the element's children. */
|
|
1008
|
+
overflow?: string;
|
|
1009
|
+
overflowX?: string;
|
|
1010
|
+
overflowY?: string;
|
|
1011
|
+
/** `"auto"` follows the system appearance (a 50% black thumb on light, 50% white on dark), or
|
|
1012
|
+
* `"<thumb> <track>"` sets both colours, each any CSS colour. The track is the faint
|
|
1013
|
+
* strip that shows while the pointer is over the bar. Anything else is ignored, as in CSS. */
|
|
1014
|
+
scrollbarColor?: string;
|
|
1015
|
+
/** `"auto"` (the default) or `"thin"` for a narrower bar. `"none"` draws no bar and leaves
|
|
1016
|
+
* the container scrollable. The bar is a macOS-style overlay: hidden at rest, shown while
|
|
1017
|
+
* the offset moves, faded out after about a second, and thicker under the pointer. */
|
|
1018
|
+
scrollbarWidth?: "auto" | "thin" | "none";
|
|
1019
|
+
/** What a scroller at its limit does with the wheel it cannot use, like CSS. `"auto"`
|
|
1020
|
+
* (default) passes it to the scroller around it, `"contain"` and `"none"` keep it. */
|
|
1021
|
+
overscrollBehavior?: "auto" | "contain" | "none";
|
|
1022
|
+
overscrollBehaviorX?: "auto" | "contain" | "none";
|
|
1023
|
+
overscrollBehaviorY?: "auto" | "contain" | "none";
|
|
1024
|
+
/** `"smooth"` animates `scrollTo` and `scrollIntoView` calls that name no `behavior`
|
|
1025
|
+
* (about 300 to 450 ms, firing `onScroll` each frame). An explicit `behavior` wins. */
|
|
1026
|
+
scrollBehavior?: "auto" | "smooth";
|
|
1027
|
+
/** Like CSS `overflow-anchor`, scroll anchoring. A scroller that is scrolled away from its start
|
|
1028
|
+
* keeps what it shows where it is when the layout moves it (content inserted or resized above):
|
|
1029
|
+
* the scroller picks the first box in view as its anchor, and when the layout moves the anchor
|
|
1030
|
+
* along the block axis it scrolls by the same distance, as Chrome does. `"none"` on a box keeps
|
|
1031
|
+
* it and what is in it from being the anchor (the next box in view anchors instead), and on a
|
|
1032
|
+
* scroller turns its anchoring off. Not inherited, so it is set on each box that opts out. Not
|
|
1033
|
+
* animatable. Not modelled: a nested scroller is anchored whole, and a focused editable has no
|
|
1034
|
+
* priority. */
|
|
1035
|
+
overflowAnchor?: "auto" | "none";
|
|
1036
|
+
cursor?: CursorValue;
|
|
1037
|
+
/** `"none"` makes the element never the target of a pointer event, so the
|
|
1038
|
+
* pointer reaches what is under it. It inherits, and a descendant's `"auto"`
|
|
1039
|
+
* restores it, like CSS. Every other element is a target where it paints,
|
|
1040
|
+
* whatever its fill or position. */
|
|
1041
|
+
pointerEvents?: "auto" | "none";
|
|
1042
|
+
/**
|
|
1043
|
+
* Window drag regions of a frameless window (`titlebarTransparent`), as Electron's
|
|
1044
|
+
* `-webkit-app-region`. `"drag"` makes the element's box drag the window; `"no-drag"` cuts a hole in
|
|
1045
|
+
* it, for the buttons on a draggable bar. It inherits, so `"no-drag"` inside a `"drag"` box and
|
|
1046
|
+
* `"drag"` inside that again work.
|
|
1047
|
+
*
|
|
1048
|
+
* Regions are layout rectangles, not hit testing: the last box in tree order that holds the
|
|
1049
|
+
* point wins, whatever overlaps it, its `pointerEvents`, `overflow` or `borderRadius`. A press in
|
|
1050
|
+
* a drag region starts the window move and reaches the page not at all: no `pointerdown`,
|
|
1051
|
+
* `mousedown` or `click`, and a double click does what the titlebar does (zoom, minimise). A
|
|
1052
|
+
* pointer over one with no button held is outside the window to the page: hover leaves, no moves
|
|
1053
|
+
* fire, and wheel is untouched. The cursor is the arrow. A right click and, on macOS, a ctrl
|
|
1054
|
+
* click reach the page; on Linux a right click opens the window menu. On Windows the OS owns the
|
|
1055
|
+
* whole region, double click and right click included. Ignored without `titlebarTransparent`.
|
|
1056
|
+
*/
|
|
1057
|
+
appRegion?: "drag" | "no-drag";
|
|
1058
|
+
/** "none" opts this element and its subtree out of text selection.
|
|
1059
|
+
* Inherited like the CSS property, so a toolbar can disable it once. */
|
|
1060
|
+
userSelect?: "text" | "none" | "auto";
|
|
1061
|
+
/** Selection wash colour for this subtree. Defaults to the theme accent at 35%. */
|
|
1062
|
+
selectionColor?: string;
|
|
1063
|
+
/**
|
|
1064
|
+
* CSS transitions, in CSS syntax with kebab-case property names, as in a DOM
|
|
1065
|
+
* inline style: `"background-color 150ms ease-out, opacity .2s 50ms"`, `"all
|
|
1066
|
+
* 1s"`, `"none"`. When the value of an animatable property changes (a style
|
|
1067
|
+
* prop, or a `hover` / `active` / `focusVisible` / `has*` state style applying or
|
|
1068
|
+
* ending) the element animates from the value it showed to the new one. An
|
|
1069
|
+
* interrupted transition continues from the visible value. The element's
|
|
1070
|
+
* first style never transitions. `animate` on a `motion` element beats a
|
|
1071
|
+
* transition on the same property. Events: `onTransitionRun`,
|
|
1072
|
+
* `onTransitionStart`, `onTransitionEnd`, `onTransitionCancel`.
|
|
1073
|
+
* An invalid value is an error. Discrete properties (`display`, `visibility`,
|
|
1074
|
+
* `flexDirection`, ...) transition only with `allow-discrete`, in the
|
|
1075
|
+
* shorthand or `transitionBehavior`.
|
|
1076
|
+
* A change between a length and `auto` (a `height` that is `auto` or unset,
|
|
1077
|
+
* and an unset `minHeight` / `maxHeight`, whose value is `auto` / `none`)
|
|
1078
|
+
* applies at once, as in a browser, unless `interpolateSize` allows it.
|
|
1079
|
+
*/
|
|
1080
|
+
transition?: string;
|
|
1081
|
+
/** `none`, `all`, or a list of CSS property names. Wins over `transition`. */
|
|
1082
|
+
transitionProperty?: string;
|
|
1083
|
+
/** A list of `<time>`s (`150ms`, `.2s`). Wins over `transition`. */
|
|
1084
|
+
transitionDuration?: string;
|
|
1085
|
+
/** A list of `ease`, `linear`, `ease-in`, `ease-out`, `ease-in-out`,
|
|
1086
|
+
* `cubic-bezier()`, `steps()`, `step-start`, `step-end` or `linear()`. */
|
|
1087
|
+
transitionTimingFunction?: string;
|
|
1088
|
+
/** A list of `<time>`s. Negative starts the transition part-way through. */
|
|
1089
|
+
transitionDelay?: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* A list of `normal` or `allow-discrete`. `allow-discrete` lets a discrete
|
|
1092
|
+
* property transition: it flips at the halfway point of the eased progress,
|
|
1093
|
+
* except `display`, where the side that is not `none` shows for the whole
|
|
1094
|
+
* duration, and `visibility`, which is `visible` for the whole duration when
|
|
1095
|
+
* either end is. `normal` (the default) applies a discrete change at once.
|
|
1096
|
+
*/
|
|
1097
|
+
transitionBehavior?: string;
|
|
1098
|
+
/**
|
|
1099
|
+
* `"allow-keywords"` lets a CSS transition run between a length and a sizing
|
|
1100
|
+
* keyword: `height` to or from `auto`, and from an unset `minHeight` /
|
|
1101
|
+
* `maxHeight`. `"numeric-only"` (the default) makes those changes discrete.
|
|
1102
|
+
* Inherited like the CSS property, so set it once on a container. `width` to
|
|
1103
|
+
* or from `auto` stays discrete either way. `motion` animates to `height:
|
|
1104
|
+
* "auto"` whatever this is set to.
|
|
1105
|
+
*/
|
|
1106
|
+
interpolateSize?: "numeric-only" | "allow-keywords";
|
|
1107
|
+
/**
|
|
1108
|
+
* CSS animations, in CSS syntax as in a DOM inline style: `"fade-in 300ms
|
|
1109
|
+
* ease-out 100ms 2 alternate both"`, `"spin 1s linear infinite"`, `"none"`.
|
|
1110
|
+
* `name` is a set of keyframes made with `defineKeyframes`. The parts come in
|
|
1111
|
+
* any order; the first time is the duration and the second the delay. A comma
|
|
1112
|
+
* list runs several animations. An invalid value is an error. A name with no
|
|
1113
|
+
* keyframes animates nothing, as in a browser. The longhands below win over
|
|
1114
|
+
* this shorthand. `animation-composition`, `animation-timeline` and
|
|
1115
|
+
* `animation-range` are not supported.
|
|
1116
|
+
*/
|
|
1117
|
+
animation?: string;
|
|
1118
|
+
/** `none` or a list of names given to `defineKeyframes`. */
|
|
1119
|
+
animationName?: string;
|
|
1120
|
+
/** A list of `<time>`s, or `auto` (`0s`). */
|
|
1121
|
+
animationDuration?: string;
|
|
1122
|
+
/** A list of the same easing functions as `transitionTimingFunction`. */
|
|
1123
|
+
animationTimingFunction?: string;
|
|
1124
|
+
/** A list of `<time>`s. Negative starts the animation part-way through. */
|
|
1125
|
+
animationDelay?: string;
|
|
1126
|
+
/** A list of `infinite` or non-negative numbers. */
|
|
1127
|
+
animationIterationCount?: string;
|
|
1128
|
+
/** A list of `normal`, `reverse`, `alternate` or `alternate-reverse`. */
|
|
1129
|
+
animationDirection?: string;
|
|
1130
|
+
/** A list of `none`, `forwards`, `backwards` or `both`. */
|
|
1131
|
+
animationFillMode?: string;
|
|
1132
|
+
/** A list of `running` or `paused`. */
|
|
1133
|
+
animationPlayState?: string;
|
|
1134
|
+
hover?: StateStyleDesc;
|
|
1135
|
+
/** Makes this element a group for `groupHover`, `groupActive` and
|
|
1136
|
+
* `groupFocusWithin` on its descendants, like a Tailwind `group`. `true` is the default group; a string
|
|
1137
|
+
* names it, so groups can nest. */
|
|
1138
|
+
group?: string | true;
|
|
1139
|
+
/** Applied while the nearest ancestor `group` is hovered (the pointer is over
|
|
1140
|
+
* it or anything inside it). `{ group: "card", ... }` follows the nearest
|
|
1141
|
+
* ancestor named `card` instead of the default group. */
|
|
1142
|
+
groupHover?: GroupStateStyleDesc;
|
|
1143
|
+
/** Applied while the mouse is down inside the nearest ancestor `group`. Same
|
|
1144
|
+
* `group` field as `groupHover`. */
|
|
1145
|
+
groupActive?: GroupStateStyleDesc;
|
|
1146
|
+
/** Applied while the nearest ancestor `group` or anything inside it has focus
|
|
1147
|
+
* (`:focus-within` of the group). Same `group` field as `groupHover`. Beats
|
|
1148
|
+
* the element's own `hover` and `active` and loses to its `focusWithin`
|
|
1149
|
+
* and `focusVisible`. */
|
|
1150
|
+
groupFocusWithin?: GroupStateStyleDesc;
|
|
1151
|
+
active?: StateStyleDesc;
|
|
1152
|
+
/** While a strict descendant is hovered, like CSS `:has(:hover)`. The pointer
|
|
1153
|
+
* over the element itself does not count, and a portal child counts as a
|
|
1154
|
+
* descendant (the logical tree, as for `hover`). Below `hover`: the element's
|
|
1155
|
+
* own state beats what its descendants cause, and this beats `groupHover`. */
|
|
1156
|
+
hasHover?: StateStyleDesc;
|
|
1157
|
+
/** While the mouse is down on a strict descendant, like CSS `:has(:active)`.
|
|
1158
|
+
* Below `active`, above `groupActive`. */
|
|
1159
|
+
hasActive?: StateStyleDesc;
|
|
1160
|
+
/** While a strict descendant has focus, like CSS `:has(:focus)`. Below
|
|
1161
|
+
* `focusWithin`, above `groupFocusWithin`. Unlike `focusWithin` it does not
|
|
1162
|
+
* apply while the element itself is the focused one. */
|
|
1163
|
+
hasFocus?: StateStyleDesc;
|
|
1164
|
+
/** While a strict descendant matches `:focus-visible`, like CSS
|
|
1165
|
+
* `:has(:focus-visible)`. Above `focusWithin`, below `focusVisible`. */
|
|
1166
|
+
hasFocusVisible?: StateStyleDesc;
|
|
1167
|
+
/** While the element is a disabled form control, like CSS `:disabled`: an `<input>` or
|
|
1168
|
+
* `<textarea>` with `disabled`, or a `Button` or `Select` trigger that is. A `div` with a
|
|
1169
|
+
* `disabled` prop does not match, as in a DOM. Hover and press still apply to a disabled
|
|
1170
|
+
* control, as `:hover` does; this sits above them, so it wins a field they both set. Unlike
|
|
1171
|
+
* `hover`, it also applies inside an `inert` subtree. */
|
|
1172
|
+
disabled?: StateStyleDesc;
|
|
1173
|
+
/** While the element is an enabled form control, like CSS `:enabled`. Same elements as
|
|
1174
|
+
* `disabled`. */
|
|
1175
|
+
enabled?: StateStyleDesc;
|
|
1176
|
+
/** While a strict descendant is a disabled form control, like CSS `:has(:disabled)`. Above
|
|
1177
|
+
* `active`, below `enabled` and `disabled`. */
|
|
1178
|
+
hasDisabled?: StateStyleDesc;
|
|
1179
|
+
/** While a strict descendant is an enabled form control, like CSS `:has(:enabled)`. Above
|
|
1180
|
+
* `active`, below `hasDisabled`. */
|
|
1181
|
+
hasEnabled?: StateStyleDesc;
|
|
1182
|
+
/** While the element matches `:focus-visible`: focused by the keyboard (Tab),
|
|
1183
|
+
* or a text control, or focus moved there by script from an element that
|
|
1184
|
+
* matched. A mouse press on a button never shows it. Needs a focusable
|
|
1185
|
+
* element. */
|
|
1186
|
+
focusVisible?: StateStyleDesc;
|
|
1187
|
+
/** While the element or any descendant is focused, like CSS `:focus-within`.
|
|
1188
|
+
* Works on any element, focusable or not. */
|
|
1189
|
+
focusWithin?: StateStyleDesc;
|
|
1190
|
+
/** `false` keeps this focusable element at full opacity while another
|
|
1191
|
+
* control has keyboard focus. Default dims it. Not inherited. */
|
|
1192
|
+
keyboardFocusDim?: boolean;
|
|
1193
|
+
/**
|
|
1194
|
+
* Makes the element a query container, like CSS `container-type`: the
|
|
1195
|
+
* `"@container"` blocks and container units (`cqw`, `cqh`, ...) of its
|
|
1196
|
+
* descendants are about its content box. `"inline-size"` contains the width:
|
|
1197
|
+
* the element's width no longer depends on its content, so with no `width`
|
|
1198
|
+
* it is only its padding and border (a flex item or an absolutely positioned
|
|
1199
|
+
* box with an `inline-size` container inside shrinks to nothing, as in a
|
|
1200
|
+
* browser). `"size"` contains the height too. `"normal"` (the default) makes
|
|
1201
|
+
* no container. Applies to `div`, `text`, an atomic `span`, `label`, `form`,
|
|
1202
|
+
* `<virtual-list>` (its rows are queried against it), `<img>` and `<svg>`
|
|
1203
|
+
* (which only lose their natural size on the contained axes) as in CSS. A
|
|
1204
|
+
* `span` that is not atomic, a `display: contents` element and a table or
|
|
1205
|
+
* one of its internal boxes are still the container a query finds, but they
|
|
1206
|
+
* cannot be size contained: a size feature asked of them is unknown (false,
|
|
1207
|
+
* and the lookup does not go on to a container above), and a container unit
|
|
1208
|
+
* looks past them. An `<input>` ignores it, as it does in a browser.
|
|
1209
|
+
*/
|
|
1210
|
+
containerType?: "normal" | "inline-size" | "size";
|
|
1211
|
+
/**
|
|
1212
|
+
* Names the container so a query can pick it: `"@container sidebar
|
|
1213
|
+
* (min-width: 400px)"` asks the nearest ancestor container called `sidebar`
|
|
1214
|
+
* instead of the nearest one. Several names are separated by spaces;
|
|
1215
|
+
* `"none"` is no name. Like CSS `container-name`. A name alone, with no
|
|
1216
|
+
* `containerType`, makes the element something only a name-only query
|
|
1217
|
+
* (`"@container sidebar"`) and a `style()` query naming it can find.
|
|
1218
|
+
*/
|
|
1219
|
+
containerName?: string;
|
|
1220
|
+
/**
|
|
1221
|
+
* `"<name> [ / <type> ]"`, both properties in one, like CSS `container`:
|
|
1222
|
+
* `"sidebar / inline-size"`. A type left out is `"normal"`. `containerType`
|
|
1223
|
+
* and `containerName` win over it.
|
|
1224
|
+
*/
|
|
1225
|
+
container?: string;
|
|
1226
|
+
/**
|
|
1227
|
+
* Like CSS `content-visibility`. `"hidden"` skips the element's content: its children
|
|
1228
|
+
* are not built, laid out or painted, but their DOM, animation and transition state is kept,
|
|
1229
|
+
* and they are there again, as they were, when the value goes back to `"visible"` (the
|
|
1230
|
+
* default). The element itself is built and painted: its background, border and hit area.
|
|
1231
|
+
* `"auto"` is not yet skipped, and for now only has the containment below.
|
|
1232
|
+
*
|
|
1233
|
+
* Anything but `"visible"` contains the element's style, layout and paint: its content is
|
|
1234
|
+
* clipped at the padding box as with `overflow: "clip"` (an `overflow` that already clips
|
|
1235
|
+
* wins), it is a stacking context and the containing block of its `position: "absolute"`
|
|
1236
|
+
* descendants. A skipped element also has size containment on both axes, sized by
|
|
1237
|
+
* `containIntrinsicSize` (none, so zero, by default) plus its padding and border. Applies to
|
|
1238
|
+
* `div`, `text`, `label`, `form` and block `span`; another element has the containment and
|
|
1239
|
+
* is never skipped. Not modelled: the element is not an independent formatting context (a
|
|
1240
|
+
* margin of its first or last child can collapse through it), and a `position: "fixed"`
|
|
1241
|
+
* descendant is placed against the viewport. An observer on an element inside a skipped
|
|
1242
|
+
* element may report it gone.
|
|
1243
|
+
*/
|
|
1244
|
+
contentVisibility?: "visible" | "auto" | "hidden";
|
|
1245
|
+
/**
|
|
1246
|
+
* Like CSS `contain-intrinsic-size`: the size of the content box of an element with size
|
|
1247
|
+
* containment that has no content to size it, for now a skipped one. `"<width> <height>"`
|
|
1248
|
+
* or one value for both; each is `"none"`, a length (a number is px), or `"auto <length>"`.
|
|
1249
|
+
* `containIntrinsicWidth` and `containIntrinsicHeight` win over it.
|
|
1250
|
+
*/
|
|
1251
|
+
containIntrinsicSize?: number | string;
|
|
1252
|
+
containIntrinsicWidth?: number | string;
|
|
1253
|
+
containIntrinsicHeight?: number | string;
|
|
1254
|
+
/** `containIntrinsicWidth` in a horizontal writing mode, which is the only one. */
|
|
1255
|
+
containIntrinsicInlineSize?: number | string;
|
|
1256
|
+
/** `containIntrinsicHeight` in a horizontal writing mode. */
|
|
1257
|
+
containIntrinsicBlockSize?: number | string;
|
|
1258
|
+
/**
|
|
1259
|
+
* Styles that apply while a container query is true, like CSS `@container`.
|
|
1260
|
+
* Keys are queries in the CSS Containment 3 grammar, written the way they
|
|
1261
|
+
* follow `@container`: an optional container name, then a condition.
|
|
1262
|
+
*
|
|
1263
|
+
* ```ts
|
|
1264
|
+
* style={{
|
|
1265
|
+
* padding: 16,
|
|
1266
|
+
* "@container": {
|
|
1267
|
+
* "(min-width: 400px)": { padding: 32 },
|
|
1268
|
+
* "sidebar (400px <= width < 800px) and (orientation: landscape)": { flexDirection: "row" },
|
|
1269
|
+
* "not (min-height: 300px)": { display: "none" },
|
|
1270
|
+
* },
|
|
1271
|
+
* }}
|
|
1272
|
+
* ```
|
|
1273
|
+
*
|
|
1274
|
+
* Features: `width`, `height`, `inline-size`, `block-size`, `aspect-ratio`
|
|
1275
|
+
* and `orientation`, with `min-` / `max-` prefixes, `(feature: value)`, the
|
|
1276
|
+
* range syntax `(400px <= width < 800px)`, and `and` / `or` / `not` (mixing
|
|
1277
|
+
* `and` with `or` needs parentheses). Lengths take px, em (the container's
|
|
1278
|
+
* font size), rem, vw, vh, vmin, vmax, the container units and `calc()`.
|
|
1279
|
+
*
|
|
1280
|
+
* `style(--name: value)` asks the container's computed custom property
|
|
1281
|
+
* (a `"--name"` key of a style, which inherits), `style(--name)` whether it
|
|
1282
|
+
* has a value, `style(--name: initial)` whether it has none, and
|
|
1283
|
+
* `style(--n > 5px)` / `style(0 < --n <= 1)` orders a number, a length or a
|
|
1284
|
+
* percentage. They combine as `style((--a: 1) and (--b: 2))`, `not style(...)`.
|
|
1285
|
+
* A normal property in `style()` (`style(color: red)`) is unknown, as it is
|
|
1286
|
+
* in a browser. A feature, or a `scroll-state()` query, that is not
|
|
1287
|
+
* supported is unknown, and an unknown query is false. A text that is not a
|
|
1288
|
+
* query at all makes the whole style invalid.
|
|
1289
|
+
*
|
|
1290
|
+
* One container answers the whole query: the nearest ancestor container
|
|
1291
|
+
* (with that name, if the query has one) that contains the axes its size
|
|
1292
|
+
* features read: `width` needs `"inline-size"` or `"size"`, `height`,
|
|
1293
|
+
* `aspect-ratio` and `orientation` need `"size"`. A query of `style()` alone
|
|
1294
|
+
* and no name asks the parent element. It never matches the element itself,
|
|
1295
|
+
* and it measures the container's content box (without padding, border and a
|
|
1296
|
+
* scrollbar gutter). With no such container, or before the container has
|
|
1297
|
+
* been laid out, it is false.
|
|
1298
|
+
*
|
|
1299
|
+
* Blocks apply in the order they are written, a later one winning over an
|
|
1300
|
+
* earlier one that sets the same property. They fold into the style before
|
|
1301
|
+
* `hover`, `active` and the other state styles, which therefore win over
|
|
1302
|
+
* them, and a block may carry its own state keys (`hover`, `focusVisible`,
|
|
1303
|
+
* ...) that merge into the style's. A block cannot hold another
|
|
1304
|
+
* `"@container"`.
|
|
1305
|
+
*
|
|
1306
|
+
* The style is right in the frame that lays the container out: when a
|
|
1307
|
+
* container's size changes what a query or a container unit resolves to,
|
|
1308
|
+
* the frame is built again before it is presented (up to four times for
|
|
1309
|
+
* nested containers).
|
|
1310
|
+
*/
|
|
1311
|
+
"@container"?: Record<string, ContainerBlockStyleDesc>;
|
|
1312
|
+
/**
|
|
1313
|
+
* CSS custom properties: any `"--name"` key. A number is written as its
|
|
1314
|
+
* decimal text, a string is trimmed (a trailing `!important` and `/* *\/`
|
|
1315
|
+
* comments go), and an empty string or `undefined` declares nothing.
|
|
1316
|
+
* They inherit, `"initial"` clears one and `"inherit"` keeps the parent's,
|
|
1317
|
+
* and a state style or an `"@container"` block may set them.
|
|
1318
|
+
*
|
|
1319
|
+
* Only `style()` container queries read them. `var()` is not substituted into
|
|
1320
|
+
* other properties.
|
|
1321
|
+
*/
|
|
1322
|
+
[customProperty: `--${string}`]: string | number | undefined;
|
|
1323
|
+
}
|
|
1324
|
+
/** A style inside `"@container"`: any style, state styles included, except another `"@container"`. */
|
|
1325
|
+
export type ContainerBlockStyleDesc = Omit<StyleDesc, "@container">;
|
|
1326
|
+
export type StateStyleDesc = Omit<StyleDesc, "@container" | "hover" | "active" | "focusVisible" | "focusWithin" | "keyboardFocusDim" | "group" | "groupHover" | "groupActive" | "groupFocusWithin" | "hasHover" | "hasActive" | "hasFocus" | "hasFocusVisible" | "disabled" | "enabled" | "hasDisabled" | "hasEnabled" | "fontVariantNumeric" | "fontFeatureSettings" | "fontVariationSettings">;
|
|
1327
|
+
/** A `groupHover`/`groupActive`/`groupFocusWithin` style. Its `group` picks which ancestor group to
|
|
1328
|
+
* follow (default group when omitted). */
|
|
1329
|
+
export type GroupStateStyleDesc = StateStyleDesc & {
|
|
1330
|
+
group?: string | true;
|
|
1331
|
+
};
|
|
1332
|
+
export type ElementType = "div" | "text" | "span" | "img" | "svg" | "canvas" | "input" | "textarea" | "label" | "form" | "anchored" | "code" | "diff" | "markdown" | "webview" | "nativeview" | "virtual-list" | SvgChildType;
|
|
1333
|
+
/** Colours for one syntax capture class each. Every field is a CSS colour. */
|
|
1334
|
+
export interface SyntaxTheme {
|
|
1335
|
+
comment?: string;
|
|
1336
|
+
keyword?: string;
|
|
1337
|
+
string?: string;
|
|
1338
|
+
stringSpecial?: string;
|
|
1339
|
+
escape?: string;
|
|
1340
|
+
number?: string;
|
|
1341
|
+
boolean?: string;
|
|
1342
|
+
typeName?: string;
|
|
1343
|
+
typeBuiltin?: string;
|
|
1344
|
+
constructor?: string;
|
|
1345
|
+
function?: string;
|
|
1346
|
+
functionBuiltin?: string;
|
|
1347
|
+
macroName?: string;
|
|
1348
|
+
property?: string;
|
|
1349
|
+
constant?: string;
|
|
1350
|
+
variable?: string;
|
|
1351
|
+
variableSpecial?: string;
|
|
1352
|
+
parameter?: string;
|
|
1353
|
+
operator?: string;
|
|
1354
|
+
punctuation?: string;
|
|
1355
|
+
tag?: string;
|
|
1356
|
+
attribute?: string;
|
|
1357
|
+
label?: string;
|
|
1358
|
+
invalid?: string;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Every number that decides layout in the native text components.
|
|
1362
|
+
*
|
|
1363
|
+
* These live in the theme, not in Rust constants, so tuning a row height or a
|
|
1364
|
+
* heading scale is a framework render and needs no native rebuild.
|
|
1365
|
+
*/
|
|
1366
|
+
export interface GpuixMetrics {
|
|
1367
|
+
codeTextSize?: number;
|
|
1368
|
+
codeLineHeight?: number;
|
|
1369
|
+
codeGutterDigitWidth?: number;
|
|
1370
|
+
codeGutterPaddingRight?: number;
|
|
1371
|
+
codeGutterMinWidth?: number;
|
|
1372
|
+
diffTextSize?: number;
|
|
1373
|
+
diffLineHeight?: number;
|
|
1374
|
+
diffFileHeaderHeight?: number;
|
|
1375
|
+
diffHunkHeaderHeight?: number;
|
|
1376
|
+
diffNoticeHeight?: number;
|
|
1377
|
+
diffBodyBottomPad?: number;
|
|
1378
|
+
diffGutterWidth?: number;
|
|
1379
|
+
diffMarkerWidth?: number;
|
|
1380
|
+
diffAccentBarWidth?: number;
|
|
1381
|
+
diffRowPaddingX?: number;
|
|
1382
|
+
mdTextSize?: number;
|
|
1383
|
+
mdLineHeight?: number;
|
|
1384
|
+
mdBlockGap?: number;
|
|
1385
|
+
/** `[h1, h2, h3, h4to6]`. A shorter array leaves the rest at their defaults. */
|
|
1386
|
+
mdHeadingSizes?: number[];
|
|
1387
|
+
mdHeadingLineHeights?: number[];
|
|
1388
|
+
mdTableCellPadding?: number;
|
|
1389
|
+
mdTableMinColumnWidth?: number;
|
|
1390
|
+
mdTableMinColumnContent?: number;
|
|
1391
|
+
mdInlineCodeRadius?: number;
|
|
1392
|
+
/**
|
|
1393
|
+
* The fenced-block card. `<code>` paints no card, so these are
|
|
1394
|
+
* markdown-only: style a `<code>` block with its own `style` prop instead.
|
|
1395
|
+
*/
|
|
1396
|
+
mdCodePaddingX?: number;
|
|
1397
|
+
mdCodePaddingY?: number;
|
|
1398
|
+
mdCodeRadius?: number;
|
|
1399
|
+
mdCodeHeaderPaddingY?: number;
|
|
1400
|
+
mdCodeHeaderTextSize?: number;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Theme tokens for the native text components. Every field is optional and
|
|
1404
|
+
* layers on top of the built-in dark theme (or light, via `appearance`).
|
|
1405
|
+
*/
|
|
1406
|
+
export interface GpuixTheme {
|
|
1407
|
+
appearance?: "dark" | "light";
|
|
1408
|
+
bg?: string;
|
|
1409
|
+
border?: string;
|
|
1410
|
+
text?: string;
|
|
1411
|
+
textMuted?: string;
|
|
1412
|
+
textFaint?: string;
|
|
1413
|
+
textDim?: string;
|
|
1414
|
+
accent?: string;
|
|
1415
|
+
caret?: string;
|
|
1416
|
+
codeText?: string;
|
|
1417
|
+
codeWash?: string;
|
|
1418
|
+
diffAdd?: string;
|
|
1419
|
+
diffDel?: string;
|
|
1420
|
+
diffHunkBg?: string;
|
|
1421
|
+
fontSans?: string;
|
|
1422
|
+
fontMono?: string;
|
|
1423
|
+
syntax?: SyntaxTheme;
|
|
1424
|
+
metrics?: GpuixMetrics;
|
|
1425
|
+
}
|
|
1426
|
+
/** One `highlight` entry. See `HostProps.highlight`. */
|
|
1427
|
+
export interface HighlightSpec {
|
|
1428
|
+
/**
|
|
1429
|
+
* Substring to match. Case-insensitive unless `caseSensitive` is set.
|
|
1430
|
+
*
|
|
1431
|
+
* A match never crosses a line, exactly like browser find. It DOES cross the
|
|
1432
|
+
* several host nodes a JSX renderer makes for one interpolated line, so
|
|
1433
|
+
* `<text>Hello {name}!</text>` matches `Hello Tommy`.
|
|
1434
|
+
*/
|
|
1435
|
+
query?: string;
|
|
1436
|
+
caseSensitive?: boolean;
|
|
1437
|
+
/** Only match when neither neighbour is alphanumeric or `_`. */
|
|
1438
|
+
wholeWord?: boolean;
|
|
1439
|
+
/**
|
|
1440
|
+
* Explicit `[start, end)` pairs in UTF-16 code units, the units `indexOf` and
|
|
1441
|
+
* `RegExp.exec` return. They index the declaring subtree's text, with a
|
|
1442
|
+
* newline between lines.
|
|
1443
|
+
*
|
|
1444
|
+
* A pair that splits a surrogate pair is rejected, not snapped. Native text
|
|
1445
|
+
* (`<code>`, `<markdown>`, `<diff>`) is not part of that text; use `query`.
|
|
1446
|
+
*/
|
|
1447
|
+
ranges?: Array<[number, number]>;
|
|
1448
|
+
/** Any CSS colour. Defaults to the theme accent at 30% alpha. */
|
|
1449
|
+
color?: string;
|
|
1450
|
+
/** Colour for the match at `activeIndex`. Defaults to accent at 65%. */
|
|
1451
|
+
activeColor?: string;
|
|
1452
|
+
/** Index of the match to highlight differently, for a find-bar cursor. */
|
|
1453
|
+
activeIndex?: number;
|
|
1454
|
+
/**
|
|
1455
|
+
* How many MATCHES come before this subtree in your document, so `activeIndex`
|
|
1456
|
+
* is compared against `matchIndexOffset + n` for the nth match here.
|
|
1457
|
+
*
|
|
1458
|
+
* It is a match count, not a row index. Rows hold different numbers of
|
|
1459
|
+
* matches, so a row index cannot stand in for it.
|
|
1460
|
+
*
|
|
1461
|
+
* Only needed for virtualized content: a `<virtual-list>` mounts a window of
|
|
1462
|
+
* its rows, so native can only number what that window contains. Sum
|
|
1463
|
+
* `findRanges` over the rows before `windowStart`. Defaults to 0.
|
|
1464
|
+
*
|
|
1465
|
+
* A negative or fractional value is refused and the whole spec is dropped,
|
|
1466
|
+
* because a bad offset silently marks the wrong match.
|
|
1467
|
+
*/
|
|
1468
|
+
matchIndexOffset?: number;
|
|
1469
|
+
/** Corner radius of the wash. Defaults to 2. */
|
|
1470
|
+
radius?: number;
|
|
1471
|
+
}
|
|
1472
|
+
export interface HostProps extends AriaProps, PointerEventProps, AnimationEventProps, ContentVisibilityEventProps, CompositionEventProps {
|
|
1473
|
+
style?: StyleDesc;
|
|
1474
|
+
/**
|
|
1475
|
+
* A button went down on an element outside this one's logical subtree, for any
|
|
1476
|
+
* button. Anchored descendants are inside; an overlay that merely paints above is
|
|
1477
|
+
* outside. Runs at this element only, after `pointerdown` and `mousedown`, with
|
|
1478
|
+
* `event.target` set to the pressed element (the one a ref gives) and
|
|
1479
|
+
* `event.currentTarget` to this one. Use for "click outside to close".
|
|
1480
|
+
*/
|
|
1481
|
+
onMouseDownOutside?: (event: DomEvent) => void;
|
|
1482
|
+
/** Fires on the focused element, then on ancestors that declare it. A key
|
|
1483
|
+
* listener does not make an element focusable: give it a `tabIndex`. */
|
|
1484
|
+
onKeyDown?: (event: KeyEvent) => void;
|
|
1485
|
+
onKeyUp?: (event: KeyEvent) => void;
|
|
1486
|
+
/** `focus`. Does not bubble. */
|
|
1487
|
+
onFocus?: (event: DomEvent) => void;
|
|
1488
|
+
/** `blur`. Does not bubble. */
|
|
1489
|
+
onBlur?: (event: DomEvent) => void;
|
|
1490
|
+
/** `focusin`. Bubbles to ancestors. Solid only. */
|
|
1491
|
+
onFocusIn?: (event: DomEvent) => void;
|
|
1492
|
+
/** `focusout`. Bubbles to ancestors. Solid only. */
|
|
1493
|
+
onFocusOut?: (event: DomEvent) => void;
|
|
1494
|
+
/**
|
|
1495
|
+
* The scroll offset of an `overflow: "scroll"` or `"auto"` element changed, however it
|
|
1496
|
+
* moved: wheel, scrollbar drag, keys, `scrollTo`, `scrollIntoView`, a smooth animation,
|
|
1497
|
+
* or content shrinking under it. `scrollTop` and `scrollLeft` are read from the target,
|
|
1498
|
+
* as on the DOM element. Does not bubble. The position at the first paint is not
|
|
1499
|
+
* reported, only movement after it. Not for `<virtual-list>`; use `onVisibleRange`.
|
|
1500
|
+
*/
|
|
1501
|
+
onScroll?: (event: ScrollEvent) => void;
|
|
1502
|
+
/**
|
|
1503
|
+
* The element's border box, reported after the first paint and each time its
|
|
1504
|
+
* size changes: `width` and `height`, plus `x` and `y` in window coordinates.
|
|
1505
|
+
* Moving without resizing reports nothing. Supported on `div` and `text`.
|
|
1506
|
+
*/
|
|
1507
|
+
onLayout?: (event: DomEvent) => void;
|
|
1508
|
+
/** The `src` decoded. Fires once per `src` change, with `naturalWidth` and
|
|
1509
|
+
* `naturalHeight` in pixels. An empty `src` fires nothing. */
|
|
1510
|
+
onLoad?: (event: DomEvent) => void;
|
|
1511
|
+
/** The `src` could not be read or decoded. Fires once per `src` change, with
|
|
1512
|
+
* the reason in `value`. */
|
|
1513
|
+
onError?: (event: DomEvent) => void;
|
|
1514
|
+
/** One edit of the text, the DOM `input`: see `HostInputEvent`. */
|
|
1515
|
+
onChange?: (event: HostInputEvent) => void;
|
|
1516
|
+
/** The DOM `submit` event of a descendant `<form>`, bubbling: see
|
|
1517
|
+
* `FormProps.onSubmit`. Not available on `<input>` or `<textarea>`: handle
|
|
1518
|
+
* Enter in `onKeyDown` and call `preventDefault()` to keep it from submitting
|
|
1519
|
+
* the form (`<input>`) or inserting a newline (`<textarea>`). */
|
|
1520
|
+
onSubmit?: (event: DomEvent) => void;
|
|
1521
|
+
/** A `required` control is empty when its form is submitted. Does not bubble. */
|
|
1522
|
+
onInvalid?: (event: DomEvent) => void;
|
|
1523
|
+
onToggleFile?: (event: DomEvent) => void;
|
|
1524
|
+
onShowMore?: (event: DomEvent) => void;
|
|
1525
|
+
onLineClick?: (event: DomEvent) => void;
|
|
1526
|
+
onLinkClick?: (event: DomEvent) => void;
|
|
1527
|
+
onVisibleRange?: (event: DomEvent) => void;
|
|
1528
|
+
/** Match count changed for this element's `highlight`. See `matchCount`. */
|
|
1529
|
+
onHighlight?: (event: DomEvent) => void;
|
|
1530
|
+
/** A native `motion` track reached its current target. */
|
|
1531
|
+
onMotionComplete?: (event: DomEvent) => void;
|
|
1532
|
+
/** A `layout` glide began: the box moved, or took over a `layoutId`. */
|
|
1533
|
+
onLayoutAnimationStart?: (event: DomEvent) => void;
|
|
1534
|
+
/** A `layout` glide reached the box's layout position. Not fired for one a
|
|
1535
|
+
* newer glide replaced. */
|
|
1536
|
+
onLayoutAnimationComplete?: (event: DomEvent) => void;
|
|
1537
|
+
/**
|
|
1538
|
+
* Paint a background wash behind matched or explicitly given text ranges.
|
|
1539
|
+
*
|
|
1540
|
+
* Scoped by position: on the root it searches the window, on a container it
|
|
1541
|
+
* searches that container. The nearest declaration wins, so a nested
|
|
1542
|
+
* `highlight` replaces an ancestor's for its own subtree.
|
|
1543
|
+
*/
|
|
1544
|
+
highlight?: HighlightSpec | HighlightSpec[] | null;
|
|
1545
|
+
/** Take keyboard focus when the element first mounts. Required for `<input>`:
|
|
1546
|
+
* without it, or a click, the field never receives key events. */
|
|
1547
|
+
autoFocus?: boolean;
|
|
1548
|
+
/**
|
|
1549
|
+
* Makes the element focusable, like the DOM. `-1` is focusable by click or
|
|
1550
|
+
* `focus()` but not by Tab. `0` joins the tab order in document order.
|
|
1551
|
+
* Positive values come first, in ascending order, then the 0s. An enabled
|
|
1552
|
+
* `<input>`/`<textarea>` is focusable without it. Key and focus listeners do
|
|
1553
|
+
* not make an element focusable.
|
|
1554
|
+
*/
|
|
1555
|
+
tabIndex?: number;
|
|
1556
|
+
/**
|
|
1557
|
+
* Makes the element a drag source, like the DOM attribute. A primary press on
|
|
1558
|
+
* it or inside it that moves more than 4px starts a drag: `onDragStart` fires
|
|
1559
|
+
* on the element, `onDrag` follows the pointer, `onDragEnter`/`onDragOver`/
|
|
1560
|
+
* `onDragLeave`/`onDrop` fire on what is under it, and `onDragEnd` on the
|
|
1561
|
+
* element when the drag ends. No pointer or mouse event fires meanwhile.
|
|
1562
|
+
* `preventDefault()` in `onDragStart` cancels the drag. There is no drag image.
|
|
1563
|
+
*/
|
|
1564
|
+
draggable?: boolean;
|
|
1565
|
+
/**
|
|
1566
|
+
* Like the DOM `inert`: the element and everything below it cannot be
|
|
1567
|
+
* focused (no tab stop, `focus()` is a no-op, a focused descendant is
|
|
1568
|
+
* blurred), is left out of the accessibility tree, cannot be selected, and
|
|
1569
|
+
* takes no pointer input: no click, hover or wheel listener fires and
|
|
1570
|
+
* clicks reach whatever lies behind it. A descendant cannot opt back in
|
|
1571
|
+
* with `pointerEvents: "auto"`, `userSelect: "text"` or `tabIndex`.
|
|
1572
|
+
* Inside an inert subtree `<input>` and `<textarea>` behave as `disabled`.
|
|
1573
|
+
*/
|
|
1574
|
+
inert?: boolean;
|
|
1575
|
+
/** The columns a `display: "table-cell"` element covers, like the DOM `colSpan`. At least 1,
|
|
1576
|
+
* at most 1000. */
|
|
1577
|
+
colSpan?: number;
|
|
1578
|
+
/** The rows a `display: "table-cell"` element covers, like the DOM `rowSpan`. 0 reaches the
|
|
1579
|
+
* last row of its row group. At most 65534. */
|
|
1580
|
+
rowSpan?: number;
|
|
1581
|
+
/** The columns a `display: "table-column"` or `"table-column-group"` element stands for, like
|
|
1582
|
+
* the DOM `span`. A column group with `table-column` children takes its columns from them. */
|
|
1583
|
+
span?: number;
|
|
1584
|
+
/**
|
|
1585
|
+
* AccessKit role, as an ARIA token (`"button"`, `"heading"`).
|
|
1586
|
+
* A node is in the accessibility tree only with both an id (always set)
|
|
1587
|
+
* and a role. `"none"` / `"presentation"` produce no node.
|
|
1588
|
+
*/
|
|
1589
|
+
role?: string;
|
|
1590
|
+
/**
|
|
1591
|
+
* DOM `id`. Exposed as `AXIdentifier` / UIA AutomationId, and what
|
|
1592
|
+
* `htmlFor` and the `aria-*` id references (`aria-labelledby`,
|
|
1593
|
+
* `aria-describedby`, ...) resolve against. An element without a `role`
|
|
1594
|
+
* that one of those props names gets a group node, named by its text.
|
|
1595
|
+
*/
|
|
1596
|
+
id?: string;
|
|
1597
|
+
/** Stable locator id for automation. */
|
|
1598
|
+
testId?: string;
|
|
1599
|
+
/**
|
|
1600
|
+
* Internal: set by `Button`, `Select` and the other components that stand in for a `<button>`
|
|
1601
|
+
* or `<select>`, so their element matches the `disabled` and `enabled` state styles (and its
|
|
1602
|
+
* ancestors `hasDisabled` and `hasEnabled`). `disabled` itself reaches native only on
|
|
1603
|
+
* `<input>` and `<textarea>`, so a `<div disabled>` is not a form control, as in a DOM.
|
|
1604
|
+
*/
|
|
1605
|
+
formControl?: "enabled" | "disabled";
|
|
1606
|
+
/** Internal native animation description used by motion components. */
|
|
1607
|
+
motion?: MotionProps;
|
|
1608
|
+
}
|
|
1609
|
+
export interface TextControlProps extends Omit<HostProps, "onSubmit"> {
|
|
1610
|
+
/** External editor value. Native edits apply immediately and report through onChange. */
|
|
1611
|
+
value?: string;
|
|
1612
|
+
placeholder?: string;
|
|
1613
|
+
readOnly?: boolean;
|
|
1614
|
+
/**
|
|
1615
|
+
* Like the DOM: not focusable, not a tab stop, no caret, no editing, no
|
|
1616
|
+
* mouse, click or key events, the text in the theme's muted colour, and
|
|
1617
|
+
* reported as disabled to assistive technology. Focus leaves the control
|
|
1618
|
+
* when it becomes disabled.
|
|
1619
|
+
*/
|
|
1620
|
+
disabled?: boolean;
|
|
1621
|
+
/**
|
|
1622
|
+
* The most UTF-16 code units the user can type or paste. Longer input is
|
|
1623
|
+
* cut to fit. A `value` set from code is kept whole, even when it is longer.
|
|
1624
|
+
*/
|
|
1625
|
+
maxLength?: number;
|
|
1626
|
+
/** The key this control's value is submitted under. A control without a
|
|
1627
|
+
* name is not part of its form's `FormData`. */
|
|
1628
|
+
name?: string;
|
|
1629
|
+
/** An empty control blocks its form's submission and gets `onInvalid`.
|
|
1630
|
+
* Not enforced while `disabled` or `readOnly`. */
|
|
1631
|
+
required?: boolean;
|
|
1632
|
+
theme?: GpuixTheme;
|
|
1633
|
+
}
|
|
1634
|
+
/** Values of `<input type>`. */
|
|
1635
|
+
export type InputType = "text" | "password" | "number" | "email" | "search" | "tel" | "url";
|
|
1636
|
+
export interface InputProps extends TextControlProps {
|
|
1637
|
+
/**
|
|
1638
|
+
* Defaults to `"text"`; an unknown value is `"text"` too.
|
|
1639
|
+
*
|
|
1640
|
+
* - `"password"` paints one bullet per character and disables copy and cut.
|
|
1641
|
+
* - `"number"` makes ArrowUp and ArrowDown step the value by `step`, within
|
|
1642
|
+
* `min` and `max`, and report it through `onChange`. Typing is not
|
|
1643
|
+
* restricted: `onChange` reports exactly the text, even when it is not a
|
|
1644
|
+
* number. There is no spinner.
|
|
1645
|
+
* - `"search"` is exposed to assistive technology as a search field.
|
|
1646
|
+
* - `"email"`, `"tel"` and `"url"` behave as `"text"`.
|
|
1647
|
+
*/
|
|
1648
|
+
type?: InputType;
|
|
1649
|
+
/** `type="number"` only. A number or numeric string. */
|
|
1650
|
+
min?: number | string;
|
|
1651
|
+
/** `type="number"` only. A number or numeric string. */
|
|
1652
|
+
max?: number | string;
|
|
1653
|
+
/** `type="number"` only: the ArrowUp and ArrowDown step. Defaults to 1. */
|
|
1654
|
+
step?: number | string;
|
|
1655
|
+
}
|
|
1656
|
+
export interface TextareaProps extends TextControlProps {
|
|
1657
|
+
minRows?: number;
|
|
1658
|
+
maxRows?: number;
|
|
1659
|
+
}
|
|
1660
|
+
/** The `submit` event of a `<form>`. */
|
|
1661
|
+
export type SubmitEvent = DomEvent & {
|
|
1662
|
+
/** The `name` and `value` of every named, enabled `<input>` and `<textarea>`
|
|
1663
|
+
* in the form, in document order. */
|
|
1664
|
+
formData: FormData;
|
|
1665
|
+
/** The button that submitted the form. Always null: there is no submit button. */
|
|
1666
|
+
submitter: null;
|
|
1667
|
+
};
|
|
1668
|
+
/** `<form>`: groups `<input>` and `<textarea>` controls and submits them together. */
|
|
1669
|
+
export interface FormProps extends Omit<HostProps, "onSubmit"> {
|
|
1670
|
+
/**
|
|
1671
|
+
* Enter in an `<input>` of this form, or `requestSubmit()`, once every
|
|
1672
|
+
* `required` control has a value. Cancelable and bubbling, like the DOM; there
|
|
1673
|
+
* is no navigation, so there is nothing to cancel. Enter in a `<textarea>`
|
|
1674
|
+
* inserts a newline and never submits.
|
|
1675
|
+
*/
|
|
1676
|
+
onSubmit?: (event: SubmitEvent) => void;
|
|
1677
|
+
}
|
|
1678
|
+
/** What a ref to a `<form>` carries. */
|
|
1679
|
+
export interface FormMethods {
|
|
1680
|
+
/**
|
|
1681
|
+
* Validate the form's controls, then submit it. Each empty `required` control
|
|
1682
|
+
* gets `invalid`, and the first whose handlers did not call `preventDefault()`
|
|
1683
|
+
* takes focus; the form is not submitted. Otherwise `submit` fires. The events
|
|
1684
|
+
* are delivered before this returns.
|
|
1685
|
+
*/
|
|
1686
|
+
requestSubmit(): void;
|
|
1687
|
+
}
|
|
1688
|
+
/** `<label>`: names a control and forwards a click to it. */
|
|
1689
|
+
export interface LabelProps extends HostProps {
|
|
1690
|
+
/** The `id` of the control to label. Without it, the first `<input>` or
|
|
1691
|
+
* `<textarea>` inside the label is the control. */
|
|
1692
|
+
htmlFor?: string;
|
|
1693
|
+
}
|
|
1694
|
+
export type VirtualListShared = AriaProps & {
|
|
1695
|
+
/** No `hover` or `active`: gpui's `List` has no pressed or hovered style
|
|
1696
|
+
* state. Put those on a wrapping `<div>` instead. */
|
|
1697
|
+
style?: Omit<StyleDesc, "hover" | "active">;
|
|
1698
|
+
alignment?: "top" | "bottom";
|
|
1699
|
+
followTail?: boolean;
|
|
1700
|
+
overdraw?: number;
|
|
1701
|
+
onVisibleRange?: (event: DomEvent) => void;
|
|
1702
|
+
role?: string;
|
|
1703
|
+
id?: string;
|
|
1704
|
+
testId?: string;
|
|
1705
|
+
};
|
|
1706
|
+
/** A variable-height list that builds only rows near its viewport. */
|
|
1707
|
+
export type VirtualListProps = (VirtualListShared & {
|
|
1708
|
+
estimatedItemHeight?: number;
|
|
1709
|
+
itemCount?: never;
|
|
1710
|
+
windowStart?: never;
|
|
1711
|
+
}) | (VirtualListShared & {
|
|
1712
|
+
itemCount: number;
|
|
1713
|
+
estimatedItemHeight: number;
|
|
1714
|
+
windowStart?: number;
|
|
1715
|
+
});
|
|
1716
|
+
export interface ImgProps extends HostProps {
|
|
1717
|
+
/** Filesystem path, `file://` URL, data URL, `blob:` URL (from
|
|
1718
|
+
* `URL.createObjectURL` in this process) or http(s) URL. */
|
|
1719
|
+
src?: string;
|
|
1720
|
+
/** CSS `object-fit`. Default `"contain"`. */
|
|
1721
|
+
objectFit?: "fill" | "contain" | "cover" | "scaleDown" | "none";
|
|
1722
|
+
alt?: string;
|
|
1723
|
+
}
|
|
1724
|
+
/** A web page in a native view of the window, after Electron's `<webview>` tag. 300 x 150 px
|
|
1725
|
+
* unless sized. It is a Tab stop, like a text control. */
|
|
1726
|
+
export interface WebviewProps extends HostProps {
|
|
1727
|
+
/** The URL to show. Setting it to another value navigates; removing it leaves the page. */
|
|
1728
|
+
src?: string;
|
|
1729
|
+
/** Navigation began. */
|
|
1730
|
+
onDidStartLoading?: (event: DomEvent) => void;
|
|
1731
|
+
/** The page and its frames finished loading, or the load failed. */
|
|
1732
|
+
onDidStopLoading?: (event: DomEvent) => void;
|
|
1733
|
+
/** A navigation committed. `event.url` is the page's URL. */
|
|
1734
|
+
onDidNavigate?: (event: DomEvent) => void;
|
|
1735
|
+
/** The title changed: `event.title`, and `event.explicitSet` when the page set it. */
|
|
1736
|
+
onPageTitleUpdated?: (event: DomEvent) => void;
|
|
1737
|
+
/** A load failed: `event.errorCode` (an `NSURLError` code, not a Chromium net error),
|
|
1738
|
+
* `event.errorDescription` and `event.validatedUrl`. */
|
|
1739
|
+
onDidFailLoad?: (event: DomEvent) => void;
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* A native view of a separate library, put between GPUI layers of the window. It is a `div`
|
|
1743
|
+
* otherwise: `style`, children and events apply. The element's own background and border are
|
|
1744
|
+
* drawn below the view and its children above it.
|
|
1745
|
+
*
|
|
1746
|
+
* `onAttach` hands the library the content `NSView` of the element's native surface, and the
|
|
1747
|
+
* library adds its view as a subview that fills it. The surface fills the padding box of the
|
|
1748
|
+
* element. It is cut to that box, and to the inner border radius, only where the element's
|
|
1749
|
+
* `overflow` clips; an element that does not clip lets the view show as far as the clip of its
|
|
1750
|
+
* ancestors reaches.
|
|
1751
|
+
*
|
|
1752
|
+
* Lifetime: the view is valid from `onAttach` until `onDetach` returns. `onDetach` is called
|
|
1753
|
+
* synchronously, before the surface is taken down, when the element unmounts and when the window
|
|
1754
|
+
* closes, and once for every `onAttach`. In `onDetach` the library MUST remove its view and
|
|
1755
|
+
* release it and every reference to the pointer. Using the pointer after `onDetach` returns is
|
|
1756
|
+
* undefined behaviour and can crash the process. `display: none` hides the surface and does not
|
|
1757
|
+
* detach, and a keyed reorder does not detach. Keep `onDetach` set for as long as the element
|
|
1758
|
+
* can be attached: removing it while attached means the library is never told.
|
|
1759
|
+
*
|
|
1760
|
+
* Only macOS has native surfaces. Elsewhere the element lays out and paints nothing, a warning
|
|
1761
|
+
* is logged once, and `onAttach` is never called.
|
|
1762
|
+
*/
|
|
1763
|
+
export interface NativeviewProps extends HostProps {
|
|
1764
|
+
/**
|
|
1765
|
+
* Take pointer events into the library's view. Off by default: the surface takes none, and
|
|
1766
|
+
* clicks and hover on the element and its children work as on a `div`. On, a point where GPUI
|
|
1767
|
+
* has nothing above the surface goes to the library view's `hitTest:`, and a `nil` falls back
|
|
1768
|
+
* to GPUI.
|
|
1769
|
+
*/
|
|
1770
|
+
nativeEvents?: boolean;
|
|
1771
|
+
/**
|
|
1772
|
+
* The native surface exists. `view` is the pointer of its content `NSView`, as a `bigint`.
|
|
1773
|
+
* Called once, asynchronously: it arrives after the first frame that has the surface, not
|
|
1774
|
+
* during that frame. If the element is gone by then, it is not called at all. See the
|
|
1775
|
+
* lifetime rule above. A throw is reported like any handler's and does not unpair
|
|
1776
|
+
* `onDetach`.
|
|
1777
|
+
*/
|
|
1778
|
+
onAttach?: (view: bigint) => void;
|
|
1779
|
+
/**
|
|
1780
|
+
* The surface is about to be taken down: remove and release the view added in `onAttach`.
|
|
1781
|
+
* Runs synchronously, before the unmount or the window close continues. Called only when
|
|
1782
|
+
* `onAttach` ran, or on every detach when there is no `onAttach`.
|
|
1783
|
+
*/
|
|
1784
|
+
onDetach?: () => void;
|
|
1785
|
+
}
|
|
1786
|
+
/** Byte order of a `setImagePixels` buffer. Alpha is straight in both. */
|
|
1787
|
+
export type ImagePixelFormat = "rgba" | "bgra";
|
|
1788
|
+
export interface ImagePixelsOptions {
|
|
1789
|
+
/** Default `"rgba"`. `"bgra"` is GPUI's native order and skips a per-pixel pass. */
|
|
1790
|
+
format?: ImagePixelFormat;
|
|
1791
|
+
}
|
|
1792
|
+
/** The tags that are valid only inside an `<svg>`. */
|
|
1793
|
+
export type SvgChildType = "path" | "circle" | "ellipse" | "rect" | "line" | "polyline" | "polygon" | "g" | "defs" | "linearGradient" | "radialGradient" | "stop" | "clipPath" | "mask" | "use" | "symbol" | "pattern" | "marker" | "image" | "tspan" | "textPath" | "filter" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feFuncR" | "feFuncG" | "feFuncB" | "feFuncA" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence";
|
|
1794
|
+
/**
|
|
1795
|
+
* SVG presentation attributes, camelCase as in React DOM: `strokeWidth`
|
|
1796
|
+
* becomes `stroke-width`. Lengths are user units; a string passes through.
|
|
1797
|
+
*/
|
|
1798
|
+
export interface SvgPresentationProps {
|
|
1799
|
+
fill?: string;
|
|
1800
|
+
fillOpacity?: number | string;
|
|
1801
|
+
fillRule?: "nonzero" | "evenodd";
|
|
1802
|
+
clipRule?: "nonzero" | "evenodd";
|
|
1803
|
+
stroke?: string;
|
|
1804
|
+
strokeWidth?: number | string;
|
|
1805
|
+
strokeOpacity?: number | string;
|
|
1806
|
+
strokeLinecap?: "butt" | "round" | "square";
|
|
1807
|
+
strokeLinejoin?: "miter" | "round" | "bevel";
|
|
1808
|
+
strokeMiterlimit?: number | string;
|
|
1809
|
+
/** A number, a list, or `"4 2"`. Measured in `pathLength` units when set. */
|
|
1810
|
+
strokeDasharray?: number | string | number[];
|
|
1811
|
+
strokeDashoffset?: number | string;
|
|
1812
|
+
opacity?: number | string;
|
|
1813
|
+
/** An SVG transform list, passed through: `"rotate(45 12 12)"`. */
|
|
1814
|
+
transform?: string;
|
|
1815
|
+
display?: string;
|
|
1816
|
+
visibility?: string;
|
|
1817
|
+
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
1818
|
+
/** `url(#id)` of a `<clipPath>` in the same `<svg>`. */
|
|
1819
|
+
clipPath?: string;
|
|
1820
|
+
/** `url(#id)` of a `<mask>` in the same `<svg>`. */
|
|
1821
|
+
mask?: string;
|
|
1822
|
+
/**
|
|
1823
|
+
* `url(#id)` of a `<filter>` in the same `<svg>`. This is the SVG attribute,
|
|
1824
|
+
* not the CSS `filter` style: a filter function such as `blur(2px)` is read
|
|
1825
|
+
* by the rasteriser but only `url(#id)` is portable.
|
|
1826
|
+
*/
|
|
1827
|
+
filter?: string;
|
|
1828
|
+
/** `url(#id)` of a `<marker>`, drawn at the first vertex of a `path`, `line`, `polyline` or `polygon`. */
|
|
1829
|
+
markerStart?: string;
|
|
1830
|
+
/** `url(#id)` of a `<marker>`, drawn at every vertex but the first and last. */
|
|
1831
|
+
markerMid?: string;
|
|
1832
|
+
/** `url(#id)` of a `<marker>`, drawn at the last vertex. */
|
|
1833
|
+
markerEnd?: string;
|
|
1834
|
+
/** The CSS shorthand: sets `markerStart`, `markerMid` and `markerEnd` that are not set themselves. */
|
|
1835
|
+
marker?: string;
|
|
1836
|
+
/** `"stroke"` paints the stroke under the fill, as in CSS `paint-order`. */
|
|
1837
|
+
paintOrder?: string;
|
|
1838
|
+
imageRendering?: "auto" | "optimizeQuality" | "optimizeSpeed" | "smooth" | "high-quality" | "crisp-edges" | "pixelated";
|
|
1839
|
+
fontFamily?: string;
|
|
1840
|
+
fontSize?: number | string;
|
|
1841
|
+
fontWeight?: number | string;
|
|
1842
|
+
fontStyle?: "normal" | "italic" | "oblique";
|
|
1843
|
+
fontVariant?: string;
|
|
1844
|
+
fontStretch?: string;
|
|
1845
|
+
textAnchor?: "start" | "middle" | "end";
|
|
1846
|
+
dominantBaseline?: string;
|
|
1847
|
+
alignmentBaseline?: string;
|
|
1848
|
+
baselineShift?: number | string;
|
|
1849
|
+
letterSpacing?: number | string;
|
|
1850
|
+
wordSpacing?: number | string;
|
|
1851
|
+
textDecoration?: string;
|
|
1852
|
+
writingMode?: string;
|
|
1853
|
+
direction?: "ltr" | "rtl";
|
|
1854
|
+
unicodeBidi?: string;
|
|
1855
|
+
textRendering?: "auto" | "optimizeSpeed" | "optimizeLegibility" | "geometricPrecision";
|
|
1856
|
+
/** `"preserve"` keeps the white space of a text's string, otherwise it collapses as in a browser. */
|
|
1857
|
+
xmlSpace?: "default" | "preserve";
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* What a shape's `style` takes: CSS animations. A shape is painted by its
|
|
1861
|
+
* `<svg>`, so no layout or paint style applies to it; its `animation` runs
|
|
1862
|
+
* keyframes made with `defineKeyframes` over the SVG properties CSS animates
|
|
1863
|
+
* (see `SvgKeyframeStyle`).
|
|
1864
|
+
*/
|
|
1865
|
+
export type SvgShapeStyle = Pick<StyleDesc, "animation" | "animationName" | "animationDuration" | "animationTimingFunction" | "animationDelay" | "animationIterationCount" | "animationDirection" | "animationFillMode" | "animationPlayState">;
|
|
1866
|
+
/**
|
|
1867
|
+
* Props shared by the shapes inside an `<svg>`. A shape is part of its svg's
|
|
1868
|
+
* one image, so it has no layout box, paint style or pointer events: size and
|
|
1869
|
+
* place the `<svg>`, and draw inside its `viewBox`. Its `style` takes CSS
|
|
1870
|
+
* animations only, and the animation events fire from the shape.
|
|
1871
|
+
*/
|
|
1872
|
+
export interface SvgShapeProps extends SvgPresentationProps, AnimationEventProps {
|
|
1873
|
+
style?: SvgShapeStyle;
|
|
1874
|
+
testId?: string;
|
|
1875
|
+
/** What `fill="url(#id)"`, `clipPath`, `mask` and `<use href="#id">` refer to. */
|
|
1876
|
+
id?: string;
|
|
1877
|
+
/** Internal native animation description used by `motion.*` shapes. */
|
|
1878
|
+
motion?: SvgMotionProps;
|
|
1879
|
+
/**
|
|
1880
|
+
* The DOM attribute: the length the shape's dash values are measured in, so
|
|
1881
|
+
* `pathLength={1}` with `strokeDasharray="0.5 1"` strokes half the outline.
|
|
1882
|
+
* (Animate Framer's normalised `pathLength` through `motion`.)
|
|
1883
|
+
*/
|
|
1884
|
+
pathLength?: number;
|
|
1885
|
+
}
|
|
1886
|
+
export interface SvgPathProps extends SvgShapeProps {
|
|
1887
|
+
/** Path data. Relative commands are fine. */
|
|
1888
|
+
d?: string;
|
|
1889
|
+
}
|
|
1890
|
+
export interface SvgCircleProps extends SvgShapeProps {
|
|
1891
|
+
cx?: number | string;
|
|
1892
|
+
cy?: number | string;
|
|
1893
|
+
r?: number | string;
|
|
1894
|
+
}
|
|
1895
|
+
export interface SvgEllipseProps extends SvgShapeProps {
|
|
1896
|
+
cx?: number | string;
|
|
1897
|
+
cy?: number | string;
|
|
1898
|
+
rx?: number | string;
|
|
1899
|
+
ry?: number | string;
|
|
1900
|
+
}
|
|
1901
|
+
export interface SvgRectProps extends SvgShapeProps {
|
|
1902
|
+
x?: number | string;
|
|
1903
|
+
y?: number | string;
|
|
1904
|
+
width?: number | string;
|
|
1905
|
+
height?: number | string;
|
|
1906
|
+
rx?: number | string;
|
|
1907
|
+
ry?: number | string;
|
|
1908
|
+
}
|
|
1909
|
+
export interface SvgLineProps extends SvgShapeProps {
|
|
1910
|
+
x1?: number | string;
|
|
1911
|
+
y1?: number | string;
|
|
1912
|
+
x2?: number | string;
|
|
1913
|
+
y2?: number | string;
|
|
1914
|
+
}
|
|
1915
|
+
export interface SvgPolyProps extends SvgShapeProps {
|
|
1916
|
+
/** `"x,y x,y ..."` */
|
|
1917
|
+
points?: string;
|
|
1918
|
+
}
|
|
1919
|
+
export type SvgGroupProps = SvgShapeProps;
|
|
1920
|
+
/** `<defs>`: what its children define is drawn only where something refers to it. */
|
|
1921
|
+
export type SvgDefsProps = SvgShapeProps;
|
|
1922
|
+
/** `<linearGradient>` and `<radialGradient>`: `<stop>` children, referred to by `fill="url(#id)"`. */
|
|
1923
|
+
export interface SvgGradientProps extends SvgShapeProps {
|
|
1924
|
+
x1?: number | string;
|
|
1925
|
+
y1?: number | string;
|
|
1926
|
+
x2?: number | string;
|
|
1927
|
+
y2?: number | string;
|
|
1928
|
+
cx?: number | string;
|
|
1929
|
+
cy?: number | string;
|
|
1930
|
+
r?: number | string;
|
|
1931
|
+
fx?: number | string;
|
|
1932
|
+
fy?: number | string;
|
|
1933
|
+
gradientUnits?: "userSpaceOnUse" | "objectBoundingBox";
|
|
1934
|
+
gradientTransform?: string;
|
|
1935
|
+
spreadMethod?: "pad" | "reflect" | "repeat";
|
|
1936
|
+
/** Another gradient whose stops and attributes this one inherits: `"#id"`. */
|
|
1937
|
+
href?: string;
|
|
1938
|
+
}
|
|
1939
|
+
export interface SvgStopProps extends SvgShapeProps {
|
|
1940
|
+
/** A number from 0 to 1, or a percentage. */
|
|
1941
|
+
offset?: number | string;
|
|
1942
|
+
stopColor?: string;
|
|
1943
|
+
stopOpacity?: number | string;
|
|
1944
|
+
}
|
|
1945
|
+
export interface SvgClipPathProps extends SvgShapeProps {
|
|
1946
|
+
clipPathUnits?: "userSpaceOnUse" | "objectBoundingBox";
|
|
1947
|
+
}
|
|
1948
|
+
export interface SvgMaskProps extends SvgShapeProps {
|
|
1949
|
+
x?: number | string;
|
|
1950
|
+
y?: number | string;
|
|
1951
|
+
width?: number | string;
|
|
1952
|
+
height?: number | string;
|
|
1953
|
+
maskUnits?: "userSpaceOnUse" | "objectBoundingBox";
|
|
1954
|
+
maskContentUnits?: "userSpaceOnUse" | "objectBoundingBox";
|
|
1955
|
+
}
|
|
1956
|
+
/** `<use>`: draws the element `href` names, here. */
|
|
1957
|
+
export interface SvgUseProps extends SvgShapeProps {
|
|
1958
|
+
/** `"#id"` of an element in the same `<svg>`. */
|
|
1959
|
+
href?: string;
|
|
1960
|
+
x?: number | string;
|
|
1961
|
+
y?: number | string;
|
|
1962
|
+
width?: number | string;
|
|
1963
|
+
height?: number | string;
|
|
1964
|
+
}
|
|
1965
|
+
/** `<symbol>`: a drawing that is shown only through a `<use>`. */
|
|
1966
|
+
export interface SvgSymbolProps extends SvgShapeProps {
|
|
1967
|
+
viewBox?: string;
|
|
1968
|
+
preserveAspectRatio?: string;
|
|
1969
|
+
}
|
|
1970
|
+
type SvgLength = number | string;
|
|
1971
|
+
/** `<pattern>`: tiles its children over a shape that has `fill="url(#id)"`. */
|
|
1972
|
+
export interface SvgPatternProps extends SvgShapeProps {
|
|
1973
|
+
x?: SvgLength;
|
|
1974
|
+
y?: SvgLength;
|
|
1975
|
+
width?: SvgLength;
|
|
1976
|
+
height?: SvgLength;
|
|
1977
|
+
patternUnits?: "userSpaceOnUse" | "objectBoundingBox";
|
|
1978
|
+
patternContentUnits?: "userSpaceOnUse" | "objectBoundingBox";
|
|
1979
|
+
patternTransform?: string;
|
|
1980
|
+
viewBox?: string;
|
|
1981
|
+
preserveAspectRatio?: string;
|
|
1982
|
+
/** Another pattern whose children and attributes this one inherits: `"#id"`. */
|
|
1983
|
+
href?: string;
|
|
1984
|
+
}
|
|
1985
|
+
/** `<marker>`: a drawing placed at the vertices of a shape with `markerStart`, `markerMid` or `markerEnd`. */
|
|
1986
|
+
export interface SvgMarkerProps extends SvgShapeProps {
|
|
1987
|
+
markerWidth?: SvgLength;
|
|
1988
|
+
markerHeight?: SvgLength;
|
|
1989
|
+
markerUnits?: "strokeWidth" | "userSpaceOnUse";
|
|
1990
|
+
refX?: SvgLength;
|
|
1991
|
+
refY?: SvgLength;
|
|
1992
|
+
orient?: "auto" | "auto-start-reverse" | SvgLength;
|
|
1993
|
+
viewBox?: string;
|
|
1994
|
+
preserveAspectRatio?: string;
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* `<image>`: a raster or SVG picture. `href` is a `data:` URL, a `file://` URL
|
|
1998
|
+
* or a file path. A `blob:` or `http(s):` URL is not loaded here, unlike
|
|
1999
|
+
* `<img src>`: it is dropped with a warning.
|
|
2000
|
+
*/
|
|
2001
|
+
export interface SvgImageProps extends SvgShapeProps {
|
|
2002
|
+
href?: string;
|
|
2003
|
+
x?: SvgLength;
|
|
2004
|
+
y?: SvgLength;
|
|
2005
|
+
width?: SvgLength;
|
|
2006
|
+
height?: SvgLength;
|
|
2007
|
+
preserveAspectRatio?: string;
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* `<text>` inside an `<svg>`. Its string children are the text. Outside an
|
|
2011
|
+
* `<svg>`, `<text>` is the host text element and takes none of these.
|
|
2012
|
+
*/
|
|
2013
|
+
export interface SvgTextProps extends SvgShapeProps {
|
|
2014
|
+
x?: SvgLength | SvgLength[];
|
|
2015
|
+
y?: SvgLength | SvgLength[];
|
|
2016
|
+
dx?: SvgLength | SvgLength[];
|
|
2017
|
+
dy?: SvgLength | SvgLength[];
|
|
2018
|
+
/** One angle per character, in degrees. */
|
|
2019
|
+
rotate?: number | string | number[];
|
|
2020
|
+
textLength?: SvgLength;
|
|
2021
|
+
lengthAdjust?: "spacing" | "spacingAndGlyphs";
|
|
2022
|
+
}
|
|
2023
|
+
/** `<tspan>`: a run of a `<text>` with its own position or text properties. */
|
|
2024
|
+
export type SvgTspanProps = SvgTextProps;
|
|
2025
|
+
/** `<textPath>`: text laid along the `<path>` that `href` names. */
|
|
2026
|
+
export interface SvgTextPathProps extends SvgShapeProps {
|
|
2027
|
+
/** `"#id"` of a `<path>` in the same `<svg>`. */
|
|
2028
|
+
href?: string;
|
|
2029
|
+
startOffset?: SvgLength;
|
|
2030
|
+
method?: "align" | "stretch";
|
|
2031
|
+
spacing?: "auto" | "exact";
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* `<filter>`: `fe*` primitive children, referred to by `filter="url(#id)"`.
|
|
2035
|
+
* The region is `x`, `y`, `width` and `height`, in `filterUnits`.
|
|
2036
|
+
*/
|
|
2037
|
+
export interface SvgFilterProps extends SvgShapeProps {
|
|
2038
|
+
x?: SvgLength;
|
|
2039
|
+
y?: SvgLength;
|
|
2040
|
+
width?: SvgLength;
|
|
2041
|
+
height?: SvgLength;
|
|
2042
|
+
filterUnits?: "userSpaceOnUse" | "objectBoundingBox";
|
|
2043
|
+
primitiveUnits?: "userSpaceOnUse" | "objectBoundingBox";
|
|
2044
|
+
/** Another filter whose primitives and attributes this one inherits: `"#id"`. */
|
|
2045
|
+
href?: string;
|
|
2046
|
+
}
|
|
2047
|
+
/** What every filter primitive takes: its subregion, the colour space it works in and a name. */
|
|
2048
|
+
export interface SvgFilterPrimitiveProps extends SvgShapeProps {
|
|
2049
|
+
x?: SvgLength;
|
|
2050
|
+
y?: SvgLength;
|
|
2051
|
+
width?: SvgLength;
|
|
2052
|
+
height?: SvgLength;
|
|
2053
|
+
/** The name of an earlier `result`, or `SourceGraphic`, `SourceAlpha`. Default: the previous primitive's result. */
|
|
2054
|
+
in?: string;
|
|
2055
|
+
/** Names this primitive's output for a later `in` or `in2`. */
|
|
2056
|
+
result?: string;
|
|
2057
|
+
colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB";
|
|
2058
|
+
}
|
|
2059
|
+
export interface SvgFeBlendProps extends SvgFilterPrimitiveProps {
|
|
2060
|
+
in2?: string;
|
|
2061
|
+
mode?: "normal" | "multiply" | "screen" | "overlay" | "darken" | "lighten" | "color-dodge" | "color-burn" | "hard-light" | "soft-light" | "difference" | "exclusion" | "hue" | "saturation" | "color" | "luminosity";
|
|
2062
|
+
}
|
|
2063
|
+
export interface SvgFeColorMatrixProps extends SvgFilterPrimitiveProps {
|
|
2064
|
+
type?: "matrix" | "saturate" | "hueRotate" | "luminanceToAlpha";
|
|
2065
|
+
/** 20 numbers for `matrix`, one for `saturate` and `hueRotate`. */
|
|
2066
|
+
values?: string | number | number[];
|
|
2067
|
+
}
|
|
2068
|
+
export type SvgFeComponentTransferProps = SvgFilterPrimitiveProps;
|
|
2069
|
+
/** `<feFuncR>`, `<feFuncG>`, `<feFuncB>` and `<feFuncA>`: one channel of an `<feComponentTransfer>`. */
|
|
2070
|
+
export interface SvgFeFuncProps extends SvgShapeProps {
|
|
2071
|
+
type?: "identity" | "table" | "discrete" | "linear" | "gamma";
|
|
2072
|
+
tableValues?: string | number[];
|
|
2073
|
+
slope?: number | string;
|
|
2074
|
+
intercept?: number | string;
|
|
2075
|
+
amplitude?: number | string;
|
|
2076
|
+
exponent?: number | string;
|
|
2077
|
+
offset?: number | string;
|
|
2078
|
+
}
|
|
2079
|
+
export interface SvgFeCompositeProps extends SvgFilterPrimitiveProps {
|
|
2080
|
+
in2?: string;
|
|
2081
|
+
operator?: "over" | "in" | "out" | "atop" | "xor" | "arithmetic";
|
|
2082
|
+
k1?: number | string;
|
|
2083
|
+
k2?: number | string;
|
|
2084
|
+
k3?: number | string;
|
|
2085
|
+
k4?: number | string;
|
|
2086
|
+
}
|
|
2087
|
+
export interface SvgFeConvolveMatrixProps extends SvgFilterPrimitiveProps {
|
|
2088
|
+
order?: number | string;
|
|
2089
|
+
kernelMatrix?: string | number[];
|
|
2090
|
+
divisor?: number | string;
|
|
2091
|
+
bias?: number | string;
|
|
2092
|
+
targetX?: number | string;
|
|
2093
|
+
targetY?: number | string;
|
|
2094
|
+
edgeMode?: "duplicate" | "wrap" | "none";
|
|
2095
|
+
preserveAlpha?: boolean | "true" | "false";
|
|
2096
|
+
}
|
|
2097
|
+
export interface SvgFeDiffuseLightingProps extends SvgFilterPrimitiveProps {
|
|
2098
|
+
surfaceScale?: number | string;
|
|
2099
|
+
diffuseConstant?: number | string;
|
|
2100
|
+
lightingColor?: string;
|
|
2101
|
+
}
|
|
2102
|
+
export interface SvgFeSpecularLightingProps extends SvgFilterPrimitiveProps {
|
|
2103
|
+
surfaceScale?: number | string;
|
|
2104
|
+
specularConstant?: number | string;
|
|
2105
|
+
specularExponent?: number | string;
|
|
2106
|
+
lightingColor?: string;
|
|
2107
|
+
}
|
|
2108
|
+
export interface SvgFeDisplacementMapProps extends SvgFilterPrimitiveProps {
|
|
2109
|
+
in2?: string;
|
|
2110
|
+
scale?: number | string;
|
|
2111
|
+
xChannelSelector?: "R" | "G" | "B" | "A";
|
|
2112
|
+
yChannelSelector?: "R" | "G" | "B" | "A";
|
|
2113
|
+
}
|
|
2114
|
+
/** A light source, the child of an `<feDiffuseLighting>` or `<feSpecularLighting>`. */
|
|
2115
|
+
export interface SvgFeDistantLightProps extends SvgShapeProps {
|
|
2116
|
+
azimuth?: number | string;
|
|
2117
|
+
elevation?: number | string;
|
|
2118
|
+
}
|
|
2119
|
+
export interface SvgFePointLightProps extends SvgShapeProps {
|
|
2120
|
+
x?: number | string;
|
|
2121
|
+
y?: number | string;
|
|
2122
|
+
z?: number | string;
|
|
2123
|
+
}
|
|
2124
|
+
export interface SvgFeSpotLightProps extends SvgFePointLightProps {
|
|
2125
|
+
pointsAtX?: number | string;
|
|
2126
|
+
pointsAtY?: number | string;
|
|
2127
|
+
pointsAtZ?: number | string;
|
|
2128
|
+
specularExponent?: number | string;
|
|
2129
|
+
limitingConeAngle?: number | string;
|
|
2130
|
+
}
|
|
2131
|
+
export interface SvgFeDropShadowProps extends SvgFilterPrimitiveProps {
|
|
2132
|
+
dx?: number | string;
|
|
2133
|
+
dy?: number | string;
|
|
2134
|
+
/** One number, or `"x y"`. */
|
|
2135
|
+
stdDeviation?: number | string | number[];
|
|
2136
|
+
floodColor?: string;
|
|
2137
|
+
floodOpacity?: number | string;
|
|
2138
|
+
}
|
|
2139
|
+
export interface SvgFeFloodProps extends SvgFilterPrimitiveProps {
|
|
2140
|
+
floodColor?: string;
|
|
2141
|
+
floodOpacity?: number | string;
|
|
2142
|
+
}
|
|
2143
|
+
export interface SvgFeGaussianBlurProps extends SvgFilterPrimitiveProps {
|
|
2144
|
+
/** One number, or `"x y"`. */
|
|
2145
|
+
stdDeviation?: number | string | number[];
|
|
2146
|
+
edgeMode?: "duplicate" | "wrap" | "none";
|
|
2147
|
+
}
|
|
2148
|
+
export interface SvgFeImageProps extends SvgFilterPrimitiveProps {
|
|
2149
|
+
/** Same sources as `<image href>`. */
|
|
2150
|
+
href?: string;
|
|
2151
|
+
preserveAspectRatio?: string;
|
|
2152
|
+
}
|
|
2153
|
+
export type SvgFeMergeProps = SvgFilterPrimitiveProps;
|
|
2154
|
+
/** `<feMergeNode in="...">`: one layer of an `<feMerge>`. */
|
|
2155
|
+
export interface SvgFeMergeNodeProps extends SvgShapeProps {
|
|
2156
|
+
in?: string;
|
|
2157
|
+
}
|
|
2158
|
+
export interface SvgFeMorphologyProps extends SvgFilterPrimitiveProps {
|
|
2159
|
+
operator?: "erode" | "dilate";
|
|
2160
|
+
radius?: number | string | number[];
|
|
2161
|
+
}
|
|
2162
|
+
export interface SvgFeOffsetProps extends SvgFilterPrimitiveProps {
|
|
2163
|
+
dx?: number | string;
|
|
2164
|
+
dy?: number | string;
|
|
2165
|
+
}
|
|
2166
|
+
export type SvgFeTileProps = SvgFilterPrimitiveProps;
|
|
2167
|
+
export interface SvgFeTurbulenceProps extends SvgFilterPrimitiveProps {
|
|
2168
|
+
type?: "fractalNoise" | "turbulence";
|
|
2169
|
+
baseFrequency?: number | string | number[];
|
|
2170
|
+
numOctaves?: number | string;
|
|
2171
|
+
seed?: number | string;
|
|
2172
|
+
stitchTiles?: "stitch" | "noStitch";
|
|
2173
|
+
}
|
|
2174
|
+
/**
|
|
2175
|
+
* Props for `<svg>`, a vector graphic rasterised in full colour at device
|
|
2176
|
+
* resolution as one image. `currentColor` is the element's computed `color`.
|
|
2177
|
+
*
|
|
2178
|
+
* Give it DOM-style children (`path circle ellipse rect line polyline polygon
|
|
2179
|
+
* g image text tspan textPath`, and `defs linearGradient radialGradient stop
|
|
2180
|
+
* clipPath mask use symbol pattern marker filter` with its `fe*` primitives for
|
|
2181
|
+
* what shapes refer to by `id`) and a `viewBox`, or raw markup through `source` / `src`. Children win
|
|
2182
|
+
* when both are given. `width` and `height` size the element unless `style`
|
|
2183
|
+
* does; without either it has no size to paint into.
|
|
2184
|
+
*/
|
|
2185
|
+
export interface SvgProps extends HostProps, SvgPresentationProps {
|
|
2186
|
+
/** Desktop local path. Use source for portable browser rendering. */
|
|
2187
|
+
src?: string;
|
|
2188
|
+
/** Raw SVG markup, rasterised in full colour at device resolution. */
|
|
2189
|
+
source?: string;
|
|
2190
|
+
/** `"minX minY width height"`: the coordinate system the children draw in. */
|
|
2191
|
+
viewBox?: string;
|
|
2192
|
+
preserveAspectRatio?: string;
|
|
2193
|
+
width?: number | string;
|
|
2194
|
+
height?: number | string;
|
|
2195
|
+
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Props for the <code> custom element — a syntax-highlighted code block.
|
|
2198
|
+
*
|
|
2199
|
+
* It paints **no surface of its own**: no fill, border, radius, padding or
|
|
2200
|
+
* language header. `style` is the surface, and `fontFamily`, `fontSize`,
|
|
2201
|
+
* `fontWeight`, `lineHeight` and `color` there beat the theme. Wrap it, or
|
|
2202
|
+
* style it, to get a card.
|
|
2203
|
+
*
|
|
2204
|
+
* Rows are a fixed height, so `fontSize` alone scales that height by the
|
|
2205
|
+
* theme's ratio. Lines never wrap and the block is its own horizontal
|
|
2206
|
+
* scroller, so `whiteSpace` and `overflowX` do nothing.
|
|
2207
|
+
*/
|
|
2208
|
+
export interface CodeProps extends HostProps {
|
|
2209
|
+
/** The source to display. Rendered one div per line at an exact line height. */
|
|
2210
|
+
code?: string;
|
|
2211
|
+
/** Language alias such as "ts", "rust", "bash". Beats `path` for detection. */
|
|
2212
|
+
language?: string;
|
|
2213
|
+
/** File path, used for extension-based language detection. */
|
|
2214
|
+
path?: string;
|
|
2215
|
+
showLineNumbers?: boolean;
|
|
2216
|
+
theme?: GpuixTheme;
|
|
2217
|
+
}
|
|
2218
|
+
export interface DiffProps extends HostProps {
|
|
2219
|
+
/** A unified git patch (the output of `git diff`). */
|
|
2220
|
+
patch?: string;
|
|
2221
|
+
/** Highlight the words that changed inside paired +/- lines. */
|
|
2222
|
+
wordDiff?: boolean;
|
|
2223
|
+
/** File paths rendered as a header only. Collapsed bodies cost one row. */
|
|
2224
|
+
collapsedPaths?: string[];
|
|
2225
|
+
/**
|
|
2226
|
+
* Use the virtualized `list()` scroller. Off by default so a parent
|
|
2227
|
+
* list can be the only scroll container. Requires a bounded height.
|
|
2228
|
+
*/
|
|
2229
|
+
scroll?: boolean;
|
|
2230
|
+
/** Paint this many line rows, then a Show more row. */
|
|
2231
|
+
maxLines?: number;
|
|
2232
|
+
theme?: GpuixTheme;
|
|
2233
|
+
/** Fires when a file header is clicked. `event.value` is the file path. */
|
|
2234
|
+
onToggleFile?: (event: DomEvent) => void;
|
|
2235
|
+
/** Fires when Show more is clicked. `event.value` is the hidden line count. */
|
|
2236
|
+
onShowMore?: (event: DomEvent) => void;
|
|
2237
|
+
/** Fires when a diff line is clicked. `event.value` is the line text,
|
|
2238
|
+
* `event.oldLine` / `event.newLine` are its line numbers. */
|
|
2239
|
+
onLineClick?: (event: DomEvent) => void;
|
|
2240
|
+
}
|
|
2241
|
+
export interface MarkdownProps extends HostProps {
|
|
2242
|
+
/** GitHub-flavoured markdown. Tables, strikethrough and task lists are on. */
|
|
2243
|
+
source?: string;
|
|
2244
|
+
theme?: GpuixTheme;
|
|
2245
|
+
/** Fires when a block containing links is clicked. `event.value` is the URL. */
|
|
2246
|
+
onLinkClick?: (event: DomEvent) => void;
|
|
2247
|
+
}
|
|
2248
|
+
/** Payload of `<anchored onPlacement>`. */
|
|
2249
|
+
export interface AnchoredPlacementEvent extends DomEvent {
|
|
2250
|
+
side: "top" | "right" | "bottom" | "left";
|
|
2251
|
+
align: "start" | "center" | "end";
|
|
2252
|
+
/** Width the layer can take without leaving the window, minus `snapMargin`. */
|
|
2253
|
+
availableWidth: number;
|
|
2254
|
+
/** Height the layer can take on its side of the trigger, minus `snapMargin` and `gap`. */
|
|
2255
|
+
availableHeight: number;
|
|
2256
|
+
/** Border-box size of the trigger. 0 when placed at a `position` point. */
|
|
2257
|
+
anchorWidth: number;
|
|
2258
|
+
anchorHeight: number;
|
|
2259
|
+
}
|
|
2260
|
+
export interface AnchoredProps extends HostProps {
|
|
2261
|
+
position?: {
|
|
2262
|
+
x: number;
|
|
2263
|
+
y: number;
|
|
2264
|
+
};
|
|
2265
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
2266
|
+
align?: "start" | "center" | "end";
|
|
2267
|
+
gap?: number;
|
|
2268
|
+
anchor?: "topLeft" | "topCenter" | "topRight" | "rightCenter" | "bottomRight" | "bottomCenter" | "bottomLeft" | "leftCenter";
|
|
2269
|
+
offset?: {
|
|
2270
|
+
x: number;
|
|
2271
|
+
y: number;
|
|
2272
|
+
};
|
|
2273
|
+
/** `"flip"` (default, `"switch"` is the same) opens on the opposite side of the trigger,
|
|
2274
|
+
* with the same `gap`, when the preferred side runs out of room, or on the side with more
|
|
2275
|
+
* room when neither fits, then shifts along the other axis to stay inside the window.
|
|
2276
|
+
* `"snap"` only shifts. Applies when `anchor` is not set. */
|
|
2277
|
+
fit?: "flip" | "switch" | "snap";
|
|
2278
|
+
/** Distance kept to the window edges, also taken off `available*`. */
|
|
2279
|
+
snapMargin?: number;
|
|
2280
|
+
/** Cap the layer's `maxWidth`/`maxHeight` to the room left in the window, natively on every
|
|
2281
|
+
* layout. Like floating-ui's `size` middleware. */
|
|
2282
|
+
constrainToAvailable?: boolean;
|
|
2283
|
+
/** Fires when side, alignment or the available room change (whole pixels). */
|
|
2284
|
+
onPlacement?: (event: AnchoredPlacementEvent) => void;
|
|
2285
|
+
deferred?: boolean;
|
|
2286
|
+
priority?: number;
|
|
2287
|
+
/** `"window"` covers the whole viewport and tracks resizes natively. Ignores
|
|
2288
|
+
* position, side, align, anchor, offset and fit. */
|
|
2289
|
+
fill?: "window";
|
|
2290
|
+
}
|
|
2291
|
+
export type MutationHost = Pick<GpuixRenderer, "applyBatch">;
|
|
2292
|
+
export type WindowSizeHost = Pick<GpuixRenderer, "getWindowSize">;
|
|
2293
|
+
export type WindowInsetsHost = Pick<GpuixRenderer, "getWindowInsets">;
|
|
2294
|
+
export type SelectionHost = Pick<GpuixRenderer, "getSelectedText">;
|
|
2295
|
+
export type AppearanceHost = Pick<GpuixRenderer, "getAppearance">;
|
|
2296
|
+
/** The effective window appearance. `setAppearance` also takes `"system"`. */
|
|
2297
|
+
export type Appearance = "light" | "dark";
|
|
2298
|
+
/** The native motion value graph. Ids are chosen by the caller. */
|
|
2299
|
+
export type MotionValueHost = Pick<GpuixRenderer, "createMotionValue" | "createMotionTransform" | "createMotionFollower" | "createMotionSpring" | "disposeMotionValue" | "getMotionValue" | "getMotionValueVelocity" | "isMotionValueAnimating" | "setMotionValue" | "jumpMotionValue" | "animateMotionValue" | "stopMotionValue" | "pauseMotionValue" | "playMotionValue" | "seekMotionValue" | "setMotionValueSpeed" | "completeMotionValue" | "detachMotionValueClock" | "getMotionValuePlayback" | "setMotionValueListener">;
|
|
2300
|
+
/** `applyBatch` plus the live renderer methods a host may also expose. */
|
|
2301
|
+
export type NativeRenderer = MutationHost & Partial<MotionValueHost> & Partial<Pick<GpuixRenderer, "focusElement" | "blurElement" | "matchesFocus" | "focusNext" | "focusPrevious" | "getFocusedElementId" | "focusNextWithin" | "focusPreviousWithin" | "blur" | "setWindowKeyEvents" | "setWindowEventListeners" | "setSyncEventHandler" | "setWindowSelectionChange" | "setWindowAppearanceChange" | "setWindowMediaChange" | "getMediaFeatures" | "getElementBounds" | "probeElementBounds" | "getElementsAt" | "scrollTo" | "scrollToItem" | "scrollIntoView" | "setPointerCapture" | "releasePointerCapture" | "hasPointerCapture" | "clickElement" | "getAnimations" | "getSubtreeAnimations" | "getDocumentAnimations" | "getAnimation" | "pauseAnimation" | "playAnimation" | "cancelAnimation" | "finishAnimation" | "reverseAnimation" | "setAnimationCurrentTime" | "setAnimationPlaybackRate" | "updateAnimationPlaybackRate" | "setAnimationStartTime" | "getAnimationTimelineTime" | "releaseAnimation" | "forgetAnimation" | "getAnimationEffect" | "getAnimationKeyframes" | "updateAnimationTiming" | "cancelDrag" | "requestPointerLock" | "exitPointerLock" | "pointerLockElement" | "getScrollMetrics" | "scrollByKey" | "setImage" | "setStyleImage" | "failStyleImage" | "setImagePixels" | "selectText" | "setSelectionRange" | "getTextSelection" | "webviewCommand" | "webviewState" | "webviewExecuteJavascript" | "requestSubmit" | "getScrollOffset" | "getListScrollTop" | "getSelectedText" | "clearSelection" | "getPaintedHighlights" | "getWindowSize" | "getWindowInsets" | "setWindowTitle" | "registerFont" | "setAppearance" | "getAppearance" | "promptForPaths" | "writeClipboardText" | "readClipboardText" | "supportsEyeDropper" | "openEyeDropper" | "activateWindow" | "minimizeWindow" | "zoomWindow" | "toggleFullscreen" | "setDebugFrameOverlay" | "getDebugFrameOverlay" | "cycleDebugFrameOverlay" | "resetDebugFrameOverlayStats" | "getDebugFrameOverlayStats">>;
|
|
2302
|
+
/** Commit-phase mutation facade shared by framework adapters. */
|
|
2303
|
+
export interface MutationRenderer {
|
|
2304
|
+
createElement(id: number, elementType: string): void;
|
|
2305
|
+
destroyElement(id: number): Array<number>;
|
|
2306
|
+
appendChild(parentId: number, childId: number): void;
|
|
2307
|
+
insertBefore(parentId: number, childId: number, beforeId: number): void;
|
|
2308
|
+
setStyle(id: number, style: object): void;
|
|
2309
|
+
setText(id: number, content: string): void;
|
|
2310
|
+
setEventListener(id: number, eventType: string, hasHandler: boolean): void;
|
|
2311
|
+
setRoot(id: number): void;
|
|
2312
|
+
setKeyboardFocusDim(enabled: boolean): void;
|
|
2313
|
+
/**
|
|
2314
|
+
* The style layer under every element's own style, a CSS `* { ... }` rule, or
|
|
2315
|
+
* `null` for none. Use `pushUniversalStyle` rather than this, which lets
|
|
2316
|
+
* several components share the one layer.
|
|
2317
|
+
*/
|
|
2318
|
+
setUniversalStyle(style: StyleDesc | null): void;
|
|
2319
|
+
setCustomProp(id: number, key: string, value: object | string | number | boolean | null): void;
|
|
2320
|
+
/**
|
|
2321
|
+
* Schedule the flush a queued mutation would have scheduled. An adapter that
|
|
2322
|
+
* defers work to the flush (Solid destroys a removed node there) calls it when
|
|
2323
|
+
* it has something to finish but nothing to enqueue yet. A queue with no
|
|
2324
|
+
* scheduler leaves the flush to the caller.
|
|
2325
|
+
*/
|
|
2326
|
+
requestFlush(): void;
|
|
2327
|
+
flushMutations(): void;
|
|
2328
|
+
}
|
|
2329
|
+
export type DebugFrameOverlayMode = "hidden" | "minimal" | "full";
|
|
2330
|
+
/** Method syntax makes the parameter bivariant, so an `onKeyDown` typed with
|
|
2331
|
+
* `KeyEvent` can share the map. Dispatch builds the `KeyEvent` for key types. */
|
|
2332
|
+
export type HostEventHandler = {
|
|
2333
|
+
handle(event: DomEvent): void;
|
|
2334
|
+
}["handle"];
|
|
2335
|
+
export type EventHandlerMap = Map<number, Map<string, HostEventHandler>>;
|
|
2336
|
+
/**
|
|
2337
|
+
* A `keydown` / `keyup` event, the same object every handler of one keystroke
|
|
2338
|
+
* sees, like one DOM event travelling from the focused element to `window`.
|
|
2339
|
+
*
|
|
2340
|
+
* `key`, `code`, `repeat`, `isComposing` and the `*Key` booleans follow DOM
|
|
2341
|
+
* `KeyboardEvent`: `key` is `"Enter"`, `"ArrowDown"`, `" "`, `"F1"`, or the
|
|
2342
|
+
* character produced (`"A"` for shift-a); `code` is the physical key (`"KeyA"`,
|
|
2343
|
+
* `"Digit1"`), assuming a US QWERTY layout for printable keys. The mapping from
|
|
2344
|
+
* GPUI key names lives in `events/key_names.rs`.
|
|
2345
|
+
*
|
|
2346
|
+
* `keyCode` and `which` are the legacy Windows virtual-key codes Chrome on
|
|
2347
|
+
* macOS reports (65 for `a`, 13 for Enter, 229 for `"Process"`); `charCode`
|
|
2348
|
+
* does not exist because there is no `keypress` event.
|
|
2349
|
+
*
|
|
2350
|
+
* On macOS a key the input method takes first has `key` `"Process"` and cannot
|
|
2351
|
+
* be cancelled: `preventDefault()` does not stop the input method. `isComposing`
|
|
2352
|
+
* is true while it has text marked.
|
|
2353
|
+
*/
|
|
2354
|
+
export interface KeyEvent extends DomEvent {
|
|
2355
|
+
/** True after any handler of this keystroke called `preventDefault()`. */
|
|
2356
|
+
readonly defaultPrevented: boolean;
|
|
2357
|
+
/**
|
|
2358
|
+
* Cancel the default action. On `keydown` that is native: no editor action
|
|
2359
|
+
* (caret movement, deletion, Enter, Cmd+C), no text typed, and in JS, Tab
|
|
2360
|
+
* moving focus and Escape closing the top overlay. Handlers run before native
|
|
2361
|
+
* acts, except on Windows and Linux, where the key is delivered after the
|
|
2362
|
+
* fact and only the JS defaults can be cancelled.
|
|
2363
|
+
*/
|
|
2364
|
+
preventDefault(): void;
|
|
2365
|
+
/** Skip the handlers further along the path, up to and including `window`.
|
|
2366
|
+
* The default action still runs, like the DOM. */
|
|
2367
|
+
stopPropagation(): void;
|
|
2368
|
+
}
|
|
2369
|
+
export type WindowKeyEventHandler = (event: KeyEvent, renderer: NativeRenderer) => void;
|
|
2370
|
+
export type WindowEventHandler = (event: RootEvent, renderer: NativeRenderer) => void;
|
|
2371
|
+
export interface WindowKeyEventHandlers {
|
|
2372
|
+
/** A `window` bubble listener for `keydown`, for this root only. Runs after
|
|
2373
|
+
* every element handler on the focused element's path. */
|
|
2374
|
+
onKeyDown?: WindowKeyEventHandler;
|
|
2375
|
+
/** A `window` bubble listener for `keyup`, for this root only. */
|
|
2376
|
+
onKeyUp?: WindowKeyEventHandler;
|
|
2377
|
+
/** Window-level text selection. Fires when the selected ranges change. */
|
|
2378
|
+
onSelectionChange?: WindowEventHandler;
|
|
2379
|
+
/** Window-level appearance. Fires when the effective appearance flips
|
|
2380
|
+
* between light and dark. `event.value` is `"light"` or `"dark"`. */
|
|
2381
|
+
onAppearanceChange?: WindowEventHandler;
|
|
2382
|
+
/**
|
|
2383
|
+
* Tab and Shift+Tab move focus through `tabIndex` elements. Defaults to
|
|
2384
|
+
* true. Call `event.preventDefault()` in any `onKeyDown` to keep one Tab.
|
|
2385
|
+
*/
|
|
2386
|
+
tabNavigation?: boolean;
|
|
2387
|
+
/**
|
|
2388
|
+
* While a control has keyboard focus, every other focusable element dims.
|
|
2389
|
+
* Defaults to true. Set false to draw your own focus look with
|
|
2390
|
+
* `focusVisible`. Per element, use `style.keyboardFocusDim: false`.
|
|
2391
|
+
*/
|
|
2392
|
+
keyboardFocusDim?: boolean;
|
|
2393
|
+
}
|
|
2394
|
+
export interface RootEventHandlers extends WindowKeyEventHandlers {
|
|
2395
|
+
onEvent?: (event: EventPayload) => void;
|
|
2396
|
+
onUncaughtError?: (error: Error, errorInfo: {
|
|
2397
|
+
componentStack?: string;
|
|
2398
|
+
}) => void;
|
|
2399
|
+
}
|
|
2400
|
+
export interface ElementIdAllocator {
|
|
2401
|
+
nextElementId: number;
|
|
2402
|
+
}
|
|
2403
|
+
//# sourceMappingURL=host.d.ts.map
|