@colixsystems/widget-sdk 0.230.0 → 0.231.0
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 +28 -1
- package/dist/contract.cjs +46 -2
- package/dist/contract.js +46 -2
- package/dist/hooks.js +42 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +1 -0
- package/dist/index.native.js +1 -0
- package/package.json +1 -1
- package/src/contract.js +46 -2
package/README.md
CHANGED
|
@@ -84,7 +84,34 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
84
84
|
|
|
85
85
|
## Status
|
|
86
86
|
|
|
87
|
-
`v0.
|
|
87
|
+
`v0.231.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
|
|
88
|
+
|
|
89
|
+
### What's new in 0.231.0 (contract 1.186.0)
|
|
90
|
+
|
|
91
|
+
**A whole-screen widget can run to the bottom edge of a phone — `useFitScreenInsets()`.** In the exported app, a Fit to screen section whose widget scrolls itself (`prefersFitToScreen: true`) and calls the new `useFitScreenInsets()` runs all the way to the screen's bottom edge, under the iPhone home indicator or the Android navigation bar, so your widget's background fills the screen with no strip of page colour below it. Keep your bottom-anchored controls clear of that area with the new `useFitScreenInsets()`: it returns `{ top, right, bottom, left }` in px, the parts of the device's safe area your surface runs under. Pad your composer, a pinned bar or the end of a list by `bottom`, with your background behind the padding.
|
|
92
|
+
|
|
93
|
+
```jsx
|
|
94
|
+
import * as sdk from "@colixsystems/widget-sdk";
|
|
95
|
+
import { View, TextInput } from "@colixsystems/widget-sdk";
|
|
96
|
+
|
|
97
|
+
// A host older than 0.231.0 has no useFitScreenInsets.
|
|
98
|
+
const NO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
99
|
+
const useFitScreenInsets =
|
|
100
|
+
typeof sdk.useFitScreenInsets === "function" ? sdk.useFitScreenInsets : () => NO_INSETS;
|
|
101
|
+
|
|
102
|
+
function ComposerBar({ theme }) {
|
|
103
|
+
const { bottom } = useFitScreenInsets();
|
|
104
|
+
return (
|
|
105
|
+
<View style={{ backgroundColor: theme.colors.surface, padding: 10, paddingBottom: 10 + bottom }}>
|
|
106
|
+
<TextInput placeholder="Message" />
|
|
107
|
+
</View>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The host decides the value, so you never subtract anything yourself: it is `0` while the keyboard is up (the keyboard covers that area, and your composer sits right on it), when the app's bottom bar already holds the inset, on web (the browser keeps the page inside its own safe area), and for every widget that is not a self-scrolling fit surface ending the page. Calling the hook is the opt-in: a widget that never calls it, or does not scroll itself, keeps the inset below its section, as before, so an existing widget's controls never move under the indicator. Nor does a widget with something drawn below it inside the section, such as a bottom tab bar. Use this hook rather than `useSafeAreaInsets()` from `react-native-safe-area-context`: the device's raw inset would also pad a composer that sits on a bottom bar or on the keyboard.
|
|
113
|
+
|
|
114
|
+
Additive: a host without the `fitScreenFoot` hint reads zeros, so a widget that pads by it looks exactly as before there.
|
|
88
115
|
|
|
89
116
|
### What's new in 0.230.0 (contract 1.185.0)
|
|
90
117
|
|
package/dist/contract.cjs
CHANGED
|
@@ -1021,6 +1021,31 @@ const HOOKS = [
|
|
|
1021
1021
|
requiredContextSlice: ["fitScreen"],
|
|
1022
1022
|
scopes: null,
|
|
1023
1023
|
},
|
|
1024
|
+
{
|
|
1025
|
+
name: "useFitScreenInsets",
|
|
1026
|
+
signature: "useFitScreenInsets()",
|
|
1027
|
+
description:
|
|
1028
|
+
"Returns { top, right, bottom, left } in px: the parts of the device's " +
|
|
1029
|
+
"safe area (the home indicator, a system navigation bar) that this " +
|
|
1030
|
+
"widget's surface runs under. Calling it opts the widget in: only then " +
|
|
1031
|
+
"does a Fit to screen section whose widget scrolls itself (manifest " +
|
|
1032
|
+
"prefersFitToScreen) run to the screen's bottom edge in the exported " +
|
|
1033
|
+
"app, so the widget's background fills it; a widget that never calls it " +
|
|
1034
|
+
"keeps the inset below its section. Pad the bottom-anchored controls (a composer, a pinned bar, the end of " +
|
|
1035
|
+
"a list) by bottom so they stay clear, with the background behind the " +
|
|
1036
|
+
"padding. The host reports 0 while the keyboard is up (it covers that " +
|
|
1037
|
+
"area), when the app's bottom bar holds the inset, on web (the browser " +
|
|
1038
|
+
"keeps the page inside its own safe area) and for every widget that is " +
|
|
1039
|
+
"not such a surface, so calling it is always safe.",
|
|
1040
|
+
returnShape: {
|
|
1041
|
+
top: "number",
|
|
1042
|
+
right: "number",
|
|
1043
|
+
bottom: "number",
|
|
1044
|
+
left: "number",
|
|
1045
|
+
},
|
|
1046
|
+
requiredContextSlice: ["fitScreenFoot"],
|
|
1047
|
+
scopes: null,
|
|
1048
|
+
},
|
|
1024
1049
|
{
|
|
1025
1050
|
name: "useChildRenderer",
|
|
1026
1051
|
signature: "useChildRenderer()",
|
|
@@ -3606,7 +3631,7 @@ const MANIFEST_SCHEMA = {
|
|
|
3606
3631
|
type: "boolean",
|
|
3607
3632
|
required: false,
|
|
3608
3633
|
description:
|
|
3609
|
-
"Optional (default false). TRUE when the widget is built to own the rest of the screen: it scrolls its own content and keeps its controls in view, like a messenger, a map or a full-height board. Dropping the widget at the top level of a page in the Builder turns that section's \"Fit to screen\" setting on (the maker can switch it off, and it stays off), and the app-builder fits the section it plans the widget into. A fit section runs edge to edge across the content area and takes the rest of the screen; the widget learns it through useFill() and useFitScreen(), and the host gives it a box exactly the height left, which it scrolls inside (a widget without the field grows with its content there, and the page scrolls). Set it only for a widget that honours useFill() and scrolls inside the height it is given; leave it false (or omit) for everything else.",
|
|
3634
|
+
"Optional (default false). TRUE when the widget is built to own the rest of the screen: it scrolls its own content and keeps its controls in view, like a messenger, a map or a full-height board. Dropping the widget at the top level of a page in the Builder turns that section's \"Fit to screen\" setting on (the maker can switch it off, and it stays off), and the app-builder fits the section it plans the widget into. A fit section runs edge to edge across the content area and takes the rest of the screen; the widget learns it through useFill() and useFitScreen(), and the host gives it a box exactly the height left, which it scrolls inside (a widget without the field grows with its content there, and the page scrolls). In the exported app a widget that also calls useFitScreenInsets() has that box run to the screen's bottom edge, under the home indicator: keep the background filling it and pad bottom-anchored controls by useFitScreenInsets().bottom (a widget that never calls it keeps the inset below its section). Set it only for a widget that honours useFill() and scrolls inside the height it is given; leave it false (or omit) for everything else.",
|
|
3610
3635
|
default: false,
|
|
3611
3636
|
},
|
|
3612
3637
|
events: {
|
|
@@ -3694,6 +3719,21 @@ const WIDGET_CONTEXT_SHAPE = {
|
|
|
3694
3719
|
required: false,
|
|
3695
3720
|
fields: {},
|
|
3696
3721
|
},
|
|
3722
|
+
// sc-11615 — optional host hint backing useFitScreenInsets(): the screen's
|
|
3723
|
+
// foot a self-scrolling fit surface may claim.
|
|
3724
|
+
fitScreenFoot: {
|
|
3725
|
+
description:
|
|
3726
|
+
"Optional host layout hint ({ claim } or null). Set only for a " +
|
|
3727
|
+
"self-scrolling Fit to screen surface with nothing below it in the " +
|
|
3728
|
+
"exported app: claim(onInset) runs the surface under the bottom safe " +
|
|
3729
|
+
"area, calls onInset(px) now and on every change, and returns the " +
|
|
3730
|
+
"release. Backs useFitScreenInsets(); null or absent reads as zeros " +
|
|
3731
|
+
"and leaves the inset below the section.",
|
|
3732
|
+
required: false,
|
|
3733
|
+
fields: {
|
|
3734
|
+
claim: "(onInset: (bottom: number) => void) => () => void",
|
|
3735
|
+
},
|
|
3736
|
+
},
|
|
3697
3737
|
user: {
|
|
3698
3738
|
description:
|
|
3699
3739
|
"Signed-in user, host-built context object (camelCase: { id, email, displayName, photoUrl, roles, groupIds }) — NOT a wire payload, so it is the one camelCase island among the hooks. photoUrl is the user's own profile photo as an absolute URL, or null. email is null for an account created without one. Not a data-client.",
|
|
@@ -5996,7 +6036,11 @@ const CONTRACT = deepFreeze({
|
|
|
5996
6036
|
// `canSetLocale` and `setLocale(code)`, backed by the optional
|
|
5997
6037
|
// `i18n.languages` / `i18n.setLocale` host slice: a widget can switch
|
|
5998
6038
|
// the app's language. Hosts without them read [] / false.
|
|
5999
|
-
|
|
6039
|
+
// 1.186.0: additive (sc-11615) — `useFitScreenInsets()` with its optional
|
|
6040
|
+
// `fitScreenFoot` host hint: a self-scrolling Fit to screen surface that
|
|
6041
|
+
// calls it runs under the bottom safe area on native and pads its
|
|
6042
|
+
// controls by it. Hosts without the hint read zeros.
|
|
6043
|
+
version: "1.186.0",
|
|
6000
6044
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
6001
6045
|
hooks: HOOKS,
|
|
6002
6046
|
primitives: PRIMITIVES,
|
package/dist/contract.js
CHANGED
|
@@ -1021,6 +1021,31 @@ const HOOKS = [
|
|
|
1021
1021
|
requiredContextSlice: ["fitScreen"],
|
|
1022
1022
|
scopes: null,
|
|
1023
1023
|
},
|
|
1024
|
+
{
|
|
1025
|
+
name: "useFitScreenInsets",
|
|
1026
|
+
signature: "useFitScreenInsets()",
|
|
1027
|
+
description:
|
|
1028
|
+
"Returns { top, right, bottom, left } in px: the parts of the device's " +
|
|
1029
|
+
"safe area (the home indicator, a system navigation bar) that this " +
|
|
1030
|
+
"widget's surface runs under. Calling it opts the widget in: only then " +
|
|
1031
|
+
"does a Fit to screen section whose widget scrolls itself (manifest " +
|
|
1032
|
+
"prefersFitToScreen) run to the screen's bottom edge in the exported " +
|
|
1033
|
+
"app, so the widget's background fills it; a widget that never calls it " +
|
|
1034
|
+
"keeps the inset below its section. Pad the bottom-anchored controls (a composer, a pinned bar, the end of " +
|
|
1035
|
+
"a list) by bottom so they stay clear, with the background behind the " +
|
|
1036
|
+
"padding. The host reports 0 while the keyboard is up (it covers that " +
|
|
1037
|
+
"area), when the app's bottom bar holds the inset, on web (the browser " +
|
|
1038
|
+
"keeps the page inside its own safe area) and for every widget that is " +
|
|
1039
|
+
"not such a surface, so calling it is always safe.",
|
|
1040
|
+
returnShape: {
|
|
1041
|
+
top: "number",
|
|
1042
|
+
right: "number",
|
|
1043
|
+
bottom: "number",
|
|
1044
|
+
left: "number",
|
|
1045
|
+
},
|
|
1046
|
+
requiredContextSlice: ["fitScreenFoot"],
|
|
1047
|
+
scopes: null,
|
|
1048
|
+
},
|
|
1024
1049
|
{
|
|
1025
1050
|
name: "useChildRenderer",
|
|
1026
1051
|
signature: "useChildRenderer()",
|
|
@@ -3602,7 +3627,7 @@ const MANIFEST_SCHEMA = {
|
|
|
3602
3627
|
type: "boolean",
|
|
3603
3628
|
required: false,
|
|
3604
3629
|
description:
|
|
3605
|
-
"Optional (default false). TRUE when the widget is built to own the rest of the screen: it scrolls its own content and keeps its controls in view, like a messenger, a map or a full-height board. Dropping the widget at the top level of a page in the Builder turns that section's \"Fit to screen\" setting on (the maker can switch it off, and it stays off), and the app-builder fits the section it plans the widget into. A fit section runs edge to edge across the content area and takes the rest of the screen; the widget learns it through useFill() and useFitScreen(), and the host gives it a box exactly the height left, which it scrolls inside (a widget without the field grows with its content there, and the page scrolls). Set it only for a widget that honours useFill() and scrolls inside the height it is given; leave it false (or omit) for everything else.",
|
|
3630
|
+
"Optional (default false). TRUE when the widget is built to own the rest of the screen: it scrolls its own content and keeps its controls in view, like a messenger, a map or a full-height board. Dropping the widget at the top level of a page in the Builder turns that section's \"Fit to screen\" setting on (the maker can switch it off, and it stays off), and the app-builder fits the section it plans the widget into. A fit section runs edge to edge across the content area and takes the rest of the screen; the widget learns it through useFill() and useFitScreen(), and the host gives it a box exactly the height left, which it scrolls inside (a widget without the field grows with its content there, and the page scrolls). In the exported app a widget that also calls useFitScreenInsets() has that box run to the screen's bottom edge, under the home indicator: keep the background filling it and pad bottom-anchored controls by useFitScreenInsets().bottom (a widget that never calls it keeps the inset below its section). Set it only for a widget that honours useFill() and scrolls inside the height it is given; leave it false (or omit) for everything else.",
|
|
3606
3631
|
default: false,
|
|
3607
3632
|
},
|
|
3608
3633
|
events: {
|
|
@@ -3690,6 +3715,21 @@ const WIDGET_CONTEXT_SHAPE = {
|
|
|
3690
3715
|
required: false,
|
|
3691
3716
|
fields: {},
|
|
3692
3717
|
},
|
|
3718
|
+
// sc-11615 — optional host hint backing useFitScreenInsets(): the screen's
|
|
3719
|
+
// foot a self-scrolling fit surface may claim.
|
|
3720
|
+
fitScreenFoot: {
|
|
3721
|
+
description:
|
|
3722
|
+
"Optional host layout hint ({ claim } or null). Set only for a " +
|
|
3723
|
+
"self-scrolling Fit to screen surface with nothing below it in the " +
|
|
3724
|
+
"exported app: claim(onInset) runs the surface under the bottom safe " +
|
|
3725
|
+
"area, calls onInset(px) now and on every change, and returns the " +
|
|
3726
|
+
"release. Backs useFitScreenInsets(); null or absent reads as zeros " +
|
|
3727
|
+
"and leaves the inset below the section.",
|
|
3728
|
+
required: false,
|
|
3729
|
+
fields: {
|
|
3730
|
+
claim: "(onInset: (bottom: number) => void) => () => void",
|
|
3731
|
+
},
|
|
3732
|
+
},
|
|
3693
3733
|
user: {
|
|
3694
3734
|
description:
|
|
3695
3735
|
"Signed-in user, host-built context object (camelCase: { id, email, displayName, photoUrl, roles, groupIds }) — NOT a wire payload, so it is the one camelCase island among the hooks. photoUrl is the user's own profile photo as an absolute URL, or null. email is null for an account created without one. Not a data-client.",
|
|
@@ -5992,7 +6032,11 @@ const CONTRACT = deepFreeze({
|
|
|
5992
6032
|
// `canSetLocale` and `setLocale(code)`, backed by the optional
|
|
5993
6033
|
// `i18n.languages` / `i18n.setLocale` host slice: a widget can switch
|
|
5994
6034
|
// the app's language. Hosts without them read [] / false.
|
|
5995
|
-
|
|
6035
|
+
// 1.186.0: additive (sc-11615) — `useFitScreenInsets()` with its optional
|
|
6036
|
+
// `fitScreenFoot` host hint: a self-scrolling Fit to screen surface that
|
|
6037
|
+
// calls it runs under the bottom safe area on native and pads its
|
|
6038
|
+
// controls by it. Hosts without the hint read zeros.
|
|
6039
|
+
version: "1.186.0",
|
|
5996
6040
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
5997
6041
|
hooks: HOOKS,
|
|
5998
6042
|
primitives: PRIMITIVES,
|
package/dist/hooks.js
CHANGED
|
@@ -23,6 +23,7 @@ import React, {
|
|
|
23
23
|
useContext,
|
|
24
24
|
useCallback,
|
|
25
25
|
useEffect,
|
|
26
|
+
useLayoutEffect,
|
|
26
27
|
useMemo,
|
|
27
28
|
useRef,
|
|
28
29
|
useState,
|
|
@@ -501,6 +502,47 @@ export function useFitScreen() {
|
|
|
501
502
|
return ctx.fitScreen === true;
|
|
502
503
|
}
|
|
503
504
|
|
|
505
|
+
const NO_FIT_SCREEN_INSETS = Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 });
|
|
506
|
+
|
|
507
|
+
function insetPx(value) {
|
|
508
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Returns `{ top, right, bottom, left }` in px: the parts of the device's safe
|
|
513
|
+
* area (the home indicator, a system navigation bar) that this widget's
|
|
514
|
+
* surface runs under. Calling it OPTS the widget in: only then does the host
|
|
515
|
+
* run a self-scrolling Fit to screen surface (manifest `prefersFitToScreen`)
|
|
516
|
+
* to the screen's bottom edge in the exported app, so the widget's background
|
|
517
|
+
* fills it; pad your bottom-anchored controls (a composer, a pinned bar) by
|
|
518
|
+
* `bottom` to keep them clear. A widget that never calls it keeps the inset
|
|
519
|
+
* below its section. The host reports 0 while the keyboard is up (it covers
|
|
520
|
+
* that area), when the app's bottom bar holds the inset, on web (the browser
|
|
521
|
+
* keeps the page inside its own safe area) and for every widget that is not
|
|
522
|
+
* such a surface.
|
|
523
|
+
*/
|
|
524
|
+
export function useFitScreenInsets() {
|
|
525
|
+
const ctx = useWidgetContextOrThrow("useFitScreenInsets");
|
|
526
|
+
const foot = ctx.fitScreenFoot;
|
|
527
|
+
const claim = foot && typeof foot.claim === "function" ? foot.claim : null;
|
|
528
|
+
const [bottom, setBottom] = useState(0);
|
|
529
|
+
// Before paint, so the surface never shows a frame off the edge.
|
|
530
|
+
useLayoutEffect(() => {
|
|
531
|
+
if (!claim) {
|
|
532
|
+
setBottom(0);
|
|
533
|
+
return undefined;
|
|
534
|
+
}
|
|
535
|
+
const release = claim((value) => setBottom(insetPx(value)));
|
|
536
|
+
return () => {
|
|
537
|
+
if (typeof release === "function") release();
|
|
538
|
+
};
|
|
539
|
+
}, [claim]);
|
|
540
|
+
return useMemo(
|
|
541
|
+
() => (bottom === 0 ? NO_FIT_SCREEN_INSETS : { top: 0, right: 0, bottom, left: 0 }),
|
|
542
|
+
[bottom],
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
|
|
504
546
|
/**
|
|
505
547
|
* Returns the host's child-node renderer:
|
|
506
548
|
* { renderNode(node) }.
|
package/dist/index.d.ts
CHANGED
|
@@ -799,6 +799,15 @@ export interface WidgetContext<TProps = unknown> {
|
|
|
799
799
|
* the rest of the screen). Absent / `false` everywhere else.
|
|
800
800
|
*/
|
|
801
801
|
fitScreen?: boolean;
|
|
802
|
+
/**
|
|
803
|
+
* sc-11615 — optional host hint backing `useFitScreenInsets()`: set only for
|
|
804
|
+
* a self-scrolling fit surface with nothing below it. `claim(onInset)` runs
|
|
805
|
+
* the surface under the bottom safe area, reports the inset in px now and
|
|
806
|
+
* on every change, and returns the release. Null / absent reads as zeros.
|
|
807
|
+
*/
|
|
808
|
+
fitScreenFoot?: {
|
|
809
|
+
claim(onInset: (bottom: number) => void): () => void;
|
|
810
|
+
} | null;
|
|
802
811
|
/** Active end-user identity from the host-built context (camelCase, not a wire payload). `id` is null when anonymous. */
|
|
803
812
|
user: {
|
|
804
813
|
id: string | null;
|
|
@@ -2177,6 +2186,26 @@ export function useFill(): boolean;
|
|
|
2177
2186
|
*/
|
|
2178
2187
|
export function useFitScreen(): boolean;
|
|
2179
2188
|
|
|
2189
|
+
/** Insets in px, one per screen edge. */
|
|
2190
|
+
export interface FitScreenInsets {
|
|
2191
|
+
top: number;
|
|
2192
|
+
right: number;
|
|
2193
|
+
bottom: number;
|
|
2194
|
+
left: number;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
/**
|
|
2198
|
+
* sc-11615 — the parts of the device's safe area (the home indicator, a
|
|
2199
|
+
* system navigation bar) that this widget's surface runs under. Calling it
|
|
2200
|
+
* opts in: a Fit to screen section whose widget scrolls itself
|
|
2201
|
+
* (`prefersFitToScreen`) then runs to the screen's bottom edge in the exported
|
|
2202
|
+
* app; keep the background filling it and pad bottom-anchored controls (a
|
|
2203
|
+
* composer, a pinned bar) by `bottom`. Never called, the inset stays below.
|
|
2204
|
+
* All zeros while the keyboard is up, when the app's bottom bar holds the
|
|
2205
|
+
* inset, on web, and for every widget that is not such a surface.
|
|
2206
|
+
*/
|
|
2207
|
+
export function useFitScreenInsets(): FitScreenInsets;
|
|
2208
|
+
|
|
2180
2209
|
/**
|
|
2181
2210
|
* The host-provided navigation surface. `goTo(pageId, params?)` navigates
|
|
2182
2211
|
* to an internal app page; `goBack()` pops the stack. `goToStartPage()`
|
package/dist/index.js
CHANGED
package/dist/index.native.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.231.0",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"homepage": "https://github.com/Colix-AB/AppStudio",
|
|
6
6
|
"type": "module",
|
package/src/contract.js
CHANGED
|
@@ -1021,6 +1021,31 @@ const HOOKS = [
|
|
|
1021
1021
|
requiredContextSlice: ["fitScreen"],
|
|
1022
1022
|
scopes: null,
|
|
1023
1023
|
},
|
|
1024
|
+
{
|
|
1025
|
+
name: "useFitScreenInsets",
|
|
1026
|
+
signature: "useFitScreenInsets()",
|
|
1027
|
+
description:
|
|
1028
|
+
"Returns { top, right, bottom, left } in px: the parts of the device's " +
|
|
1029
|
+
"safe area (the home indicator, a system navigation bar) that this " +
|
|
1030
|
+
"widget's surface runs under. Calling it opts the widget in: only then " +
|
|
1031
|
+
"does a Fit to screen section whose widget scrolls itself (manifest " +
|
|
1032
|
+
"prefersFitToScreen) run to the screen's bottom edge in the exported " +
|
|
1033
|
+
"app, so the widget's background fills it; a widget that never calls it " +
|
|
1034
|
+
"keeps the inset below its section. Pad the bottom-anchored controls (a composer, a pinned bar, the end of " +
|
|
1035
|
+
"a list) by bottom so they stay clear, with the background behind the " +
|
|
1036
|
+
"padding. The host reports 0 while the keyboard is up (it covers that " +
|
|
1037
|
+
"area), when the app's bottom bar holds the inset, on web (the browser " +
|
|
1038
|
+
"keeps the page inside its own safe area) and for every widget that is " +
|
|
1039
|
+
"not such a surface, so calling it is always safe.",
|
|
1040
|
+
returnShape: {
|
|
1041
|
+
top: "number",
|
|
1042
|
+
right: "number",
|
|
1043
|
+
bottom: "number",
|
|
1044
|
+
left: "number",
|
|
1045
|
+
},
|
|
1046
|
+
requiredContextSlice: ["fitScreenFoot"],
|
|
1047
|
+
scopes: null,
|
|
1048
|
+
},
|
|
1024
1049
|
{
|
|
1025
1050
|
name: "useChildRenderer",
|
|
1026
1051
|
signature: "useChildRenderer()",
|
|
@@ -3602,7 +3627,7 @@ const MANIFEST_SCHEMA = {
|
|
|
3602
3627
|
type: "boolean",
|
|
3603
3628
|
required: false,
|
|
3604
3629
|
description:
|
|
3605
|
-
"Optional (default false). TRUE when the widget is built to own the rest of the screen: it scrolls its own content and keeps its controls in view, like a messenger, a map or a full-height board. Dropping the widget at the top level of a page in the Builder turns that section's \"Fit to screen\" setting on (the maker can switch it off, and it stays off), and the app-builder fits the section it plans the widget into. A fit section runs edge to edge across the content area and takes the rest of the screen; the widget learns it through useFill() and useFitScreen(), and the host gives it a box exactly the height left, which it scrolls inside (a widget without the field grows with its content there, and the page scrolls). Set it only for a widget that honours useFill() and scrolls inside the height it is given; leave it false (or omit) for everything else.",
|
|
3630
|
+
"Optional (default false). TRUE when the widget is built to own the rest of the screen: it scrolls its own content and keeps its controls in view, like a messenger, a map or a full-height board. Dropping the widget at the top level of a page in the Builder turns that section's \"Fit to screen\" setting on (the maker can switch it off, and it stays off), and the app-builder fits the section it plans the widget into. A fit section runs edge to edge across the content area and takes the rest of the screen; the widget learns it through useFill() and useFitScreen(), and the host gives it a box exactly the height left, which it scrolls inside (a widget without the field grows with its content there, and the page scrolls). In the exported app a widget that also calls useFitScreenInsets() has that box run to the screen's bottom edge, under the home indicator: keep the background filling it and pad bottom-anchored controls by useFitScreenInsets().bottom (a widget that never calls it keeps the inset below its section). Set it only for a widget that honours useFill() and scrolls inside the height it is given; leave it false (or omit) for everything else.",
|
|
3606
3631
|
default: false,
|
|
3607
3632
|
},
|
|
3608
3633
|
events: {
|
|
@@ -3690,6 +3715,21 @@ const WIDGET_CONTEXT_SHAPE = {
|
|
|
3690
3715
|
required: false,
|
|
3691
3716
|
fields: {},
|
|
3692
3717
|
},
|
|
3718
|
+
// sc-11615 — optional host hint backing useFitScreenInsets(): the screen's
|
|
3719
|
+
// foot a self-scrolling fit surface may claim.
|
|
3720
|
+
fitScreenFoot: {
|
|
3721
|
+
description:
|
|
3722
|
+
"Optional host layout hint ({ claim } or null). Set only for a " +
|
|
3723
|
+
"self-scrolling Fit to screen surface with nothing below it in the " +
|
|
3724
|
+
"exported app: claim(onInset) runs the surface under the bottom safe " +
|
|
3725
|
+
"area, calls onInset(px) now and on every change, and returns the " +
|
|
3726
|
+
"release. Backs useFitScreenInsets(); null or absent reads as zeros " +
|
|
3727
|
+
"and leaves the inset below the section.",
|
|
3728
|
+
required: false,
|
|
3729
|
+
fields: {
|
|
3730
|
+
claim: "(onInset: (bottom: number) => void) => () => void",
|
|
3731
|
+
},
|
|
3732
|
+
},
|
|
3693
3733
|
user: {
|
|
3694
3734
|
description:
|
|
3695
3735
|
"Signed-in user, host-built context object (camelCase: { id, email, displayName, photoUrl, roles, groupIds }) — NOT a wire payload, so it is the one camelCase island among the hooks. photoUrl is the user's own profile photo as an absolute URL, or null. email is null for an account created without one. Not a data-client.",
|
|
@@ -5992,7 +6032,11 @@ const CONTRACT = deepFreeze({
|
|
|
5992
6032
|
// `canSetLocale` and `setLocale(code)`, backed by the optional
|
|
5993
6033
|
// `i18n.languages` / `i18n.setLocale` host slice: a widget can switch
|
|
5994
6034
|
// the app's language. Hosts without them read [] / false.
|
|
5995
|
-
|
|
6035
|
+
// 1.186.0: additive (sc-11615) — `useFitScreenInsets()` with its optional
|
|
6036
|
+
// `fitScreenFoot` host hint: a self-scrolling Fit to screen surface that
|
|
6037
|
+
// calls it runs under the bottom safe area on native and pads its
|
|
6038
|
+
// controls by it. Hosts without the hint read zeros.
|
|
6039
|
+
version: "1.186.0",
|
|
5996
6040
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
5997
6041
|
hooks: HOOKS,
|
|
5998
6042
|
primitives: PRIMITIVES,
|