@colixsystems/widget-sdk 0.219.0 → 0.219.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 +6 -2
- package/dist/contract.cjs +13 -11
- package/dist/contract.js +13 -11
- package/dist/hooks.js +9 -8
- package/dist/index.d.ts +9 -7
- package/package.json +1 -1
- package/src/contract.js +13 -11
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ The data layer lives in **four separate domain-client packages**, each instantia
|
|
|
32
32
|
| **CORE** | `useWidgetEvent(name)` | `(payload?) => void` | `ctx.events.emit` — no scope. The hook IS the emitter: `const emitSlot = useWidgetEvent("slotChosen")`, then `emitSlot(payload)`. Never destructure the result — there is no `emit` member. A sibling's input reads the payload, and a page action the author binds to the event (Run action, Navigate) runs with it — fired from one control, only that control runs it. |
|
|
33
33
|
| **CORE** | `useWidgetInput(inputName)` | the published payload, or `undefined` | `ctx.inputs` — no scope. Reads a value ANOTHER widget on the same page published with `useWidgetEvent`. Declare the input in `manifest.inputs`; the page author wires it to one sibling's declared event. The channel retains the last payload, so a widget that mounts later still reads it. `undefined` while unwired or before the first publish — always render a sensible default. Page-scoped and ephemeral: use `useRouteParams()` for state that must survive navigation, the datastore for state that must persist. |
|
|
34
34
|
| **CORE** | `useChildRenderer()` | `{ renderNode(node) }` | `ctx.renderer` — no scope (prefer the `WidgetTree` component) |
|
|
35
|
-
| **CORE** | `useFill()` | `boolean` | `ctx.fill` — no scope. `true` when the host sized this widget to fill
|
|
35
|
+
| **CORE** | `useFill()` | `boolean` | `ctx.fill` — no scope. `true` when the host sized this widget to fill a box of definite height: a widget in the section a fit-to-screen page stretches to the bottom of the screen, or one given a fixed slot height. Media-style widgets, and a chat or feed that scrolls its own content, switch to a `flex: 1` / `height: "100%"` layout and scroll inside it; others ignore it. Defaults `false`. |
|
|
36
36
|
| **CORE** | `useContainerWidth()` | `[width, onLayout]` | No context slice, no scope. Measures the width the widget's OWN box has, so it can lay itself out for the space it is in rather than for the screen. Spread the handler onto your outermost primitive. Use it for any widget with a wide form and a narrow one (a table, a toolbar, a row of tiles) — never switch on the device or window width, because a widget in a one-of-three grid cell on desktop has phone-width room and a widget filling a phone page does not. Width is 0 until the first layout: render the WIDE form then. One implementation covers web (react-native-web) and the native export. |
|
|
37
37
|
| **CORE** | `isNarrowWidth(width)` | `boolean` | No context slice, no scope. True when a MEASURED width is below `NARROW_WIDTH_PX` (480) — the one threshold every widget switches at, so a page reflows together rather than raggedly. An unmeasured width (0) is NOT narrow, so nothing flashes through the narrow form on first paint. |
|
|
38
38
|
| **CORE** | `widthTier(width)` | `"narrow" \| "medium" \| "wide"` | No context slice, no scope. Which of THREE layouts a measured width calls for: narrow below `NARROW_WIDTH_PX` (480), wide at or above `WIDE_WIDTH_PX` (960), medium between. `widthTier(w) === "narrow"` exactly when `isNarrowWidth(w)`; an unmeasured width (0) is "wide". |
|
|
@@ -83,7 +83,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
83
83
|
|
|
84
84
|
## Status
|
|
85
85
|
|
|
86
|
-
`v0.219.
|
|
86
|
+
`v0.219.1` — 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**.
|
|
87
|
+
|
|
88
|
+
### What's new in 0.219.1
|
|
89
|
+
|
|
90
|
+
**`useFill()` says when it is true today.** It described a page-grid tile with a "Fill tile height" choice, a layout that no longer exists. A host now fills a widget in two cases: the widget sits in the section a fit-to-screen page stretches to the bottom of the screen, or the widget has a fixed slot height. A chat or feed that scrolls its own content is one of the widgets that should honour it. A documentation correction; `CONTRACT.version` is unchanged.
|
|
87
91
|
|
|
88
92
|
### What's new in 0.219.0 (contract 1.175.0)
|
|
89
93
|
|
package/dist/contract.cjs
CHANGED
|
@@ -942,13 +942,14 @@ const HOOKS = [
|
|
|
942
942
|
name: "useFill",
|
|
943
943
|
signature: "useFill()",
|
|
944
944
|
description:
|
|
945
|
-
"Returns true when the host has sized this widget to fill
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
"
|
|
949
|
-
"Chart, Map, Video
|
|
950
|
-
|
|
951
|
-
"
|
|
945
|
+
"Returns true when the host has sized this widget to fill a box of " +
|
|
946
|
+
"definite height — a widget in the section a fit-to-screen page " +
|
|
947
|
+
"stretches to the bottom of the screen, or a widget given a fixed slot " +
|
|
948
|
+
"height. When true, a widget that has a meaningful filled form (Image, " +
|
|
949
|
+
"Chart, Map, Video, a chat or feed that scrolls its own content) should " +
|
|
950
|
+
"switch from its intrinsic height to a stretch style (flex: 1 / " +
|
|
951
|
+
'height: "100%") and scroll inside it; widgets with no useful filled ' +
|
|
952
|
+
"form may ignore it. Defaults to false wherever the host has not opted the " +
|
|
952
953
|
"widget into filling, so calling it is always safe. The SAME value is " +
|
|
953
954
|
"injected by the web Player and the native export (widget-parity skill), so a " +
|
|
954
955
|
"widget's fill behaviour is identical on both platforms.",
|
|
@@ -3549,15 +3550,16 @@ const WIDGET_CONTEXT_SHAPE = {
|
|
|
3549
3550
|
},
|
|
3550
3551
|
},
|
|
3551
3552
|
// REQ-LAY-08 — optional host layout hint backing useFill(). True when the
|
|
3552
|
-
// host sized this widget to fill
|
|
3553
|
-
// page
|
|
3553
|
+
// host sized this widget to fill a box of definite height (a fit-to-screen
|
|
3554
|
+
// page's stretched section, or a fixed slot height).
|
|
3554
3555
|
// Optional: a host that never fills a widget simply omits it and useFill()
|
|
3555
3556
|
// returns false, so existing hosts need no change.
|
|
3556
3557
|
fill: {
|
|
3557
3558
|
description:
|
|
3558
3559
|
"Optional host layout hint (boolean). True when the host sized this " +
|
|
3559
|
-
"widget to fill
|
|
3560
|
-
"
|
|
3560
|
+
"widget to fill a box of definite height (a fit-to-screen page's " +
|
|
3561
|
+
"stretched section, or a fixed slot height). Backs useFill(); defaults " +
|
|
3562
|
+
"to false when absent.",
|
|
3561
3563
|
required: false,
|
|
3562
3564
|
fields: {},
|
|
3563
3565
|
},
|
package/dist/contract.js
CHANGED
|
@@ -942,13 +942,14 @@ const HOOKS = [
|
|
|
942
942
|
name: "useFill",
|
|
943
943
|
signature: "useFill()",
|
|
944
944
|
description:
|
|
945
|
-
"Returns true when the host has sized this widget to fill
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
"
|
|
949
|
-
"Chart, Map, Video
|
|
950
|
-
|
|
951
|
-
"
|
|
945
|
+
"Returns true when the host has sized this widget to fill a box of " +
|
|
946
|
+
"definite height — a widget in the section a fit-to-screen page " +
|
|
947
|
+
"stretches to the bottom of the screen, or a widget given a fixed slot " +
|
|
948
|
+
"height. When true, a widget that has a meaningful filled form (Image, " +
|
|
949
|
+
"Chart, Map, Video, a chat or feed that scrolls its own content) should " +
|
|
950
|
+
"switch from its intrinsic height to a stretch style (flex: 1 / " +
|
|
951
|
+
'height: "100%") and scroll inside it; widgets with no useful filled ' +
|
|
952
|
+
"form may ignore it. Defaults to false wherever the host has not opted the " +
|
|
952
953
|
"widget into filling, so calling it is always safe. The SAME value is " +
|
|
953
954
|
"injected by the web Player and the native export (widget-parity skill), so a " +
|
|
954
955
|
"widget's fill behaviour is identical on both platforms.",
|
|
@@ -3545,15 +3546,16 @@ const WIDGET_CONTEXT_SHAPE = {
|
|
|
3545
3546
|
},
|
|
3546
3547
|
},
|
|
3547
3548
|
// REQ-LAY-08 — optional host layout hint backing useFill(). True when the
|
|
3548
|
-
// host sized this widget to fill
|
|
3549
|
-
// page
|
|
3549
|
+
// host sized this widget to fill a box of definite height (a fit-to-screen
|
|
3550
|
+
// page's stretched section, or a fixed slot height).
|
|
3550
3551
|
// Optional: a host that never fills a widget simply omits it and useFill()
|
|
3551
3552
|
// returns false, so existing hosts need no change.
|
|
3552
3553
|
fill: {
|
|
3553
3554
|
description:
|
|
3554
3555
|
"Optional host layout hint (boolean). True when the host sized this " +
|
|
3555
|
-
"widget to fill
|
|
3556
|
-
"
|
|
3556
|
+
"widget to fill a box of definite height (a fit-to-screen page's " +
|
|
3557
|
+
"stretched section, or a fixed slot height). Backs useFill(); defaults " +
|
|
3558
|
+
"to false when absent.",
|
|
3557
3559
|
required: false,
|
|
3558
3560
|
fields: {},
|
|
3559
3561
|
},
|
package/dist/hooks.js
CHANGED
|
@@ -392,14 +392,15 @@ export function useUserPhoto() {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
|
-
* Returns `true` when the host has sized this widget to fill
|
|
396
|
-
* height
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
* to a stretch style (`flex: 1` / `height: "100%"`)
|
|
401
|
-
*
|
|
402
|
-
*
|
|
395
|
+
* Returns `true` when the host has sized this widget to fill a box of
|
|
396
|
+
* definite height — a widget in the section a fit-to-screen page stretches to
|
|
397
|
+
* the bottom of the screen, or a widget given a fixed slot height. When
|
|
398
|
+
* `true`, a widget that has a meaningful filled form (Image, Chart, Map,
|
|
399
|
+
* Video, a chat or feed that scrolls its own content, …) should switch from
|
|
400
|
+
* its intrinsic height to a stretch style (`flex: 1` / `height: "100%"`) and
|
|
401
|
+
* scroll inside it; widgets with no useful filled form may ignore it.
|
|
402
|
+
* Defaults to `false` everywhere the host has not opted the widget into
|
|
403
|
+
* filling, so calling it is always safe.
|
|
403
404
|
*
|
|
404
405
|
* The SAME value is injected by the web Player host and the native export
|
|
405
406
|
* host (widget-parity skill), so a widget's fill behaviour is identical on both
|
package/dist/index.d.ts
CHANGED
|
@@ -728,8 +728,8 @@ export interface WidgetContext<TProps = unknown> {
|
|
|
728
728
|
};
|
|
729
729
|
/**
|
|
730
730
|
* REQ-LAY-08 — optional host layout hint backing `useFill()`. `true` when
|
|
731
|
-
* the host sized this widget to fill
|
|
732
|
-
*
|
|
731
|
+
* the host sized this widget to fill a box of definite height (a
|
|
732
|
+
* fit-to-screen page's stretched section, or a fixed slot height).
|
|
733
733
|
* Absent / `false` everywhere the host has not opted the widget into filling.
|
|
734
734
|
*/
|
|
735
735
|
fill?: boolean;
|
|
@@ -1948,11 +1948,13 @@ export interface UserPhotoApi {
|
|
|
1948
1948
|
export function useUserPhoto(): UserPhotoApi;
|
|
1949
1949
|
|
|
1950
1950
|
/**
|
|
1951
|
-
* REQ-LAY-08 — returns `true` when the host has sized this widget to fill
|
|
1952
|
-
*
|
|
1953
|
-
*
|
|
1954
|
-
* stretch (Image, Chart, Map, Video,
|
|
1955
|
-
*
|
|
1951
|
+
* REQ-LAY-08 — returns `true` when the host has sized this widget to fill a
|
|
1952
|
+
* box of definite height (a widget in the section a fit-to-screen page
|
|
1953
|
+
* stretches to the bottom of the screen, or one given a fixed slot height).
|
|
1954
|
+
* Widgets that can stretch (Image, Chart, Map, Video, a chat or feed that
|
|
1955
|
+
* scrolls itself, …) should switch to a fill style (`flex: 1` /
|
|
1956
|
+
* `height: "100%"`) and scroll inside it when this is `true`; others may
|
|
1957
|
+
* ignore it.
|
|
1956
1958
|
* Defaults to `false`, so calling it is always safe, and the same value is
|
|
1957
1959
|
* injected on web and native so fill behaviour is identical on both platforms.
|
|
1958
1960
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.219.
|
|
3
|
+
"version": "0.219.1",
|
|
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
|
@@ -942,13 +942,14 @@ const HOOKS = [
|
|
|
942
942
|
name: "useFill",
|
|
943
943
|
signature: "useFill()",
|
|
944
944
|
description:
|
|
945
|
-
"Returns true when the host has sized this widget to fill
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
"
|
|
949
|
-
"Chart, Map, Video
|
|
950
|
-
|
|
951
|
-
"
|
|
945
|
+
"Returns true when the host has sized this widget to fill a box of " +
|
|
946
|
+
"definite height — a widget in the section a fit-to-screen page " +
|
|
947
|
+
"stretches to the bottom of the screen, or a widget given a fixed slot " +
|
|
948
|
+
"height. When true, a widget that has a meaningful filled form (Image, " +
|
|
949
|
+
"Chart, Map, Video, a chat or feed that scrolls its own content) should " +
|
|
950
|
+
"switch from its intrinsic height to a stretch style (flex: 1 / " +
|
|
951
|
+
'height: "100%") and scroll inside it; widgets with no useful filled ' +
|
|
952
|
+
"form may ignore it. Defaults to false wherever the host has not opted the " +
|
|
952
953
|
"widget into filling, so calling it is always safe. The SAME value is " +
|
|
953
954
|
"injected by the web Player and the native export (widget-parity skill), so a " +
|
|
954
955
|
"widget's fill behaviour is identical on both platforms.",
|
|
@@ -3545,15 +3546,16 @@ const WIDGET_CONTEXT_SHAPE = {
|
|
|
3545
3546
|
},
|
|
3546
3547
|
},
|
|
3547
3548
|
// REQ-LAY-08 — optional host layout hint backing useFill(). True when the
|
|
3548
|
-
// host sized this widget to fill
|
|
3549
|
-
// page
|
|
3549
|
+
// host sized this widget to fill a box of definite height (a fit-to-screen
|
|
3550
|
+
// page's stretched section, or a fixed slot height).
|
|
3550
3551
|
// Optional: a host that never fills a widget simply omits it and useFill()
|
|
3551
3552
|
// returns false, so existing hosts need no change.
|
|
3552
3553
|
fill: {
|
|
3553
3554
|
description:
|
|
3554
3555
|
"Optional host layout hint (boolean). True when the host sized this " +
|
|
3555
|
-
"widget to fill
|
|
3556
|
-
"
|
|
3556
|
+
"widget to fill a box of definite height (a fit-to-screen page's " +
|
|
3557
|
+
"stretched section, or a fixed slot height). Backs useFill(); defaults " +
|
|
3558
|
+
"to false when absent.",
|
|
3557
3559
|
required: false,
|
|
3558
3560
|
fields: {},
|
|
3559
3561
|
},
|