@tarve/core 0.4.0 → 0.5.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/CHANGELOG.md +80 -1
- package/README.md +67 -10
- package/dist/npm/build.js +823 -83
- package/dist/npm/cli.js +1087 -116
- package/dist/npm/embedded-assets.js +15 -1
- package/dist/npm/index.js +2468 -181
- package/dist/npm/native-runtime.json +3 -3
- package/dist/npm/node-build.js +865 -0
- package/dist/npm/protocol.js +1 -1
- package/dist/npm/runtime.js +5 -5
- package/dist/types/core/app-metadata.d.ts +49 -0
- package/dist/types/core/build.d.ts +21 -0
- package/dist/types/core/cli.d.ts +1 -1
- package/dist/types/core/esbuild-file-imports.d.ts +8 -0
- package/dist/types/core/node-build.d.ts +7 -0
- package/dist/types/core/node-dev.d.ts +4 -0
- package/dist/types/core/node-target.d.ts +10 -0
- package/dist/types/core/runtime-select.d.ts +8 -0
- package/dist/types/core/src/app-metadata.d.ts +16 -0
- package/dist/types/core/src/app.d.ts +87 -2
- package/dist/types/core/src/assets.d.ts +4 -0
- package/dist/types/core/src/bridge/binding.d.ts +10 -34
- package/dist/types/core/src/canvas.d.ts +161 -0
- package/dist/types/core/src/components/image.d.ts +7 -3
- package/dist/types/core/src/components/layout.d.ts +4 -3
- package/dist/types/core/src/components/pressable.d.ts +2 -2
- package/dist/types/core/src/extra-controls.d.ts +1 -1
- package/dist/types/core/src/html-elements.d.ts +26 -0
- package/dist/types/core/src/index.d.ts +4 -1
- package/dist/types/core/src/inline-text.d.ts +21 -0
- package/dist/types/core/src/jsx-runtime.d.ts +175 -4
- package/dist/types/core/src/media-element.d.ts +71 -0
- package/dist/types/core/src/memo.d.ts +18 -0
- package/dist/types/core/src/png.d.ts +29 -0
- package/dist/types/core/src/popups.d.ts +3 -2
- package/dist/types/core/src/reconciler.d.ts +27 -3
- package/dist/types/core/src/test-renderer.d.ts +2 -0
- package/dist/types/core/src/theme.d.ts +2 -1
- package/dist/types/core/src/virtual-list.d.ts +5 -1
- package/dist/types/core/windows-executable.d.ts +16 -0
- package/dist/types/protocol/src/index.d.ts +187 -5
- package/native/linux-x64/libtarve_native.so +0 -0
- package/native/linux-x64/runtime.json +4 -4
- package/native/win32-x64/runtime.json +4 -4
- package/native/win32-x64/tarve_native.dll +0 -0
- package/package.json +11 -2
|
@@ -11,6 +11,38 @@ export type PastePayload = {
|
|
|
11
11
|
height: number;
|
|
12
12
|
rgba: Uint8Array;
|
|
13
13
|
};
|
|
14
|
+
export interface DragPosition {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}
|
|
18
|
+
/** Pointer position while dragging and the drop target currently under it. */
|
|
19
|
+
export interface DragMoveEvent extends DragPosition {
|
|
20
|
+
over: string | null;
|
|
21
|
+
}
|
|
22
|
+
/** Fired once per drag: `target` is the accepting drop target, or null. */
|
|
23
|
+
export interface DragEndEvent extends DragPosition {
|
|
24
|
+
target: string | null;
|
|
25
|
+
cancelled: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Delivered to the drop target; `source` is the dragged node id. */
|
|
28
|
+
export interface DropEvent extends DragPosition {
|
|
29
|
+
source: string;
|
|
30
|
+
}
|
|
31
|
+
/** Makes a node a drop target. Any of the drop handlers implies `dropTarget`. */
|
|
32
|
+
export interface DropTargetProps {
|
|
33
|
+
dropTarget?: boolean;
|
|
34
|
+
onDragEnter?: (source: string) => void;
|
|
35
|
+
onDragLeave?: (source: string) => void;
|
|
36
|
+
onDrop?: (event: DropEvent) => void;
|
|
37
|
+
}
|
|
38
|
+
/** Pointer drag on an interactive node. A press only becomes a drag after the
|
|
39
|
+
* pointer travels 4px, so the node keeps its click; Escape or window blur cancels. */
|
|
40
|
+
export interface DraggableProps {
|
|
41
|
+
draggable?: boolean;
|
|
42
|
+
onDragStart?: (position: DragPosition) => void;
|
|
43
|
+
onDragMove?: (event: DragMoveEvent) => void;
|
|
44
|
+
onDragEnd?: (event: DragEndEvent) => void;
|
|
45
|
+
}
|
|
14
46
|
export interface BaseProps {
|
|
15
47
|
id?: string;
|
|
16
48
|
key?: string | number;
|
|
@@ -28,18 +60,41 @@ export interface BaseProps {
|
|
|
28
60
|
}) => void;
|
|
29
61
|
/** Receives non-text clipboard content (files or a bitmap) pasted while focused. */
|
|
30
62
|
onPaste?: (payload: PastePayload) => void;
|
|
63
|
+
/** Content-box size after layout, on mount and whenever it changes (a ResizeObserver). */
|
|
64
|
+
onSize?: (size: {
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
}) => void;
|
|
68
|
+
/** Pointer position inside this node (like DOM `offsetX`/`offsetY`) while it is over it or its children. */
|
|
69
|
+
onPointerMove?: (point: {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
}) => void;
|
|
73
|
+
/** The pointer left this node and its children (DOM `pointerleave`). */
|
|
74
|
+
onPointerLeave?: () => void;
|
|
31
75
|
}
|
|
32
76
|
export type IntrinsicStateStyle = StateStyle & {
|
|
33
77
|
backgroundColor?: string;
|
|
34
78
|
color?: string;
|
|
35
79
|
};
|
|
36
|
-
export type IntrinsicStyle = Omit<Style, "hover" | "focus" | "focusVisible" | "active" | "disabled"> & {
|
|
80
|
+
export type IntrinsicStyle = Omit<Style, "hover" | "focus" | "focusVisible" | "active" | "disabled" | "overflow"> & {
|
|
81
|
+
/** CSS `overflow`; on a `<div>`, `auto` or `scroll` makes it a scroll container. */
|
|
82
|
+
overflow?: Style["overflow"] | "auto" | "scroll";
|
|
83
|
+
overflowX?: Style["overflow"] | "auto" | "scroll";
|
|
84
|
+
overflowY?: Style["overflow"] | "auto" | "scroll";
|
|
37
85
|
/** CSS-like alias for Tarve's native `direction`. */
|
|
38
86
|
flexDirection?: Style["direction"];
|
|
39
87
|
/** CSS-like alias for Tarve's native `background`. */
|
|
40
88
|
backgroundColor?: string;
|
|
41
89
|
/** CSS-like alias for Tarve's native `foreground`. */
|
|
42
90
|
color?: string;
|
|
91
|
+
/** CSS-like alias for Tarve's native `radius`. */
|
|
92
|
+
borderRadius?: number;
|
|
93
|
+
/** CSS `align-items` and `justify-content` (Tarve's `align` and `justify`). */
|
|
94
|
+
alignItems?: "flex-start" | "start" | "center" | "flex-end" | "end" | "stretch";
|
|
95
|
+
justifyContent?: "flex-start" | "start" | "center" | "flex-end" | "end" | "space-between";
|
|
96
|
+
/** CSS `object-fit` on an `<img>` (its `fit` prop). */
|
|
97
|
+
objectFit?: "fill" | "contain" | "cover" | "none" | "scale-down";
|
|
43
98
|
hover?: IntrinsicStateStyle;
|
|
44
99
|
focus?: IntrinsicStateStyle;
|
|
45
100
|
focusVisible?: IntrinsicStateStyle;
|
|
@@ -47,11 +102,11 @@ export type IntrinsicStyle = Omit<Style, "hover" | "focus" | "focusVisible" | "a
|
|
|
47
102
|
disabled?: IntrinsicStateStyle;
|
|
48
103
|
};
|
|
49
104
|
export type DivStyle = IntrinsicStyle;
|
|
50
|
-
export interface DivProps extends Omit<BaseProps, "style"
|
|
105
|
+
export interface DivProps extends Omit<BaseProps, "style">, DropTargetProps {
|
|
51
106
|
style?: IntrinsicStyle;
|
|
52
107
|
gap?: number;
|
|
53
108
|
padding?: Style["padding"];
|
|
54
|
-
flex?: number;
|
|
109
|
+
flex?: number | string;
|
|
55
110
|
align?: Style["align"];
|
|
56
111
|
justify?: Style["justify"];
|
|
57
112
|
portal?: boolean;
|
|
@@ -77,6 +132,8 @@ export interface SpanProps extends Omit<BaseProps, "style"> {
|
|
|
77
132
|
size?: number;
|
|
78
133
|
weight?: number;
|
|
79
134
|
color?: string;
|
|
135
|
+
/** Inside a paragraph the span becomes a click target. */
|
|
136
|
+
onClick?: () => void;
|
|
80
137
|
}
|
|
81
138
|
export type ParagraphProps = SpanProps;
|
|
82
139
|
export type HeadingProps = SpanProps;
|
|
@@ -94,10 +151,30 @@ export interface ImgProps extends Omit<BaseProps, "style" | "children"> {
|
|
|
94
151
|
height?: number;
|
|
95
152
|
fit?: "cover" | "contain";
|
|
96
153
|
}
|
|
97
|
-
export type IntrinsicInputType = "text" | "password" | "email" | "number" | "search" | "tel" | "url";
|
|
154
|
+
export type IntrinsicInputType = "text" | "password" | "email" | "number" | "search" | "tel" | "url" | "checkbox" | "radio" | "range" | "date" | "file" | "color" | "time";
|
|
98
155
|
export interface IntrinsicInputProps extends Omit<BaseProps, "style" | "children"> {
|
|
99
156
|
style?: IntrinsicStyle;
|
|
100
157
|
type?: IntrinsicInputType;
|
|
158
|
+
/** Form field name: `<form onSubmit>` receives values keyed by it. */
|
|
159
|
+
name?: string;
|
|
160
|
+
required?: boolean;
|
|
161
|
+
/** Initial value of an uncontrolled field. */
|
|
162
|
+
defaultValue?: string;
|
|
163
|
+
/** checkbox and radio. */
|
|
164
|
+
checked?: boolean;
|
|
165
|
+
defaultChecked?: boolean;
|
|
166
|
+
/** Visible label of a checkbox, radio or range. */
|
|
167
|
+
label?: string;
|
|
168
|
+
ariaLabel?: string;
|
|
169
|
+
/** range and date. */
|
|
170
|
+
min?: number | string;
|
|
171
|
+
max?: number | string;
|
|
172
|
+
step?: number;
|
|
173
|
+
/** file: `.png,.jpg` filters and multiple selection; onFiles receives every path. */
|
|
174
|
+
accept?: string;
|
|
175
|
+
multiple?: boolean;
|
|
176
|
+
onFiles?: (paths: string[]) => void;
|
|
177
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
101
178
|
value?: string;
|
|
102
179
|
placeholder?: string;
|
|
103
180
|
disabled?: boolean;
|
|
@@ -106,6 +183,11 @@ export interface IntrinsicInputProps extends Omit<BaseProps, "style" | "children
|
|
|
106
183
|
}
|
|
107
184
|
export interface IntrinsicTextareaProps extends Omit<BaseProps, "style" | "children"> {
|
|
108
185
|
style?: IntrinsicStyle;
|
|
186
|
+
/** Form field name: `<form onSubmit>` receives the text keyed by it. */
|
|
187
|
+
name?: string;
|
|
188
|
+
required?: boolean;
|
|
189
|
+
/** Initial text of an uncontrolled textarea. */
|
|
190
|
+
defaultValue?: string;
|
|
109
191
|
value?: string;
|
|
110
192
|
placeholder?: string;
|
|
111
193
|
disabled?: boolean;
|
|
@@ -119,6 +201,8 @@ export interface IntrinsicButtonProps extends Omit<BaseProps, "style"> {
|
|
|
119
201
|
size?: "sm" | "default" | "lg";
|
|
120
202
|
disabled?: boolean;
|
|
121
203
|
control?: Control;
|
|
204
|
+
/** Inside a `<form>` a button submits unless `type="button"`. */
|
|
205
|
+
type?: "submit" | "button" | "reset";
|
|
122
206
|
onClick?: () => void;
|
|
123
207
|
onHover?: (hovered: boolean) => void;
|
|
124
208
|
}
|
|
@@ -206,6 +290,11 @@ export interface IntrinsicOptionProps {
|
|
|
206
290
|
}
|
|
207
291
|
export interface IntrinsicSelectProps extends Omit<BaseProps, "style"> {
|
|
208
292
|
style?: IntrinsicStyle;
|
|
293
|
+
/** Form field name: `<form onSubmit>` receives the chosen value keyed by it. */
|
|
294
|
+
name?: string;
|
|
295
|
+
required?: boolean;
|
|
296
|
+
/** Initial choice of an uncontrolled select; without it, the first enabled option. */
|
|
297
|
+
defaultValue?: string;
|
|
209
298
|
value?: string;
|
|
210
299
|
placeholder?: string;
|
|
211
300
|
disabled?: boolean;
|
|
@@ -238,6 +327,42 @@ export declare const jsxDEV: typeof jsx;
|
|
|
238
327
|
export declare function Fragment(props: {
|
|
239
328
|
children?: Child;
|
|
240
329
|
}): VNode;
|
|
330
|
+
export interface IntrinsicBlockProps extends Omit<BaseProps, "style"> {
|
|
331
|
+
style?: IntrinsicStyle;
|
|
332
|
+
}
|
|
333
|
+
export interface IntrinsicFormProps extends IntrinsicBlockProps {
|
|
334
|
+
/** Enter in a field or a submit button: named values, after `required` fields are filled. */
|
|
335
|
+
onSubmit?: (values: Record<string, string | boolean | string[]>) => void;
|
|
336
|
+
/** A required field was empty; receives its name. */
|
|
337
|
+
onInvalid?: (name: string) => void;
|
|
338
|
+
ariaLabel?: string;
|
|
339
|
+
}
|
|
340
|
+
export interface IntrinsicListProps extends IntrinsicBlockProps {
|
|
341
|
+
start?: number;
|
|
342
|
+
}
|
|
343
|
+
export interface IntrinsicDetailsProps extends IntrinsicBlockProps {
|
|
344
|
+
open?: boolean;
|
|
345
|
+
onToggle?: (open: boolean) => void;
|
|
346
|
+
}
|
|
347
|
+
export interface IntrinsicCellProps extends IntrinsicBlockProps {
|
|
348
|
+
colSpan?: number;
|
|
349
|
+
rowSpan?: number;
|
|
350
|
+
}
|
|
351
|
+
export interface IntrinsicCanvasProps extends IntrinsicBlockProps {
|
|
352
|
+
/** CSS pixels; HTML's default canvas is 300×150. */
|
|
353
|
+
width?: number;
|
|
354
|
+
height?: number;
|
|
355
|
+
/** Draws with the Canvas 2D API; replayed on every render. */
|
|
356
|
+
onDraw?: (context: import("./canvas").CanvasRenderingContext2D) => void;
|
|
357
|
+
ariaLabel?: string;
|
|
358
|
+
}
|
|
359
|
+
export interface IntrinsicMeterProps extends IntrinsicBlockProps {
|
|
360
|
+
value: number;
|
|
361
|
+
min?: number;
|
|
362
|
+
max?: number;
|
|
363
|
+
ariaLabel?: string;
|
|
364
|
+
title?: string;
|
|
365
|
+
}
|
|
241
366
|
export declare namespace JSX {
|
|
242
367
|
type Element = VNode;
|
|
243
368
|
interface ElementChildrenAttribute {
|
|
@@ -248,7 +373,53 @@ export declare namespace JSX {
|
|
|
248
373
|
}
|
|
249
374
|
interface IntrinsicElements {
|
|
250
375
|
div: DivProps;
|
|
376
|
+
form: IntrinsicFormProps;
|
|
377
|
+
pre: SpanProps;
|
|
378
|
+
blockquote: IntrinsicBlockProps;
|
|
379
|
+
meter: IntrinsicMeterProps;
|
|
380
|
+
canvas: IntrinsicCanvasProps;
|
|
381
|
+
audio: import("./media-element").MediaElementProps;
|
|
382
|
+
abbr: SpanProps & {
|
|
383
|
+
title?: string;
|
|
384
|
+
};
|
|
385
|
+
fieldset: IntrinsicBlockProps;
|
|
386
|
+
legend: IntrinsicBlockProps;
|
|
387
|
+
ul: IntrinsicListProps;
|
|
388
|
+
ol: IntrinsicListProps;
|
|
389
|
+
li: IntrinsicBlockProps;
|
|
390
|
+
dl: IntrinsicBlockProps;
|
|
391
|
+
dt: IntrinsicBlockProps;
|
|
392
|
+
dd: IntrinsicBlockProps;
|
|
393
|
+
table: IntrinsicBlockProps;
|
|
394
|
+
caption: IntrinsicBlockProps;
|
|
395
|
+
thead: IntrinsicBlockProps;
|
|
396
|
+
tbody: IntrinsicBlockProps;
|
|
397
|
+
tfoot: IntrinsicBlockProps;
|
|
398
|
+
tr: IntrinsicBlockProps;
|
|
399
|
+
th: IntrinsicCellProps;
|
|
400
|
+
td: IntrinsicCellProps;
|
|
401
|
+
details: IntrinsicDetailsProps;
|
|
402
|
+
summary: IntrinsicBlockProps;
|
|
251
403
|
span: SpanProps;
|
|
404
|
+
strong: SpanProps;
|
|
405
|
+
b: SpanProps;
|
|
406
|
+
em: SpanProps;
|
|
407
|
+
i: SpanProps;
|
|
408
|
+
u: SpanProps;
|
|
409
|
+
s: SpanProps;
|
|
410
|
+
del: SpanProps;
|
|
411
|
+
ins: SpanProps;
|
|
412
|
+
code: SpanProps;
|
|
413
|
+
kbd: SpanProps;
|
|
414
|
+
samp: SpanProps;
|
|
415
|
+
var: SpanProps;
|
|
416
|
+
cite: SpanProps;
|
|
417
|
+
dfn: SpanProps;
|
|
418
|
+
mark: SpanProps;
|
|
419
|
+
small: SpanProps;
|
|
420
|
+
sub: SpanProps;
|
|
421
|
+
sup: SpanProps;
|
|
422
|
+
br: Omit<SpanProps, "children">;
|
|
252
423
|
p: ParagraphProps;
|
|
253
424
|
h1: HeadingProps;
|
|
254
425
|
h2: HeadingProps;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { VNode } from "./jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `<audio>`: an HTMLMediaElement played by the native runtime. Attributes are
|
|
4
|
+
* reconciled after each render (src, loop, muted, volume, autoPlay); playback
|
|
5
|
+
* state comes back as media events. With `controls` it renders the default
|
|
6
|
+
* control bar; without, it renders nothing, as in a browser.
|
|
7
|
+
*/
|
|
8
|
+
export interface MediaElementProps {
|
|
9
|
+
id?: string;
|
|
10
|
+
src?: string;
|
|
11
|
+
controls?: boolean;
|
|
12
|
+
autoPlay?: boolean;
|
|
13
|
+
loop?: boolean;
|
|
14
|
+
muted?: boolean;
|
|
15
|
+
/** 0–1, HTMLMediaElement.volume. */
|
|
16
|
+
volume?: number;
|
|
17
|
+
style?: Record<string, unknown>;
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
onLoadedMetadata?: (event: MediaEventInfo) => void;
|
|
20
|
+
onPlay?: (event: MediaEventInfo) => void;
|
|
21
|
+
onPause?: (event: MediaEventInfo) => void;
|
|
22
|
+
onTimeUpdate?: (event: MediaEventInfo) => void;
|
|
23
|
+
onSeeked?: (event: MediaEventInfo) => void;
|
|
24
|
+
onEnded?: (event: MediaEventInfo) => void;
|
|
25
|
+
onError?: (message: string) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface MediaEventInfo {
|
|
28
|
+
currentTime: number;
|
|
29
|
+
duration: number | null;
|
|
30
|
+
paused: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** What a render asks of one media element. */
|
|
33
|
+
export interface MediaRequest {
|
|
34
|
+
src?: string;
|
|
35
|
+
loop: boolean;
|
|
36
|
+
muted: boolean;
|
|
37
|
+
volume: number;
|
|
38
|
+
autoPlay: boolean;
|
|
39
|
+
handlers: MediaElementProps;
|
|
40
|
+
}
|
|
41
|
+
interface MediaState {
|
|
42
|
+
paused: boolean;
|
|
43
|
+
time: number;
|
|
44
|
+
duration: number | null;
|
|
45
|
+
ended: boolean;
|
|
46
|
+
error?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Forgets playback state (tests and remounts). */
|
|
49
|
+
export declare function resetMediaState(): void;
|
|
50
|
+
export declare function mediaState(id: string): MediaState;
|
|
51
|
+
export interface MediaController {
|
|
52
|
+
play(): void;
|
|
53
|
+
pause(): void;
|
|
54
|
+
/** HTMLMediaElement.currentTime = seconds. */
|
|
55
|
+
seek(seconds: number): void;
|
|
56
|
+
setVolume(volume: number): void;
|
|
57
|
+
setMuted(muted: boolean): void;
|
|
58
|
+
}
|
|
59
|
+
export declare function mediaRequest(props: MediaElementProps): MediaRequest;
|
|
60
|
+
/** The default controls of a browser's audio element: play, time, seek bar, mute. */
|
|
61
|
+
export declare function expandAudio(props: MediaElementProps, id: string): VNode;
|
|
62
|
+
/** Applies a native media event to the element's state; returns the handler to call. */
|
|
63
|
+
export declare function applyMediaEvent(event: {
|
|
64
|
+
id: string;
|
|
65
|
+
event: string;
|
|
66
|
+
time?: number;
|
|
67
|
+
duration?: number | null;
|
|
68
|
+
paused?: boolean;
|
|
69
|
+
message?: string;
|
|
70
|
+
}, request: MediaRequest | undefined): (() => void) | undefined;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { VNode } from "./jsx-runtime";
|
|
2
|
+
/** Marks a component made by {@link memo}; the reconciler reads it. */
|
|
3
|
+
export declare const MEMO: unique symbol;
|
|
4
|
+
export interface MemoInfo<P> {
|
|
5
|
+
render: (props: P) => VNode;
|
|
6
|
+
equal: (previous: P, next: P) => boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Object.is on every own prop, like React.memo's default comparison. */
|
|
9
|
+
export declare function shallowEqual(previous: object, next: object): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* A component whose compiled subtree is reused while its props stay equal
|
|
12
|
+
* (shallowly, or by `equal`), its position in the tree is the same, and the
|
|
13
|
+
* theme, inherited font and form around it have not changed. A reused subtree
|
|
14
|
+
* costs no rendering, no compiling and no diffing: an update touches only the
|
|
15
|
+
* components whose props changed. Everything the component shows must come
|
|
16
|
+
* from its props; reading module state inside it shows stale values.
|
|
17
|
+
*/
|
|
18
|
+
export declare function memo<P extends object>(render: (props: P) => VNode, equal?: (previous: P, next: P) => boolean): (props: P) => VNode;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface DecodedPng {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
/** Straight (not premultiplied) RGBA8. */
|
|
5
|
+
rgba: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
export declare function isPng(bytes: Uint8Array): boolean;
|
|
8
|
+
/** Width and height from a PNG's IHDR, without decoding it. */
|
|
9
|
+
export declare function pngSize(bytes: Uint8Array): {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
} | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Decodes a non-interlaced PNG of any colour type at bit depth 8 or 16 (and
|
|
15
|
+
* 1/2/4-bit palette or grey), the forms image editors and icon exporters write.
|
|
16
|
+
*/
|
|
17
|
+
export declare function decodePng(bytes: Uint8Array): DecodedPng;
|
|
18
|
+
/** Encodes straight RGBA8 pixels as an 8-bit RGBA PNG. */
|
|
19
|
+
export declare function encodePng(rgba: Uint8Array, width: number, height: number): Uint8Array;
|
|
20
|
+
/** Area-averaged downscale (premultiplied, so transparent edges keep their colour) to a size x size square. */
|
|
21
|
+
export declare function resizeSquare(image: DecodedPng, size: number): Uint8Array;
|
|
22
|
+
/** An .ico whose entries are PNG images (Windows Vista and later), each square and at most 256 px. */
|
|
23
|
+
export declare function encodeIco(entries: readonly {
|
|
24
|
+
size: number;
|
|
25
|
+
png: Uint8Array;
|
|
26
|
+
}[]): Uint8Array;
|
|
27
|
+
export declare function isIco(bytes: Uint8Array): boolean;
|
|
28
|
+
/** The largest PNG-compressed entry of an .ico, if it has one. */
|
|
29
|
+
export declare function largestIcoPng(bytes: Uint8Array): Uint8Array | undefined;
|
|
@@ -4,7 +4,8 @@ import { type IconName } from "./components";
|
|
|
4
4
|
export type PopupSide = "top" | "right" | "bottom" | "left";
|
|
5
5
|
export interface TooltipProps extends BaseProps {
|
|
6
6
|
id: string;
|
|
7
|
-
|
|
7
|
+
/** Controlled visibility. Omit it and the tooltip shows while its trigger is hovered, one at a time. */
|
|
8
|
+
open?: boolean;
|
|
8
9
|
trigger: Child;
|
|
9
10
|
content: Child;
|
|
10
11
|
side?: PopupSide;
|
|
@@ -12,7 +13,7 @@ export interface TooltipProps extends BaseProps {
|
|
|
12
13
|
onOpenChange?: (open: boolean) => void;
|
|
13
14
|
contentStyle?: Style;
|
|
14
15
|
}
|
|
15
|
-
export declare function Tooltip({ id, open, trigger, content, side, label, onOpenChange, contentStyle, style, }: TooltipProps): VNode;
|
|
16
|
+
export declare function Tooltip({ id, open: controlledOpen, trigger, content, side, label, onOpenChange, contentStyle, style, }: TooltipProps): VNode;
|
|
16
17
|
export interface PopoverProps extends BaseProps {
|
|
17
18
|
id: string;
|
|
18
19
|
open: boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type MotionProperty, type NativeNode, type Renderer, type SceneDocument, type ScrollPosition, type TreeMutation, type VirtualListMeasurement } from "../../protocol/src/index";
|
|
2
|
-
import { type PastePayload, type VNode } from "./jsx-runtime";
|
|
2
|
+
import { type DragEndEvent, type DragMoveEvent, type DragPosition, type DropEvent, type PastePayload, type VNode } from "./jsx-runtime";
|
|
3
3
|
import type { WindowCloseRequestEvent } from "./components";
|
|
4
4
|
import type { ComponentAdapter } from "./component-adapter";
|
|
5
|
+
import { type MediaRequest } from "./media-element";
|
|
5
6
|
export interface Handlers {
|
|
6
7
|
onClick?: () => void;
|
|
7
8
|
onMarkdownLink?: (href: string) => void;
|
|
@@ -29,7 +30,7 @@ export interface Handlers {
|
|
|
29
30
|
onScroll?: (offset: number, max: number) => void;
|
|
30
31
|
onScrollPosition?: (position: ScrollPosition) => void;
|
|
31
32
|
onVirtualListLayout?: (items: VirtualListMeasurement[]) => void;
|
|
32
|
-
onVirtualListScrollToItem?: (index: number, offset: number) => void;
|
|
33
|
+
onVirtualListScrollToItem?: (index: number, offset: number, smooth?: boolean) => void;
|
|
33
34
|
onVirtualListFocus?: (key: string | null) => void;
|
|
34
35
|
onEscape?: () => void;
|
|
35
36
|
onKeyDown?: (key: string) => void;
|
|
@@ -38,12 +39,35 @@ export interface Handlers {
|
|
|
38
39
|
onTransitionEnd?: (event: {
|
|
39
40
|
property: MotionProperty;
|
|
40
41
|
}) => void;
|
|
42
|
+
onDragStart?: (position: DragPosition) => void;
|
|
43
|
+
onDragMove?: (event: DragMoveEvent) => void;
|
|
44
|
+
onDragEnd?: (event: DragEndEvent) => void;
|
|
45
|
+
onDragEnter?: (source: string) => void;
|
|
46
|
+
onDragLeave?: (source: string) => void;
|
|
47
|
+
onDrop?: (event: DropEvent) => void;
|
|
48
|
+
onSize?: (size: {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
}) => void;
|
|
52
|
+
onPointerMove?: (point: {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
}) => void;
|
|
56
|
+
onPointerLeave?: () => void;
|
|
41
57
|
}
|
|
42
58
|
export interface CompiledTree {
|
|
43
59
|
document: SceneDocument;
|
|
44
60
|
handlers: Map<string, Handlers>;
|
|
45
61
|
nodes: Map<string, NativeNode>;
|
|
62
|
+
media?: Map<string, MediaRequest>;
|
|
46
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Forgets every memoized subtree containing `id`, so the next render compiles it
|
|
66
|
+
* again. Called when a handler of that node runs: handlers update the state a
|
|
67
|
+
* component reads (VirtualList's measured height, a row's own module state),
|
|
68
|
+
* which its props alone do not show.
|
|
69
|
+
*/
|
|
70
|
+
export declare function invalidateMemos(renderScope: object, id: string): void;
|
|
47
71
|
export declare function compileTree(element: VNode, debug?: boolean, renderer?: Renderer, componentAdapters?: readonly ComponentAdapter[], renderScope?: object, visible?: boolean): CompiledTree;
|
|
48
72
|
/** null requests a structural replacement; an empty list means no native work is needed. */
|
|
49
73
|
export declare function diffTrees(previous: CompiledTree, next: CompiledTree): NativeNode[] | null;
|
|
@@ -51,4 +75,4 @@ export declare function diffTrees(previous: CompiledTree, next: CompiledTree): N
|
|
|
51
75
|
* Computes one atomic retained-tree mutation batch. A null result is reserved for
|
|
52
76
|
* identity-incompatible replacements (root ID or an existing keyed node kind changed).
|
|
53
77
|
*/
|
|
54
|
-
export declare function diffTreeMutations(previous: CompiledTree, next: CompiledTree): TreeMutation[] | null;
|
|
78
|
+
export declare function diffTreeMutations(previous: CompiledTree, next: CompiledTree, unchanged?: (old: NativeNode, node: NativeNode) => boolean): TreeMutation[] | null;
|
|
@@ -53,6 +53,8 @@ export declare class Locator {
|
|
|
53
53
|
node(): Promise<NodeSnapshot>;
|
|
54
54
|
waitFor(options?: WaitForOptions): Promise<NodeSnapshot>;
|
|
55
55
|
click(): Promise<void>;
|
|
56
|
+
/** Moves the pointer over the node: its centre, or `offset` from its top-left corner. */
|
|
57
|
+
hover(offset?: Point): Promise<void>;
|
|
56
58
|
fill(value: string): Promise<void>;
|
|
57
59
|
press(key: string): Promise<void>;
|
|
58
60
|
wheel(options: number | WheelOptions): Promise<void>;
|
|
@@ -19,6 +19,8 @@ export interface ThemeColors {
|
|
|
19
19
|
destructiveForeground: string;
|
|
20
20
|
destructiveHover: string;
|
|
21
21
|
destructiveActive: string;
|
|
22
|
+
/** Destructive colour for text and icons on the background: errors, alerts. */
|
|
23
|
+
destructiveText: string;
|
|
22
24
|
ring: string;
|
|
23
25
|
ringSoft: string;
|
|
24
26
|
success: string;
|
|
@@ -86,7 +88,6 @@ export declare const theme: {
|
|
|
86
88
|
};
|
|
87
89
|
};
|
|
88
90
|
export declare function resolveThemeColor(value: string, selected: ThemeDefinition): string;
|
|
89
|
-
/** Theme token or CSS colour (hex, rgb(), hsl(), names) for colour keys; other strings unchanged. */
|
|
90
91
|
export declare function resolveStyleString(key: string, value: string, selected: ThemeDefinition): string;
|
|
91
92
|
export declare function resolveThemeStyle(style: Style, selected: ThemeDefinition): Style;
|
|
92
93
|
export type ButtonVariant = "default" | "secondary" | "outline" | "ghost" | "destructive";
|
|
@@ -2,7 +2,11 @@ import { type BaseProps, type Child, type VNode } from "./jsx-runtime";
|
|
|
2
2
|
export interface VirtualListProps<T> extends BaseProps {
|
|
3
3
|
items: readonly T[];
|
|
4
4
|
itemHeight: number;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Viewport height in px. Omit it (with an `id`) to fill the parent like
|
|
7
|
+
* `flex: 1`: the list follows its real laid-out height, window resizes included.
|
|
8
|
+
*/
|
|
9
|
+
height?: number;
|
|
6
10
|
offset: number;
|
|
7
11
|
overscan?: number;
|
|
8
12
|
keyForItem?: (item: T, index: number) => string | number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WindowsExecutableInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
publisher?: string;
|
|
7
|
+
copyright?: string;
|
|
8
|
+
/** .ico bytes; replace the host executable's icon. */
|
|
9
|
+
ico?: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Give a Node.js single-executable app the identity `bun build --compile` gives a
|
|
13
|
+
* Tarve app: its own name, description and version instead of Node.js branding, and
|
|
14
|
+
* the GUI subsystem so double-clicking it does not open a console window.
|
|
15
|
+
*/
|
|
16
|
+
export declare function brandWindowsExecutable(path: string, info: WindowsExecutableInfo): void;
|