@swiftbrowser/react 0.5.0 → 0.5.1

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
@@ -158,7 +158,7 @@ RoundedRectangle(cornerRadius: 8))`. Each modifier wraps the view in the same
158
158
  identically. A modifier that must apply twice goes in `modifiers={[…]}`, an
159
159
  ordered list. The environment modifiers (`buttonStyle`, `controlSize`,
160
160
  `pickerStyle`, `labelsHidden`) are React contexts the views below read, and
161
- `navigationTitle`, `toolbar`, `searchable`, `sheet`, `alert`,
161
+ `navigationTitle`, `toolbar`, `toolbarRole`, `searchable`, `sheet`, `alert`,
162
162
  `presentationDetents` and `preferredColorScheme` attach to the enclosing
163
163
  screen, sheet or page, as the SwiftUI preferences do. Effects (`blur`,
164
164
  `grayscale`, `saturation`, `brightness`, `contrast`, `hueRotation`,
@@ -201,6 +201,39 @@ content and actions render as root-level elements while presented;
201
201
  `presentationDetents` inside a sheet sets its detents. `useDismiss()` inside
202
202
  a pushed screen or a sheet pops or dismisses it.
203
203
 
204
+ ### Toolbars
205
+
206
+ `ToolbarItem`'s `placement` takes SwiftUI's names. `secondaryAction` items
207
+ collapse into the bar's More menu (an ellipsis at the trailing end), as on
208
+ an iPhone; with `toolbarRole="editor"` on the screen, a regular width shows
209
+ them in the bar before the trailing items, and only those that do not fit
210
+ go into More. `bottomBar` items float in glass capsules at the foot of the
211
+ screen, split by `ToolbarSpacer`.
212
+
213
+ ```tsx
214
+ <List
215
+ navigationTitle="Notes"
216
+ toolbarRole="editor"
217
+ toolbar={
218
+ <>
219
+ <ToolbarItem placement="primaryAction">
220
+ <Button action={compose}>
221
+ <Image systemName="square.and.pencil" />
222
+ </Button>
223
+ </ToolbarItem>
224
+ <ToolbarItem placement="secondaryAction">
225
+ <Button title="Export" action={exportNotes} />
226
+ </ToolbarItem>
227
+ <ToolbarItem placement="secondaryAction">
228
+ <Button title="Archive" action={archive} />
229
+ </ToolbarItem>
230
+ </>
231
+ }
232
+ >
233
+ {/* … */}
234
+ </List>
235
+ ```
236
+
204
237
  ### Lists
205
238
 
206
239
  `List` and `Form` hold `Section`s and rows. `selection={[…]}` makes rows with
@@ -217,8 +250,9 @@ and `regular` from it (a tablet, a desktop window); `mount` and
217
250
  `SwiftUIView` follow the root's width as it changes. The views that adapt do
218
251
  it as on iOS: `NavigationSplitView` is two columns when regular (the
219
252
  sidebar's toggle button hides and shows the sidebar) and one stack when
220
- compact, which pushes the detail while the sidebar's `List(selection:)` has
221
- a selection and clears it on back; `.inspector` is a trailing panel when
253
+ compact, which pushes the detail while a `List(selection:)` in the sidebar
254
+ has a selection and clears it on back (lists without a selection, and
255
+ anything a sheet, popover or inspector presents, have no say); `.inspector` is a trailing panel when
222
256
  regular and a sheet when compact; `Table` shows every column under sortable
223
257
  titles when regular and the first column when compact.
224
258
 
@@ -8,9 +8,15 @@ import { type ReactNode } from 'react';
8
8
  import { type BindingValue } from '../binding';
9
9
  import { type ViewModifiers } from '../modifiers';
10
10
  export type NavigationSplitViewVisibility = 'automatic' | 'all' | 'doubleColumn' | 'detailOnly';
11
- /** What the sidebar's `List(selection:)` tells its split view: whether something is selected, and how to clear it. */
11
+ /**
12
+ * What the sidebar's `List(selection:)`s tell their split view: whether
13
+ * each has something selected, and how to clear it. Each list reports under
14
+ * its own key and retracts when it unmounts; the split pushes the detail in
15
+ * a compact width while any of them has a selection.
16
+ */
12
17
  export interface SplitSelection {
13
- report(selected: boolean, clear: () => void): void;
18
+ report(key: object, selected: boolean, clear: () => void): void;
19
+ retract(key: object): void;
14
20
  }
15
21
  export declare const SplitSelectionContext: import("react").Context<SplitSelection | null>;
16
22
  export interface NavigationSplitViewProps extends ViewModifiers {
@@ -20,6 +26,14 @@ export interface NavigationSplitViewProps extends ViewModifiers {
20
26
  onColumnVisibilityChange?: (visibility: NavigationSplitViewVisibility) => void;
21
27
  }
22
28
  export declare function NavigationSplitView(props: NavigationSplitViewProps): ReactNode;
23
- /** Used by `List`: tells the enclosing split view whether the sidebar has a selection. */
24
- export declare function useReportSplitSelection(split: SplitSelection | null, selected: boolean, clear: () => void): void;
29
+ /**
30
+ * Used by `List(selection:)`: tells the enclosing split view whether the
31
+ * sidebar has a selection. A list without a selection binding (a `Form`, a
32
+ * plain list) passes `active: false` and says nothing.
33
+ */
34
+ export declare function useReportSplitSelection(split: SplitSelection | null, selected: boolean, clear: () => void, active?: boolean): void;
35
+ /** Presented content (a sheet, a popover, an inspector) is outside its presenter's split column. */
36
+ export declare function OutsideSplit({ children }: {
37
+ children?: ReactNode;
38
+ }): ReactNode;
25
39
  //# sourceMappingURL=split.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../src/components/split.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzG,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAI5D,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAI9E,MAAM,MAAM,6BAA6B,GAAG,WAAW,GAAG,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;AAEhG,sHAAsH;AACtH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,qBAAqB,gDAA6C,CAAC;AAEhF,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,gBAAgB,CAAC,EAAE,YAAY,CAAC,6BAA6B,CAAC,CAAC;IAC/D,wBAAwB,CAAC,EAAE,CAAC,UAAU,EAAE,6BAA6B,KAAK,IAAI,CAAC;CAChF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,SAAS,CAwC9E;AAoCD,0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B,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAE9E"}
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export type { Binding, BindingValue } from './binding';
11
11
  export { readBinding } from './binding';
12
12
  export { useColorScheme, useDynamicTypeSize, useHorizontalSizeClass, useRedacted, type HorizontalSizeClass, useDismiss, useViewEnvironment, type ControlSize, type Environment, type ViewEnvironment, } from './environment';
13
13
  export { useNavigation } from './navigation-context';
14
- export type { ViewModifiers, BackgroundValue, SearchableModifier, ToolbarItemPlacementName, DragGestureModifier, DragValue, SwipeActionsModifier, AlignmentGuideName, DropDestinationModifier, InspectorModifier, ContainerAxes, ContainerRelativeFrameValue, } from './modifiers';
14
+ export type { ViewModifiers, BackgroundValue, SearchableModifier, ToolbarItemPlacementName, ToolbarRole, DragGestureModifier, DragValue, 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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACjF,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,EAA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