@colixsystems/widget-sdk 0.102.0 → 0.102.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 +1 -1
- package/dist/contract.cjs +11 -4
- package/dist/contract.js +11 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ The data layer lives in **four separate domain-client packages**, each instantia
|
|
|
21
21
|
| **CORE** | `useWorkspaceCurrency()` | `{ currency, formatMoney }` | `ctx.workspace.currency` — no scope. The currency this workspace charges its app users in, resolved at RENDER time. Render every price as `formatMoney(minorUnits)` and never write a currency symbol or code into a widget: the owner can change it after the widget ships, and a baked label then contradicts the charge. |
|
|
22
22
|
| **CORE** | `useWidgetStyle()` | `{ [styleField]: value }` | `ctx.props.style` — no scope. The author-set per-widget style values declared in `manifest.styleSchema`; apply each onto whatever element you choose. |
|
|
23
23
|
| **CORE** | `useUser()` | `{ id, email, displayName, roles, groupIds }` | `ctx.user` (host-built context, **camelCase** — not a wire payload; `id` null when anonymous) — no scope |
|
|
24
|
-
| **CORE** | `useNavigation()` | `{ goTo, goBack, push, replace, back, currentRoute, openLink }` | `ctx.navigation` — no scope (`openLink` for a link of unknown shape; a known external URL can also use the `Linking` primitive) |
|
|
24
|
+
| **CORE** | `useNavigation()` | `{ goTo, goBack, push, replace, back, currentRoute, openLink }` | `ctx.navigation` — no scope. `goTo(pageIdOrSlug, params?)` accepts a page UUID (a `pageRef` prop) **or its slug** (a row's page-key field) — both hosts resolve either (`openLink` for a link of unknown shape; a known external URL can also use the `Linking` primitive) |
|
|
25
25
|
| **CORE** | `useRouteParams()` | `{ [paramKey]: value }` | `ctx.navigation.currentRoute.params` — no scope. The nav params the previous page passed via `goTo(pageId, params)`; the flat accessor for master→detail (read `recordId` on a detail page). Empty object when none. |
|
|
26
26
|
| **CORE** | `usePageContext()` | `{ params, records }` | `ctx.pageContext` — no scope. The page's DECLARED parameters, resolved once by the host: `params` are coerced to their declared types, `records` holds the row already fetched for each `record` param (read it instead of fetching again). Both empty when the page declares none. |
|
|
27
27
|
| **CORE** | `useWidgetRoute(initial)` | `[state, setState]` | `ctx.widgetRoute` — no scope. Where YOUR WIDGET is, persisted by the host so it survives a reload and travels in a shared link (the `w_<instanceId>` query key on web, the screen's route params natively): the folder a browser has opened, a wizard step, a selected tab, a list's sort and search. `useState` semantics over an object — writes MERGE, `null` clears a key back to its `initial`, and `initial` is read once. Values are scalars or flat arrays of scalars, size- and length-capped; anything else is not stored. NOT history (Back still leaves the page, on both platforms). Degrades to component state on the Studio canvas. |
|
package/dist/contract.cjs
CHANGED
|
@@ -655,11 +655,12 @@ const HOOKS = [
|
|
|
655
655
|
name: "useNavigation",
|
|
656
656
|
signature: "useNavigation()",
|
|
657
657
|
returnShape: {
|
|
658
|
-
goTo:
|
|
658
|
+
goTo:
|
|
659
|
+
"(pageIdOrSlug: string, params?: object) => void — a page's UUID (a pageRef prop) OR its SLUG (e.g. a row's page-key field); both hosts resolve either. There is NO page-name lookup: a slug is the only data-carried navigation key.",
|
|
659
660
|
openLink: "(link: string) => boolean",
|
|
660
661
|
goBack: "() => void",
|
|
661
|
-
push: "(
|
|
662
|
-
replace: "(
|
|
662
|
+
push: "(pageIdOrSlug: string, params?: object) => void",
|
|
663
|
+
replace: "(pageIdOrSlug: string, params?: object) => void",
|
|
663
664
|
back: "() => void",
|
|
664
665
|
currentRoute: "{ pageId: string, params: object }",
|
|
665
666
|
},
|
|
@@ -3259,7 +3260,13 @@ const CONTRACT = deepFreeze({
|
|
|
3259
3260
|
// are compressed to WebP by default; `compress: false` stores the file
|
|
3260
3261
|
// byte-for-byte. Existing callers are unaffected — the field is only sent
|
|
3261
3262
|
// when the opt-out is chosen.
|
|
3262
|
-
|
|
3263
|
+
// 1.77.0: documentation (sc-5713) — `goTo`/`push`/`replace` document that
|
|
3264
|
+
// they accept a page SLUG as well as a page UUID. Both hosts have always
|
|
3265
|
+
// resolved either (the web route reads id-or-slug; the export's
|
|
3266
|
+
// PAGE_ROUTES maps both to the screen name), but the contract said
|
|
3267
|
+
// `pageId` only, so data-driven widgets — whose rows carry slugs —
|
|
3268
|
+
// invented params patterns that navigate nowhere. No code changed shape.
|
|
3269
|
+
version: "1.77.0",
|
|
3263
3270
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
3264
3271
|
hooks: HOOKS,
|
|
3265
3272
|
primitives: PRIMITIVES,
|
package/dist/contract.js
CHANGED
|
@@ -655,11 +655,12 @@ const HOOKS = [
|
|
|
655
655
|
name: "useNavigation",
|
|
656
656
|
signature: "useNavigation()",
|
|
657
657
|
returnShape: {
|
|
658
|
-
goTo:
|
|
658
|
+
goTo:
|
|
659
|
+
"(pageIdOrSlug: string, params?: object) => void — a page's UUID (a pageRef prop) OR its SLUG (e.g. a row's page-key field); both hosts resolve either. There is NO page-name lookup: a slug is the only data-carried navigation key.",
|
|
659
660
|
openLink: "(link: string) => boolean",
|
|
660
661
|
goBack: "() => void",
|
|
661
|
-
push: "(
|
|
662
|
-
replace: "(
|
|
662
|
+
push: "(pageIdOrSlug: string, params?: object) => void",
|
|
663
|
+
replace: "(pageIdOrSlug: string, params?: object) => void",
|
|
663
664
|
back: "() => void",
|
|
664
665
|
currentRoute: "{ pageId: string, params: object }",
|
|
665
666
|
},
|
|
@@ -3259,7 +3260,13 @@ const CONTRACT = deepFreeze({
|
|
|
3259
3260
|
// are compressed to WebP by default; `compress: false` stores the file
|
|
3260
3261
|
// byte-for-byte. Existing callers are unaffected — the field is only sent
|
|
3261
3262
|
// when the opt-out is chosen.
|
|
3262
|
-
|
|
3263
|
+
// 1.77.0: documentation (sc-5713) — `goTo`/`push`/`replace` document that
|
|
3264
|
+
// they accept a page SLUG as well as a page UUID. Both hosts have always
|
|
3265
|
+
// resolved either (the web route reads id-or-slug; the export's
|
|
3266
|
+
// PAGE_ROUTES maps both to the screen name), but the contract said
|
|
3267
|
+
// `pageId` only, so data-driven widgets — whose rows carry slugs —
|
|
3268
|
+
// invented params patterns that navigate nowhere. No code changed shape.
|
|
3269
|
+
version: "1.77.0",
|
|
3263
3270
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
3264
3271
|
hooks: HOOKS,
|
|
3265
3272
|
primitives: PRIMITIVES,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.102.
|
|
3
|
+
"version": "0.102.1",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|