@danxbot/ui 15.40.0 → 16.1.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.
@@ -2,5 +2,5 @@ export { OpenApiViewer, type OpenApiViewerProps } from "./OpenApiViewer";
2
2
  export { OperationCard, type OperationCardProps } from "./OperationCard";
3
3
  export { OperationHeader, type OperationHeaderProps, OperationDetail, type OperationDetailProps } from "./OperationCard";
4
4
  export { SchemaView, type SchemaViewProps } from "./SchemaView";
5
- export { groupOperations, isHttpMethod, mergedParameters, operationAnchorId, resolveSchema, schemaToExample, type SchemaResolution, } from "./resolve";
5
+ export { groupOperations, isHttpMethod, mergedParameters, operationAnchorId, resolveSchema, resolveWebhooks, schemaToExample, type SchemaResolution, } from "./resolve";
6
6
  export { HTTP_METHODS, type HttpMethod, type OpenApiDocument, type OpenApiMediaType, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterLocation, type OpenApiPathItem, type OpenApiRequestBody, type OpenApiResponse, type OpenApiSchema, type OpenApiSecurityRequirement, type OpenApiSecurityScheme, type OpenApiTag, type OperationGroup, type ResolvedOperation, } from "./types";
@@ -1,4 +1,4 @@
1
- import type { HttpMethod, OpenApiDocument, OpenApiParameter, OpenApiSchema, OperationGroup } from "./types";
1
+ import type { HttpMethod, OpenApiDocument, OpenApiParameter, OpenApiSchema, OperationGroup, ResolvedOperation } from "./types";
2
2
  export declare function isHttpMethod(key: string): key is HttpMethod;
3
3
  /**
4
4
  * Resolves a single `{ $ref: "#/components/schemas/Foo" }` against the
@@ -42,10 +42,20 @@ export declare function mergedParameters(pathParameters: readonly OpenApiParamet
42
42
  * group by tag".
43
43
  */
44
44
  export declare function groupOperations(doc: OpenApiDocument): OperationGroup[];
45
+ /**
46
+ * Every operation of the document's top-level `webhooks` (DX-4178), in
47
+ * document order, each carrying its webhook NAME as `path` and `webhook:
48
+ * true`. Webhooks are not grouped by tag: they are a short, named list of the
49
+ * calls a consumer must receive, shown as their own section.
50
+ */
51
+ export declare function resolveWebhooks(doc: OpenApiDocument): ResolvedOperation[];
45
52
  /** A stable per-operation id for a deep link / anchor — same input, same id,
46
53
  * across renders and across documents (used as both the section `id` and the
47
54
  * `#fragment` a "copy link" control writes). */
48
- export declare function operationAnchorId(method: HttpMethod, path: string): string;
55
+ export declare function operationAnchorId(method: HttpMethod, path: string, webhook?: boolean): string;
56
+ /** `operationAnchorId` for a resolved operation — the one place a caller
57
+ * cannot forget the webhook namespace. */
58
+ export declare function resolvedAnchorId(resolved: ResolvedOperation): string;
49
59
  /**
50
60
  * Synthesises a representative JSON value from a schema when the document
51
61
  * supplies no explicit `example`/`examples` — the same fallback every
@@ -85,6 +85,10 @@ export interface OpenApiDocument {
85
85
  }[];
86
86
  readonly tags?: readonly OpenApiTag[];
87
87
  readonly paths: Record<string, OpenApiPathItem>;
88
+ /** OpenAPI 3.1 top-level `webhooks` (DX-4178): calls the API's server
89
+ * MAKES to a consumer, keyed by a name rather than a path. Each value is a
90
+ * Path Item whose operations are the requests the consumer must receive. */
91
+ readonly webhooks?: Record<string, OpenApiPathItem>;
88
92
  readonly components?: {
89
93
  readonly schemas?: Record<string, OpenApiSchema>;
90
94
  readonly securitySchemes?: Record<string, OpenApiSecurityScheme>;
@@ -104,6 +108,12 @@ export interface ResolvedOperation {
104
108
  * merges these with the operation's own, operation-level winning on a
105
109
  * `name`+`in` collision — see `resolve.ts#mergedParameters`). */
106
110
  readonly pathParameters: readonly OpenApiParameter[];
111
+ /** DX-4178: true when this is an OpenAPI `webhooks` entry — `path` then
112
+ * holds the webhook's NAME, not a URL path the API serves. A webhook has no
113
+ * document-level default security (the document's `security` governs the
114
+ * calls INTO the API, not the one a consumer's receiver is sent) and its
115
+ * anchor id is namespaced apart from every path's. */
116
+ readonly webhook?: true;
107
117
  }
