@swiftbrowser/react 0.0.0-stage → 0.4.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 +435 -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 +131 -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 +138 -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 +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4038 -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 +330 -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/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/package.json +47 -4
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swift Charts: `Chart` with bar, line, area, point and rule marks. The
|
|
3
|
+
* marks are declarations; `Chart` reads them, builds the scales (bands for
|
|
4
|
+
* categories, "nice" numeric domains, calendar strides for dates), turns
|
|
5
|
+
* every value into the protocol's unit coordinates and emits one `chart`
|
|
6
|
+
* element with its axes and legend, as Sources/SwiftUI/Charts does.
|
|
7
|
+
*/
|
|
8
|
+
import type { ChartInterpolation, ChartSymbol, FrameAlignment } from '@swiftbrowser/web/src/protocol';
|
|
9
|
+
import { type ReactNode } from 'react';
|
|
10
|
+
import { type ViewModifiers } from '../modifiers';
|
|
11
|
+
import { type StyleValue } from '../values';
|
|
12
|
+
export type ChartValue = number | Date | string;
|
|
13
|
+
export interface AnnotationSpec {
|
|
14
|
+
position?: 'top' | 'bottom' | 'leading' | 'trailing' | 'overlay';
|
|
15
|
+
alignment?: FrameAlignment;
|
|
16
|
+
spacing?: number;
|
|
17
|
+
content: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
interface MarkCommon {
|
|
20
|
+
foregroundStyle?: StyleValue;
|
|
21
|
+
/** `.foregroundStyle(by:)`: a series name; the palette colors it and the legend lists it. */
|
|
22
|
+
foregroundStyleBy?: string;
|
|
23
|
+
opacity?: number;
|
|
24
|
+
/** `.annotation(position:alignment:spacing:) { }` */
|
|
25
|
+
annotation?: AnnotationSpec;
|
|
26
|
+
}
|
|
27
|
+
export interface BarMarkProps extends MarkCommon {
|
|
28
|
+
x: ChartValue;
|
|
29
|
+
y: ChartValue;
|
|
30
|
+
/** `yStart:` (0 by default). */
|
|
31
|
+
yStart?: number;
|
|
32
|
+
cornerRadius?: number;
|
|
33
|
+
/** `width: .fixed(points)` */
|
|
34
|
+
width?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface LineMarkProps extends MarkCommon {
|
|
37
|
+
x: ChartValue;
|
|
38
|
+
y: number;
|
|
39
|
+
series?: string;
|
|
40
|
+
interpolation?: ChartInterpolation;
|
|
41
|
+
lineWidth?: number;
|
|
42
|
+
symbol?: ChartSymbol;
|
|
43
|
+
symbolSize?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface AreaMarkProps extends MarkCommon {
|
|
46
|
+
x: ChartValue;
|
|
47
|
+
y: number;
|
|
48
|
+
yStart?: number;
|
|
49
|
+
series?: string;
|
|
50
|
+
interpolation?: ChartInterpolation;
|
|
51
|
+
}
|
|
52
|
+
export interface PointMarkProps extends MarkCommon {
|
|
53
|
+
x: ChartValue;
|
|
54
|
+
y: number;
|
|
55
|
+
symbol?: ChartSymbol;
|
|
56
|
+
symbolSize?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface RuleMarkProps extends MarkCommon {
|
|
59
|
+
/** A vertical rule at `x`, or a horizontal one at `y`. */
|
|
60
|
+
x?: ChartValue;
|
|
61
|
+
y?: number;
|
|
62
|
+
xStart?: ChartValue;
|
|
63
|
+
xEnd?: ChartValue;
|
|
64
|
+
yStart?: number;
|
|
65
|
+
yEnd?: number;
|
|
66
|
+
lineWidth?: number;
|
|
67
|
+
}
|
|
68
|
+
/** The marks render nothing themselves; `Chart` reads them. */
|
|
69
|
+
export declare function BarMark(_props: BarMarkProps): null;
|
|
70
|
+
export declare function LineMark(_props: LineMarkProps): null;
|
|
71
|
+
export declare function AreaMark(_props: AreaMarkProps): null;
|
|
72
|
+
export declare function PointMark(_props: PointMarkProps): null;
|
|
73
|
+
export declare function RuleMark(_props: RuleMarkProps): null;
|
|
74
|
+
export interface ChartProps extends ViewModifiers {
|
|
75
|
+
/** `.chartXAxis(.hidden)` is `null`; the position otherwise. */
|
|
76
|
+
xAxis?: 'bottom' | 'top' | null;
|
|
77
|
+
yAxis?: 'trailing' | 'leading' | null;
|
|
78
|
+
/** `.chartLegend`: the position, or `null` to hide it. Shown at the top when a series exists. */
|
|
79
|
+
legend?: 'top' | 'bottom' | 'leading' | 'trailing' | null;
|
|
80
|
+
/** `.chartXScale(domain:)`: numbers, dates or the categories in order. */
|
|
81
|
+
xScale?: {
|
|
82
|
+
domain?: readonly [ChartValue, ChartValue] | readonly string[];
|
|
83
|
+
};
|
|
84
|
+
/** `.chartYScale(domain:)`; `includesZero` is true by default, as in Swift Charts. */
|
|
85
|
+
yScale?: {
|
|
86
|
+
domain?: readonly [number, number];
|
|
87
|
+
includesZero?: boolean;
|
|
88
|
+
};
|
|
89
|
+
children?: ReactNode;
|
|
90
|
+
}
|
|
91
|
+
/** Steps of 1, 2, 2.5, 5 × 10ᵏ, the one nearest `span / (desired − 1)`. */
|
|
92
|
+
export declare function niceStep(span: number, desired?: number): number;
|
|
93
|
+
/** Calendar ticks in UTC, with the stride that gives at most `desired + 1` intervals. */
|
|
94
|
+
export declare function timeTicks(min: number, max: number, desired?: number): {
|
|
95
|
+
ticks: number[];
|
|
96
|
+
format: (ms: number) => string;
|
|
97
|
+
};
|
|
98
|
+
export declare function Chart(props: ChartProps): ReactNode;
|
|
99
|
+
export {};
|
|
100
|
+
//# sourceMappingURL=charts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../src/components/charts.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAEV,kBAAkB,EAGlB,WAAW,EACX,cAAc,EAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAGxD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACjE,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,S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G,MAAM,CAU1D;AAwDD,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,CA0DpH;AAwCD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CA+LlD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gauges, `ViewThatFits`, lazy stacks, and the composite containers the
|
|
3
|
+
* shim builds from other views: `ContentUnavailableView`, `GroupBox`,
|
|
4
|
+
* `ControlGroup`, `DisclosureGroup`.
|
|
5
|
+
*/
|
|
6
|
+
import type { GaugeStyle, HStackAlignment, VStackAlignment } from '@swiftbrowser/web/src/protocol';
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import { type BindingValue } from '../binding';
|
|
9
|
+
import { type ViewModifiers } from '../modifiers';
|
|
10
|
+
export interface GaugeProps extends ViewModifiers {
|
|
11
|
+
value: number;
|
|
12
|
+
/** `in: 0...1` */
|
|
13
|
+
range?: readonly [number, number];
|
|
14
|
+
label?: ReactNode;
|
|
15
|
+
currentValueLabel?: ReactNode;
|
|
16
|
+
gaugeStyle?: Exclude<GaugeStyle, 'progress'>;
|
|
17
|
+
}
|
|
18
|
+
/** `Gauge(value:in:) { label } currentValueLabel: { }` */
|
|
19
|
+
export declare function Gauge(props: GaugeProps): ReactNode;
|
|
20
|
+
export interface ViewThatFitsProps extends ViewModifiers {
|
|
21
|
+
/** The axes a candidate must fit on (`in:`); both by default. */
|
|
22
|
+
axes?: 'horizontal' | 'vertical' | 'both';
|
|
23
|
+
/** The candidates, preferred first. */
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/** `ViewThatFits`: the first child whose ideal size fits, else the last. */
|
|
27
|
+
export declare function ViewThatFits(props: ViewThatFitsProps): ReactNode;
|
|
28
|
+
export interface LazyVStackProps extends ViewModifiers {
|
|
29
|
+
alignment?: VStackAlignment;
|
|
30
|
+
spacing?: number | null;
|
|
31
|
+
/** `.scrollTargetLayout()`: the children are the scroll view's snap points. */
|
|
32
|
+
scrollTargetLayout?: boolean;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
/** `LazyVStack`: a `VStack` whose long `ForEach`es build their rows as they scroll into view. */
|
|
36
|
+
export declare function LazyVStack(props: LazyVStackProps): ReactNode;
|
|
37
|
+
export interface LazyHStackProps extends ViewModifiers {
|
|
38
|
+
alignment?: HStackAlignment;
|
|
39
|
+
spacing?: number | null;
|
|
40
|
+
scrollTargetLayout?: boolean;
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
export declare function LazyHStack(props: LazyHStackProps): ReactNode;
|
|
44
|
+
export interface ContentUnavailableViewProps extends ViewModifiers {
|
|
45
|
+
title: ReactNode;
|
|
46
|
+
systemImage?: string;
|
|
47
|
+
/** A string or a view. */
|
|
48
|
+
description?: ReactNode;
|
|
49
|
+
actions?: ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/** `ContentUnavailableView(_:systemImage:description:)`: the empty state iOS shows, filling its space. */
|
|
52
|
+
export declare function ContentUnavailableView(props: ContentUnavailableViewProps): ReactNode;
|
|
53
|
+
export declare namespace ContentUnavailableView {
|
|
54
|
+
var search: (text?: string) => ReactNode;
|
|
55
|
+
}
|
|
56
|
+
export interface GroupBoxProps extends ViewModifiers {
|
|
57
|
+
label?: ReactNode;
|
|
58
|
+
children?: ReactNode;
|
|
59
|
+
}
|
|
60
|
+
/** `GroupBox`: the label (headline) over the content, in a padded rounded box. */
|
|
61
|
+
export declare function GroupBox(props: GroupBoxProps): ReactNode;
|
|
62
|
+
/** `ControlGroup`: its controls, flowing in the enclosing stack (or items of their own in a menu). Its label is not drawn. */
|
|
63
|
+
export declare function ControlGroup(props: {
|
|
64
|
+
label?: ReactNode;
|
|
65
|
+
children?: ReactNode;
|
|
66
|
+
} & ViewModifiers): ReactNode;
|
|
67
|
+
export interface DisclosureGroupProps extends ViewModifiers {
|
|
68
|
+
label: ReactNode;
|
|
69
|
+
isExpanded?: BindingValue<boolean>;
|
|
70
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
71
|
+
children?: ReactNode;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* `DisclosureGroup`: a row with the label and a chevron that turns down as
|
|
75
|
+
* the content opens below it, animated.
|
|
76
|
+
*/
|
|
77
|
+
export declare function DisclosureGroup(props: DisclosureGroupProps): ReactNode;
|
|
78
|
+
//# sourceMappingURL=containers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containers.d.ts","sourceRoot":"","sources":["../../src/components/containers.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAWtF,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;CAC9C;AAED,0DAA0D;AAC1D,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAsBlD;AAMD,MAAM,WAAW,iBAAkB,SAAQ,aAAa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AED,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CAexD;AAED,8HAA8H;AAC9H,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,aAAa,GAAG,SAAS,CAG1G;AAED,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACnC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,CA4BtE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { TextFieldStyle } from '@swiftbrowser/web/src/protocol';
|
|
2
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
3
|
+
import { type BindingValue } from '../binding';
|
|
4
|
+
import { type ToolbarItemPlacementName, type ViewModifiers } from '../modifiers';
|
|
5
|
+
export interface ButtonProps extends ViewModifiers {
|
|
6
|
+
title?: string;
|
|
7
|
+
role?: 'destructive' | 'cancel';
|
|
8
|
+
action?: () => void;
|
|
9
|
+
/** The label, when there is no `title`. */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function Button(props: ButtonProps): ReactNode;
|
|
13
|
+
export interface ToggleProps extends ViewModifiers {
|
|
14
|
+
isOn: BindingValue<boolean>;
|
|
15
|
+
onChange?: (isOn: boolean) => void;
|
|
16
|
+
title?: string;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare function Toggle(props: ToggleProps): ReactNode;
|
|
20
|
+
export interface PickerOption<T> {
|
|
21
|
+
label: string;
|
|
22
|
+
tag: T;
|
|
23
|
+
}
|
|
24
|
+
export interface PickerProps<T> extends ViewModifiers {
|
|
25
|
+
label: string;
|
|
26
|
+
selection: BindingValue<T>;
|
|
27
|
+
onChange?: (value: T) => void;
|
|
28
|
+
/** The options, or `<Text tag={…}>` children (a `Text` without a tag is tagged with its string). */
|
|
29
|
+
options?: readonly (T | PickerOption<T>)[];
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
export declare function Picker<T>(props: PickerProps<T>): ReactNode;
|
|
33
|
+
/** The string of a `<Text>` element (other elements read as their title, else ""). */
|
|
34
|
+
export declare function plainText(element: ReactElement): string;
|
|
35
|
+
export interface SliderProps extends ViewModifiers {
|
|
36
|
+
value: BindingValue<number>;
|
|
37
|
+
onChange?: (value: number) => void;
|
|
38
|
+
/** `in: 0...1` */
|
|
39
|
+
range?: readonly [number, number];
|
|
40
|
+
step?: number;
|
|
41
|
+
label?: ReactNode;
|
|
42
|
+
minimumValueLabel?: ReactNode;
|
|
43
|
+
maximumValueLabel?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
export declare function Slider(props: SliderProps): ReactNode;
|
|
46
|
+
export interface StepperProps extends ViewModifiers {
|
|
47
|
+
value: BindingValue<number>;
|
|
48
|
+
onChange?: (value: number) => void;
|
|
49
|
+
/** `in: 1...10` */
|
|
50
|
+
range?: readonly [number, number];
|
|
51
|
+
step?: number;
|
|
52
|
+
title?: string;
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
}
|
|
55
|
+
export declare function Stepper(props: StepperProps): ReactNode;
|
|
56
|
+
export interface TextFieldProps extends ViewModifiers {
|
|
57
|
+
/** The placeholder (SwiftUI's title). */
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
text: BindingValue<string>;
|
|
60
|
+
onChange?: (text: string) => void;
|
|
61
|
+
onSubmit?: () => void;
|
|
62
|
+
textFieldStyle?: TextFieldStyle;
|
|
63
|
+
secure?: boolean;
|
|
64
|
+
axis?: 'vertical';
|
|
65
|
+
/** `.focused($isFocused)`: the field takes the focus while true, and sets it as the viewer focuses or leaves it. */
|
|
66
|
+
focused?: BindingValue<boolean>;
|
|
67
|
+
}
|
|
68
|
+
export declare function TextField(props: TextFieldProps): ReactNode;
|
|
69
|
+
export declare function SecureField(props: Omit<TextFieldProps, 'secure'>): ReactNode;
|
|
70
|
+
export interface ProgressViewProps extends ViewModifiers {
|
|
71
|
+
/** Determinate progress (`value / total`); absent: the spinning indicator. */
|
|
72
|
+
value?: number;
|
|
73
|
+
total?: number;
|
|
74
|
+
label?: ReactNode;
|
|
75
|
+
currentValueLabel?: ReactNode;
|
|
76
|
+
/** The label, as children. */
|
|
77
|
+
children?: ReactNode;
|
|
78
|
+
}
|
|
79
|
+
export declare function ProgressView(props: ProgressViewProps): ReactNode;
|
|
80
|
+
export interface ToolbarItemProps {
|
|
81
|
+
placement?: ToolbarItemPlacementName;
|
|
82
|
+
children?: ReactNode;
|
|
83
|
+
}
|
|
84
|
+
/** `ToolbarItem(placement:) { }`, inside a `toolbar` modifier. */
|
|
85
|
+
export declare function ToolbarItem(props: ToolbarItemProps): ReactNode;
|
|
86
|
+
export declare const ToolbarItemGroup: typeof ToolbarItem;
|
|
87
|
+
export type DatePickerComponents = 'date' | 'hourAndMinute' | 'dateAndTime';
|
|
88
|
+
export interface DatePickerProps extends ViewModifiers {
|
|
89
|
+
label?: string;
|
|
90
|
+
selection: BindingValue<Date>;
|
|
91
|
+
onChange?: (date: Date) => void;
|
|
92
|
+
/** `displayedComponents:`; `date` by default. */
|
|
93
|
+
displayedComponents?: DatePickerComponents;
|
|
94
|
+
/** `in:` bounds. */
|
|
95
|
+
range?: readonly [Date | null, Date | null];
|
|
96
|
+
}
|
|
97
|
+
/** `DatePicker("Date", selection:)`: the compact style, with the browser's native pickers. */
|
|
98
|
+
export declare function DatePicker(props: DatePickerProps): ReactNode;
|
|
99
|
+
export interface TextEditorProps extends ViewModifiers {
|
|
100
|
+
text: BindingValue<string>;
|
|
101
|
+
onChange?: (text: string) => void;
|
|
102
|
+
focused?: BindingValue<boolean>;
|
|
103
|
+
}
|
|
104
|
+
/** `TextEditor(text:)`: a multi-line field filling its proposal. */
|
|
105
|
+
export declare function TextEditor(props: TextEditorProps): ReactNode;
|
|
106
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../src/components/controls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqD,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACxH,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAG5D,OAAO,EAAsE,KAAK,wBAAwB,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AASrJ,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,aAAa,GAAG,QAAQ,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,CAmBpD;AAMD,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,CAKpD;AAMD,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,CAAC,CAAC;CAC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,gBAAgB,GAAG,SAAS,CAE9D;AAED,eAAO,MAAM,gBAAgB,oBAAc,CAAC;AAM5C,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,eAAe,GAAG,aAAa,CAAC;AAE5E,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,iDAAiD;IACjD,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;IAC3C,oBAAoB;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;CAC7C;AAED,8FAA8F;AAC9F,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAe5D;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;CACjC;AAED,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAU5D"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `GeometryReader` and custom `Layout`: both are round trips with the
|
|
3
|
+
* renderer. The engine lays the element out and reports what it found (a
|
|
4
|
+
* `geometry` event with the size, a `layout` event with the children's
|
|
5
|
+
* measurements); the component answers by rendering again.
|
|
6
|
+
*/
|
|
7
|
+
import type { LayoutChildMeasurement } from '@swiftbrowser/web/src/protocol';
|
|
8
|
+
import { type ReactNode } from 'react';
|
|
9
|
+
import { type ViewModifiers } from '../modifiers';
|
|
10
|
+
import { type UnitPointValue } from '../values';
|
|
11
|
+
export interface Size {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export interface Rect extends Size {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}
|
|
19
|
+
/** A reader's safe-area insets, every edge given. */
|
|
20
|
+
export interface SafeAreaInsets {
|
|
21
|
+
top: number;
|
|
22
|
+
leading: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
trailing: number;
|
|
25
|
+
}
|
|
26
|
+
/** `GeometryProxy`: what the reader's content is told. */
|
|
27
|
+
export interface GeometryProxy {
|
|
28
|
+
size: Size;
|
|
29
|
+
/**
|
|
30
|
+
* The reader's frame: in its own space (`local`, the default), on the
|
|
31
|
+
* root's screen (`global`), or relative to an enclosing view marked
|
|
32
|
+
* `coordinateSpace="name"` (`{ named: 'name' }`), scrolling included, kept
|
|
33
|
+
* current as the views around it scroll.
|
|
34
|
+
*/
|
|
35
|
+
frame(space?: 'local' | 'global' | {
|
|
36
|
+
named: string;
|
|
37
|
+
}): Rect;
|
|
38
|
+
/** How far the device's safe area (the status bar, the home indicator) reaches into the reader. */
|
|
39
|
+
safeAreaInsets: SafeAreaInsets;
|
|
40
|
+
}
|
|
41
|
+
export interface GeometryReaderProps extends ViewModifiers {
|
|
42
|
+
children: (proxy: GeometryProxy) => ReactNode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* `GeometryReader { proxy in }`: fills its proposal and reports its size.
|
|
46
|
+
* The content renders with a zero size first and again with the real one in
|
|
47
|
+
* the same event cycle, before the page paints. A content that reads the
|
|
48
|
+
* global frame or the safe-area insets asks the page for them from then on.
|
|
49
|
+
*/
|
|
50
|
+
export declare function GeometryReader(props: GeometryReaderProps): ReactNode;
|
|
51
|
+
/** A proposal axis: points, `Infinity`, or `null` (unspecified). */
|
|
52
|
+
export interface LayoutProposal {
|
|
53
|
+
width: number | null;
|
|
54
|
+
height: number | null;
|
|
55
|
+
}
|
|
56
|
+
export interface LayoutSubview {
|
|
57
|
+
/** The engine's answers for a zero, unspecified and infinite proposal. */
|
|
58
|
+
min: Size;
|
|
59
|
+
ideal: Size;
|
|
60
|
+
max: Size;
|
|
61
|
+
/** `.layoutPriority` of the subview (0 by default). */
|
|
62
|
+
priority: number;
|
|
63
|
+
/** `.layoutValue(key:value:)`s of the subview (`subview[Key.self]`). */
|
|
64
|
+
values: Readonly<Record<string, unknown>>;
|
|
65
|
+
/** `ViewSpacing`: the space the subview wants beside another, iOS's default 8 between views. */
|
|
66
|
+
spacing: ViewSpacing;
|
|
67
|
+
/** The size for a proposal: `ideal` on an unspecified axis, else clamped to min…max. */
|
|
68
|
+
sizeThatFits(proposal: LayoutProposal): Size;
|
|
69
|
+
/** Place the subview: `at` is the point `anchor` (default top leading) lands on, in the layout's bounds. */
|
|
70
|
+
place(options: {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
anchor?: UnitPointValue;
|
|
74
|
+
proposal?: LayoutProposal;
|
|
75
|
+
}): void;
|
|
76
|
+
}
|
|
77
|
+
/** `ViewSpacing`: what a subview wants between itself and a neighbor. */
|
|
78
|
+
export interface ViewSpacing {
|
|
79
|
+
/** `distance(to:along:)`: the space between this subview and `next` on an axis. */
|
|
80
|
+
distance(next: ViewSpacing, axis: 'horizontal' | 'vertical'): number;
|
|
81
|
+
}
|
|
82
|
+
/** iOS's default space between two views, the renderer's stack spacing when none is given. */
|
|
83
|
+
export declare const DEFAULT_VIEW_SPACING: ViewSpacing;
|
|
84
|
+
export type LayoutGuide = 'leading' | 'horizontalCenter' | 'trailing' | 'top' | 'verticalCenter' | 'bottom' | 'firstTextBaseline' | 'lastTextBaseline';
|
|
85
|
+
/** SwiftUI's `Layout` protocol: the two methods, an optional cache shared by them, and explicit alignment guides. */
|
|
86
|
+
export interface CustomLayout<Cache = unknown> {
|
|
87
|
+
sizeThatFits(proposal: LayoutProposal, subviews: readonly LayoutSubview[], cache: Cache): Size;
|
|
88
|
+
placeSubviews(bounds: Rect, proposal: LayoutProposal, subviews: readonly LayoutSubview[], cache: Cache): void;
|
|
89
|
+
/** `makeCache(subviews:)`: computed once for the subviews, before sizing and placing. */
|
|
90
|
+
makeCache?(subviews: readonly LayoutSubview[]): Cache;
|
|
91
|
+
/**
|
|
92
|
+
* `explicitAlignment(of:in:proposal:subviews:cache:)`: where the layout
|
|
93
|
+
* puts a guide, in its bounds (null: the guide's default). A stack, frame
|
|
94
|
+
* or overlay aligning the layout by that guide uses it.
|
|
95
|
+
*/
|
|
96
|
+
explicitAlignment?(guide: LayoutGuide, bounds: Rect, proposal: LayoutProposal, subviews: readonly LayoutSubview[], cache: Cache): number | null;
|
|
97
|
+
/** `spacing(subviews:cache:)`: accepted; the engine spaces the layout like any view (8 by default). */
|
|
98
|
+
spacing?(subviews: readonly LayoutSubview[], cache: Cache): ViewSpacing;
|
|
99
|
+
}
|
|
100
|
+
/** What `Layout` reads from each subview's element besides the engine's measurements. */
|
|
101
|
+
export interface SubviewTraits {
|
|
102
|
+
priority: number;
|
|
103
|
+
values: Record<string, unknown>;
|
|
104
|
+
}
|
|
105
|
+
export interface LayoutProps<Cache = unknown> extends ViewModifiers {
|
|
106
|
+
layout: CustomLayout<Cache>;
|
|
107
|
+
children?: ReactNode;
|
|
108
|
+
}
|
|
109
|
+
interface LayoutRecord {
|
|
110
|
+
proposal: LayoutProposal;
|
|
111
|
+
children: LayoutChildMeasurement[];
|
|
112
|
+
}
|
|
113
|
+
/** Run the layout for a record: the size, the frames and the min/ideal/max sizes. */
|
|
114
|
+
export declare function answerLayout<Cache>(layout: CustomLayout<Cache>, record: LayoutRecord, traits?: readonly SubviewTraits[]): {
|
|
115
|
+
size: Size;
|
|
116
|
+
frames: Rect[];
|
|
117
|
+
sizes: {
|
|
118
|
+
min: Size;
|
|
119
|
+
ideal: Size;
|
|
120
|
+
max: Size;
|
|
121
|
+
};
|
|
122
|
+
guides: Partial<Record<LayoutGuide, number>>;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* `Layout`: a custom layout the engine asks for sizes and frames. Until the
|
|
126
|
+
* first answer the element fills its proposal; then it answers from the
|
|
127
|
+
* layout's own `sizeThatFits` and `placeSubviews`.
|
|
128
|
+
*/
|
|
129
|
+
export declare function Layout<Cache = unknown>(props: LayoutProps<Cache>): ReactNode;
|
|
130
|
+
export {};
|
|
131
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/components/geometry.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAa,sBAAsB,EAAsC,MAAM,gCAAgC,CAAC;AAC5H,OAAO,EAA0C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAgD,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAI3D,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAK,SAAQ,IAAI;IAChC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5D,mGAAmG;IACnG,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,MAAM,WAAW,mBA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M,EAAE,YAAY,EACpB,MAAM,GAAE,SAAS,aAAa,EAAO,GACpC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,IAAI,EAAE,CAAC;IAAC,KAAK,EAAE;QAAE,GAAG,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,IAAI,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAqD5H;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,SAAS,CAsC5E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Host`: ordinary React DOM inside a SwiftUI tree. The children render in a
|
|
3
|
+
* react-dom root of their own, inside a `host` element the layout engine
|
|
4
|
+
* sizes (docs/ops-protocol.md, "Host elements"): by its content, like text,
|
|
5
|
+
* or filling its proposal. The DOM content sees this package's contexts
|
|
6
|
+
* (`useDismiss`, `useNavigation`, the environment) and any it names.
|
|
7
|
+
*/
|
|
8
|
+
import { type CSSProperties, type Context, type ReactNode } from 'react';
|
|
9
|
+
import { type ViewModifiers } from '../modifiers';
|
|
10
|
+
export interface HostProps extends ViewModifiers {
|
|
11
|
+
/**
|
|
12
|
+
* `content` (the default): the box is as wide as the content wants, at most
|
|
13
|
+
* the proposed width, and as tall as the content at that width. `fill`:
|
|
14
|
+
* the box takes the proposal (combine with `frame`); the content fills it.
|
|
15
|
+
*/
|
|
16
|
+
sizing?: 'fill' | 'content';
|
|
17
|
+
/** Contexts of the SwiftUI tree the DOM content reads (this package's own always cross). */
|
|
18
|
+
contexts?: readonly Context<unknown>[];
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare function Host(props: HostProps): ReactNode;
|
|
24
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/components/host.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAuD,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9H,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,SAAS,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAiDhD"}
|
|
@@ -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;AAU5F,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,CAsChE;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,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