@swiftbrowser/react 0.9.7 → 0.9.9
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 +13 -0
- package/dist/components/stacks.d.ts +9 -0
- package/dist/components/stacks.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +76 -32
- package/dist/index.js.map +1 -1
- package/dist/island.d.ts +10 -1
- package/dist/island.d.ts.map +1 -1
- package/dist/mount.d.ts +8 -0
- package/dist/mount.d.ts.map +1 -1
- package/dist/scrollReader.d.ts +29 -3
- package/dist/scrollReader.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/island.d.ts
CHANGED
|
@@ -35,6 +35,15 @@ export interface SwiftUIViewProps {
|
|
|
35
35
|
* owns the history.
|
|
36
36
|
*/
|
|
37
37
|
history?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Follow the on-screen keyboard: its height becomes a bottom inset, so a
|
|
40
|
+
* field, a bottom search field or a chat's composer rises above it and a
|
|
41
|
+
* list stops above it, as on iOS, instead of the browser panning the page
|
|
42
|
+
* to the field. On by default for a `fill` island, which fills the layout
|
|
43
|
+
* viewport as a full-screen app; a `content` island in a page leaves the
|
|
44
|
+
* page to the browser.
|
|
45
|
+
*/
|
|
46
|
+
keyboard?: boolean;
|
|
38
47
|
className?: string;
|
|
39
48
|
style?: CSSProperties;
|
|
40
49
|
}
|
|
@@ -45,6 +54,6 @@ interface SafeAreaInsets {
|
|
|
45
54
|
trailing: number;
|
|
46
55
|
}
|
|
47
56
|
export declare function insetsOf(safeArea: SwiftUIViewProps['safeArea'], fit: 'fill' | 'content'): SafeAreaInsets;
|
|
48
|
-
export declare function SwiftUIView({ children, fit, colorScheme, dynamicTypeSize, contexts, assets, safeArea, history, className, style, }: SwiftUIViewProps): ReactNode;
|
|
57
|
+
export declare function SwiftUIView({ children, fit, colorScheme, dynamicTypeSize, contexts, assets, safeArea, history, keyboard, className, style, }: SwiftUIViewProps): ReactNode;
|
|
49
58
|
export {};
|
|
50
59
|
//# sourceMappingURL=island.d.ts.map
|
package/dist/island.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"island.d.ts","sourceRoot":"","sources":["../src/island.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEnF,OAAO,EAA2B,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,uFAAuF;IACvF,QAAQ,CAAC,EAAE,SAAS,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IACvC,sFAAsF;IACtF,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5C;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAKD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc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;AAKD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAGxG;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,GAAY,EACZ,WAAqB,EACrB,eAAyB,EACzB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAc,EACd,QAAyB,EACzB,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB,GAAG,SAAS,CAoD9B"}
|
package/dist/mount.d.ts
CHANGED
|
@@ -38,6 +38,14 @@ export interface MountOptions {
|
|
|
38
38
|
* router owns it.
|
|
39
39
|
*/
|
|
40
40
|
history?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Follow the on-screen keyboard (a phone's): its height becomes a bottom
|
|
43
|
+
* inset, so a field, a bottom search field or a chat's composer rises
|
|
44
|
+
* above it and a list stops above it, as on iOS, instead of the browser
|
|
45
|
+
* panning the page to the field. For a root that fills the layout
|
|
46
|
+
* viewport (a full-screen app); off by default.
|
|
47
|
+
*/
|
|
48
|
+
keyboard?: boolean;
|
|
41
49
|
}
|
|
42
50
|
export interface Mounted {
|
|
43
51
|
root: SwiftUIRoot;
|
package/dist/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA0B,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAChH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA0B,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAChH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACrF,mFAAmF;IACnF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,CAAC,WAAW,EAAE;QAAE,WAAW,CAAC,EAAE,WAAW,CAAC;QAAC,eAAe,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,IAAI,CAAC;IACpG,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAqElG"}
|
package/dist/scrollReader.d.ts
CHANGED
|
@@ -3,18 +3,28 @@
|
|
|
3
3
|
* marks the view with that id with a `scrollTo` command whose serial is new,
|
|
4
4
|
* and the page scrolls every scrolling ancestor to it after the pass.
|
|
5
5
|
*/
|
|
6
|
-
import type { UnitPoint } from '@swiftbrowser/web/src/protocol';
|
|
6
|
+
import type { ScrollAxes, UnitPoint } from '@swiftbrowser/web/src/protocol';
|
|
7
7
|
import { type ReactNode } from 'react';
|
|
8
|
+
import { type BindingValue } from './binding';
|
|
8
9
|
import { type UnitPointValue } from './values';
|
|
9
10
|
interface ScrollRequest {
|
|
10
11
|
id: string | number;
|
|
11
12
|
anchor: UnitPoint | null;
|
|
12
13
|
serial: number;
|
|
14
|
+
/** The axes to scroll on; both when absent. */
|
|
15
|
+
axes?: ScrollAxes;
|
|
13
16
|
}
|
|
14
17
|
export declare const ScrollRequestContext: import("react").Context<ScrollRequest | null>;
|
|
15
18
|
export interface ScrollViewProxy {
|
|
16
|
-
/**
|
|
17
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Scroll so `anchor` of the view with that `scrollID` meets the same point
|
|
21
|
+
* of the visible area; no anchor: as little as shows it. Every scrolling
|
|
22
|
+
* ancestor moves on its axes, or only on `axes` when given (a horizontal
|
|
23
|
+
* pager inside a list: `{ axes: 'horizontal' }` leaves the list where it is).
|
|
24
|
+
*/
|
|
25
|
+
scrollTo(id: string | number, anchor?: UnitPointValue, options?: {
|
|
26
|
+
axes?: ScrollAxes;
|
|
27
|
+
}): void;
|
|
18
28
|
}
|
|
19
29
|
export declare function ScrollViewReader({ children }: {
|
|
20
30
|
children: (proxy: ScrollViewProxy) => ReactNode;
|
|
@@ -23,5 +33,21 @@ export declare function ScrollTarget({ id, children }: {
|
|
|
23
33
|
id: string | number;
|
|
24
34
|
children?: ReactNode;
|
|
25
35
|
}): ReactNode;
|
|
36
|
+
/** What a `scrollPosition` scroll view hands the targets inside it: where to say they came to the anchor. */
|
|
37
|
+
export declare const ScrollPositionContext: import("react").Context<{
|
|
38
|
+
report: (id: string | number) => void;
|
|
39
|
+
} | null>;
|
|
40
|
+
export type ScrollPositionValue = string | number | null;
|
|
41
|
+
/**
|
|
42
|
+
* `scrollPosition={[id, setId]}` on a `ScrollView` (`.scrollPosition(id:anchor:)`):
|
|
43
|
+
* the scroll view reports the target at its anchor when scrolling settles
|
|
44
|
+
* (`reportsPosition`), and a value the app sets, the first included, scrolls
|
|
45
|
+
* to that target, as `proxy.scrollTo` would. A value the page just reported
|
|
46
|
+
* scrolls nowhere.
|
|
47
|
+
*/
|
|
48
|
+
export declare function useScrollPosition(binding: BindingValue<ScrollPositionValue> | undefined, anchor: UnitPointValue | undefined, axes: ScrollAxes): {
|
|
49
|
+
props: Record<string, unknown>;
|
|
50
|
+
provide(children: ReactNode): ReactNode;
|
|
51
|
+
} | null;
|
|
26
52
|
export {};
|
|
27
53
|
//# sourceMappingURL=scrollReader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollReader.d.ts","sourceRoot":"","sources":["../src/scrollReader.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"scrollReader.d.ts","sourceRoot":"","sources":["../src/scrollReader.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAI3D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1D,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAOD,eAAO,MAAM,oBAAoB,+CAA4C,CAAC;AAG9E,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI,CAAC;CAC/F;AAED,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,SAAS,CAAA;CAAE,GAAG,SAAS,CAM7G;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAQvG;AAED,6GAA6G;AAC7G,eAAO,MAAM,qBAAqB;YAA2B,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI;SAAgB,CAAC;AAE3G,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,CAAC,mBAAmB,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,GAAG,IAAI,CAkClO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swiftbrowser/react",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SwiftUI's components for React: a react-reconciler host that emits SwiftBrowser render ops into the @swiftbrowser/web renderer, so a pure React/TypeScript web app gets the same iOS UI as a SwiftUI app in the browser.",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test:unit": "vitest run"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@swiftbrowser/web": "0.9.
|
|
32
|
+
"@swiftbrowser/web": "0.9.9"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^19.0.0",
|