108
118
  /** One tag/path group of operations, in document order. */
109
119
  export interface OperationGroup {
@@ -11,15 +11,17 @@ export interface ProfileFormSaveInput {
11
11
  name: string;
12
12
  username?: string;
13
13
  email: string;
14
+ /** Present only when the avatar changed: a URL sets it, `null` removes it. */
15
+ avatarUrl?: string | null;
14
16
  }
15
17
  export interface ProfileFormProps {
16
18
  account: ProfileFormAccount;
17
19
  onSave: (input: ProfileFormSaveInput) => Promise<void>;
20
+ /** Uploads the file to storage and resolves with its URL. Must NOT change the
21
+ * account — the avatar is only persisted by `onSave`. */
18
22
  onUploadAvatar: (file: File) => Promise<string>;
19
- /** Fired the moment a new avatar finishes uploading (or is removed) — see
20
- * the module header for why the avatar has no separate Save step. */
21
- onAvatarChange?: (avatarUrl: string | null) => void;
22
23
  saveLabel?: string;
24
+ discardLabel?: string;
23
25
  className?: string;
24
26
  }
25
- export declare function ProfileForm({ account, onSave, onUploadAvatar, onAvatarChange, saveLabel, className, }: ProfileFormProps): import("react").JSX.Element;
27
+ export declare function ProfileForm({ account, onSave, onUploadAvatar, saveLabel, discardLabel, className, }: ProfileFormProps): import("react").JSX.Element;
@@ -4,8 +4,8 @@ export interface ProfilePageProps {
4
4
  * still locally-editable) `actualUser` display. */
5
5
  account?: ProfileFormAccount;
6
6
  onSave?: (input: ProfileFormSaveInput) => Promise<void>;
7
+ /** Uploads the file and resolves with its URL; the avatar is persisted only by `onSave` (DX-4131). */
7
8
  onUploadAvatar?: (file: File) => Promise<string>;
8
- onAvatarChange?: (avatarUrl: string | null) => void;
9
9
  /** DX-4029: `false` omits the page's own title text (the `<h1>` and the
10
10
  * team-name line) so a host layout can own the screen's one `<h1>`. The
11
11
  * read-only avatar (content, not title) stays, and the default `true` is
@@ -13,4 +13,4 @@ export interface ProfilePageProps {
13
13
  heading?: boolean;
14
14
  className?: string;
15
15
  }
16
- export declare function ProfilePage({ account, onSave, onUploadAvatar, onAvatarChange, heading, className, }: ProfilePageProps): import("react").JSX.Element;
16
+ export declare function ProfilePage({ account, onSave, onUploadAvatar, heading, className, }: ProfilePageProps): import("react").JSX.Element;
@@ -4,17 +4,19 @@ export interface TeamSettingsFormTeam {
4
4
  }
5
5
  export interface TeamSettingsFormSaveInput {
6
6
  name: string;
7
+ /** Present only when the logo changed: a URL sets it, `null` removes it. */
8
+ logoUrl?: string | null;
7
9
  }
8
10
  export interface TeamSettingsFormProps {
9
11
  team: TeamSettingsFormTeam;
10
12
  onSave: (input: TeamSettingsFormSaveInput) => Promise<void>;
13
+ /** Uploads the file to storage and resolves with its URL. Must NOT change the
14
+ * team record — the logo is only persisted by `onSave`. */
11
15
  onUploadLogo: (file: File) => Promise<string>;
12
- /** Fired the moment a new logo finishes uploading (or is removed) — see
13
- * the module header for why the logo has no separate Save step. */
14
- onLogoChange?: (logoUrl: string | null) => void;
15
16
  /** The viewer lacks `team.update` — every control renders disabled. */
16
17
  readOnly?: boolean;
17
18
  saveLabel?: string;
19
+ discardLabel?: string;
18
20
  className?: string;
19
21
  }
