@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,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Canvas`: a `GeometryReader` whose content, at the reported size, is a
|
|
3
|
+
* `canvas` element. The renderer function draws into a `GraphicsContext`
|
|
4
|
+
* that records commands, as Sources/SwiftUI/API/Canvas.swift does; the page
|
|
5
|
+
* draws them as SVG.
|
|
6
|
+
*/
|
|
7
|
+
import type { CanvasCommand, CanvasFilter } from '@swiftbrowser/web/src/protocol';
|
|
8
|
+
import { type ReactNode } from 'react';
|
|
9
|
+
import { type ViewModifiers } from '../modifiers';
|
|
10
|
+
import type { Path, Point } from '../path';
|
|
11
|
+
import { type ColorValue, type FontValue, type StyleValue, type UnitPointValue } from '../values';
|
|
12
|
+
type Matrix = [number, number, number, number, number, number];
|
|
13
|
+
/** A shading in the drawing's coordinates: a style, or a gradient between two points. */
|
|
14
|
+
export type Shading = StyleValue | {
|
|
15
|
+
linearGradient: {
|
|
16
|
+
colors?: ColorValue[];
|
|
17
|
+
stops?: {
|
|
18
|
+
color: ColorValue;
|
|
19
|
+
location: number;
|
|
20
|
+
}[];
|
|
21
|
+
start: Point;
|
|
22
|
+
end: Point;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
radialGradient: {
|
|
26
|
+
colors?: ColorValue[];
|
|
27
|
+
stops?: {
|
|
28
|
+
color: ColorValue;
|
|
29
|
+
location: number;
|
|
30
|
+
}[];
|
|
31
|
+
center: Point;
|
|
32
|
+
startRadius: number;
|
|
33
|
+
endRadius: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export interface StrokeOptions {
|
|
37
|
+
lineWidth?: number;
|
|
38
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
39
|
+
lineJoin?: 'miter' | 'round' | 'bevel';
|
|
40
|
+
miterLimit?: number;
|
|
41
|
+
dash?: number[];
|
|
42
|
+
dashPhase?: number;
|
|
43
|
+
}
|
|
44
|
+
/** What a canvas image is: a symbol, a catalog image, or a remote image of a known size. */
|
|
45
|
+
export type CanvasImage = {
|
|
46
|
+
systemName: string;
|
|
47
|
+
} | {
|
|
48
|
+
name: string;
|
|
49
|
+
} | {
|
|
50
|
+
url: string;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
};
|
|
54
|
+
/** A view passed in `Canvas`'s `symbols`, resolved by its id. */
|
|
55
|
+
export interface ResolvedSymbol {
|
|
56
|
+
symbol: string;
|
|
57
|
+
}
|
|
58
|
+
/** Where a symbol was drawn: the point (the context's transform applied) and the look at that moment. */
|
|
59
|
+
export interface SymbolDraw {
|
|
60
|
+
id: string;
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
rotation: number;
|
|
64
|
+
scale: {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
};
|
|
68
|
+
opacity: number;
|
|
69
|
+
}
|
|
70
|
+
/** `GraphicsContext`: what `Canvas`'s renderer draws with. Methods return the context for chaining. */
|
|
71
|
+
export declare class GraphicsContext {
|
|
72
|
+
readonly size: {
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
};
|
|
76
|
+
readonly commands: CanvasCommand[];
|
|
77
|
+
readonly symbolDraws: SymbolDraw[];
|
|
78
|
+
private symbolIds;
|
|
79
|
+
/** @internal The ids `symbols` gave the canvas. */
|
|
80
|
+
setSymbols(ids: Iterable<string>): void;
|
|
81
|
+
/** `resolveSymbol(id:)`: the view the canvas was given under `id`, or null. */
|
|
82
|
+
resolveSymbol(id: string): ResolvedSymbol | null;
|
|
83
|
+
/**
|
|
84
|
+
* `draw(symbol, at:)`: the symbol's view centered on the point. Symbols are
|
|
85
|
+
* views laid over the drawing, so they draw above its other commands.
|
|
86
|
+
*/
|
|
87
|
+
drawSymbol(symbol: ResolvedSymbol, at: Point): this;
|
|
88
|
+
private state;
|
|
89
|
+
constructor(size: {
|
|
90
|
+
width: number;
|
|
91
|
+
height: number;
|
|
92
|
+
});
|
|
93
|
+
get opacity(): number;
|
|
94
|
+
set opacity(value: number);
|
|
95
|
+
get blendMode(): string | undefined;
|
|
96
|
+
set blendMode(value: string | undefined);
|
|
97
|
+
translateBy(x: number, y: number): this;
|
|
98
|
+
scaleBy(x: number, y?: number): this;
|
|
99
|
+
/** Degrees, clockwise on screen. */
|
|
100
|
+
rotate(degrees: number): this;
|
|
101
|
+
concatenate(matrix: Matrix): this;
|
|
102
|
+
clip(to: Path): this;
|
|
103
|
+
addFilter(filter: CanvasFilter): this;
|
|
104
|
+
/** `drawLayer { }`: draws with a copy of the state, restored after. */
|
|
105
|
+
drawLayer(body: (context: GraphicsContext) => void): this;
|
|
106
|
+
fill(path: Path, with_: Shading, options?: {
|
|
107
|
+
eoFill?: boolean;
|
|
108
|
+
}): this;
|
|
109
|
+
stroke(path: Path, with_: Shading, options?: StrokeOptions | number): this;
|
|
110
|
+
/** `draw(Text(...), at:anchor:)` */
|
|
111
|
+
drawText(text: string, at: Point, options?: {
|
|
112
|
+
anchor?: UnitPointValue;
|
|
113
|
+
font?: FontValue;
|
|
114
|
+
color?: StyleValue;
|
|
115
|
+
}): this;
|
|
116
|
+
/** `draw(Image(...), at:anchor:)` or `draw(_:in:)` with `size`. */
|
|
117
|
+
drawImage(image: CanvasImage, at: Point, options?: {
|
|
118
|
+
anchor?: UnitPointValue;
|
|
119
|
+
size?: {
|
|
120
|
+
width: number;
|
|
121
|
+
height: number;
|
|
122
|
+
};
|
|
123
|
+
color?: StyleValue;
|
|
124
|
+
}): this;
|
|
125
|
+
private push;
|
|
126
|
+
}
|
|
127
|
+
export interface CanvasProps extends ViewModifiers {
|
|
128
|
+
/** `Canvas { context, size in }` */
|
|
129
|
+
renderer: (context: GraphicsContext, size: {
|
|
130
|
+
width: number;
|
|
131
|
+
height: number;
|
|
132
|
+
}) => void;
|
|
133
|
+
/** `Canvas(renderer:symbols:)`: views the renderer draws by id (`resolveSymbol`, `drawSymbol`). */
|
|
134
|
+
symbols?: Record<string, ReactNode>;
|
|
135
|
+
}
|
|
136
|
+
export declare function Canvas(props: CanvasProps): ReactNode;
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/components/canvas.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAkD,MAAM,gCAAgC,CAAC;AAClI,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAsC,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEtI,KAAK,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAU/D,yFAAyF;AACzF,MAAM,MAAM,OAAO,GACf,UAAU,GACV;IAAE,cAAc,EAAE;QAAE,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE;YAAE,KAAK,EAAE,UAAU,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC;QAAC,GAAG,EAAE,KAAK,CAAA;KAAE,CAAA;CAAE,GAC1H;IAAE,cAAc,EAAE;QAAE,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE;YAAE,KAAK,EAAE,UAAU,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAAC,MAAM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AO,EAAE,OAAO,GAAE,aAAa,GAAG,MAAW,GAAG,IAAI;IAY9E,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,cAAc,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAC;QAAC,KAAK,CAAC,EAAE,UAAU,CAAA;KAAO,GAAG,IAAI;IAcxH,mEAAmE;IACnE,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,cAAc,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,KAAK,CAAC,EAAE,UAAU,CAAA;KAAO,GAAG,IAAI;IAevJ,OAAO,CAAC,IAAI;CASb;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,oCAAoC;IACpC,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACtF,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACrC;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,CAmCpD"}
|
|
@@ -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,SAAS,CAAC;CACpB;AAED,UAAU,UAAU;IAClB,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,6FAA6F;IAC7F,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED,MAAM,WAAW,YAAa,SAAQ,UA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AK,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;IACtD,iEAAiE;IACjE,IAAI,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IAC1C,uCAAuC;IACvC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAGhE;AAOD,MAAM,WAAW,eAAgB,SAAQ,aAAa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AW,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":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,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,161 @@
|
|
|
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 { GeometryEvent, 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
|
+
/**
|
|
39
|
+
* `bounds(of: .scrollView)`: the visible part of the scroll view (or list)
|
|
40
|
+
* the reader is in, in the reader's own coordinates; null outside one.
|
|
41
|
+
*/
|
|
42
|
+
bounds(of: 'scrollView'): Rect | null;
|
|
43
|
+
/** How far the device's safe area (the status bar, the home indicator) reaches into the reader. */
|
|
44
|
+
safeAreaInsets: SafeAreaInsets;
|
|
45
|
+
}
|
|
46
|
+
export interface GeometryReaderProps extends ViewModifiers {
|
|
47
|
+
children: (proxy: GeometryProxy) => ReactNode;
|
|
48
|
+
}
|
|
49
|
+
/** What the page last reported about a reader. */
|
|
50
|
+
export interface ReportedGeometry {
|
|
51
|
+
size: Size;
|
|
52
|
+
origin: {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
} | null;
|
|
56
|
+
safeArea: SafeAreaInsets;
|
|
57
|
+
/** The enclosing scroll view's visible rectangle on screen, and its axis. */
|
|
58
|
+
scrollView: (Rect & {
|
|
59
|
+
axis: 'horizontal' | 'vertical';
|
|
60
|
+
}) | null;
|
|
61
|
+
}
|
|
62
|
+
export declare const NO_GEOMETRY: ReportedGeometry;
|
|
63
|
+
/** The reader's record after a `geometry` event. */
|
|
64
|
+
export declare function nextGeometry(event: GeometryEvent, reported: ReportedGeometry): ReportedGeometry;
|
|
65
|
+
/**
|
|
66
|
+
* The proxy over a reader's record. `onReadFrame` is called when the content
|
|
67
|
+
* reads anything that needs the reader's place on screen.
|
|
68
|
+
*/
|
|
69
|
+
export declare function geometryProxy(reported: ReportedGeometry, spaces: Readonly<Record<string, {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
} | null>>, onReadFrame: () => void): GeometryProxy;
|
|
73
|
+
/**
|
|
74
|
+
* `GeometryReader { proxy in }`: fills its proposal and reports its size.
|
|
75
|
+
* The content renders with a zero size first and again with the real one in
|
|
76
|
+
* the same event cycle, before the page paints. A content that reads the
|
|
77
|
+
* global frame, the scroll view's bounds or the safe-area insets asks the
|
|
78
|
+
* page for them from then on.
|
|
79
|
+
*/
|
|
80
|
+
export declare function GeometryReader(props: GeometryReaderProps): ReactNode;
|
|
81
|
+
/** A proposal axis: points, `Infinity`, or `null` (unspecified). */
|
|
82
|
+
export interface LayoutProposal {
|
|
83
|
+
width: number | null;
|
|
84
|
+
height: number | null;
|
|
85
|
+
}
|
|
86
|
+
export interface LayoutSubview {
|
|
87
|
+
/** The engine's answers for a zero, unspecified and infinite proposal. */
|
|
88
|
+
min: Size;
|
|
89
|
+
ideal: Size;
|
|
90
|
+
max: Size;
|
|
91
|
+
/** `.layoutPriority` of the subview (0 by default). */
|
|
92
|
+
priority: number;
|
|
93
|
+
/** `.layoutValue(key:value:)`s of the subview (`subview[Key.self]`). */
|
|
94
|
+
values: Readonly<Record<string, unknown>>;
|
|
95
|
+
/** `ViewSpacing`: the space the subview wants beside another, iOS's default 8 between views. */
|
|
96
|
+
spacing: ViewSpacing;
|
|
97
|
+
/** The size for a proposal: `ideal` on an unspecified axis, else clamped to min…max. */
|
|
98
|
+
sizeThatFits(proposal: LayoutProposal): Size;
|
|
99
|
+
/** Place the subview: `at` is the point `anchor` (default top leading) lands on, in the layout's bounds. */
|
|
100
|
+
place(options: {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
anchor?: UnitPointValue;
|
|
104
|
+
proposal?: LayoutProposal;
|
|
105
|
+
}): void;
|
|
106
|
+
}
|
|
107
|
+
/** `ViewSpacing`: what a subview wants between itself and a neighbor. */
|
|
108
|
+
export interface ViewSpacing {
|
|
109
|
+
/** `distance(to:along:)`: the space between this subview and `next` on an axis. */
|
|
110
|
+
distance(next: ViewSpacing, axis: 'horizontal' | 'vertical'): number;
|
|
111
|
+
}
|
|
112
|
+
/** iOS's default space between two views, the renderer's stack spacing when none is given. */
|
|
113
|
+
export declare const DEFAULT_VIEW_SPACING: ViewSpacing;
|
|
114
|
+
export type LayoutGuide = 'leading' | 'horizontalCenter' | 'trailing' | 'top' | 'verticalCenter' | 'bottom' | 'firstTextBaseline' | 'lastTextBaseline';
|
|
115
|
+
/** SwiftUI's `Layout` protocol: the two methods, an optional cache shared by them, and explicit alignment guides. */
|
|
116
|
+
export interface CustomLayout<Cache = unknown> {
|
|
117
|
+
sizeThatFits(proposal: LayoutProposal, subviews: readonly LayoutSubview[], cache: Cache): Size;
|
|
118
|
+
placeSubviews(bounds: Rect, proposal: LayoutProposal, subviews: readonly LayoutSubview[], cache: Cache): void;
|
|
119
|
+
/** `makeCache(subviews:)`: computed once for the subviews, before sizing and placing. */
|
|
120
|
+
makeCache?(subviews: readonly LayoutSubview[]): Cache;
|
|
121
|
+
/**
|
|
122
|
+
* `explicitAlignment(of:in:proposal:subviews:cache:)`: where the layout
|
|
123
|
+
* puts a guide, in its bounds (null: the guide's default). A stack, frame
|
|
124
|
+
* or overlay aligning the layout by that guide uses it.
|
|
125
|
+
*/
|
|
126
|
+
explicitAlignment?(guide: LayoutGuide, bounds: Rect, proposal: LayoutProposal, subviews: readonly LayoutSubview[], cache: Cache): number | null;
|
|
127
|
+
/** `spacing(subviews:cache:)`: accepted; the engine spaces the layout like any view (8 by default). */
|
|
128
|
+
spacing?(subviews: readonly LayoutSubview[], cache: Cache): ViewSpacing;
|
|
129
|
+
}
|
|
130
|
+
/** What `Layout` reads from each subview's element besides the engine's measurements. */
|
|
131
|
+
export interface SubviewTraits {
|
|
132
|
+
priority: number;
|
|
133
|
+
values: Record<string, unknown>;
|
|
134
|
+
}
|
|
135
|
+
export interface LayoutProps<Cache = unknown> extends ViewModifiers {
|
|
136
|
+
layout: CustomLayout<Cache>;
|
|
137
|
+
children?: ReactNode;
|
|
138
|
+
}
|
|
139
|
+
interface LayoutRecord {
|
|
140
|
+
proposal: LayoutProposal;
|
|
141
|
+
children: LayoutChildMeasurement[];
|
|
142
|
+
}
|
|
143
|
+
/** Run the layout for a record: the size, the frames and the min/ideal/max sizes. */
|
|
144
|
+
export declare function answerLayout<Cache>(layout: CustomLayout<Cache>, record: LayoutRecord, traits?: readonly SubviewTraits[]): {
|
|
145
|
+
size: Size;
|
|
146
|
+
frames: Rect[];
|
|
147
|
+
sizes: {
|
|
148
|
+
min: Size;
|
|
149
|
+
ideal: Size;
|
|
150
|
+
max: Size;
|
|
151
|
+
};
|
|
152
|
+
guides: Partial<Record<LayoutGuide, number>>;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* `Layout`: a custom layout the engine asks for sizes and frames. Until the
|
|
156
|
+
* first answer the element fills its proposal; then it answers from the
|
|
157
|
+
* layout's own `sizeThatFits` and `placeSubviews`.
|
|
158
|
+
*/
|
|
159
|
+
export declare function Layout<Cache = unknown>(props: LayoutProps<Cache>): ReactNode;
|
|
160
|
+
export {};
|
|
161
|
+
//# 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,aAAa,EAAE,sBAAsB,EAAsC,MAAM,gCAAgC,CAAC;AAC3I,OAAO,EAA0C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAgD,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAAa,K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CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAUD,UAAU,YAAY;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CACpC;AAeD,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,KAAK,EAChC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,EAC3B,MAAM,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,CA8DhD"}
|