@swiftbrowser/react 0.18.0 → 0.18.2

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 CHANGED
@@ -400,6 +400,75 @@ titles when regular and the first column when compact.
400
400
  />
401
401
  ```
402
402
 
403
+ ### Scene phase
404
+
405
+ `useScenePhase()` is `@Environment(\.scenePhase)`: `active` while the app is
406
+ in front and takes input, `inactive` while it shows but does not, and
407
+ `background` while it is not shown. A page follows the document's visibility
408
+ (hidden is `background`) and the window's focus (`mount` and `SwiftUIView`
409
+ watch them); the native app follows its scene. Refresh what time moved on
410
+ when it turns `active`: timers may not have run in the background.
411
+
412
+ ```tsx
413
+ const phase = useScenePhase();
414
+ useEffect(() => {
415
+ if (phase === 'active') setToday(dayKey(new Date()));
416
+ }, [phase]);
417
+ ```
418
+
419
+ ### Wake lock
420
+
421
+ `useWakeLock(active)` keeps the screen awake while `active` (a recording
422
+ under way, a recipe being followed), through the Screen Wake Lock API: the
423
+ browser's on a page, the runtime's `navigator.wakeLock` over the idle timer
424
+ in a native app. It returns whether a lock is held, and takes the lock
425
+ again when the browser let it go as the document hid and it shows again.
426
+ Where there is no `navigator.wakeLock`, nothing happens.
427
+
428
+ ```tsx
429
+ useWakeLock(recorder.status !== 'idle');
430
+ ```
431
+
432
+ ### Location
433
+
434
+ `useGeolocation(options)` is the viewer's position through the Geolocation
435
+ API: the browser's on a page, the runtime's `navigator.geolocation` over
436
+ `CLLocationManager` in a native app (the app's Info.plist names
437
+ `NSLocationWhenInUseUsageDescription`). Nothing is asked until `request()`
438
+ (the first ask prompts the viewer) unless `immediate` is set; `watch` keeps
439
+ following the position until `stop()` or the view goes. The state carries
440
+ `available`, `status` (`idle`, `locating`, `located`, `denied`, `failed`),
441
+ the latest `position` (`latitude`, `longitude`, `accuracy`, `altitude`,
442
+ `heading`, `speed`, `timestamp`) and `error`.
443
+
444
+ ```tsx
445
+ const location = useGeolocation({ enableHighAccuracy: true });
446
+ <Button title="Use My Location" action={location.request} />
447
+ {location.position && <Text>{`${location.position.latitude}, ${location.position.longitude}`}</Text>}
448
+ ```
449
+
450
+ ### Speech
451
+
452
+ `useSpeechSynthesis()` reads text aloud through the Web Speech API (the
453
+ browser's voices on a page, `AVSpeechSynthesizer` in a native app):
454
+ `speak(text, { lang, rate, pitch, volume })` queues an utterance, `cancel()`
455
+ stops and empties the queue, `pause()` and `resume()` hold it, and
456
+ `speaking` and `paused` follow; what a view was reading stops when it goes.
457
+ `useSpeechRecognition({ lang, continuous, interimResults })` turns the
458
+ viewer's speech into text (the browser's recognizer, `SFSpeechRecognizer`
459
+ natively; the app's Info.plist names `NSSpeechRecognitionUsageDescription`
460
+ and `NSMicrophoneUsageDescription`): `start()` listens, `transcript` is the
461
+ final words of the session so far and `interim` what is being heard,
462
+ `stop()` lets the last words arrive and `abort()` does not; `error` names
463
+ `not-allowed`, `audio-capture`, `no-speech` or `network`. Both read
464
+ `available` where the environment lacks the API, and the Showcase's Books
465
+ reads a chapter aloud and its Notes takes dictation with them.
466
+
467
+ ```tsx
468
+ const speech = useSpeechSynthesis();
469
+ <Button title={speech.speaking ? 'Stop' : 'Read Aloud'} action={() => (speech.speaking ? speech.cancel() : speech.speak(chapterText))} />
470
+ ```
471
+
403
472
  ### Scrolling
404
473
 
405
474
  `List`, `LazyVStack` and `LazyHStack` build a long `ForEach` a batch of
@@ -427,7 +496,9 @@ Name a coordinate space with `coordinateSpace="page"` on the `ScrollView`
427
496
  `proxy.frame({ named: 'page' })`, updated as the page scrolls.
428
497
  `onGeometryChange={{ of: (proxy) => proxy.size, action: setSize }}` is
429
498
  `.onGeometryChange(for:of:action:)`: the action hears the transform's
430
- answer when it changes, after the render, without a reader or a child
499
+ answer when it changes, after the render and before anything is painted
500
+ (state it sets lays out in the same frame, so a view sized from its own
501
+ measurement settles at once), without a reader or a child
431
502
  that reports in an effect.
432
503
 
433
504
  `onScrollGeometryChange` on a `ScrollView` is `.onScrollGeometryChange`:
@@ -558,6 +629,39 @@ chooser calls `onCancellation`:
558
629
  onCompletion: ([file]) => upload(file) }} />
559
630
  ```