20
- export declare function TeamSettingsForm({ team, onSave, onUploadLogo, onLogoChange, readOnly, saveLabel, className, }: TeamSettingsFormProps): import("react").JSX.Element;
22
+ export declare function TeamSettingsForm({ team, onSave, onUploadLogo, readOnly, saveLabel, discardLabel, className, }: TeamSettingsFormProps): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ export interface SaveFlow {
2
+ saving: boolean;
3
+ /** The last Save resolved and nothing has been edited since. */
4
+ saved: boolean;
5
+ error: string | null;
6
+ /** Run a draft change (an edit, or a Discard) and retire the last outcome. */
7
+ edit: (change: () => void) => void;
8
+ /** Run the consumer's `onSave`; a rejection's message (or `failureMessage`) becomes `error`. */
9
+ save: (run: () => Promise<void>) => Promise<void>;
10
+ }
11
+ export declare function useSaveFlow(failureMessage: string): SaveFlow;
12
+ /** The line under a staged image, naming what Save will do with it. */
13
+ export declare function stagedImageNote(noun: string, saveLabel: string, removed: boolean): string;
14
+ export interface StagedFormActionsProps {
15
+ onSave: () => void;
16
+ onDiscard: () => void;
17
+ /** The draft is valid, changed, and nothing is in flight. */
18
+ canSave: boolean;
19
+ /** The draft differs from what is saved in ANY way, including whitespace Save would trim away. */
20
+ canDiscard: boolean;
21
+ saving: boolean;
22
+ saveLabel: string;
23
+ discardLabel: string;
24
+ }
25
+ export declare function StagedFormActions({ onSave, onDiscard, canSave, canDiscard, saving, saveLabel, discardLabel, }: StagedFormActionsProps): import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ export interface StagedImage {
2
+ /** What to show: the staged URL (or `null` for a staged removal), else the saved one. */
3
+ value: string | null;
4
+ /** The staged value differs from the saved one — the form must send it on Save. */
5
+ dirty: boolean;
6
+ /** A pick is mid-upload. */
7
+ uploading: boolean;
8
+ /** Stage a URL, or `null` to stage a removal. */
9
+ stage: (url: string | null) => void;
10
+ /** Drop the staged value and go back to the saved one. */
11
+ discard: () => void;
12
+ /** Pass to `ImageUploadField.onUpload`. */
13
+ upload: (file: File) => Promise<string>;
14
+ }
15
+ export declare function useStagedImage(saved: string | null | undefined, onUpload: (file: File) => Promise<string>): StagedImage;
@@ -156,7 +156,7 @@ export { NodeCanvas, LAYOUT_DEFAULTS, edgePath, layoutGraph, neighbourhood, type
156
156
  export { GraphExplorer, frameBoxFor, layoutExplorerTree, neighbourhoodTree, CAMERA_DEFAULTS, centerOn, clampScale, fitBox, fitBoxWithFloor, toContentPoint, toScreenPoint, unionBox, zoomAtPoint, type GraphExplorerProps, type Box, type CameraState, type FitOptions, type FitWithFloorOptions, type FitWithFloorResult, type FrameOverflow, type Point, type ScaleBounds, type Size, type CrossLink, type ExplorerLayout, type ExplorerNodeRenderContext, type ExplorerNodeRenderer, type ExplorerTree, type GraphExplorerVariant, type TreeNode as ExplorerTreeNode, } from "./components/graph-explorer";
157
157
  export { FocusWeb, CENTER_POSITION, PARENT_POSITION, WIDE_RING_THRESHOLD, layoutRing, type FocusNodeRenderContext, type FocusNodeRenderer, type FocusNodeRole, type FocusWebNode, type FocusWebNodeLook, type FocusWebProps, type PlacedRingNode, } from "./components/focus-web";
158
158
  export { SequenceDiagram, type SequenceDiagramProps, type SequenceStep, } from "./components/SequenceDiagram";
159
- export { OpenApiViewer, type OpenApiViewerProps, OperationCard, type OperationCardProps, OperationHeader, type OperationHeaderProps, OperationDetail, type OperationDetailProps, SchemaView, type SchemaViewProps, groupOperations, isHttpMethod, mergedParameters, operationAnchorId, resolveSchema, schemaToExample, type SchemaResolution, HTTP_METHODS, type HttpMethod, type OpenApiDocument, type OpenApiMediaType, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterLocation, type OpenApiPathItem, type OpenApiRequestBody, type OpenApiResponse, type OpenApiSchema, type OpenApiSecurityRequirement, type OpenApiSecurityScheme, type OpenApiTag, type OperationGroup, type ResolvedOperation, } from "./components/openapi";
159
+ export { OpenApiViewer, type OpenApiViewerProps, OperationCard, type OperationCardProps, OperationHeader, type OperationHeaderProps, OperationDetail, type OperationDetailProps, SchemaView, type SchemaViewProps, groupOperations, isHttpMethod, mergedParameters, operationAnchorId, resolveSchema, resolveWebhooks, schemaToExample, type SchemaResolution, HTTP_METHODS, type HttpMethod, type OpenApiDocument, type OpenApiMediaType, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterLocation, type OpenApiPathItem, type OpenApiRequestBody, type OpenApiResponse, type OpenApiSchema, type OpenApiSecurityRequirement, type OpenApiSecurityScheme, type OpenApiTag, type OperationGroup, type ResolvedOperation, } from "./components/openapi";
160
160
  export { defineRecordType, resetRecordTypes, useRecord, useRecords, useStaleness, write, writeAll, peekRecord, readState, readStaleness, subscribeToKey, subscribeToStaleness, retainKeys, sweepRecords, setRecordStoreTenant, getRecordStoreTenant, flushRecordNotifications, resetRecordStore, recordStoreStats, UNKNOWN_STATE, normalizeTypeName, normalizeTimestamp, recordKey, isRecordRef, type RecordRef, type ReadOptions, type RecordPayload, type RecordState, type RecordTypeOptions, type RecordTypeToken, type StalenessEntry, type WriteAllResult, type WriteOptions, type WriteResult, type WriteSource, type WriteVerdict, } from "./lib/records";
161
161
  export { RealtimeProvider, useRealtime, useRealtimeEpoch, useRealtimeHealth, useRealtimeRegistry, SubscriptionRegistry, normalizeScope, scopeKey, subscriptionKey, readRealtimeEpoch, subscribeToRealtimeEpoch, subscribeToRealtimeEvents, resetRealtimeSignals, type RealtimeChannel, type RealtimeConnectionState, type RealtimeDiagnostic, type RealtimeEvent, type RealtimeHealth, type RealtimeProviderProps, type RealtimeScope, type RealtimeScopeInput, type RealtimeStatus, type RealtimeTransport, type RegistryOptions, type SubscriptionHealth, type SubscriptionLease, type SubscriptionRequest, } from "./lib/realtime";
162
162
  export { useRecordRead, useRecordListRead, useRecordStoreSweep, applyMutationResult, optimisticWrite, beginOptimisticWrite, resetOptimisticWrites, type OptimisticHandle, type OptimisticWriteOptions, type OptimisticWriteSpec, type SlotDescriptor, acquireSlot, appendCreated, emptySlotSnapshot, readSlot, resetSlots, slotKeys, subscribeToSlot, writeSlot, RefetchRunner, registerActiveRead, resetActiveReads, type ActiveRead, type ListFetch, type ListFetchResult, type ListReadOptions, type ListReadResult, type ReadError, type RecordFetch, type RecordReadOptions, type RecordReadResult, type RunnerOptions, type SlotSnapshot, } from "./lib/reads";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "15.40.0",
3
+ "version": "16.1.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",