@swiftbrowser/react 0.0.0-stage → 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/README.md +490 -2
- package/dist/binding.d.ts +9 -0
- package/dist/binding.d.ts.map +1 -0
- package/dist/bridge.d.ts +17 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/components/animators.d.ts +40 -0
- package/dist/components/animators.d.ts.map +1 -0
- package/dist/components/canvas.d.ts +138 -0
- package/dist/components/canvas.d.ts.map +1 -0
- package/dist/components/charts.d.ts +100 -0
- package/dist/components/charts.d.ts.map +1 -0
- package/dist/components/containers.d.ts +78 -0
- package/dist/components/containers.d.ts.map +1 -0
- package/dist/components/controls.d.ts +106 -0
- package/dist/components/controls.d.ts.map +1 -0
- package/dist/components/geometry.d.ts +161 -0
- package/dist/components/geometry.d.ts.map +1 -0
- package/dist/components/host.d.ts +24 -0
- package/dist/components/host.d.ts.map +1 -0
- package/dist/components/images.d.ts +18 -0
- package/dist/components/images.d.ts.map +1 -0
- package/dist/components/lists.d.ts +26 -0
- package/dist/components/lists.d.ts.map +1 -0
- package/dist/components/media.d.ts +105 -0
- package/dist/components/media.d.ts.map +1 -0
- package/dist/components/menus.d.ts +20 -0
- package/dist/components/menus.d.ts.map +1 -0
- package/dist/components/navigation.d.ts +22 -0
- package/dist/components/navigation.d.ts.map +1 -0
- package/dist/components/row.d.ts +34 -0
- package/dist/components/row.d.ts.map +1 -0
- package/dist/components/shapes.d.ts +107 -0
- package/dist/components/shapes.d.ts.map +1 -0
- package/dist/components/split.d.ts +25 -0
- package/dist/components/split.d.ts.map +1 -0
- package/dist/components/stacks.d.ts +159 -0
- package/dist/components/stacks.d.ts.map +1 -0
- package/dist/components/system.d.ts +25 -0
- package/dist/components/system.d.ts.map +1 -0
- package/dist/components/table.d.ts +36 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/tabs.d.ts +20 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/text.d.ts +63 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/coordinateSpace.d.ts +20 -0
- package/dist/coordinateSpace.d.ts.map +1 -0
- package/dist/dragDrop.d.ts +16 -0
- package/dist/dragDrop.d.ts.map +1 -0
- package/dist/environment.d.ts +54 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/host/instance.d.ts +67 -0
- package/dist/host/instance.d.ts.map +1 -0
- package/dist/host/reconciler.d.ts +9 -0
- package/dist/host/reconciler.d.ts.map +1 -0
- package/dist/host/root.d.ts +29 -0
- package/dist/host/root.d.ts.map +1 -0
- package/dist/host/sb.d.ts +5 -0
- package/dist/host/sb.d.ts.map +1 -0
- package/dist/host/tree.d.ts +35 -0
- package/dist/host/tree.d.ts.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4379 -0
- package/dist/index.js.map +1 -0
- package/dist/inspector.d.ts +11 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/island.d.ts +25 -0
- package/dist/island.d.ts.map +1 -0
- package/dist/lazy.d.ts +19 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lifecycle.d.ts +11 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/modifiers.d.ts +379 -0
- package/dist/modifiers.d.ts.map +1 -0
- package/dist/mount.d.ts +41 -0
- package/dist/mount.d.ts.map +1 -0
- package/dist/navigation-context.d.ts +15 -0
- package/dist/navigation-context.d.ts.map +1 -0
- package/dist/path.d.ts +48 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/pointer.d.ts +65 -0
- package/dist/pointer.d.ts.map +1 -0
- package/dist/presentation.d.ts +38 -0
- package/dist/presentation.d.ts.map +1 -0
- package/dist/scrollEnvironment.d.ts +50 -0
- package/dist/scrollEnvironment.d.ts.map +1 -0
- package/dist/scrollReader.d.ts +27 -0
- package/dist/scrollReader.d.ts.map +1 -0
- package/dist/values.d.ts +118 -0
- package/dist/values.d.ts.map +1 -0
- package/dist/visualEffect.d.ts +120 -0
- package/dist/visualEffect.d.ts.map +1 -0
- package/package.json +48 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ViewModifiers } from '../modifiers';
|
|
3
|
+
export interface AsyncImageProps extends ViewModifiers {
|
|
4
|
+
url: string;
|
|
5
|
+
/** `.resizable()` on the loaded image. */
|
|
6
|
+
resizable?: boolean;
|
|
7
|
+
/** Shown until the image loaded (nothing by default). */
|
|
8
|
+
placeholder?: ReactNode;
|
|
9
|
+
/** Shown when the image failed to load (the placeholder by default). */
|
|
10
|
+
failure?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* `AsyncImage(url:)`: the page loads the image to learn its size (the
|
|
14
|
+
* engine lays a remote image out by its pixel size, as the Swift core does
|
|
15
|
+
* after its `image` request), then shows it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function AsyncImage(props: AsyncImageProps): ReactNode;
|
|
18
|
+
//# sourceMappingURL=images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../src/components/images.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yDAAyD;IACzD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,wEAAwE;IACxE,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAUD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAgC5D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ListStyle } from '@swiftbrowser/web/src/protocol';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type BindingValue } from '../binding';
|
|
4
|
+
import { type ViewModifiers } from '../modifiers';
|
|
5
|
+
/** A selection: one value (or `null`), or a `Set` of values. */
|
|
6
|
+
export type Selection<T> = T | null | Set<T>;
|
|
7
|
+
export interface ListProps<T = unknown> extends ViewModifiers {
|
|
8
|
+
listStyle?: ListStyle;
|
|
9
|
+
/** Edit mode (`EditButton`). */
|
|
10
|
+
editing?: BindingValue<boolean>;
|
|
11
|
+
/** `List(selection:)`: rows with a `tag` (or a `NavigationLink` value) become selectable; a `Set` selects several. */
|
|
12
|
+
selection?: BindingValue<Set<T>> | BindingValue<T | null>;
|
|
13
|
+
onSelectionChange?: (selection: Selection<T>) => void;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function List<T = unknown>(props: ListProps<T>): ReactNode;
|
|
17
|
+
/** `Form { }`: an inset grouped list, as the shim draws it. */
|
|
18
|
+
export declare function Form(props: Omit<ListProps, 'listStyle' | 'selection' | 'onSelectionChange'>): ReactNode;
|
|
19
|
+
export interface SectionProps extends ViewModifiers {
|
|
20
|
+
/** A string or a `<Text>` becomes the section's header text; any other view is a view header. */
|
|
21
|
+
header?: ReactNode;
|
|
22
|
+
footer?: ReactNode;
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare function Section(props: SectionProps): ReactNode;
|
|
26
|
+
//# sourceMappingURL=lists.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lists.d.ts","sourceRoot":"","sources":["../../src/components/lists.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAA4C,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAW5F,gEAAgE;AAChE,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAE7C,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,aAAa;IAC3D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gCAAgC;IAChC,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAChC,sHAAsH;IACtH,SAAS,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1D,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CA4ChE;AAED,+DAA+D;AAC/D,wBAAgB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,GAAG,mBAAmB,CAAC,GAAG,SAAS,CAEvG;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,iGAAiG;IACjG,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAStD"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** `TimelineView` and `VideoPlayer` with `useAVPlayer`. */
|
|
2
|
+
import type { RendererEvent } from '@swiftbrowser/web/src/protocol';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import { type ViewModifiers } from '../modifiers';
|
|
5
|
+
export type TimelineSchedule = 'animation' | 'everyMinute' | {
|
|
6
|
+
animation: {
|
|
7
|
+
minimumInterval?: number;
|
|
8
|
+
paused?: boolean;
|
|
9
|
+
};
|
|
10
|
+
} | {
|
|
11
|
+
periodic: {
|
|
12
|
+
from?: Date;
|
|
13
|
+
by: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export interface TimelineViewProps {
|
|
17
|
+
schedule: TimelineSchedule;
|
|
18
|
+
children: (context: {
|
|
19
|
+
date: Date;
|
|
20
|
+
}) => ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/** `TimelineView(.periodic(from:by:)) { context in }`: the content renders again at each date of the schedule. */
|
|
23
|
+
export declare function TimelineView({ schedule, children }: TimelineViewProps): ReactNode;
|
|
24
|
+
type VideoEvent = Extract<RendererEvent, {
|
|
25
|
+
type: 'video';
|
|
26
|
+
}>;
|
|
27
|
+
interface PlayerState {
|
|
28
|
+
url: string | null;
|
|
29
|
+
rate: number;
|
|
30
|
+
muted: boolean;
|
|
31
|
+
volume: number;
|
|
32
|
+
loop: boolean;
|
|
33
|
+
seek: {
|
|
34
|
+
time: number;
|
|
35
|
+
serial: number;
|
|
36
|
+
};
|
|
37
|
+
duration: number | null;
|
|
38
|
+
size: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
} | null;
|
|
42
|
+
status: 'playing' | 'waiting' | 'paused';
|
|
43
|
+
failed: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `AVPlayer`: what plays, the rate, mute and volume, seeks. A view showing
|
|
47
|
+
* it re-renders when those change; the position (`currentTime`, several
|
|
48
|
+
* reports a second) re-renders nothing: read it or listen with `onTime`.
|
|
49
|
+
*/
|
|
50
|
+
export declare class AVPlayer {
|
|
51
|
+
private state;
|
|
52
|
+
private listeners;
|
|
53
|
+
private timeListeners;
|
|
54
|
+
private time;
|
|
55
|
+
private serial;
|
|
56
|
+
constructor(url?: string | null, options?: {
|
|
57
|
+
loop?: boolean;
|
|
58
|
+
});
|
|
59
|
+
get url(): string | null;
|
|
60
|
+
get rate(): number;
|
|
61
|
+
get isPlaying(): boolean;
|
|
62
|
+
get isMuted(): boolean;
|
|
63
|
+
get volume(): number;
|
|
64
|
+
get duration(): number | null;
|
|
65
|
+
get presentationSize(): {
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
} | null;
|
|
69
|
+
get timeControlStatus(): PlayerState['status'];
|
|
70
|
+
get error(): string | null;
|
|
71
|
+
get currentTime(): number;
|
|
72
|
+
/** @internal */
|
|
73
|
+
get snapshot(): PlayerState;
|
|
74
|
+
play(): void;
|
|
75
|
+
pause(): void;
|
|
76
|
+
seek(time: number): void;
|
|
77
|
+
replaceCurrentItem(url: string | null): void;
|
|
78
|
+
set isMuted(muted: boolean);
|
|
79
|
+
set volume(volume: number);
|
|
80
|
+
set rate(rate: number);
|
|
81
|
+
set loop(loop: boolean);
|
|
82
|
+
subscribe: (listener: () => void) => (() => void);
|
|
83
|
+
/** `addPeriodicTimeObserver`: told the position as the page reports it. */
|
|
84
|
+
onTime(listener: (time: number) => void): () => void;
|
|
85
|
+
/** @internal The page's report for a view showing this player. */
|
|
86
|
+
handle(event: VideoEvent): void;
|
|
87
|
+
private update;
|
|
88
|
+
}
|
|
89
|
+
/** A player kept for the component's life, re-rendering it when what it plays changes. */
|
|
90
|
+
export declare function useAVPlayer(url?: string | null, options?: {
|
|
91
|
+
loop?: boolean;
|
|
92
|
+
}): AVPlayer;
|
|
93
|
+
export interface VideoPlayerProps extends ViewModifiers {
|
|
94
|
+
player: AVPlayer | null;
|
|
95
|
+
/** `videoGravity`: fit (default), fill, or stretch. */
|
|
96
|
+
gravity?: 'resizeAspect' | 'resizeAspectFill' | 'resize';
|
|
97
|
+
/** The browser's native controls; true by default, as `VideoPlayer` shows them. */
|
|
98
|
+
controls?: boolean;
|
|
99
|
+
/** `VideoPlayer(player:) { videoOverlay }`: drawn over the video. */
|
|
100
|
+
videoOverlay?: ReactNode;
|
|
101
|
+
}
|
|
102
|
+
/** `VideoPlayer(player:)`: the page's `<video>` showing the player, or black without one. */
|
|
103
|
+
export declare function VideoPlayer(props: VideoPlayerProps): ReactNode;
|
|
104
|
+
export {};
|
|
105
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/components/media.tsx"],"names":[],"mappings":"AAAA,2DAA2D;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAA+D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpG,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAM9E,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,aAAa,GACb;IAAE,SAAS,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,GAC7D;IAAE,QAAQ,EAAE;QAAE,IAAI,CAAC,EAAE,IAAI,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,KAAK,SAAS,CAAC;CAClD;AAED,kHAAkH;AAClH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,iBAAiB,GAAG,SAAS,CAgDjF;AAMD,KAAK,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAE5D,UAAU,WAAW;IACnB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAA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|
|
3
|
+
import { type ViewModifiers } from '../modifiers';
|
|
4
|
+
export interface MenuProps extends ViewModifiers {
|
|
5
|
+
/** The label: a title, or any view. */
|
|
6
|
+
title?: string;
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
/** The items: buttons, pickers, dividers, sections, texts, nested menus. */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** `Menu("Sort") { … }`: the label opens a popover of the items. */
|
|
12
|
+
export declare function Menu(props: MenuProps): ReactNode;
|
|
13
|
+
export interface EditButtonProps extends ViewModifiers {
|
|
14
|
+
/** The list's edit mode (`List editing={…}`). */
|
|
15
|
+
editMode: BindingValue<boolean>;
|
|
16
|
+
onChange?: (editing: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
/** `EditButton()`: "Edit" / "Done", flipping the edit mode it is given. */
|
|
19
|
+
export declare function EditButton(props: EditButtonProps): ReactNode;
|
|
20
|
+
//# sourceMappingURL=menus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menus.d.ts","sourceRoot":"","sources":["../../src/components/menus.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAI9E,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,oEAAoE;AACpE,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAUhD;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,iDAAiD;IACjD,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAI5D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type BindingValue } from '../binding';
|
|
3
|
+
import { type ViewModifiers } from '../modifiers';
|
|
4
|
+
export interface NavigationStackProps extends ViewModifiers {
|
|
5
|
+
/** `NavigationStack(path:)`: the pushed values. */
|
|
6
|
+
path?: BindingValue<readonly unknown[]>;
|
|
7
|
+
onPathChange?: (path: readonly unknown[]) => void;
|
|
8
|
+
/** `.navigationDestination(for:)`, for every pushed value. */
|
|
9
|
+
destination?: (value: never) => ReactNode;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function NavigationStack(props: NavigationStackProps): ReactNode;
|
|
13
|
+
export interface NavigationLinkProps extends ViewModifiers {
|
|
14
|
+
title?: string;
|
|
15
|
+
/** The value to push (`navigationDestination` builds the screen). */
|
|
16
|
+
value?: unknown;
|
|
17
|
+
/** The screen to push. */
|
|
18
|
+
destination?: ReactNode;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export declare function NavigationLink(props: NavigationLinkProps): ReactNode;
|
|
22
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/components/navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAG5D,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAI9E,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,mDAAmD;IACnD,IAAI,CAAC,EAAE,YAAY,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,KAAK,IAAI,CAAC;IAClD,8DAA8D;IAC9D,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC;IAC1C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAUD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,CAMtE;AA0DD,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAUpE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List rows that can be selected or deleted are wrapped in a `listrow`
|
|
3
|
+
* (docs/ops-protocol.md, "Edit mode and list selection"). `ForEach`'s
|
|
4
|
+
* `onDelete` and a `List`'s `selection` both end in this component; a row
|
|
5
|
+
* that is neither selectable nor deletable renders bare.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
export interface ListSelection {
|
|
9
|
+
isSelected(tag: unknown): boolean;
|
|
10
|
+
select(tag: unknown): void;
|
|
11
|
+
editing: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const ListSelectionContext: import("react").Context<ListSelection | null>;
|
|
14
|
+
export interface RowProps {
|
|
15
|
+
/** The row's tag (`.tag`, a `NavigationLink` value or a `ForEach` id). */
|
|
16
|
+
tag?: unknown;
|
|
17
|
+
/** `ForEach` with `onDelete`: what a swipe or the edit-mode minus does. */
|
|
18
|
+
onDelete?: () => void;
|
|
19
|
+
deletable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* `ForEach` with `onMove`: called with the destination offset in the
|
|
22
|
+
* `ForEach`'s data (as `move(fromOffsets:toOffset:)` takes it) when the
|
|
23
|
+
* row was dragged to a new place.
|
|
24
|
+
*/
|
|
25
|
+
onMove?: (to: number) => void;
|
|
26
|
+
movable?: boolean;
|
|
27
|
+
/** The row's offset in its `ForEach`. */
|
|
28
|
+
index?: number;
|
|
29
|
+
/** The row's index among its container's children (set by `List` / `Section`), for mapping `move`. */
|
|
30
|
+
containerIndex?: number;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export declare function Row({ tag, onDelete, deletable, onMove, movable, index, containerIndex, children }: RowProps): ReactNode;
|
|
34
|
+
//# sourceMappingURL=row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row.d.ts","sourceRoot":"","sources":["../../src/components/row.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlE,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IAClC,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,oBAAoB,+CAA4C,CAAC;AAE9E,MAAM,WAAW,QAAQ;IACvB,0EAA0E;IAC1E,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sGAAsG;IACtG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,GAAG,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,QAAQ,GAAG,SAAS,CA4BvH"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ViewModifiers } from '../modifiers';
|
|
3
|
+
import { Path, type CGRect } from '../path';
|
|
4
|
+
import { ColorValues, type ColorValue, type StyleValue } from '../values';
|
|
5
|
+
export interface StrokeSpec {
|
|
6
|
+
style?: StyleValue;
|
|
7
|
+
lineWidth?: number;
|
|
8
|
+
dash?: number[];
|
|
9
|
+
dashPhase?: number;
|
|
10
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
11
|
+
lineJoin?: 'miter' | 'round' | 'bevel';
|
|
12
|
+
miterLimit?: number;
|
|
13
|
+
}
|
|
14
|
+
export type StrokeValue = StyleValue | StrokeSpec;
|
|
15
|
+
export interface ShapeProps extends ViewModifiers {
|
|
16
|
+
/** `.fill(_:)`; without a fill or stroke the shape draws in the foreground color. */
|
|
17
|
+
fill?: StyleValue;
|
|
18
|
+
/** `.stroke(_:lineWidth:)` */
|
|
19
|
+
stroke?: StrokeValue;
|
|
20
|
+
/** `.strokeBorder(_:style:)`: the stroke inside the bounds. */
|
|
21
|
+
strokeBorder?: StrokeValue;
|
|
22
|
+
trim?: {
|
|
23
|
+
from: number;
|
|
24
|
+
to: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function Rectangle(props: ShapeProps): ReactNode;
|
|
28
|
+
export declare namespace Rectangle {
|
|
29
|
+
var shape: {
|
|
30
|
+
kind: string;
|
|
31
|
+
cornerRadius: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface RoundedRectangleProps extends ShapeProps {
|
|
35
|
+
cornerRadius: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function RoundedRectangle(props: RoundedRectangleProps): ReactNode;
|
|
38
|
+
export declare namespace RoundedRectangle {
|
|
39
|
+
var shape: {
|
|
40
|
+
kind: string;
|
|
41
|
+
cornerRadius: null;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export declare function Circle(props: ShapeProps): ReactNode;
|
|
45
|
+
export declare namespace Circle {
|
|
46
|
+
var shape: {
|
|
47
|
+
kind: string;
|
|
48
|
+
cornerRadius: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare function Capsule(props: ShapeProps): ReactNode;
|
|
52
|
+
export declare namespace Capsule {
|
|
53
|
+
var shape: {
|
|
54
|
+
kind: string;
|
|
55
|
+
cornerRadius: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export declare function Ellipse(props: ShapeProps): ReactNode;
|
|
59
|
+
export declare namespace Ellipse {
|
|
60
|
+
var shape: {
|
|
61
|
+
kind: string;
|
|
62
|
+
cornerRadius: number;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface ContainerRelativeShapeProps extends ShapeProps {
|
|
66
|
+
/** The container's corner radius (a widget's, a card's). */
|
|
67
|
+
cornerRadius?: number;
|
|
68
|
+
}
|
|
69
|
+
/** `ContainerRelativeShape`: a rounded rectangle with its container's corners. */
|
|
70
|
+
export declare function ContainerRelativeShape(props: ContainerRelativeShapeProps): ReactNode;
|
|
71
|
+
export declare namespace ContainerRelativeShape {
|
|
72
|
+
var shape: {
|
|
73
|
+
kind: string;
|
|
74
|
+
cornerRadius: null;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export interface CustomShapeProps extends Omit<ShapeProps, 'trim'> {
|
|
78
|
+
/** `path(in:)`: the shape's path for a rectangle of the size it is laid out at. */
|
|
79
|
+
path: (rect: CGRect) => Path;
|
|
80
|
+
/** `FillStyle(eoFill: true)` */
|
|
81
|
+
evenOdd?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A custom `Shape`: the element reports its laid-out size, and the shape
|
|
85
|
+
* draws `path(in:)` for that size, as the Swift shim does.
|
|
86
|
+
*/
|
|
87
|
+
export declare function Shape(props: CustomShapeProps): ReactNode;
|
|
88
|
+
export interface UnevenRoundedRectangleProps extends ShapeProps {
|
|
89
|
+
topLeadingRadius?: number;
|
|
90
|
+
bottomLeadingRadius?: number;
|
|
91
|
+
bottomTrailingRadius?: number;
|
|
92
|
+
topTrailingRadius?: number;
|
|
93
|
+
}
|
|
94
|
+
/** `UnevenRoundedRectangle`: a custom shape with a radius per corner. */
|
|
95
|
+
export declare function UnevenRoundedRectangle(props: UnevenRoundedRectangleProps): ReactNode;
|
|
96
|
+
export interface ColorViewProps extends ViewModifiers {
|
|
97
|
+
color: ColorValue;
|
|
98
|
+
}
|
|
99
|
+
/** `Color.red` as a view: a box of the color that fills its proposal. */
|
|
100
|
+
declare function ColorView(props: ColorViewProps): ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* `Color`: as a view, `<Color color="red" />`; as values, `Color.red`,
|
|
103
|
+
* `Color.opacity('black', 0.2)`, `Color.gradient('teal')`, `Color.hex('#336699')`.
|
|
104
|
+
*/
|
|
105
|
+
export declare const Color: typeof ColorView & typeof ColorValues;
|
|
106
|
+
export {};
|
|
107
|
+
//# sourceMappingURL=shapes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapes.d.ts","sourceRoot":"","sources":["../../src/components/shapes.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAA8C,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAqB,KAAK,UAAU,EAAE,KAAK,UAAU,E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W,2BAA4B,SAAQ,UAAU;IAC7D,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,CAGpF;yBAHe,sBAAsB;;;;;;AAUtC,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;IAChE,mFAAmF;IACnF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAsBxD;AAED,MAAM,WAAW,2BAA4B,SAAQ,UAAU;IAC7D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,yEAAyE;AACzE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,CAoBpF;AAMD,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,yEAAyE;AACzE,iBAAS,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAGnD;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,OAAO,SAAS,GAAG,OAAO,WAAmD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `NavigationSplitView`: in a regular width a `navsplit` of two columns (the
|
|
3
|
+
* sidebar's stack and the detail's), the sidebar toggled by the bar button;
|
|
4
|
+
* in a compact width one stack rooted at the sidebar that pushes the detail
|
|
5
|
+
* while the sidebar's list has a selection, as on iOS.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import { type BindingValue } from '../binding';
|
|
9
|
+
import { type ViewModifiers } from '../modifiers';
|
|
10
|
+
export type NavigationSplitViewVisibility = 'automatic' | 'all' | 'doubleColumn' | 'detailOnly';
|
|
11
|
+
/** What the sidebar's `List(selection:)` tells its split view: whether something is selected, and how to clear it. */
|
|
12
|
+
export interface SplitSelection {
|
|
13
|
+
report(selected: boolean, clear: () => void): void;
|
|
14
|
+
}
|
|
15
|
+
export declare const SplitSelectionContext: import("react").Context<SplitSelection | null>;
|
|
16
|
+
export interface NavigationSplitViewProps extends ViewModifiers {
|
|
17
|
+
sidebar: ReactNode;
|
|
18
|
+
detail: ReactNode;
|
|
19
|
+
columnVisibility?: BindingValue<NavigationSplitViewVisibility>;
|
|
20
|
+
onColumnVisibilityChange?: (visibility: NavigationSplitViewVisibility) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function NavigationSplitView(props: NavigationSplitViewProps): ReactNode;
|
|
23
|
+
/** Used by `List`: tells the enclosing split view whether the sidebar has a selection. */
|
|
24
|
+
export declare function useReportSplitSelection(split: SplitSelection | null, selected: boolean, clear: () => void): void;
|
|
25
|
+
//# sourceMappingURL=split.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../src/components/split.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzG,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAI5D,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAI9E,MAAM,MAAM,6BAA6B,GAAG,WAAW,GAAG,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;AAEhG,sHAAsH;AACtH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,qBAAqB,gDAA6C,CAAC;AAEhF,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,gBAAgB,CAAC,EAAE,YAAY,CAAC,6BAA6B,CAAC,CAAC;IAC/D,wBAAwB,CAAC,EAAE,CAAC,UAAU,EAAE,6BAA6B,KAAK,IAAI,CAAC;CAChF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,SAAS,CAwC9E;AAoCD,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAIhH"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { FrameAlignment, GridItem as GridItemProps, GridRowAlignment, HStackAlignment, ScrollAxes, VStackAlignment } from '@swiftbrowser/web/src/protocol';
|
|
2
|
+
import { type Key, type ReactElement, type ReactNode } from 'react';
|
|
3
|
+
import type { EventHandlers } from '../host/instance';
|
|
4
|
+
import { type ModifierEntry, type ViewModifiers } from '../modifiers';
|
|
5
|
+
import { type ScrollSettings } from '../scrollEnvironment';
|
|
6
|
+
export interface VStackProps extends ViewModifiers {
|
|
7
|
+
alignment?: VStackAlignment;
|
|
8
|
+
spacing?: number | null;
|
|
9
|
+
/** `.scrollTargetLayout()`: the children are the enclosing scroll view's snap points. */
|
|
10
|
+
scrollTargetLayout?: boolean;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function VStack(props: VStackProps): ReactNode;
|
|
14
|
+
export interface HStackProps extends ViewModifiers {
|
|
15
|
+
alignment?: HStackAlignment | 'firstTextBaseline' | 'lastTextBaseline';
|
|
16
|
+
spacing?: number | null;
|
|
17
|
+
scrollTargetLayout?: boolean;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare function HStack(props: HStackProps): ReactNode;
|
|
21
|
+
export interface ZStackProps extends ViewModifiers {
|
|
22
|
+
alignment?: FrameAlignment;
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare function ZStack(props: ZStackProps): ReactNode;
|
|
26
|
+
export interface SpacerProps extends ViewModifiers {
|
|
27
|
+
minLength?: number | null;
|
|
28
|
+
}
|
|
29
|
+
export declare function Spacer(props: SpacerProps): ReactNode;
|
|
30
|
+
export declare function Divider(props: ViewModifiers): ReactNode;
|
|
31
|
+
export interface ScrollViewProps extends ViewModifiers {
|
|
32
|
+
axes?: ScrollAxes;
|
|
33
|
+
/** `.scrollTargetBehavior(_:)`: snap to the `scrollTargetLayout` children, or a page at a time. */
|
|
34
|
+
scrollTargetBehavior?: 'viewAligned' | 'paging';
|
|
35
|
+
/** `.scrollDismissesKeyboard(.immediately)` */
|
|
36
|
+
scrollDismissesKeyboard?: boolean;
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export declare function ScrollView(props: ScrollViewProps): ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* The scroll modifiers written on a `ScrollView` or `List` itself: they apply
|
|
42
|
+
* to it, and pass on to the scroll views inside as from above.
|
|
43
|
+
*/
|
|
44
|
+
export declare function takeScrollSettings(modifiers: ModifierEntry[]): ScrollSettings;
|
|
45
|
+
/** `children` under the settings a scroll view was given itself (when there are any). */
|
|
46
|
+
export declare function providingScrollSettings(settings: ScrollSettings, children: ReactNode): ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* `.refreshable` above a `List` or `ScrollView`: its props (`refreshable`,
|
|
49
|
+
* `refreshing` while the action runs) and the `refresh` handler.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useRefreshable(own?: () => unknown): {
|
|
52
|
+
props: Record<string, unknown>;
|
|
53
|
+
handlers?: EventHandlers;
|
|
54
|
+
};
|
|
55
|
+
export interface GroupProps extends ViewModifiers {
|
|
56
|
+
children?: ReactNode;
|
|
57
|
+
}
|
|
58
|
+
/** `Group { }`: the modifiers apply to each child. */
|
|
59
|
+
export declare function Group(props: GroupProps): ReactNode;
|
|
60
|
+
export interface ForEachProps<T> extends ViewModifiers {
|
|
61
|
+
data: readonly T[];
|
|
62
|
+
/** The identity of each element (`id: \.self` by default, or `.id` when the element has one). */
|
|
63
|
+
id?: (element: T, index: number) => Key;
|
|
64
|
+
/** `.onDelete`: the rows become deletable (a swipe, or edit mode's minus); called with the offsets to remove. */
|
|
65
|
+
onDelete?: (offsets: number[]) => void;
|
|
66
|
+
/** `.deleteDisabled`, per element. */
|
|
67
|
+
deleteDisabled?: (element: T, index: number) => boolean;
|
|
68
|
+
/**
|
|
69
|
+
* `.onMove`: the rows become movable (a grip in edit mode, a long press
|
|
70
|
+
* otherwise); called like `move(fromOffsets:toOffset:)`, with the offsets
|
|
71
|
+
* moved and the offset they go before, counted before the move
|
|
72
|
+
* (`moveItems` applies it to an array).
|
|
73
|
+
*/
|
|
74
|
+
onMove?: (offsets: number[], to: number) => void;
|
|
75
|
+
/** `.moveDisabled`, per element. */
|
|
76
|
+
moveDisabled?: (element: T, index: number) => boolean;
|
|
77
|
+
children: (element: T, index: number) => ReactNode;
|
|
78
|
+
}
|
|
79
|
+
/** `Array.move(fromOffsets:toOffset:)`: the array with `offsets` moved before `to` (counted before the move). */
|
|
80
|
+
export declare function moveItems<T>(items: readonly T[], offsets: readonly number[], to: number): T[];
|
|
81
|
+
/** `ForEach(data, id:) { }`: one keyed child per element. */
|
|
82
|
+
export declare function ForEach<T>(props: ForEachProps<T>): ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* The elements of `children`, through fragments, arrays and `ForEach`, so
|
|
85
|
+
* `Picker` and `TabView` can read their options and tabs.
|
|
86
|
+
*/
|
|
87
|
+
export declare function flattenChildren(children: ReactNode, options?: {
|
|
88
|
+
keepLazy?: boolean;
|
|
89
|
+
}): ReactElement[];
|
|
90
|
+
export interface GridItemSpec {
|
|
91
|
+
size?: {
|
|
92
|
+
fixed: number;
|
|
93
|
+
} | {
|
|
94
|
+
flexible: {
|
|
95
|
+
minimum?: number;
|
|
96
|
+
maximum?: number;
|
|
97
|
+
};
|
|
98
|
+
} | {
|
|
99
|
+
adaptive: {
|
|
100
|
+
minimum: number;
|
|
101
|
+
maximum?: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
spacing?: number | null;
|
|
105
|
+
alignment?: FrameAlignment | null;
|
|
106
|
+
}
|
|
107
|
+
/** `GridItem(.flexible(), spacing: 8)`; `GridItem.flexible()` for short. */
|
|
108
|
+
export declare function GridItem(spec?: GridItemSpec): GridItemProps;
|
|
109
|
+
export declare namespace GridItem {
|
|
110
|
+
var flexible: (options?: {
|
|
111
|
+
minimum?: number;
|
|
112
|
+
maximum?: number;
|
|
113
|
+
spacing?: number;
|
|
114
|
+
alignment?: FrameAlignment;
|
|
115
|
+
}) => GridItemProps;
|
|
116
|
+
var fixed: (value: number, options?: {
|
|
117
|
+
spacing?: number;
|
|
118
|
+
alignment?: FrameAlignment;
|
|
119
|
+
}) => GridItemProps;
|
|
120
|
+
var adaptive: (options: {
|
|
121
|
+
minimum: number;
|
|
122
|
+
maximum?: number;
|
|
123
|
+
spacing?: number;
|
|
124
|
+
alignment?: FrameAlignment;
|
|
125
|
+
}) => GridItemProps;
|
|
126
|
+
}
|
|
127
|
+
export interface LazyVGridProps extends ViewModifiers {
|
|
128
|
+
columns: GridItemProps[];
|
|
129
|
+
alignment?: FrameAlignment;
|
|
130
|
+
spacing?: number | null;
|
|
131
|
+
children?: ReactNode;
|
|
132
|
+
}
|
|
133
|
+
export declare function LazyVGrid(props: LazyVGridProps): ReactNode;
|
|
134
|
+
export interface LazyHGridProps extends ViewModifiers {
|
|
135
|
+
rows: GridItemProps[];
|
|
136
|
+
/** How each cell sits in its slot: `top`, `center` (the default) or `bottom`. */
|
|
137
|
+
alignment?: 'top' | 'center' | 'bottom' | 'firstTextBaseline' | 'lastTextBaseline';
|
|
138
|
+
/** Between the columns (8 by default). */
|
|
139
|
+
spacing?: number | null;
|
|
140
|
+
children?: ReactNode;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* `LazyHGrid(rows:)`: the rows share the height it is proposed and the cells
|
|
144
|
+
* fill them column by column, usually inside a horizontal `ScrollView`.
|
|
145
|
+
*/
|
|
146
|
+
export declare function LazyHGrid(props: LazyHGridProps): ReactNode;
|
|
147
|
+
export interface GridProps extends ViewModifiers {
|
|
148
|
+
alignment?: FrameAlignment;
|
|
149
|
+
horizontalSpacing?: number | null;
|
|
150
|
+
verticalSpacing?: number | null;
|
|
151
|
+
children?: ReactNode;
|
|
152
|
+
}
|
|
153
|
+
export declare function Grid(props: GridProps): ReactNode;
|
|
154
|
+
export interface GridRowProps extends ViewModifiers {
|
|
155
|
+
alignment?: GridRowAlignment | null;
|
|
156
|
+
children?: ReactNode;
|
|
157
|
+
}
|
|
158
|
+
export declare function GridRow(props: GridRowProps): ReactNode;
|
|
159
|
+
//# sourceMappingURL=stacks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacks.d.ts","sourceRoot":"","sources":["../../src/components/stacks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,IAAI,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAChK,OAAO,EAA+D,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAA4C,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAChH,OAAO,EAYL,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,WAAW,WAAY,SAAQ,aA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EAAE,YAAY,GAAG,SAAS,CAGtD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** `ColorPicker` and `ShareLink`: controls that open the browser's own chooser and share sheet. */
|
|
2
|
+
import type { RGBAColor } from '@swiftbrowser/web/src/protocol';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { type BindingValue } from '../binding';
|
|
5
|
+
import { type ViewModifiers } from '../modifiers';
|
|
6
|
+
export interface ColorPickerProps extends ViewModifiers {
|
|
7
|
+
title?: string;
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
selection: BindingValue<RGBAColor>;
|
|
10
|
+
onChange?: (color: RGBAColor) => void;
|
|
11
|
+
}
|
|
12
|
+
/** `ColorPicker("Tint", selection:)`: the label and a swatch; tapping opens the browser's color chooser. */
|
|
13
|
+
export declare function ColorPicker(props: ColorPickerProps): ReactNode;
|
|
14
|
+
export interface ShareLinkProps extends ViewModifiers {
|
|
15
|
+
/** What is shared: a URL or text. */
|
|
16
|
+
item: string | URL;
|
|
17
|
+
subject?: string;
|
|
18
|
+
message?: string;
|
|
19
|
+
/** The label; "Share" with the share symbol by default. */
|
|
20
|
+
title?: string;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/** `ShareLink(item:)`: the Web Share API where the browser has it, else a download of the text. */
|
|
24
|
+
export declare function ShareLink(props: ShareLinkProps): ReactNode;
|
|
25
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/components/system.tsx"],"names":[],"mappings":"AAAA,mGAAmG;AAInG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAM9E,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACvC;AAKD,4GAA4G;AAC5G,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAyB9D;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,qCAAqC;IACrC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,mGAAmG;AACnG,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAgB1D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Table`, drawn as iOS draws one: a list. In a compact width each row shows
|
|
3
|
+
* the first column; in a regular width every column under a row of the
|
|
4
|
+
* column titles, a sortable title a button with the sort's chevron.
|
|
5
|
+
*/
|
|
6
|
+
import { type Key, type ReactNode } from 'react';
|
|
7
|
+
import { type BindingValue } from '../binding';
|
|
8
|
+
import { type ViewModifiers } from '../modifiers';
|
|
9
|
+
import { type Selection } from './lists';
|
|
10
|
+
export interface TableColumn<T> {
|
|
11
|
+
title: string;
|
|
12
|
+
/** The cell for a row; a function of the row, or a key whose value is shown as text. */
|
|
13
|
+
content: ((row: T) => ReactNode) | keyof T;
|
|
14
|
+
/** A fixed width; the other columns share the rest. */
|
|
15
|
+
width?: number;
|
|
16
|
+
minWidth?: number;
|
|
17
|
+
maxWidth?: number;
|
|
18
|
+
/** A sortable column: the key its title sorts by (the app sorts the rows by `sortOrder`). */
|
|
19
|
+
sortKey?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SortDescriptor {
|
|
22
|
+
key: string;
|
|
23
|
+
ascending: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface TableProps<T, K extends Key = Key> extends ViewModifiers {
|
|
26
|
+
data: readonly T[];
|
|
27
|
+
columns: readonly TableColumn<T>[];
|
|
28
|
+
/** Each row's identity (its `id` property by default), what the selection holds. */
|
|
29
|
+
id?: (row: T, index: number) => K;
|
|
30
|
+
selection?: BindingValue<Set<K>> | BindingValue<K | null>;
|
|
31
|
+
onSelectionChange?: (selection: Selection<K>) => void;
|
|
32
|
+
/** The sort order, first descriptor first; tapping a sortable title puts it first or reverses it. */
|
|
33
|
+
sortOrder?: BindingValue<readonly SortDescriptor[]>;
|
|
34
|
+
}
|
|
35
|
+
export declare function Table<T, K extends Key = Key>(props: TableProps<T, K>): ReactNode;
|
|
36
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtF,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAI/C,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC;IAC3C,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAA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