560
631
 
632
+ `fileExporter` is the other way: the document goes where the viewer chooses,
633
+ a save dialog where the browser has one (Chromium's File System Access API),
634
+ a download elsewhere, and the Files app in a native app. The document is
635
+ text, bytes or a `Blob`, named by `defaultFilename` (the type's extension
636
+ added when it has none); `onCompletion` gets where it went (`saved` or
637
+ `downloaded`), and a dismissed dialog calls `onCancellation`. The Showcase's
638
+ Pages exports a document as text and Numbers a sheet as CSV with it.
639
+
640
+ ```tsx
641
+ <VStack fileExporter={{ isPresented: [exporting, setExporting], document: csv, contentType: 'text/csv', defaultFilename: `${title}.csv` }}>
642
+ <Button title="Export as CSV" action={() => setExporting(true)} />
643
+ </VStack>
644
+ ```
645
+
646
+ ### Sign in with Apple
647
+
648
+ `SignInWithAppleButton` is SwiftUI's button (`label`: `signIn`, `signUp` or
649
+ `continue`; `style`: `black`, `white` or `whiteOutline`); `onCompletion` gets
650
+ the credential (`user`, the stable identifier; `email` and `fullName`, shared
651
+ the first time only; `identityToken` and `authorizationCode` for your server)
652
+ or the error (`cancelled: …` when the viewer dismissed the sheet).
653
+ `signInWithApple({ scopes, nonce, state })` is the same without the button,
654
+ `appleCredentialState(user)` asks what the credential is now (`unknown` on a
655
+ page), and `canSignInWithApple()` says whether it works here. Natively the
656
+ system sheet answers, in an app with the entitlement (`swiftbrowser native
657
+ init --sign-in-with-apple`). On a page Apple's JS does, once the app named
658
+ the Services ID and return URL it registered with Apple for the domain:
659
+
660
+ ```tsx
661
+ configureSignInWithApple({ clientId: 'com.example.app.web', redirectURI: 'https://example.com/app/' });
662
+ <SignInWithAppleButton onCompletion={({ credential, error }) => credential && signedIn(credential)} padding={16} />
663
+ ```
664
+
561
665
  ### Gestures
562
666
 
563
667
  `onTapGesture`, `dragGesture`, `magnifyGesture`, `rotateGesture` and
@@ -577,7 +681,10 @@ without the item's own space moving along. `onTapGesture={{ count: 2, action
577
681
  the double tap is inside), the single tap waits for the double-tap interval
578
682
  to pass, as on iOS. `contentShape="rectangle"` makes the whole frame take
579
683
  taps and gestures, which, as in SwiftUI, only what a view draws does
580
- otherwise: a 44 pt box around a 14 pt handle, a clear slide.
684
+ otherwise: a 44 pt box around a 14 pt handle, a clear slide. `onTouches={(touches, phase) => …}` is a SwiftBrowser
685
+ addition for chords and glissandi: every pointer down on the view, in its
686
+ coordinates, with `began`, `changed`, `ended` or `cancelled`; the view owns
687
+ its pointers, so nothing above it scrolls or swipes with them.
581
688
 
582
689
  ### Mouse, keyboard and effects
583
690
 
@@ -666,7 +773,8 @@ Native app they are the app's sandbox. Paths are `file:` URLs, made with
666
773
  `url(directory, path)`. The calls are Swift's, asynchronous on both sides
667
774
  since the page's storage is: `contents`, `text`, `write` (bytes, a Blob or
668
775
  text; the directory must exist), `contentsOfDirectory`, `createDirectory`
669
- (with its parents), `fileExists`, `attributesOfItem`, `moveItem`,
776
+ (with its parents), `fileExists`, `attributesOfItem` (size, the modification
777
+ and creation times, the MIME type the extension names), `moveItem`,
670
778
  `copyItem`, `removeItem`. Failures say what went wrong first: `notFound:`,
