@swiftbrowser/react 0.28.1 → 0.28.3
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 +53 -5
- package/dist/bitmaps.d.ts +80 -0
- package/dist/bitmaps.d.ts.map +1 -0
- package/dist/components/text.d.ts +12 -0
- package/dist/components/text.d.ts.map +1 -1
- package/dist/host/remote.d.ts.map +1 -1
- package/dist/host/tree.d.ts +4 -0
- package/dist/host/tree.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +207 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -373,7 +373,12 @@ a row from the leading edge, a `Spacer` pushing the rest to the trailing
|
|
|
373
373
|
edge; it is hidden while nothing in the screen is being edited. A `Label`
|
|
374
374
|
in a bar shows its icon alone, its title the icon's accessible name, as iOS
|
|
375
375
|
draws a bar's labels; `labelStyle="titleAndIcon"` on it shows both, and a
|
|
376
|
-
`Menu`'s items keep their labels' title and icon.
|
|
376
|
+
`Menu`'s items keep their labels' title and icon. A `Menu` among a menu's
|
|
377
|
+
items is a submenu, as on iOS: a row with its label (a second `Text` in it
|
|
378
|
+
is a subtitle, where iOS shows the current choice) and a chevron, which
|
|
379
|
+
opens a panel of its own over the menu, headed by the label, with the menu
|
|
380
|
+
pushed back behind it until the header or the menu is tapped (a `Section`
|
|
381
|
+
is inline instead, its header a caption). Keep a bar's items the
|
|
377
382
|
same from the push's first frame: iOS sizes their glass as the push starts
|
|
378
383
|
and lays it out again only once the push ends, so an item that arrives with
|
|
379
384
|
fetched data (an Edit button once the rows are in) sits clipped in the
|
|
@@ -439,7 +444,10 @@ that is a `NavigationStack` with a `path` binding keeps what it pushes in
|
|
|
439
444
|
that binding in both widths, so an app that mirrors the path in the URL
|
|
440
445
|
sees the same path on a phone as in a wide window, and a path it starts
|
|
441
446
|
with (a reload onto a deep link) is shown over the detail; `.inspector` is a trailing panel when
|
|
442
|
-
regular and a sheet when compact
|
|
447
|
+
regular and a sheet when compact (inside a `NavigationStack`'s screen the
|
|
448
|
+
panel is a column beside the screen, the whole height, and the screen's bar
|
|
449
|
+
and content keep to the rest, as on iPadOS; through `RemoteTree` an app's
|
|
450
|
+
inspector becomes such a column of the host's screen); `Table` shows every column under sortable
|
|
443
451
|
titles when regular and the first column when compact.
|
|
444
452
|
|
|
445
453
|
```tsx
|
|
@@ -684,9 +692,10 @@ records with `MediaRecorder` (MP4 where the browser can, else WebM) into a
|
|
|
684
692
|
`blob:` URL that plays with `useAVPlayer` and a `VideoPlayer`, until
|
|
685
693
|
`discard(url)` lets it go. The native app records with an
|
|
686
694
|
`AVCaptureSession` and a movie file output into a QuickTime file in
|
|
687
|
-
`Documents/Recordings` (a `file:` URL
|
|
688
|
-
upright
|
|
689
|
-
|
|
695
|
+
`Documents/Recordings` (a `file:` URL the app can keep where it is),
|
|
696
|
+
upright as the phone is held when recording starts (sideways, a
|
|
697
|
+
landscape movie), and draws `CameraPreview` with the session's preview
|
|
698
|
+
layer, upright however the phone turns; its Info.plist names `NSCameraUsageDescription`
|
|
690
699
|
and `NSMicrophoneUsageDescription`, and `pause()` needs iOS 18.
|
|
691
700
|
|
|
692
701
|
AVFoundation's assets edit video, as an iOS app's do. `new AVURLAsset(url)`
|
|
@@ -798,6 +807,45 @@ Pages exports a document as text and Numbers a sheet as CSV with it.
|
|
|
798
807
|
</VStack>
|
|
799
808
|
```
|
|
800
809
|
|
|
810
|
+
### Bitmaps and Core Image
|
|
811
|
+
|
|
812
|
+
A picture can be drawn through Core Image's filters, as `Image(uiImage:)` of
|
|
813
|
+
a `CIImage` is. `bitmapSource(file)` registers a PNG, JPEG, GIF or WebP file
|
|
814
|
+
(bytes or a data URL) and reads its size from the header; `<Image bitmap={{
|
|
815
|
+
source, steps }} />` draws it with the steps applied in order, in Core
|
|
816
|
+
Image's space (source pixels, origin at the bottom left): `crop`,
|
|
817
|
+
`transform` (a quarter turn, a flip), `colorControls` (saturation,
|
|
818
|
+
brightness, contrast), `exposureAdjust`, `vibrance`,
|
|
819
|
+
`highlightShadowAdjust`, `colorMatrix`, `photoEffect` (Mono, Noir, Chrome,
|
|
820
|
+
Fade…), `sepiaTone`, `vignette`, `gaussianBlur`, `unsharpMask`,
|
|
821
|
+
`pixellate` and the rest of docs/ops-protocol.md, "Steps". The pixels never
|
|
822
|
+
pass through JavaScript: the page runs the steps on a canvas at the size the
|
|
823
|
+
image is shown, a native app with Core Image itself, so a slider can drive
|
|
824
|
+
them as it moves. The image is the size of the recipe's extent
|
|
825
|
+
(`bitmapExtent`) over its `scale`, and `resizable` as any image; the root
|
|
826
|
+
sends each source once, before the first image that draws it. The
|
|
827
|
+
Showcase's Files edits photos this way, keeping the edits beside the file
|
|
828
|
+
so Revert gives the original back.
|
|
829
|
+
|
|
830
|
+
```tsx
|
|
831
|
+
const source = bitmapSource(photo.dataURL);
|
|
832
|
+
<Image
|
|
833
|
+
bitmap={{ source, steps: [{ op: 'colorControls', saturation: 1.2, brightness: 0.05, contrast: 1.1 }, { op: 'photoEffect', effect: 'chrome' }] }}
|
|
834
|
+
resizable
|
|
835
|
+
aspectRatio={{ contentMode: 'fit' }}
|
|
836
|
+
/>
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
Pixels the app holds can be a source too: `liveBitmapSource(pixels, width,
|
|
840
|
+
height)` registers RGBA memory the app changes in place (a frame a worker or
|
|
841
|
+
a WebAssembly module wrote, a simulation's cells), and `<Image bitmap={{
|
|
842
|
+
source, version }} />` shows it, drawn again each time `version` rises,
|
|
843
|
+
with no image file in between. Over a `SharedArrayBuffer` the drawing reads
|
|
844
|
+
the memory itself; over plain memory each version is copied once to the
|
|
845
|
+
drawing worker. The Showcase's Life runs Conway's game this way, scaled up
|
|
846
|
+
with `interpolation="none"` so the cells stay square. A native app has no
|
|
847
|
+
live sources yet, so `liveBitmapSource` answers null there.
|
|
848
|
+
|
|
801
849
|
### Sign in with Apple
|
|
802
850
|
|
|
803
851
|
`SignInWithAppleButton` is SwiftUI's button (`label`: `signIn`, `signUp` or
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitmaps: a picture's bytes as a Core Image source, and the recipes the
|
|
3
|
+
* renderer draws over one (docs/ops-protocol.md, "Bitmaps and Core Image").
|
|
4
|
+
* `bitmapSource` registers a file (a PNG, JPEG, GIF or WebP, as bytes or a
|
|
5
|
+
* data URL) and reads its size from the header; `<Image bitmap={...} />`
|
|
6
|
+
* draws it with Core Image steps applied: crops, turns, adjustments, photo
|
|
7
|
+
* effects, blurs. The pixels never pass through JavaScript: the page runs
|
|
8
|
+
* the steps on a canvas (Web/src/imageOps.ts), a native app with Core Image.
|
|
9
|
+
* The host tree sends each source once, as an `imagedata` op before the
|
|
10
|
+
* first element that draws it (host/tree.ts).
|
|
11
|
+
*/
|
|
12
|
+
import type { BitmapStep, ImageDataOp } from '@swiftbrowser/web/src/protocol';
|
|
13
|
+
export type { BitmapPoint, BitmapStep, BitmapVector, PhotoEffect } from '@swiftbrowser/web/src/protocol';
|
|
14
|
+
/** A registered picture: the key the renderer knows it by, and its size in pixels as drawn (a JPEG's EXIF rotation applied). */
|
|
15
|
+
export interface BitmapSource {
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly width: number;
|
|
18
|
+
readonly height: number;
|
|
19
|
+
readonly mime: string;
|
|
20
|
+
}
|
|
21
|
+
/** What `<Image bitmap>` draws: `source` (null: an empty image) with `steps` applied in order, in Core Image's space (source pixels, origin at the bottom left, y up). */
|
|
22
|
+
export interface Bitmap {
|
|
23
|
+
source: BitmapSource | null;
|
|
24
|
+
steps?: readonly BitmapStep[];
|
|
25
|
+
/** For a live source (`liveBitmapSource`): a count raised each time the pixels changed in place, which draws them again. */
|
|
26
|
+
version?: number;
|
|
27
|
+
}
|
|
28
|
+
/** A rectangle in Core Image's space; infinite sides for a clamped image. */
|
|
29
|
+
export interface BitmapRect {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Registers a picture file and returns it as a source, or null when the bytes
|
|
37
|
+
* are not a PNG, JPEG, GIF or WebP file whose size the header gives (pass
|
|
38
|
+
* `width` and `height` to register one anyway). The same bytes give the same
|
|
39
|
+
* key, however often they are registered.
|
|
40
|
+
*/
|
|
41
|
+
export declare function bitmapSource(file: Uint8Array | string, options?: {
|
|
42
|
+
mime?: string;
|
|
43
|
+
width?: number;
|
|
44
|
+
height?: number;
|
|
45
|
+
}): BitmapSource | null;
|
|
46
|
+
/**
|
|
47
|
+
* Pixels the page holds as a source: RGBA (straight alpha, rows from the
|
|
48
|
+
* top), `width` × `height`, in memory the app changes in place, a frame at a
|
|
49
|
+
* time, and draws with `<Image bitmap={{ source, version }} />`, raising
|
|
50
|
+
* `version` after each change. Over a `SharedArrayBuffer` (a worker's
|
|
51
|
+
* output, a WebAssembly module's memory) the drawing reads the bytes as
|
|
52
|
+
* they are; over plain memory each version is copied once to the drawing
|
|
53
|
+
* worker. Null in a native app, whose renderer draws no pixels the app
|
|
54
|
+
* holds yet. `releaseBitmapSource` lets the pixels go once nothing shows
|
|
55
|
+
* them.
|
|
56
|
+
*/
|
|
57
|
+
export declare function liveBitmapSource(pixels: Uint8Array, width: number, height: number): BitmapSource | null;
|
|
58
|
+
export declare function releaseBitmapSource(source: BitmapSource): void;
|
|
59
|
+
/** A source's `imagedata` op, when it was registered here. */
|
|
60
|
+
export declare function bitmapSourceOp(key: string): ImageDataOp | undefined;
|
|
61
|
+
/** Keeps an `imagedata` op another tree sent (a remote tree's, host/remote.ts), so this realm's tree can send it on. */
|
|
62
|
+
export declare function registerBitmapSourceOp(op: ImageDataOp): void;
|
|
63
|
+
/** A file's type and size in pixels as drawn, from its header: PNG, JPEG (EXIF orientation 5–8 swaps the sides), GIF and WebP. */
|
|
64
|
+
export declare function imageHeader(b: Uint8Array): {
|
|
65
|
+
mime: string;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
} | null;
|
|
69
|
+
/**
|
|
70
|
+
* Where a recipe's output lies, in Core Image's space: the source's
|
|
71
|
+
* rectangle carried through the steps as Core Image's `extent` is (a crop
|
|
72
|
+
* keeps the overlap, a blur grows by three radii, a transform takes the
|
|
73
|
+
* moved rectangle's bounds, `clamp` makes it infinite). What `<Image
|
|
74
|
+
* bitmap>` sizes itself by.
|
|
75
|
+
*/
|
|
76
|
+
export declare function bitmapExtent(source: {
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
} | null, steps?: readonly BitmapStep[]): BitmapRect;
|
|
80
|
+
//# sourceMappingURL=bitmaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitmaps.d.ts","sourceRoot":"","sources":["../src/bitmaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE9E,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAEzG,gIAAgI;AAChI,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,0KAA0K;AAC1K,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAC9B,4HAA4H;IAC5H,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAOD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAE,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,YAAY,GAAG,IAAI,CAU7I;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAGvG;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE9D;AAED,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEnE;AAED,wHAAwH;AACxH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAE5D;AAwBD,kIAAkI;AAClI,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA0CjG;AA2BD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EAAE,KAAK,GAAE,SAAS,UAAU,EAAO,GAAG,UAAU,CA6D5H"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type ViewModifiers } from '../modifiers';
|
|
3
3
|
import { type ColorValue } from '../values';
|
|
4
|
+
import { type Bitmap } from '../bitmaps';
|
|
4
5
|
export interface TextProps extends ViewModifiers {
|
|
5
6
|
/**
|
|
6
7
|
* Strings and numbers, nested `<Text>`s (`Text + Text`) and inline
|
|
@@ -47,6 +48,17 @@ export interface ImageProps extends ViewModifiers {
|
|
|
47
48
|
* title, as on iOS.
|
|
48
49
|
*/
|
|
49
50
|
accessibilityLabel?: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* `Image(uiImage:)` of a Core Image recipe: a source registered with
|
|
53
|
+
* `bitmapSource` and the steps to draw it with (bitmaps.ts). Its size is
|
|
54
|
+
* the recipe's extent in pixels over `scale`; a clamped (infinite) image
|
|
55
|
+
* has none until it is cropped.
|
|
56
|
+
*/
|
|
57
|
+
bitmap?: Bitmap;
|
|
58
|
+
/** Pixels per point of a `bitmap` (`UIImage`'s `scale`): 1 by default. */
|
|
59
|
+
scale?: number;
|
|
60
|
+
/** `.interpolation(.none)`: a `bitmap` scaled up without smoothing (a QR code, pixel art). */
|
|
61
|
+
interpolation?: 'none';
|
|
50
62
|
}
|
|
51
63
|
export declare function Image(props: ImageProps): ReactNode;
|
|
52
64
|
export interface LabelProps extends ViewModifiers {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components/text.tsx"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAoD,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEpG,OAAO,EAA2B,KAAK,UAAU,EAAmC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components/text.tsx"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAoD,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEpG,OAAO,EAA2B,KAAK,UAAU,EAAmC,MAAM,WAAW,CAAC;AAEtG,O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AAG,UAAU,GAAG,SAAS,CAAC;IACzC,gHAAgH;IAChH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,qGAAqG;IACrG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,CAAC;IACvC,kGAAkG;IAClG,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;IACpC,qFAAqF;IACrF,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAuJ7C"}
|
package/dist/host/tree.d.ts
CHANGED
|
@@ -84,6 +84,8 @@ export declare class HostTree {
|
|
|
84
84
|
private committedColorScheme;
|
|
85
85
|
/** Remote: the root's props last sent. */
|
|
86
86
|
private committedRootProps;
|
|
87
|
+
/** The bitmap sources (`imagedata` keys) this tree has sent: each goes once, before the first image that draws it. */
|
|
88
|
+
private readonly sentSources;
|
|
87
89
|
constructor(sink: OpsSink, options?: HostTreeOptions);
|
|
88
90
|
/** Whether another tree draws this one (`createSwiftUIRoot(sink, { remote: true })`, for a `RemoteTree`). */
|
|
89
91
|
get remote(): boolean;
|
|
@@ -94,6 +96,8 @@ export declare class HostTree {
|
|
|
94
96
|
/** Emit the ops for everything that changed since the last commit. */
|
|
95
97
|
commit(): void;
|
|
96
98
|
flush(): Op[];
|
|
99
|
+
/** An `imagedata` op ahead of an image whose recipe's source this tree has not sent yet (bitmaps.ts). */
|
|
100
|
+
private sendBitmapSource;
|
|
97
101
|
/** Whether a pass is still animating with this completion serial. */
|
|
98
102
|
awaitsCompletion(serial: number): boolean;
|
|
99
103
|
/** Hand a renderer event to the element's handler for its type. */
|
package/dist/host/tree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/host/tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,S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AAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAqBzD,yFAAyF;IACzF,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAKpD,sEAAsE;IACtE,MAAM,IAAI,IAAI;IAKd,KAAK,IAAI,EAAE,EAAE;IA6Mb,yGAAyG;IACzG,OAAO,CAAC,gBAAgB;IASxB,qEAAqE;IACrE,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIzC,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;CAgBrC;AAED,+CAA+C;AAC/C,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAazD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export { CameraPreview, useVideoRecorder, type CameraFacing, type CameraPreviewP
|
|
|
31
31
|
export { AVAudioEngine, AVAudioFile, AVAudioInputNode, AVAudioMixerNode, AVAudioNode, AVAudioOutputNode, AVAudioPCMBuffer, AVAudioPlayerNode, AVAudioTime, AVAudioUnitDelay, AVAudioUnitDistortion, AVAudioUnitEffect, AVAudioUnitEQ, AVAudioUnitEQFilterParameters, AVAudioUnitReverb, AVAudioUnitSampler, AVAudioUnitTimePitch, noteInName, samplerZones, useAudioEngine, type AVAudioFormat, type AVAudioPlayerNodeBufferOptions, type AVAudioUnitDistortionPreset, type AVAudioUnitEQFilterType, type AVAudioUnitReverbPreset, type SamplerLoadOptions, } from './audioEngine';
|
|
32
32
|
export { GenerationError, LanguageModelSession, ResponseStream, SystemLanguageModel, useSystemLanguageModel, type GenerationErrorKind, type GenerationOptions, type LanguageModelAvailability, type LanguageModelChoice, type LanguageModelDownload, type Tool as LanguageModelTool, type LanguageModelHost, type LanguageModelSessionOptions, type LanguageModelUnavailableReason, type Response as LanguageModelResponse, } from './languageModel';
|
|
33
33
|
export { useCoordinateSpaces } from './coordinateSpace';
|
|
34
|
+
export { bitmapExtent, bitmapSource, imageHeader, liveBitmapSource, releaseBitmapSource, type Bitmap, type BitmapPoint, type BitmapRect, type BitmapSource, type BitmapStep, type BitmapVector, type PhotoEffect } from './bitmaps';
|
|
34
35
|
export { useWakeLock } from './wakeLock';
|
|
35
36
|
export { SignInWithAppleButton, signInWithApple, appleCredentialState, canSignInWithApple, configureSignInWithApple, type AppleCredentialState, type AppleIDCredential, type SignInWithAppleButtonProps, type SignInWithAppleLabel, type SignInWithAppleOptions, type SignInWithAppleStyle, } from './appleSignIn';
|
|
36
37
|
export { useGeolocation, type GeolocationFix, type GeolocationOptions, type GeolocationState, type GeolocationStatus } from './geolocation';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,2BAA2B,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3L,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC9F,YAAY,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAA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EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createContext, useContext, createElement, isValidElement, useMemo, useSyncExternalStore, useLayoutEffect, useRef, Fragment, useState, Children, useEffect, useId, cloneElement, useCallback } from "react";
|
|
2
2
|
import { DefaultEventPriority, ConcurrentRoot } from "react-reconciler/constants";
|
|
3
3
|
import Reconciler from "react-reconciler";
|
|
4
|
+
import { base64Decode, base64Encode } from "@swiftbrowser/web/src/base64";
|
|
5
|
+
import { addLiveBitmap, forgetLiveBitmap } from "@swiftbrowser/web/src/bitmaps";
|
|
4
6
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
5
7
|
import { horizontalSizeClassFor } from "@swiftbrowser/web/src/protocol";
|
|
6
8
|
import { BrowserHistory } from "@swiftbrowser/web/src/browserHistory";
|
|
@@ -16,7 +18,6 @@ import { createRoot } from "react-dom/client";
|
|
|
16
18
|
import { flushSync } from "react-dom";
|
|
17
19
|
import { ViewRegistry } from "@swiftbrowser/web/src/viewRegistry";
|
|
18
20
|
import { chooseColor } from "@swiftbrowser/web/src/colorPicker";
|
|
19
|
-
import { base64Encode } from "@swiftbrowser/web/src/base64";
|
|
20
21
|
import { timingFor } from "@swiftbrowser/web/src/animation";
|
|
21
22
|
const ViewEnvironmentContext = createContext({});
|
|
22
23
|
function useViewEnvironment() {
|
|
@@ -63,6 +64,176 @@ function usePlatform() {
|
|
|
63
64
|
function useRedacted() {
|
|
64
65
|
return useContext(ViewEnvironmentContext).redacted === true;
|
|
65
66
|
}
|
|
67
|
+
const registry = /* @__PURE__ */ new Map();
|
|
68
|
+
const byURL = /* @__PURE__ */ new Map();
|
|
69
|
+
function bitmapSource(file, options = {}) {
|
|
70
|
+
if (typeof file === "string") {
|
|
71
|
+
const known = byURL.get(file);
|
|
72
|
+
if (known !== void 0) return known;
|
|
73
|
+
const match = /^data:([^;,]*)(?:;[^,]*)?;base64,(.*)$/s.exec(file);
|
|
74
|
+
const source = match ? register(base64Decode(match[2]), match[2], { mime: match[1] || void 0, ...options }) : null;
|
|
75
|
+
byURL.set(file, source);
|
|
76
|
+
return source;
|
|
77
|
+
}
|
|
78
|
+
return register(file, null, options);
|
|
79
|
+
}
|
|
80
|
+
function register(bytes, base64, options) {
|
|
81
|
+
const header = imageHeader(bytes);
|
|
82
|
+
const width = options.width ?? header?.width;
|
|
83
|
+
const height = options.height ?? header?.height;
|
|
84
|
+
const mime = header?.mime ?? options.mime ?? "";
|
|
85
|
+
if (width === void 0 || height === void 0) return null;
|
|
86
|
+
const key = `f${fnv1a64(bytes)}`;
|
|
87
|
+
if (!registry.has(key)) registry.set(key, { op: "imagedata", key, width, height, mime, data: base64 ?? base64Encode(bytes) });
|
|
88
|
+
return { key, width, height, mime };
|
|
89
|
+
}
|
|
90
|
+
function liveBitmapSource(pixels, width, height) {
|
|
91
|
+
if (globalThis.__sbNative !== void 0) return null;
|
|
92
|
+
return { key: addLiveBitmap(pixels, width, height), width, height, mime: "" };
|
|
93
|
+
}
|
|
94
|
+
function releaseBitmapSource(source) {
|
|
95
|
+
if (source.key.startsWith("l")) forgetLiveBitmap(source.key);
|
|
96
|
+
}
|
|
97
|
+
function bitmapSourceOp(key) {
|
|
98
|
+
return registry.get(key);
|
|
99
|
+
}
|
|
100
|
+
function registerBitmapSourceOp(op) {
|
|
101
|
+
if (!registry.has(op.key)) registry.set(op.key, op);
|
|
102
|
+
}
|
|
103
|
+
function fnv1a64(bytes) {
|
|
104
|
+
let hi = 3421674724;
|
|
105
|
+
let lo = 2216829733;
|
|
106
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
107
|
+
lo = (lo ^ bytes[i]) >>> 0;
|
|
108
|
+
const loMul = lo * 435;
|
|
109
|
+
const carry = Math.floor(loMul / 4294967296);
|
|
110
|
+
const newLo = loMul >>> 0;
|
|
111
|
+
const newHi = Math.imul(hi, 435) + carry + (lo << 8 >>> 0) >>> 0;
|
|
112
|
+
hi = newHi;
|
|
113
|
+
lo = newLo;
|
|
114
|
+
}
|
|
115
|
+
return hi.toString(16).padStart(8, "0") + lo.toString(16).padStart(8, "0");
|
|
116
|
+
}
|
|
117
|
+
function imageHeader(b) {
|
|
118
|
+
const u16 = (i, little = false) => little ? b[i] | b[i + 1] << 8 : b[i] << 8 | b[i + 1];
|
|
119
|
+
const u32 = (i) => (b[i] << 24 | b[i + 1] << 16 | b[i + 2] << 8 | b[i + 3]) >>> 0;
|
|
120
|
+
if (b.length >= 24 && b[0] === 137 && b[1] === 80 && b[2] === 78 && b[3] === 71) {
|
|
121
|
+
return { mime: "image/png", width: u32(16), height: u32(20) };
|
|
122
|
+
}
|
|
123
|
+
if (b.length >= 10 && b[0] === 71 && b[1] === 73 && b[2] === 70) {
|
|
124
|
+
return { mime: "image/gif", width: u16(6, true), height: u16(8, true) };
|
|
125
|
+
}
|
|
126
|
+
if (b.length >= 30 && b[0] === 82 && b[1] === 73 && b[2] === 70 && b[3] === 70 && b[8] === 87 && b[9] === 69 && b[10] === 66 && b[11] === 80) {
|
|
127
|
+
const chunk = String.fromCharCode(b[12], b[13], b[14], b[15]);
|
|
128
|
+
if (chunk === "VP8 ") return { mime: "image/webp", width: u16(26, true) & 16383, height: u16(28, true) & 16383 };
|
|
129
|
+
if (chunk === "VP8L") {
|
|
130
|
+
const bits = (b[21] | b[22] << 8 | b[23] << 16 | b[24] << 24) >>> 0;
|
|
131
|
+
return { mime: "image/webp", width: (bits & 16383) + 1, height: (bits >>> 14 & 16383) + 1 };
|
|
132
|
+
}
|
|
133
|
+
if (chunk === "VP8X") return { mime: "image/webp", width: 1 + (b[24] | b[25] << 8 | b[26] << 16), height: 1 + (b[27] | b[28] << 8 | b[29] << 16) };
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
if (b.length >= 4 && b[0] === 255 && b[1] === 216) {
|
|
137
|
+
let orientation = 1;
|
|
138
|
+
let i = 2;
|
|
139
|
+
while (i + 4 <= b.length) {
|
|
140
|
+
if (b[i] !== 255) return null;
|
|
141
|
+
const marker = b[i + 1];
|
|
142
|
+
if (marker === 216 || marker === 1 || marker >= 208 && marker <= 215) {
|
|
143
|
+
i += 2;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const length = u16(i + 2);
|
|
147
|
+
if (marker === 225 && length >= 16) orientation = exifOrientation(b, i + 4, length - 2) ?? orientation;
|
|
148
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
|
|
149
|
+
if (i + 9 > b.length) return null;
|
|
150
|
+
const height = u16(i + 5);
|
|
151
|
+
const width = u16(i + 7);
|
|
152
|
+
return orientation >= 5 && orientation <= 8 ? { mime: "image/jpeg", width: height, height: width } : { mime: "image/jpeg", width, height };
|
|
153
|
+
}
|
|
154
|
+
i += 2 + length;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
function exifOrientation(b, start, length) {
|
|
160
|
+
if (b[start] !== 69 || b[start + 1] !== 120 || b[start + 2] !== 105 || b[start + 3] !== 102) return null;
|
|
161
|
+
const tiff = start + 6;
|
|
162
|
+
const end = Math.min(b.length, start + length);
|
|
163
|
+
const little = b[tiff] === 73;
|
|
164
|
+
const u16 = (i) => little ? b[i] | b[i + 1] << 8 : b[i] << 8 | b[i + 1];
|
|
165
|
+
const u32 = (i) => little ? (b[i] | b[i + 1] << 8 | b[i + 2] << 16 | b[i + 3] << 24) >>> 0 : (b[i] << 24 | b[i + 1] << 16 | b[i + 2] << 8 | b[i + 3]) >>> 0;
|
|
166
|
+
if (tiff + 8 > end) return null;
|
|
167
|
+
const ifd = tiff + u32(tiff + 4);
|
|
168
|
+
if (ifd + 2 > end) return null;
|
|
169
|
+
const count = u16(ifd);
|
|
170
|
+
for (let n = 0; n < count; n++) {
|
|
171
|
+
const entry = ifd + 2 + n * 12;
|
|
172
|
+
if (entry + 12 > end) return null;
|
|
173
|
+
if (u16(entry) === 274) return u16(entry + 8);
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
function bitmapExtent(source, steps = []) {
|
|
178
|
+
let r2 = source ? { x: 0, y: 0, width: source.width, height: source.height } : { x: 0, y: 0, width: 0, height: 0 };
|
|
179
|
+
const infinite = () => !Number.isFinite(r2.width) || !Number.isFinite(r2.height);
|
|
180
|
+
for (const step of steps) {
|
|
181
|
+
switch (step.op) {
|
|
182
|
+
case "crop": {
|
|
183
|
+
if (infinite()) {
|
|
184
|
+
r2 = { x: step.x, y: step.y, width: step.width, height: step.height };
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
const x0 = Math.max(r2.x, step.x);
|
|
188
|
+
const y0 = Math.max(r2.y, step.y);
|
|
189
|
+
const x1 = Math.min(r2.x + r2.width, step.x + step.width);
|
|
190
|
+
const y1 = Math.min(r2.y + r2.height, step.y + step.height);
|
|
191
|
+
r2 = { x: x0, y: y0, width: Math.max(0, x1 - x0), height: Math.max(0, y1 - y0) };
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
case "render":
|
|
195
|
+
r2 = { x: 0, y: 0, width: step.width, height: step.height };
|
|
196
|
+
break;
|
|
197
|
+
case "clamp":
|
|
198
|
+
r2 = { x: -Infinity, y: -Infinity, width: Infinity, height: Infinity };
|
|
199
|
+
break;
|
|
200
|
+
case "gaussianBlur": {
|
|
201
|
+
if (infinite()) break;
|
|
202
|
+
const grow = Math.ceil(3 * step.radius);
|
|
203
|
+
r2 = { x: r2.x - grow, y: r2.y - grow, width: r2.width + 2 * grow, height: r2.height + 2 * grow };
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
case "place":
|
|
207
|
+
if (!(step.sx > 0) || !(step.sy > 0)) r2 = { x: step.tx, y: step.ty, width: 0, height: 0 };
|
|
208
|
+
else if (!infinite()) r2 = { x: r2.x * step.sx + step.tx, y: r2.y * step.sy + step.ty, width: r2.width * step.sx, height: r2.height * step.sy };
|
|
209
|
+
break;
|
|
210
|
+
case "transform": {
|
|
211
|
+
if (infinite()) break;
|
|
212
|
+
const { a, b, c, d, tx, ty } = step;
|
|
213
|
+
if (!(Math.abs(a * d - b * c) > 1e-12)) {
|
|
214
|
+
r2 = { x: tx, y: ty, width: 0, height: 0 };
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
const xs = [];
|
|
218
|
+
const ys = [];
|
|
219
|
+
for (const [x, y] of [
|
|
220
|
+
[r2.x, r2.y],
|
|
221
|
+
[r2.x + r2.width, r2.y],
|
|
222
|
+
[r2.x, r2.y + r2.height],
|
|
223
|
+
[r2.x + r2.width, r2.y + r2.height]
|
|
224
|
+
]) {
|
|
225
|
+
xs.push(a * x + c * y + tx);
|
|
226
|
+
ys.push(b * x + d * y + ty);
|
|
227
|
+
}
|
|
228
|
+
const x0 = Math.min(...xs);
|
|
229
|
+
const y0 = Math.min(...ys);
|
|
230
|
+
r2 = { x: x0, y: y0, width: Math.max(...xs) - x0, height: Math.max(...ys) - y0 };
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return r2;
|
|
236
|
+
}
|
|
66
237
|
const PREF_KIND = "$pref";
|
|
67
238
|
const HOIST_KIND = "$hoist";
|
|
68
239
|
function inheritTitleModes(screens) {
|
|
@@ -122,6 +293,8 @@ class HostTree {
|
|
|
122
293
|
committedColorScheme;
|
|
123
294
|
/** Remote: the root's props last sent. */
|
|
124
295
|
committedRootProps = {};
|
|
296
|
+
/** The bitmap sources (`imagedata` keys) this tree has sent: each goes once, before the first image that draws it. */
|
|
297
|
+
sentSources = /* @__PURE__ */ new Set();
|
|
125
298
|
/** Whether another tree draws this one (`createSwiftUIRoot(sink, { remote: true })`, for a `RemoteTree`). */
|
|
126
299
|
get remote() {
|
|
127
300
|
return this.options.remote === true;
|
|
@@ -304,6 +477,7 @@ class HostTree {
|
|
|
304
477
|
const current = parent.committedChildren.filter((child) => child.shown && child.effectiveParent === parent);
|
|
305
478
|
entry.children.forEach((child, index) => {
|
|
306
479
|
const childEntry = child.entry;
|
|
480
|
+
if (child.kind === "image") this.sendBitmapSource(childEntry.props, ops);
|
|
307
481
|
if (!child.created) {
|
|
308
482
|
ops.push({ op: "create", id: child.id, kind: child.kind, props: childEntry.props });
|
|
309
483
|
child.created = true;
|
|
@@ -353,6 +527,15 @@ class HostTree {
|
|
|
353
527
|
ops.push(commit);
|
|
354
528
|
return ops;
|
|
355
529
|
}
|
|
530
|
+
/** An `imagedata` op ahead of an image whose recipe's source this tree has not sent yet (bitmaps.ts). */
|
|
531
|
+
sendBitmapSource(props, ops) {
|
|
532
|
+
const key = props["bitmap"]?.source;
|
|
533
|
+
if (typeof key !== "string" || this.sentSources.has(key)) return;
|
|
534
|
+
const op = bitmapSourceOp(key);
|
|
535
|
+
if (!op) return;
|
|
536
|
+
this.sentSources.add(key);
|
|
537
|
+
ops.push(op);
|
|
538
|
+
}
|
|
356
539
|
/** Whether a pass is still animating with this completion serial. */
|
|
357
540
|
awaitsCompletion(serial) {
|
|
358
541
|
return this.completions.has(serial);
|
|
@@ -671,6 +854,9 @@ function createRemoteRoot() {
|
|
|
671
854
|
case "commit":
|
|
672
855
|
commit = op;
|
|
673
856
|
break;
|
|
857
|
+
case "imagedata":
|
|
858
|
+
registerBitmapSourceOp(op);
|
|
859
|
+
break;
|
|
674
860
|
}
|
|
675
861
|
}
|
|
676
862
|
if (!commit) return;
|
|
@@ -2139,6 +2325,21 @@ function openURL(url) {
|
|
|
2139
2325
|
}
|
|
2140
2326
|
function imageProps$1(props) {
|
|
2141
2327
|
if (props.systemName !== void 0) return { systemName: props.systemName };
|
|
2328
|
+
if (props.bitmap !== void 0) {
|
|
2329
|
+
const { source, steps = [], version } = props.bitmap;
|
|
2330
|
+
const extent = bitmapExtent(source, steps);
|
|
2331
|
+
const finite = Number.isFinite(extent.width) && Number.isFinite(extent.height);
|
|
2332
|
+
const width = finite ? Math.max(0, Math.round(extent.width)) : 0;
|
|
2333
|
+
const height = finite ? Math.max(0, Math.round(extent.height)) : 0;
|
|
2334
|
+
const scale = props.scale !== void 0 && props.scale > 0 ? props.scale : 1;
|
|
2335
|
+
return {
|
|
2336
|
+
bitmap: { source: source?.key ?? null, steps, width, height, ...version !== void 0 ? { version } : {} },
|
|
2337
|
+
resizable: props.resizable ?? false,
|
|
2338
|
+
width: width / scale,
|
|
2339
|
+
height: height / scale,
|
|
2340
|
+
...props.interpolation === "none" ? { interpolation: "none" } : {}
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2142
2343
|
if (props.url !== void 0) return { url: props.url, resizable: props.resizable ?? false, width: props.width ?? 0, height: props.height ?? 0 };
|
|
2143
2344
|
return { name: props.name ?? "", resizable: props.resizable ?? false };
|
|
2144
2345
|
}
|
|
@@ -8080,6 +8281,8 @@ export {
|
|
|
8080
8281
|
answerLayout,
|
|
8081
8282
|
appStorage,
|
|
8082
8283
|
appleCredentialState,
|
|
8284
|
+
bitmapExtent,
|
|
8285
|
+
bitmapSource,
|
|
8083
8286
|
canMeasureText,
|
|
8084
8287
|
canSignInWithApple,
|
|
8085
8288
|
color,
|
|
@@ -8096,10 +8299,12 @@ export {
|
|
|
8096
8299
|
geometryProxy,
|
|
8097
8300
|
gradient,
|
|
8098
8301
|
hex,
|
|
8302
|
+
imageHeader,
|
|
8099
8303
|
injectIntoDevTools,
|
|
8100
8304
|
insets,
|
|
8101
8305
|
installTextMeasurer,
|
|
8102
8306
|
keyframeValues,
|
|
8307
|
+
liveBitmapSource,
|
|
8103
8308
|
measureText,
|
|
8104
8309
|
mount,
|
|
8105
8310
|
moveItems,
|
|
@@ -8113,6 +8318,7 @@ export {
|
|
|
8113
8318
|
plainText,
|
|
8114
8319
|
providingScrollSettings,
|
|
8115
8320
|
readBinding,
|
|
8321
|
+
releaseBitmapSource,
|
|
8116
8322
|
rgb,
|
|
8117
8323
|
routeOf,
|
|
8118
8324
|
samplerZones,
|