@colixsystems/widget-sdk 0.260.0 → 0.262.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 +36 -15
- package/dist/accordion.js +2 -1
- package/dist/banner.js +1 -1
- package/dist/button.js +1 -1
- package/dist/card-photo.js +1 -1
- package/dist/card.js +1 -1
- package/dist/chart.js +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip.js +1 -1
- package/dist/confirm-dialog.js +1 -1
- package/dist/contract.cjs +53 -2
- package/dist/contract.js +53 -2
- package/dist/data-table.js +1 -1
- package/dist/datetimepicker.js +2 -1
- package/dist/detail-parts.js +1 -1
- package/dist/emoji-picker.js +1 -1
- package/dist/file-image.js +1 -1
- package/dist/file-upload.js +2 -1
- package/dist/filter-bar.js +1 -1
- package/dist/form.js +1 -1
- package/dist/gradient.js +1 -1
- package/dist/grid.js +1 -1
- package/dist/hooks.js +134 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +2 -0
- package/dist/index.native.js +2 -0
- package/dist/linter.cjs +11 -0
- package/dist/linter.js +11 -0
- package/dist/list.js +1 -1
- package/dist/loading.js +1 -1
- package/dist/markdown-input.js +1 -1
- package/dist/modal.js +1 -1
- package/dist/overlay.js +1 -1
- package/dist/people-picker.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/primitives.js +1 -1
- package/dist/property-schema.js +4 -0
- package/dist/radio-group.js +1 -1
- package/dist/richtext.js +1 -1
- package/dist/search-field.js +1 -1
- package/dist/select.js +1 -1
- package/dist/sortable.js +1 -1
- package/dist/switch.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-field.js +1 -1
- package/dist/text-scale-style.js +60 -0
- package/dist/text-scale.d.ts +11 -0
- package/dist/text-scale.js +40 -0
- package/dist/video.js +1 -1
- package/package.json +6 -1
- package/src/contract.js +53 -2
package/src/contract.js
CHANGED
|
@@ -2155,6 +2155,41 @@ const HOOKS = [
|
|
|
2155
2155
|
requiredContextSlice: ["agents.conversations"],
|
|
2156
2156
|
scopes: ["ai.invoke:*"],
|
|
2157
2157
|
},
|
|
2158
|
+
{
|
|
2159
|
+
name: "useAction",
|
|
2160
|
+
signature: "useAction(actionRef)",
|
|
2161
|
+
description:
|
|
2162
|
+
"sc-13843 — run one of the WORKSPACE's Actions (a server-side script) " +
|
|
2163
|
+
"and read what it returned. IMPERATIVE: call run(input) from an event " +
|
|
2164
|
+
"handler, never on mount or in render — an Action can write data and " +
|
|
2165
|
+
"send messages, so placing a widget must not run it. run resolves with " +
|
|
2166
|
+
"the value the Action passed to respond() (any JSON, or null when it " +
|
|
2167
|
+
"responded with nothing) and `result` holds the last one. The Action " +
|
|
2168
|
+
"must carry the app trigger, or the server refuses the run with " +
|
|
2169
|
+
"ACTION_NOT_APP_INVOKABLE — the same gate a Button's Run action meets. " +
|
|
2170
|
+
"`actionRef` is an Action id an author bound through an `actionRef` " +
|
|
2171
|
+
"property — when it is missing, or the host brokers no actions client, " +
|
|
2172
|
+
"`available` is false and run() rejects UNAVAILABLE; render a visible " +
|
|
2173
|
+
"'pick an action' state, NEVER a blank box. A changed binding clears " +
|
|
2174
|
+
"`result` and `error`, and a run that settles after the binding changed " +
|
|
2175
|
+
"(or after unmount) writes nothing. ActionError.code: " +
|
|
2176
|
+
"INVALID_ACTION_INPUT (400) — the input was refused; " +
|
|
2177
|
+
"ACTION_NOT_APP_INVOKABLE (403) and ACTION_NOT_FOUND (404) will NOT " +
|
|
2178
|
+
"clear on a retry, so hide the affordance; RATE_LIMITED (429) will; " +
|
|
2179
|
+
"ACTION_FAILED — the Action ran and failed, or no answer arrived. NEVER " +
|
|
2180
|
+
"show an app user a raw error. A text answer from a bot is often " +
|
|
2181
|
+
"MARKDOWN, so render it with <RichText value={result} />, not <Text>. " +
|
|
2182
|
+
"Reads ctx.actions.",
|
|
2183
|
+
returnShape: {
|
|
2184
|
+
available: "boolean // false when no Action is bound, or the host brokers none",
|
|
2185
|
+
run: "(input) => Promise<unknown> // input is optional; resolves with the Action's respond() value, or null; rejects with ActionError",
|
|
2186
|
+
running: "boolean // true while any run is in flight",
|
|
2187
|
+
result: "unknown // the last successful run's result; null before the first run",
|
|
2188
|
+
error: "ActionError | null",
|
|
2189
|
+
},
|
|
2190
|
+
requiredContextSlice: ["actions.run"],
|
|
2191
|
+
scopes: ["actions.run:*"],
|
|
2192
|
+
},
|
|
2158
2193
|
{
|
|
2159
2194
|
name: "useDatastoreMutation",
|
|
2160
2195
|
signature: "useDatastoreMutation(tableId)",
|
|
@@ -3725,6 +3760,8 @@ const ACTION_SCRIPT_GLOBALS = [
|
|
|
3725
3760
|
"triggeredBy",
|
|
3726
3761
|
// sc-9031 — a Run action event's parameters; null on every other trigger.
|
|
3727
3762
|
"input",
|
|
3763
|
+
// sc-13843 — hands the app run its one JSON result.
|
|
3764
|
+
"respond",
|
|
3728
3765
|
];
|
|
3729
3766
|
// Mirrors action.service.js SCRIPT_MAX_BYTES.
|
|
3730
3767
|
const ACTION_SCRIPT_MAX_BYTES = 200 * 1024;
|
|
@@ -3878,7 +3915,7 @@ const MANIFEST_SCHEMA = {
|
|
|
3878
3915
|
type: "boolean",
|
|
3879
3916
|
required: false,
|
|
3880
3917
|
description:
|
|
3881
|
-
"Optional (default false). TRUE when every platform entry also exports useBadgeCount(props): a hook returning the count the widget puts on its page's menu entry with usePageBadge, so the app keeps that badge live while the page is closed. The host runs counters for installed marketplace widgets (the workspace's own published widgets included); the platform's built-in widgets declare none. It calls the hook with the instance's resolved props, inside the widget's own context; the hook returns a whole number, or null while the count is not known yet. It only reads, and the host enforces that: the counter's datastore and directory expose only their read methods (plus realtime subscriptions) and notification mutes only get/list, while writes, typing signals, payments, notifications.send, files, assets, AI agents, translation, link previews, device capabilities, identification
|
|
3918
|
+
"Optional (default false). TRUE when every platform entry also exports useBadgeCount(props): a hook returning the count the widget puts on its page's menu entry with usePageBadge, so the app keeps that badge live while the page is closed. The host runs counters for installed marketplace widgets (the workspace's own published widgets included); the platform's built-in widgets declare none. It calls the hook with the instance's resolved props, inside the widget's own context; the hook returns a whole number, or null while the count is not known yet. It only reads, and the host enforces that: the counter's datastore and directory expose only their read methods (plus realtime subscriptions) and notification mutes only get/list, while writes, typing signals, payments, notifications.send, files, assets, AI agents, translation, link previews, device capabilities, identification, account actions and Actions (useAction) all answer as unavailable. It also renders nothing, navigates nowhere, emits no events or toasts, marks nothing read, and calls none of usePageBadge, useScreenTitle, useSectionEmpty or useWidgetRoute's setter. The linter refuses a declared counter whose entry has no useBadgeCount export. The AppStudio widget agent leaves this unset: a generated widget never declares a badge counter.",
|
|
3882
3919
|
default: false,
|
|
3883
3920
|
},
|
|
3884
3921
|
prefersFitToScreen: {
|
|
@@ -4079,6 +4116,17 @@ const WIDGET_CONTEXT_SHAPE = {
|
|
|
4079
4116
|
required: false,
|
|
4080
4117
|
fields: { conversations: "function" },
|
|
4081
4118
|
},
|
|
4119
|
+
actions: {
|
|
4120
|
+
description:
|
|
4121
|
+
"sc-13843 — injected @colixsystems/actions-client instance. " +
|
|
4122
|
+
"{ run(actionId, input?) -> Promise<{ ok, result }> }. Backs useAction(). " +
|
|
4123
|
+
"Runs one Action as the signed-in caller; the server refuses an Action " +
|
|
4124
|
+
"without the app trigger. Errors carry the server's `code` and `status`. " +
|
|
4125
|
+
"Absent on a host that brokers no actions client, where useAction() " +
|
|
4126
|
+
"degrades to available: false rather than throwing.",
|
|
4127
|
+
required: false,
|
|
4128
|
+
fields: { run: "function" },
|
|
4129
|
+
},
|
|
4082
4130
|
linkPreviews: {
|
|
4083
4131
|
description:
|
|
4084
4132
|
"Injected @colixsystems/link-preview-client instance. { get(url) -> Promise<{ url, title, description, site_name, image_url }> }. " +
|
|
@@ -6376,7 +6424,10 @@ const CONTRACT = deepFreeze({
|
|
|
6376
6424
|
// initials when its picture fails to load. No API change.
|
|
6377
6425
|
// 1.211.0: additive (sc-9168) — `maxFontSizeMultiplier`: native `<Text>` /
|
|
6378
6426
|
// `<TextInput>` follow the device font scale up to this bound.
|
|
6379
|
-
|
|
6427
|
+
// 1.212.0: additive (sc-13843) — `useAction(actionRef)` + the `actions` host
|
|
6428
|
+
// client + the `actionRef` propertySchema type + the `actions.run:*`
|
|
6429
|
+
// scope. A widget runs one of the workspace's Actions and reads its result.
|
|
6430
|
+
version: "1.212.0",
|
|
6380
6431
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
6381
6432
|
hooks: HOOKS,
|
|
6382
6433
|
primitives: PRIMITIVES,
|