671
779
  `exists:`, `isDirectory:`, `notDirectory:`, `unsupported:` (a URL outside
672
780
  the app's directories, or a page that keeps no files: `available`).
@@ -684,6 +792,26 @@ A `VideoPlayer`, `AudioPlayer` or `Image` given a `file:` URL loads the file
684
792
  answers; natively the URL as it is). `mount`'s `app` option names the
685
793
  database on a page (`sb-files:<app>`).
686
794
 
795
+ `iCloudDirectory()` is the app's folder in iCloud Drive, where the native
796
+ app has the iCloud entitlement (`swiftbrowser native init --icloud`) and the
797
+ viewer iCloud Drive: files there follow the viewer to their other devices
798
+ and show in the Files app, a file another device wrote is downloaded when
799
+ read, and `watch(listener)` reports the URLs that changed (what this app
800
+ wrote too, so two readers of a file agree). It is null on a page and in an
801
+ app without the entitlement, so an app keeps its documents in
802
+ `iCloudDirectory() ?? documentsDirectory` and is the same code everywhere.
803
+ `useFileStorage(url, default)` keeps a value as a JSON file the way
804
+ `useAppStorage` keeps one under a key, reading it again when it changes:
805
+
806
+ ```tsx
807
+ const [folder, setFolder] = useState<string | null>(null);
808
+ useEffect(() => { void fileManager.iCloudDirectory().then((cloud) => setFolder(cloud ?? fileManager.documentsDirectory)); }, []);
809
+ const [memos, setMemos, status] = useFileStorage<Memo[]>(folder && fileManager.url(folder, 'memos.json'), []);
810
+ ```
811
+
812
+ The Showcase's Voice Memos keeps its recordings and their index this way,
813
+ so a memo recorded on one device plays on the next.
814
+
687
815
  ### Animation
688
816
 
689
817
  `withAnimation(animation, () => …)` animates the pass a state change makes,
@@ -771,7 +899,8 @@ SwiftUI row shows the count, and the row grows with the text.
771
899
  selection, scrolling inside the host and native controls work; the row
772
900
  around it still swipes when the pan starts outside the host.
773
901
  - **Hooks.** The content can use this package's hooks: `useDismiss()` from a
774
- sheet or a pushed screen, `useNavigation()` to push, `useColorScheme()`.
902
+ sheet or a pushed screen, `useNavigation()` to push, `useColorScheme()`,
903
+ `useScenePhase()`.
775
904
 
776
905
  A host is a React root of its own, so it needs the `react-dom` peer
777
906
  dependency, and React context does not cross into it by itself; see below.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Sign in with Apple: `signInWithApple()` asks the viewer and resolves with
