Share sheet
The Share sheet: who a Space is shared with (viewer or editor) and the share request to run.
The Share sheet: who a Space is shared with (viewer or editor) and the share request to run.
These APIs are part of the Cua Spaces app export for building Spaces UIs. They are source-available under FSL-1.1-MIT and ship for Swift only (import CuaSpacesFFI); the Rust tab shows the cua-spaces-ffi crate they come from. The open source SDK packages for Python, TypeScript and Kotlin do not include them.
app_share_view derives the Share sheet from AppShareInput (the Space and its Space.shares): one row per person with a role menu, the email field and why sharing is unavailable. app_share_reduce applies an action; its request goes to Space.share or Space.unshare, which ask for presence first.
AppRoleOption record#| Field | Type | Default | Description |
|---|---|---|---|
id | String | viewer or editor. | |
label | String | Can view or Can edit. |
AppShareEntryInput record#| Field | Type | Default | Description |
|---|---|---|---|
who | String | Email or account id. | |
role | String | viewer or editor. | |
connected | bool | Connected through the relay now. |
AppShareInput record#Returned by app_share_input_from_json.
| Field | Type | Default | Description |
|---|---|---|---|
space_id / spaceId | String | The Space's id. | |
space_name / spaceName | String | Its display name. | |
shares | Vec<AppShareEntryInput> | Who it is shared with. | |
signed_in / signedIn | bool | Signed in to cua.ai (sharing goes through the account's relay). | |
shareable | bool | The Space can be shared (a host, or a driver with relay_attach). |
AppShareRowView record#| Field | Type | Default | Description |
|---|---|---|---|
who | String | Email or account id. | |
role | String | viewer or editor. | |
connected | bool | Connected through the relay now (the shells show a status dot). |
AppShareSheetState record#Returned by app_share_initial, app_share_reduce, app_share_state_from_json.
| Field | Type | Default | Description |
|---|---|---|---|
who | String | The add field, as typed. | |
role | String | The role the add field shares with. | |
busy | bool | A command runs. | |
error | Option<String> | The last failure. | |
request | Option<AppShareRequest> | The command waiting for the shell. |
AppShareSheetView record#Returned by app_share_view.
| Field | Type | Default | Description |
|---|---|---|---|
title | String | Share “studio”. | |
rows | Vec<AppShareRowView> | One person per line. | |
empty_text / emptyText | String | Shown with no rows. | |
who_placeholder / whoPlaceholder | String | The add field's placeholder. | |
who | String | The add field, as typed. | |
role | String | The add field's role. | |
roles | Vec<AppRoleOption> | The role menu (for the add field and every row). | |
can_share / canShare | bool | Share is enabled. | |
share_label / shareLabel | String | Share. | |
remove_label / removeLabel | String | Remove (per row). | |
done_label / doneLabel | String | Done. | |
disabled_reason / disabledReason | Option<String> | Why the sheet cannot share at all (not signed in, an old driver). | |
hint | Option<String> | What the add field lacks (shown under it, only once typed). | |
busy | bool | A command runs. | |
error | Option<String> | The last failure. | |
request | Option<AppShareRequest> | The command waiting for the shell. |
AppShareRequest enum#.share(space: String, who: String, role: String)
.unshare(space: String, who: String)| Variant | Description |
|---|---|
Share | share_space (also changes a role). Fields: space: String, who: String, role: String |
Unshare | unshare_space. Fields: space: String, who: String |
AppShareSheetAction enum#.setWho(who: String)
.setRole(role: String)
.submit
.changeRole(who: String, role: String)
.remove(who: String)
.done
.failed(error: String)| Variant | Description |
|---|---|
SetWho | The add field changed. Fields: who: String |
SetRole | The add field's role menu changed. Fields: role: String |
Submit | Share was pressed. |
ChangeRole | A person's role menu changed. Fields: who: String, role: String |
Remove | A person's Remove was pressed. Fields: who: String |
Done | The command finished. |
Failed | The command failed (or presence was declined). Fields: error: String |
app_share_action_from_json#A Share sheet action from JSON (parity flows).
func appShareActionFromJson(json: String) throws -> AppShareSheetAction| Parameter | Type | Default |
|---|---|---|
json | String | required |
Returns AppShareSheetAction · Raises CuaError
app_share_initial#A new Share sheet.
func appShareInitial() -> AppShareSheetStateReturns AppShareSheetState
app_share_input_from_json#Share sheet input from JSON (fixtures, parity flows).
func appShareInputFromJson(json: String) throws -> AppShareInput| Parameter | Type | Default |
|---|---|---|
json | String | required |
Returns AppShareInput · Raises CuaError
app_share_reduce#Advances the Share sheet.
func appShareReduce(input: AppShareInput, state: AppShareSheetState, action: AppShareSheetAction) -> AppShareSheetState| Parameter | Type | Default |
|---|---|---|
input | AppShareInput | required |
state | AppShareSheetState | required |
action | AppShareSheetAction | required |
Returns AppShareSheetState
app_share_state_from_json#The Share sheet's state from JSON (fixtures, parity).
func appShareStateFromJson(json: String) throws -> AppShareSheetState| Parameter | Type | Default |
|---|---|---|
json | String | required |
Returns AppShareSheetState · Raises CuaError
app_share_view#The Share sheet as drawn.
func appShareView(input: AppShareInput, state: AppShareSheetState) -> AppShareSheetView| Parameter | Type | Default |
|---|---|---|
input | AppShareInput | required |
state | AppShareSheetState | required |
Returns AppShareSheetView