Composable and flow helper API
Generated from public Vue/TypeScript exports by
pnpm docs:generate. Edit source comments and stories to update this reference. Types describe the declared API; browser/device constraints are covered in the guides. This catalog reflects source commitfc6bfb108634735f1657e533206c3f8702ad357d; match your installed package and typed manifest before using an export. Source review does not establish registry-release availability.
badgeVariants
import { badgeVariants } from '@gxp-dev/app-ui'
Returns string.
| Parameter | Type | Required / default |
|---|---|---|
props | (ConfigVariants<{ variant: { default: string; secondary: string; destructive: string; outline: string; }; }> & ClassProp) | undefined | Optional |
buildElementRules
Compiles a FormElementDef's declarative validation props into a vee-validate typed schema (Zod under the hood). Pass validation.rules to replace the generated schema entirely.
import { buildElementRules } from '@gxp-dev/app-ui'
Returns TypedSchema<any, any> | undefined.
| Parameter | Type | Required / default |
|---|---|---|
element | FormElementDef | Required |
element options
| Name | Type | Optional | Description |
|---|---|---|---|
type | FormElementType | No | — |
name | string | No | Field name — the key this element's value is stored under. |
label | string | undefined | Yes | — |
placeholder | string | undefined | Yes | — |
help | string | undefined | Yes | Helper text rendered under the control (FormDescription). |
tooltip | string | undefined | Yes | Info-icon tooltip rendered next to the label. |
required | boolean | undefined | Yes | — |
disabled | boolean | undefined | Yes | — |
options | FormElementOption[] | undefined | Yes | Choice list for select / autocomplete / radio / checkbox-group / toggle-group. |
defaultValue | unknown | Yes | — |
validation | FormElementValidation | undefined | Yes | — |
min | number | undefined | Yes | number / slider / range / rating bounds and step. |
max | number | undefined | Yes | — |
step | number | undefined | Yes | — |
rows | number | undefined | Yes | textarea rows. |
multiple | boolean | undefined | Yes | file: allow multiple files / accepted mime types. |
accept | string | undefined | Yes | — |
when | ((values: Record<string, unknown>) => boolean) | undefined | Yes | Show this element only when the predicate over current values is true. |
controlProps | Record<string, unknown> | undefined | Yes | Extra props forwarded verbatim to the underlying control. |
class | string | undefined | Yes | — |
buildElementSchema
import { buildElementSchema } from '@gxp-dev/app-ui'
Returns ZodType<any, ZodTypeDef, any> | undefined.
| Parameter | Type | Required / default |
|---|---|---|
element | FormElementDef | Required |
element options
| Name | Type | Optional | Description |
|---|---|---|---|
type | FormElementType | No | — |
name | string | No | Field name — the key this element's value is stored under. |
label | string | undefined | Yes | — |
placeholder | string | undefined | Yes | — |
help | string | undefined | Yes | Helper text rendered under the control (FormDescription). |
tooltip | string | undefined | Yes | Info-icon tooltip rendered next to the label. |
required | boolean | undefined | Yes | — |
disabled | boolean | undefined | Yes | — |
options | FormElementOption[] | undefined | Yes | Choice list for select / autocomplete / radio / checkbox-group / toggle-group. |
defaultValue | unknown | Yes | — |
validation | FormElementValidation | undefined | Yes | — |
min | number | undefined | Yes | number / slider / range / rating bounds and step. |
max | number | undefined | Yes | — |
step | number | undefined | Yes | — |
rows | number | undefined | Yes | textarea rows. |
multiple | boolean | undefined | Yes | file: allow multiple files / accepted mime types. |
accept | string | undefined | Yes | — |
when | ((values: Record<string, unknown>) => boolean) | undefined | Yes | Show this element only when the predicate over current values is true. |
controlProps | Record<string, unknown> | undefined | Yes | Extra props forwarded verbatim to the underlying control. |
class | string | undefined | Yes | — |
buttonVariants
import { buttonVariants } from '@gxp-dev/app-ui'
Returns string.
| Parameter | Type | Required / default |
|---|---|---|
props | (ConfigVariants<{ variant: { default: string; destructive: string; outline: string; secondary: string; ghost: string; link: string; }; size: { default: string; sm: string; lg: string; icon: string; "icon-sm": string; "icon-lg": string; }; }> & ClassProp) | undefined | Optional |
cn
Merge Tailwind CSS classes with clsx Handles conditional classes and resolves conflicts
import { cn } from '@gxp-dev/app-ui'
Returns string.
| Parameter | Type | Required / default |
|---|---|---|
inputs | ClassValue[] | Required |
convertToCanvasBlob
Convert an image file to a canvas-generated blob. This standardizes the format to match camera captures.
import { convertToCanvasBlob } from '@gxp-dev/app-ui'
Returns Promise<Blob>.
| Parameter | Type | Required / default |
|---|---|---|
file | File | Required |
outputType | string | 'image/jpeg' |
quality | number | 1.0 |
file options
| Name | Type | Optional | Description |
|---|---|---|---|
lastModified | number | No | The lastModified read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). MDN Reference |
name | string | No | The name read-only property of the File interface returns the name of the file represented by a File object. MDN Reference |
webkitRelativePath | string | No | The webkitRelativePath read-only property of the File interface contains a string which specifies the file's path relative to the directory selected by the user in an input element with its webkitdirectory attribute set. MDN Reference |
size | number | No | The size read-only property of the Blob interface returns the size of the Blob or File in bytes. MDN Reference |
type | string | No | The type read-only property of the Blob interface returns the MIME type of the file. MDN Reference |
arrayBuffer | () => Promise<ArrayBuffer> | No | The arrayBuffer() method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer. MDN Reference |
bytes | () => Promise<Uint8Array<ArrayBuffer>> | No | The bytes() method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes. MDN Reference |
slice | (start?: number, end?: number, contentType?: string) => Blob | No | The slice() method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called. MDN Reference |
stream | () => ReadableStream<Uint8Array<ArrayBuffer>> | No | The stream() method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob. MDN Reference |
text | () => Promise<string> | No | The text() method of the string containing the contents of the blob, interpreted as UTF-8. MDN Reference |
delay
Promise-based delay
import { delay } from '@gxp-dev/app-ui'
Returns Promise<void>.
| Parameter | Type | Required / default |
|---|---|---|
ms | number | Required |
flattenElements
Collect every element across a list of sections.
import { flattenElements } from '@gxp-dev/app-ui'
Returns FormElementDef[].
| Parameter | Type | Required / default |
|---|---|---|
sections | FormSectionDef[] | Required |
flattenSectionElements
Collect every element of a section, including nested sections'.
import { flattenSectionElements } from '@gxp-dev/app-ui'
Returns FormElementDef[].
| Parameter | Type | Required / default |
|---|---|---|
section | FormSectionDef | Required |
section options
| Name | Type | Optional | Description |
|---|---|---|---|
id | string | No | — |
title | string | undefined | Yes | — |
description | string | undefined | Yes | — |
columns | 1 | 2 | 3 | 4 | undefined | Yes | Grid columns for this section's elements (default 1). |
elements | FormElementDef[] | undefined | Yes | — |
sections | FormSectionDef[] | undefined | Yes | Nested child sections, rendered after elements. |
when | ((values: Record<string, unknown>) => boolean) | undefined | Yes | Show this section only when the predicate over current values is true. |
class | string | undefined | Yes | — |
initialValuesFor
Initial form values derived from element defaultValues and types.
import { initialValuesFor } from '@gxp-dev/app-ui'
Returns Record<string, unknown>.
| Parameter | Type | Required / default |
|---|---|---|
sections | FormSectionDef[] | Required |
loadFonts
Dynamically load custom fonts via
import { loadFonts } from '@gxp-dev/app-ui'
Returns void.
| Parameter | Type | Required / default |
|---|---|---|
settings | FontSettings | Required |
assets | FontAssets | Required |
navigationMenuTriggerStyle
import { navigationMenuTriggerStyle } from '@gxp-dev/app-ui'
Returns string.
| Parameter | Type | Required / default |
|---|---|---|
props | ClassProp | undefined | Optional |
parseAIResponse
Parse AI/LLM response text, extracting JSON from markdown code blocks
import { parseAIResponse } from '@gxp-dev/app-ui'
Returns Record<string, unknown>.
| Parameter | Type | Required / default |
|---|---|---|
responseText | string | Required |
preloadAssets
Preload image assets by fetching them in parallel
import { preloadAssets } from '@gxp-dev/app-ui'
Returns Promise<Response>[].
| Parameter | Type | Required / default |
|---|---|---|
assetUrls | Record<string, unknown> | Required |
processUploadedImage
Process an uploaded image file to match camera capture format.
import { processUploadedImage } from '@gxp-dev/app-ui'
Returns Promise<Blob>.
| Parameter | Type | Required / default |
|---|---|---|
file | File | Required |
file options
| Name | Type | Optional | Description |
|---|---|---|---|
lastModified | number | No | The lastModified read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). MDN Reference |
name | string | No | The name read-only property of the File interface returns the name of the file represented by a File object. MDN Reference |
webkitRelativePath | string | No | The webkitRelativePath read-only property of the File interface contains a string which specifies the file's path relative to the directory selected by the user in an input element with its webkitdirectory attribute set. MDN Reference |
size | number | No | The size read-only property of the Blob interface returns the size of the Blob or File in bytes. MDN Reference |
type | string | No | The type read-only property of the Blob interface returns the MIME type of the file. MDN Reference |
arrayBuffer | () => Promise<ArrayBuffer> | No | The arrayBuffer() method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer. MDN Reference |
bytes | () => Promise<Uint8Array<ArrayBuffer>> | No | The bytes() method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes. MDN Reference |
slice | (start?: number, end?: number, contentType?: string) => Blob | No | The slice() method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called. MDN Reference |
stream | () => ReadableStream<Uint8Array<ArrayBuffer>> | No | The stream() method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob. MDN Reference |
text | () => Promise<string> | No | The text() method of the string containing the contents of the blob, interpreted as UTF-8. MDN Reference |
readExperienceDefaults
import { readExperienceDefaults } from '@gxp-dev/app-ui'
Returns ExperiencePageDefaults.
| Parameter | Type | Required / default |
|---|---|---|
component | Component | Required |
Returned values and methods
| Name | Type | Description |
|---|---|---|
action | ExperienceAction | undefined | — |
resultKey | string | undefined | — |
simulateNfcScan
Utility for testing: simulate an NFC scan event
import { simulateNfcScan } from '@gxp-dev/app-ui'
Returns void.
| Parameter | Type | Required / default |
|---|---|---|
uid | string | Required |
tagType | string | 'TAG_ISO_14443_3' |
throttle
Throttle a function to only execute once per wait period
import { throttle } from '@gxp-dev/app-ui'
Returns ThrottledFunction<T>.
| Parameter | Type | Required / default |
|---|---|---|
func | T | Required |
wait | number | Required |
options | ThrottleOptions | {} |
options options
| Name | Type | Optional | Description |
|---|---|---|---|
leading | boolean | undefined | Yes | — |
trailing | boolean | undefined | Yes | — |
Returned values and methods
| Name | Type | Description |
|---|---|---|
cancel | () => void | — |
timeAgo
Human-readable relative time string from an ISO date string
import { timeAgo } from '@gxp-dev/app-ui'
Returns string.
| Parameter | Type | Required / default |
|---|---|---|
isoString | string | Required |
useAnimations
import { useAnimations } from '@gxp-dev/app-ui'
Returns UseAnimationsReturn.
Returned values and methods
| Name | Type | Description |
|---|---|---|
animatingClasses | ComputedRef<string[]> | — |
pageAnimation | Ref<string, string> | — |
init | (props: { globalSettings?: AnimationSettings; }) => void | — |
animatePage | (vars?: AnimationVars, reverse?: boolean) => Promise<void> | — |
setSettings | (settings?: AnimationSettings) => void | Declarative model: apply the global animation settings. |
resolveTransition | (direction: AnimationDirection, leavingVars?: LeavingVars) => TransitionClasses | Declarative model: resolve the <transition> active classes for one move. Returns empty strings when animation is disabled (→ instant swap). |
useCameraBorder
import { useCameraBorder } from '@gxp-dev/app-ui'
Returns UseCameraBorderReturn.
Returned values and methods
| Name | Type | Description |
|---|---|---|
selectedBorder | Ref<CameraBorder | null, CameraBorder | null> | — |
canvasDimensions | Ref<CanvasDimensions, CanvasDimensions> | — |
drawBorder | (imageSrc: string) => Promise<string> | — |
reset | () => void | — |
useChatMedia
Headless multi-participant chat media manager. Owns local audio/video/screen capture lifecycle and a registry of remote participant streams. Transport (Mediasoup, plain WebRTC peerconnections, server-relayed RTC, …) is your concern: provide handlers.onTrackStarted to push the local tracks to your producers, and call addParticipantTrack when a remote track arrives.
import { useChatMedia } from '@gxp-dev/app-ui'
Returns UseChatMediaReturn.
| Parameter | Type | Required / default |
|---|---|---|
options | UseChatMediaOptions | {} |
options options
| Name | Type | Optional | Description |
|---|---|---|---|
audioConstraints | MediaTrackConstraints | undefined | Yes | — |
videoConstraints | MediaTrackConstraints | undefined | Yes | — |
screenConstraints | DisplayMediaStreamOptions | undefined | Yes | — |
handlers | ChatTrackHandlers | undefined | Yes | — |
Returned values and methods
| Name | Type | Description |
|---|---|---|
localAudioStream | Ref<MediaStream | null, MediaStream | null> | — |
localVideoStream | Ref<MediaStream | null, MediaStream | null> | — |
localScreenStream | Ref<MediaStream | null, MediaStream | null> | — |
isMuted | Ref<boolean, boolean> | — |
isVideoOff | Ref<boolean, boolean> | — |
isScreenSharing | Ref<boolean, boolean> | — |
hasAudio | ComputedRef<boolean> | — |
hasVideo | ComputedRef<boolean> | — |
participantStreams | Ref<Map<string, MediaStream>, Map<string, MediaStream>> | — |
startAudioCapture | (constraints?: MediaTrackConstraints) => Promise<MediaStream> | — |
stopAudioCapture | () => Promise<void> | — |
startVideoCapture | (constraints?: MediaTrackConstraints) => Promise<MediaStream> | — |
stopVideoCapture | () => Promise<void> | — |
startScreenShare | (options?: DisplayMediaStreamOptions) => Promise<MediaStream> | — |
stopScreenShare | () => Promise<void> | — |
toggleMute | () => Promise<void> | — |
toggleVideo | () => Promise<void> | — |
setParticipantStream | (participantId: string, stream: MediaStream) => void | — |
addParticipantTrack | (participantId: string, track: MediaStreamTrack) => MediaStream | — |
removeParticipant | (participantId: string) => void | — |
getParticipantStream | (participantId: string) => MediaStream | undefined | — |
cleanup | () => void | — |
useChatMessages
Headless chat-message state container. Owns the reactive message list, pagination cursor, reply/edit UI state, and push-event handlers. I/O is your responsibility — pass in an api object whose methods talk to your backend (REST, GraphQL, RPC, …) and the composable wraps them with optimistic local updates.
import { useChatMessages } from '@gxp-dev/app-ui'
Returns UseChatMessagesReturn.
| Parameter | Type | Required / default |
|---|---|---|
options | UseChatMessagesOptions | Required |
options options
| Name | Type | Optional | Description |
|---|---|---|---|
api | ChatMessagesApi | No | — |
deletedPlaceholder | string | undefined | Yes | When set, replace [Message deleted] with your own placeholder text. |
defaultLimit | number | undefined | Yes | Default page size for loadHistory. |
Returned values and methods
| Name | Type | Description |
|---|---|---|
messages | Ref<ChatMessage[], ChatMessage[]> | — |
isLoading | Ref<boolean, boolean> | — |
hasMore | Ref<boolean, boolean> | — |
replyingTo | Ref<ChatMessage | null, ChatMessage | null> | — |
editingMessage | Ref<ChatMessage | null, ChatMessage | null> | — |
messageCount | ComputedRef<number> | — |
oldestMessageId | ComputedRef<string | number | undefined> | — |
newestMessageId | ComputedRef<string | number | undefined> | — |
loadHistory | (opts?: LoadHistoryOptions) => Promise<ChatMessage[]> | — |
sendMessage | (content: string, attachments?: File[]) => Promise<ChatMessage> | — |
editMessage | (id: ChatMessage["id"], newContent: string) => Promise<void> | — |
deleteMessage | (id: ChatMessage["id"]) => Promise<void> | — |
addReaction | (id: ChatMessage["id"], emoji: string) => Promise<void> | — |
removeReaction | (id: ChatMessage["id"], emoji: string) => Promise<void> | — |
setReplyTo | (message: ChatMessage | null) => void | — |
cancelReply | () => void | — |
setEditing | (message: ChatMessage | null) => void | — |
cancelEditing | () => void | — |
clearMessages | () => void | — |
handleNewMessage | (message: ChatMessage) => void | — |
handleMessageEdited | (data: { messageId: ChatMessage["id"]; content: string; editedAt?: string; }) => void | — |
handleMessageDeleted | (messageId: ChatMessage["id"]) => void | — |
handleReactionAdded | (data: { messageId: ChatMessage["id"]; emoji: string; participantId: string | number; }) => void | — |
handleReactionRemoved | (data: { messageId: ChatMessage["id"]; emoji: string; participantId: string | number; }) => void | — |