@swiftbrowser/react 0.28.2 → 0.28.4
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 +10 -2
- package/dist/components/hostElement.d.ts +20 -0
- package/dist/components/hostElement.d.ts.map +1 -0
- package/dist/components/remoteTree.d.ts +11 -1
- package/dist/components/remoteTree.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1486 -1479
- 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
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `HostElement`: an element of a kind of the app's own (`'app:preview'`),
|
|
3
|
+
* for a host that draws it. A tree drawn by another root's `RemoteTree`
|
|
4
|
+
* (an app inside a platform's page) names the kind, with the props the
|
|
5
|
+
* host's view wants, and the host draws its own view there (`RemoteTree`'s
|
|
6
|
+
* `elements`): a file's preview, a map, whatever the host has and the app
|
|
7
|
+
* has not. The modifiers apply around it as around any view. Where no host
|
|
8
|
+
* draws the kind, the renderer draws nothing for it.
|
|
9
|
+
*/
|
|
10
|
+
import type { ReactNode } from 'react';
|
|
11
|
+
import { type ViewModifiers } from '../modifiers';
|
|
12
|
+
export interface HostElementProps extends ViewModifiers {
|
|
13
|
+
/** The kind, as the host's `elements` names it: a prefix of the host's own keeps it apart from SwiftBrowser's kinds (`'noya:file'`). */
|
|
14
|
+
kind: string;
|
|
15
|
+
/** What the host's view takes: plain data (JSON). */
|
|
16
|
+
props?: Readonly<Record<string, unknown>>;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare function HostElement(props: HostElementProps): ReactNode;
|
|
20
|
+
//# sourceMappingURL=hostElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostElement.d.ts","sourceRoot":"","sources":["../../src/components/hostElement.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,wIAAwI;IACxI,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAG9D"}
|
|
@@ -19,8 +19,18 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { type ReactNode } from 'react';
|
|
21
21
|
import type { RemoteRoot } from '../host/remote';
|
|
22
|
+
/** The host's view for an element kind of the child's own: its props as the child set them, and its children drawn as usual. */
|
|
23
|
+
export type HostElementRenderer = (props: Readonly<Record<string, unknown>>, children: ReactNode) => ReactNode;
|
|
22
24
|
export interface RemoteTreeProps {
|
|
23
25
|
root: RemoteRoot;
|
|
26
|
+
/**
|
|
27
|
+
* The host's own views for element kinds the child makes up (a
|
|
28
|
+
* `HostElement`'s `kind`, `'app:preview'` say), by kind: the host draws
|
|
29
|
+
* each as it likes where the child put it, with the props the child gave
|
|
30
|
+
* it. A kind no host draws is left to the renderer, which draws nothing
|
|
31
|
+
* for it.
|
|
32
|
+
*/
|
|
33
|
+
elements?: Readonly<Record<string, HostElementRenderer>>;
|
|
24
34
|
/**
|
|
25
35
|
* The child's stack's path to open with, as its screens' `route`s name it
|
|
26
36
|
* (a link to one of the child's screens): set once, when the child's stack
|
|
@@ -38,5 +48,5 @@ export interface PushedScreen {
|
|
|
38
48
|
view: ReactNode;
|
|
39
49
|
route?: unknown;
|
|
40
50
|
}
|
|
41
|
-
export declare function RemoteTree({ root, initialPath }: RemoteTreeProps): ReactNode;
|
|
51
|
+
export declare function RemoteTree({ root, initialPath, elements }: RemoteTreeProps): ReactNode;
|
|
42
52
|
//# sourceMappingURL=remoteTree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteTree.d.ts","sourceRoot":"","sources":["../../src/components/remoteTree.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAsF,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3H,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAM7D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAClC;
|
|
1
|
+
{"version":3,"file":"remoteTree.d.ts","sourceRoot":"","sources":["../../src/components/remoteTree.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAsF,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3H,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAM7D,gIAAgI;AAChI,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,KAAK,SAAS,CAAC;AAE/G,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACzD;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAClC;AAqED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,eAAe,GAAG,SAAS,CA6EtF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { createSwiftUIRoot, injectIntoDevTools, withAnimation, type AnimationCompletionCriteria, type SwiftUIRoot, type SwiftUIRootOptions, type WithAnimationOptions } from './host/root';
|
|
7
7
|
export { createRemoteRoot, type MirrorNode, type RemoteRoot } from './host/remote';
|
|
8
|
-
export { RemoteTree, type PushedScreen, type RemoteTreeProps } from './components/remoteTree';
|
|
8
|
+
export { RemoteTree, type HostElementRenderer, type PushedScreen, type RemoteTreeProps } from './components/remoteTree';
|
|
9
|
+
export { HostElement, type HostElementProps } from './components/hostElement';
|
|
9
10
|
export type { Op, RendererEvent } from '@swiftbrowser/web/src/protocol';
|
|
10
11
|
export { mount, type MountOptions, type Mounted } from './mount';
|
|
11
12
|
export { SwiftUIView, type SwiftUIViewProps } from './island';
|
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;
|
|
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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