3
+ * the credential (`ASAuthorizationAppleIDCredential`'s fields: the stable
4
+ * `user`, the name and email shared the first time, the identity token and
5
+ * authorization code for the app's server), `appleCredentialState(user)` asks
6
+ * what the credential is now, and `SignInWithAppleButton` is SwiftUI's
7
+ * button, drawn from a button, the Apple logo and the label in the black,
8
+ * white or white-outline style. Natively the system sheet answers; on a page
9
+ * Apple's JS does, once the app named its Services ID and return URL with
10
+ * `configureSignInWithApple` (both registered with Apple for the domain), and
11
+ * without that the request fails `unsupported:`.
12
+ */
13
+ import type { AppleCredentialState, AppleIDCredential } from '@swiftbrowser/web/src/hostRequests';
14
+ import { configureSignInWithApple } from '@swiftbrowser/web/src/appleSignIn';
15
+ import { type ReactNode } from 'react';
16
+ import { type ViewModifiers } from './modifiers';
17
+ export type { AppleCredentialState, AppleIDCredential };
18
+ export { configureSignInWithApple };
19
+ export interface SignInWithAppleOptions {
20
+ /** What to ask the viewer to share; both by default. Shared the first time only, as on iOS. */
21
+ scopes?: ('fullName' | 'email')[];
22
+ /** A nonce the identity token carries, for the app's server to check. */
23
+ nonce?: string;
24
+ /** Echoed back in the credential. */
25
+ state?: string;
26
+ }
27
+ /** Whether this page or app can sign in with Apple (natively always; on a page once configured). */
28
+ export declare function canSignInWithApple(): boolean;
29
+ export declare function signInWithApple(options?: SignInWithAppleOptions): Promise<AppleIDCredential>;
30
+ /** `ASAuthorizationAppleIDProvider.credentialState(forUserID:)`; `unknown` where the host cannot ask (a page). */
31
+ export declare function appleCredentialState(user: string): Promise<AppleCredentialState>;
32
+ export type SignInWithAppleLabel = 'signIn' | 'signUp' | 'continue';
33
+ export type SignInWithAppleStyle = 'black' | 'white' | 'whiteOutline';
34
+ export interface SignInWithAppleButtonProps extends ViewModifiers {
35
+ /** `.signIn` ("Sign in with Apple"), `.signUp` or `.continue`. */
36
+ label?: SignInWithAppleLabel;
37
+ /** `.signInWithAppleButtonStyle`: `black` by default. */
38
+ style?: SignInWithAppleStyle;
39
+ /** What to ask for: `onRequest` on iOS. Both scopes by default. */
40
+ scopes?: ('fullName' | 'email')[];
41
+ nonce?: string;
42
+ state?: string;
43
+ /** The credential, or the error (`cancelled: …` when the viewer dismissed the sheet). */
44
+ onCompletion: (result: {
45
+ credential: AppleIDCredential;
46
+ error?: undefined;
47
+ } | {
48
+ credential?: undefined;
49
+ error: Error;
50
+ }) => void;
51
+ }
52
+ export declare function SignInWithAppleButton(props: SignInWithAppleButtonProps): ReactNode;
53
+ //# sourceMappingURL=appleSignIn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appleSignIn.d.ts","sourceRoot":"","sources":["../src/appleSignIn.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EA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AAE;QAAE,UAAU,EAAE,iBAAiB,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG;QAAE,UAAU,CAAC,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,KAAK,IAAI,CAAC;CACjI;AAID,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,SAAS,CA0BlF"}
@@ -90,7 +90,12 @@ export interface GeometryChangeSpec<T> {
90
90
  * reports its size (and its frame on screen once the transform reads it,
91
91
  * kept current as the page scrolls) without changing its layout; the
92
92
  * action runs after the render that heard a change, as SwiftUI's does, so it
93
- * may set state. A function form is called with the proxy on every change.
93
+ * may set state. It runs in the commit (a layout effect), before anything is
94
+ * painted: state it sets renders and lays out synchronously, so a layout
95
+ * that depends on its own measurement settles within the frame, as a
96
+ * `GeometryReader`'s does in SwiftUI, instead of one round per frame with
97
+ * the page painting each. A function form is called with the proxy on
98
+ * every change.
94
99
  */
95
100
  export declare function GeometryChangeView({ handler, children }: {
96
101
  handler: GeometryChangeHandler;
@@ -1 +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,EAAkD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvF,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,cAA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gB,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,SAAS,CA2C5E"}
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Environment values: what a modifier on a container passes to the views
3
3
  * below it (`.buttonStyle`, `.controlSize`…), and the device environment the
4
- * page sets (color scheme, Dynamic Type size).
4
+ * page sets (color scheme, Dynamic Type size, size class, scene phase).
5
5
  */
6
- import type { ButtonStyle, ColorScheme, DynamicTypeSize, PickerStyle, ToggleStyle } from '@swiftbrowser/web/src/protocol';
6
+ import type { ButtonStyle, ColorScheme, DynamicTypeSize, PickerStyle, ScenePhase, ToggleStyle } from '@swiftbrowser/web/src/protocol';
7
7
  import { type ReactNode } from 'react';
8
8
  export type ControlSize = 'mini' | 'small' | 'regular' | 'large' | 'extraLarge';
9
9
  /** `.symbolRenderingMode(_:)`: `palette` draws a symbol's layers in the foreground styles' levels. */
@@ -52,7 +52,15 @@ export interface Environment {
52
52
  dynamicTypeSize: DynamicTypeSize;
53
53
  /** `compact` below 700 points of width (an iPhone), `regular` from it (an iPad, a desktop window). */
54
54
  horizontalSizeClass: HorizontalSizeClass;
55
+ /**
56
+ * `active` while the app is in front and takes input, `inactive` while it
57
+ * shows but does not (the app switcher, a system sheet over it, a page
58
+ * whose window lost focus), `background` while it is not shown (a hidden
59
+ * tab, an app the viewer left). `active` where nothing says otherwise.
60
+ */
61
+ scenePhase: ScenePhase;
55
62
  }
63
+ export type { ScenePhase };
56
64
  export declare const EnvironmentContext: import("react").Context<Environment>;
57
65
  export declare function EnvironmentProvider({ value, children }: {
58
66
  value: Environment;
@@ -67,6 +75,12 @@ export declare const DismissContext: import("react").Context<(() => void) | null
67
75
  export declare function useDismiss(): () => void;
68
76
  /** `@Environment(\.horizontalSizeClass)` */
69
77
  export declare function useHorizontalSizeClass(): HorizontalSizeClass;
78
+ /**
79
+ * `@Environment(\.scenePhase)`: `active`, `inactive` or `background`. A
80
+ * page follows the document's visibility and the window's focus; the native
81
+ * app follows its scene. Refresh what time moved on when it turns `active`.
82
+ */
83
+ export declare function useScenePhase(): ScenePhase;
70
84
  /** `@Environment(\.redactionReasons)`: whether the views below are placeholders. */
71
85
  export declare function useRedacted(): boolean;
72
86
  //# sourceMappingURL=environment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC1H,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC;AAEhF,sGAAsG;AACtG,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG,SAAS,CAAC;AAE3F,qGAAqG;AACrG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACpC,WAAW,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAC1C,kBAAkB,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,CAAC;IAChF,sBAAsB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9C;AAED,gCAAgC;AAChC,MAAM,MAAM,YAAY,GACpB,SAAS,GAAG,cAAc,GAAG,uBAAuB,GAAG,KAAK,GAAG,WAAW,GAAG,UAAU,GAAG,cAAc,GACxG,cAAc,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,uBAAuB,CAAC;AAEtF,mCAAmC;AACnC,MAAM,MAAM,eAAe,GACvB,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,iBAAiB,GAAG,UAAU,GAAG,UAAU,G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,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS,CAEvF;AAOD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;IACjC,sGAAsG;IACtG,mBAAmB,EAAE,mBAAmB,CAAC;IACzC;;;;;OAKG;IACH,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,eAAO,MAAM,kBAAkB,sCAK7B,CAAC;AAEH,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAEhH;AAED,oCAAoC;AACpC,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED,wCAAwC;AACxC,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAED,mEAAmE;AACnE,eAAO,MAAM,cAAc,iCAAwB,IAAI,SAAe,CAAC;AAEvE,wBAAgB,UAAU,IAAI,MAAM,IAAI,CAGvC;AAED,4CAA4C;AAC5C,wBAAgB,sBAAsB,IAAI,mBAAmB,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,oFAAoF;AACpF,wBAAgB,WAAW,IAAI,OAAO,CAErC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `.fileExporter(isPresented:document:contentType:defaultFilename:…)`: the
3
+ * document goes where the viewer chooses. A page shows a save dialog where
4
+ * the browser has one (the File System Access API) and downloads the file
5
+ * elsewhere; the native app shows the document picker (the Files app). Set
6
+ * `isPresented` from a button's action, as a dialog opens only within a tap.
7
+ * `onCompletion` gets where it went (`saved` or `downloaded`, with the
8
+ * host's URLs where it knows them); a dismissed dialog calls `onCancellation`.
9
+ */
10
+ import { type ExportFilesResult } from '@swiftbrowser/web/src/hostRequests';
11
+ import { type ReactNode } from 'react';
12
+ import { type BindingValue } from './binding';
13
+ export type { ExportFilesResult };
14
+ /** What a `fileExporter` writes: text, bytes or a Blob; a `File` brings its own name and type. */
15
+ export type ExportDocument = string | Uint8Array | ArrayBuffer | Blob;
16
+ export interface FileExporterModifier {
17
+ isPresented: BindingValue<boolean>;
18
+ /** The document, or several; `null` presents nothing (the exporter closes at once). */
19
+ document: ExportDocument | ExportDocument[] | null;
20
+ /** The MIME type (`text/plain`), for a document that is not a typed Blob. */
21
+ contentType?: string;
22
+ /** The name offered (`Notes.txt`); the type's extension is added when the name has none. `Untitled` by default. */
23
+ defaultFilename?: string;
24
+ onCompletion?: (result: ExportFilesResult) => void;
25
+ onCancellation?: () => void;
26
+ onError?: (error: unknown) => void;
27
+ }
28
+ /** The file a document is exported as: named, typed, with the type's extension when the name has none. */
29
+ export declare function exportFile(document: ExportDocument, contentType: string | undefined, defaultFilename: string | undefined, index?: number): File;
30
+ export declare function FileExporterPresenter(spec: FileExporterModifier): ReactNode;
31
+ //# sourceMappingURL=fileExporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileExporter.d.ts","sourceRoot":"","sources":["../src/fileExporter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAE3D,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,kGAAkG;AAClG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,IAAI,CAAC;AAEtE,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACnC,uFAAuF;IACvF,QAAQ,EAAE,cAAc,GAAG,cAAc,EAAE,GAAG,IAAI,CAAC;IACnD,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mHAAmH;IACnH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAgBD,0GAA0G;AAC1G,wBAAgB,UAAU,CAAC,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,SAAI,GAAG,IAAI,CAS1I;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,oBAAoB,GAAG,SAAS,CA+B3E"}
@@ -40,7 +40,7 @@ export interface FileManager {
40
40
  createDirectory(url: string): Promise<void>;
41
41
  /** `fileExists(atPath:)`. */
42
42
  fileExists(url: string): Promise<boolean>;
43
- /** `attributesOfItem(atPath:)`: the size, the modification time where known, and whether it is a directory; fails `notFound: …`. */
43
+ /** `attributesOfItem(atPath:)`: the size, the modification and creation times where known, whether it is a directory, and the MIME type its extension names; fails `notFound: …`. */
44
44
  attributesOfItem(url: string): Promise<FileAttributes>;
45
45
  /** `moveItem(at:to:)`: to a URL nothing is at, in a directory that exists. */
46
46
  moveItem(from: string, to: string): Promise<void>;
@@ -48,8 +48,23 @@ export interface FileManager {
48
48
  copyItem(from: string, to: string): Promise<void>;
49
49
  /** `removeItem(at:)`: a file, or a directory and all it holds. */
50
50
  removeItem(url: string): Promise<void>;
51
- /** A URL the page can load the file at (an object URL of its bytes; natively the URL itself). */
51
+ /** A URL the page can load the file at (an object URL of its bytes; natively the URL itself, downloaded from iCloud Drive first). */
52
52
  loadURL(url: string): Promise<string>;
53
+ /**
54
+ * `FileManager.url(forUbiquityContainerIdentifier:)`, then `Documents`: the
55
+ * app's folder in iCloud Drive, where the app has the iCloud entitlement
56
+ * (`swiftbrowser native init --icloud`) and the viewer iCloud Drive. The
57
+ * files there follow the viewer to their other devices and show in the
58
+ * Files app. Null without it, and on a page. Reading a file another device
59
+ * wrote downloads it first.
60
+ */
61
+ iCloudDirectory(): Promise<string | null>;
62
+ /**
63
+ * Calls `listener` with the URLs that changed: what this app wrote, and
64
+ * natively what another device wrote to iCloud Drive. Returns a function
65
+ * that stops listening. `useFileStorage` reads a file again on it.
66
+ */
67
+ watch(listener: (urls: string[]) => void): () => void;
53
68
  }
54
69
  /** A file manager over the host `host` answers (the environment's, looked up at each call, for the default). */
55
70
  export declare function createFileManager(host: () => FilesHost | undefined): FileManager;
@@ -1 +1 @@
1
- {"version":3,"file":"fileManager.d.ts","sourceRoot":"","sources":["../src/fileManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAI9F,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,qGAAqG;IACrG,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,mFAAmF;IACnF,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC;IAC7C,qDAAqD;IACrD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,+DAA+D;IAC/D,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,2EAA2E;IAC3E,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7C,6CAA6C;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E,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,qLAAqL;IACrL,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACvD,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,kEAAkE;IAClE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,qIAAqI;IACrI,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC;;;;;;;OAOG;IACH,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1C;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACvD;AAmBD,gHAAgH;AAChH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,SAAS,GAAG,SAAS,GAAG,WAAW,CA0ChF;AAED,sFAAsF;AACtF,eAAO,MAAM,WAAW,EAAE,WAA+D,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `useFileStorage(url, default)`: a value kept as a JSON file through
3
+ * `fileManager`, the way `useAppStorage` keeps one under a key. The file is
4
+ * read when the URL is given (the default stands in until then, and where
5
+ * there is no file yet), written on each set, and read again when
6
+ * `fileManager.watch` says it changed: another view wrote it, or another
7
+ * device did, in iCloud Drive. A document app keeps its documents this way:
8
+ * put the file in `iCloudDirectory()` where there is one, in
9
+ * `documentsDirectory` elsewhere, and it is the same code on both.
10
+ */
11
+ import { type FileManager } from './fileManager';
12
+ export interface FileStorageOptions<T> {
13
+ /** What a stored value becomes on load: a migration from what an older version wrote. A throw falls back to the default. */
14
+ decode?: (stored: unknown) => T;
15
+ /** A read or write that failed (the file could not be downloaded, the storage is full). */
16
+ onError?: (error: unknown) => void;
17
+ /** The file manager; `fileManager` by default. */
18
+ manager?: FileManager;
19
+ }
20
+ /** The new value, or a function of the current one, as `useState`'s setter takes. */
21
+ export type FileStorageSetter<T> = (value: T | ((current: T) => T)) => void;
22
+ /** `loading` until the file was read (or found missing); `ready` after; `error` when the read failed (the default stands). */
23
+ export type FileStorageStatus = 'loading' | 'ready' | 'error';
24
+ export declare function useFileStorage<T>(url: string | null, defaultValue: T | (() => T), options?: FileStorageOptions<T>): [T, FileStorageSetter<T>, FileStorageStatus];
25
+ //# sourceMappingURL=fileStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileStorage.d.ts","sourceRoot":"","sources":["../src/fileStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,4HAA4H;IAC5H,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,CAAC;IAChC,2FAA2F;IAC3F,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,kDAAkD;IAClD,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,qFAAqF;AACrF,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;AAE5E,8HAA8H;AAC9H,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9D,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM,GAAG,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAqFpK"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * `useGeolocation(options)`: the viewer's position through the Geolocation
3
+ * API, which a page has from the browser and a native app from the runtime
4
+ * (`navigator.geolocation` over `CLLocationManager`; the app's Info.plist
5
+ * names `NSLocationWhenInUseUsageDescription`). Nothing is asked until
6
+ * `request()` (the first ask prompts the viewer), unless `immediate` is set;
7
+ * `watch` keeps following the position until the view goes.
8
+ */
9
+ export interface GeolocationFix {
10
+ latitude: number;
11
+ longitude: number;
12
+ /** Meters. */
13
+ accuracy: number;
14
+ altitude: number | null;
15
+ heading: number | null;
16
+ speed: number | null;
17
+ /** Milliseconds since the epoch. */
18
+ timestamp: number;
19
+ }
20
+ export type GeolocationStatus = 'idle' | 'locating' | 'located' | 'denied' | 'failed';
21
+ export interface GeolocationOptions {
22
+ /** Keep following the position (`watchPosition`) instead of asking once. */
23
+ watch?: boolean;
24
+ /** Ask as soon as the view appears. */
25
+ immediate?: boolean;
26
+ enableHighAccuracy?: boolean;
27
+ /** Milliseconds to wait for a fix. */
28
+ timeout?: number;
29
+ maximumAge?: number;
30
+ }
31
+ export interface GeolocationState {
32
+ /** Whether the environment has `navigator.geolocation`. */
33
+ available: boolean;
34
+ status: GeolocationStatus;
35
+ /** The latest fix, kept across a later failure. */
36
+ position: GeolocationFix | null;
37
+ error: string | null;
38
+ /** Asks (again); with `watch`, starts following. */
39
+ request(): void;
40
+ /** Stops a watch; the position stays. */
41
+ stop(): void;
42
+ }
43
+ export declare function useGeolocation(options?: GeolocationOptions): GeolocationState;
44
+ //# sourceMappingURL=geolocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtF,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oDAAoD;IACpD,OAAO,IAAI,IAAI,CAAC;IAChB,yCAAyC;IACzC,IAAI,IAAI,IAAI,CAAC;CACd;AAqBD,wBAAgB,cAAc,CAAC,OAAO,GAAE,kBAAuB,GAAG,gBAAgB,CA6DjF"}
package/dist/index.d.ts CHANGED
@@ -9,13 +9,14 @@ export { SwiftUIView, type SwiftUIViewProps } from './island';
9
9
  export { useContextBridge } from './bridge';
10
10
  export type { Binding, BindingValue } from './binding';
11
11
  export { readBinding } from './binding';
12
- export { useColorScheme, useDynamicTypeSize, useHorizontalSizeClass, useRedacted, type HorizontalSizeClass, useDismiss, useViewEnvironment, type ControlSize, type SymbolRenderingMode, type KeyboardType, type TextContentType, type TextInputHints, type Environment, type ViewEnvironment, } from './environment';
12
+ export { useColorScheme, useDynamicTypeSize, useHorizontalSizeClass, useScenePhase, useRedacted, type HorizontalSizeClass, type ScenePhase, useDismiss, useViewEnvironment, type ControlSize, type SymbolRenderingMode, type KeyboardType, type TextContentType, type TextInputHints, type Environment, type ViewEnvironment, } from './environment';
13
13
  export { useNavigation } from './navigation-context';
14
- export type { ViewModifiers, ForegroundLayers, BackgroundValue, SearchableModifier, ToolbarItemPlacementName, ToolbarRole, CoordinateSpaceValue, DragGestureModifier, DragValue, GestureValue, TapGestureModifier, MagnifyGestureModifier, RotateGestureModifier, PinchValue, SwipeActionsModifier, AlignmentGuideName, DropDestinationModifier, InspectorModifier, ContainerAxes, ContainerRelativeFrameValue, } from './modifiers';
14
+ export type { ViewModifiers, ForegroundLayers, BackgroundValue, SearchableModifier, ToolbarItemPlacementName, ToolbarRole, CoordinateSpaceValue, DragGestureModifier, DragValue, GestureValue, TapGestureModifier, MagnifyGestureModifier, RotateGestureModifier, PinchValue, TouchPoint, TouchesPhase, TouchesHandler, SwipeActionsModifier, AlignmentGuideName, DropDestinationModifier, InspectorModifier, ContainerAxes, ContainerRelativeFrameValue, } from './modifiers';
15
15
  export { VisualEffect, type ScrollTransitionClosure, type ScrollTransitionPhase, type ScrollTransitionSpec, type VisualEffectClosure, } from './visualEffect';
16
16
  export type { ContentMarginsValue, ScrollEdgeEffectHiddenValue, ScrollEdgeEffectStyle, ScrollEdgeEffectStyleValue, ScrollEdges } from './scrollEnvironment';
17
17
  export type { SheetModifier, AlertModifier, DetentValue } from './presentation';
18
18
  export type { FileImporterModifier } from './fileImporter';
19
+ export { exportFile, type ExportDocument, type ExportFilesResult, type FileExporterModifier } from './fileExporter';
19
20
  export * from './values';
20
21
  export { Path, type CGRect, type Point } from './path';
21
22
  export { AttributedText, type AttributedRun, type RunFont, type TextAttributes, type TextSelection } from './attributedText';
@@ -23,7 +24,12 @@ export { measureText, canMeasureText, installTextMeasurer, type TextMeasurement,
23
24
  export { ScrollViewReader, type ScrollPoint, type ScrollPositionBinding, type ScrollViewProxy, type ScrollPositionValue } from './scrollReader';
24
25
  export { useAudioRecorder, type AudioRange, type AudioRecorder, type AudioRecorderOptions, type AudioRecorderStatus, type AudioRecording } from './audioRecorder';
25
26
  export { useCoordinateSpaces } from './coordinateSpace';
27
+ export { useWakeLock } from './wakeLock';
28
+ export { SignInWithAppleButton, signInWithApple, appleCredentialState, canSignInWithApple, configureSignInWithApple, type AppleCredentialState, type AppleIDCredential, type SignInWithAppleButtonProps, type SignInWithAppleLabel, type SignInWithAppleOptions, type SignInWithAppleStyle, } from './appleSignIn';
29
+ export { useGeolocation, type GeolocationFix, type GeolocationOptions, type GeolocationState, type GeolocationStatus } from './geolocation';
30
+ export { useSpeechSynthesis, useSpeechRecognition, type SpeakOptions, type SpeechSynthesisState, type SpeechRecognitionOptions, type SpeechRecognitionState } from './speech';
26
31
  export { useAppStorage, appStorage, type AppStorageOptions, type AppStorageSetter, type AppStorageStore } from './appStorage';
32
+ export { useFileStorage, type FileStorageOptions, type FileStorageSetter, type FileStorageStatus } from './fileStorage';
27
33
  export { fileManager, createFileManager, type FileAttributes, type FileContents, type FileDirectories, type FileManager } from './fileManager';
28
34
  export { UndoManager, UndoManagerContext, useUndoManager, type UndoHost, type UndoManagerOptions, type UndoOptions, type UndoState } from './undo';
29
35
  export * from './components/stacks';
@@ -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,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClK,OAAO,EAAE,KAAK,EAAE,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