@camstack/ui-library 0.1.56 → 0.1.57

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.
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Shared capability-error utilities for the admin UI.
3
+ *
4
+ * The primary export `isAbsentProvider` lets UI components distinguish
5
+ * "this device doesn't have this cap" (expected — hide the widget) from
6
+ * "something went wrong while calling a present cap" (unexpected — surface
7
+ * the error to the operator).
8
+ *
9
+ * Detection strategy (two-tier):
10
+ *
11
+ * 1. **Typed reason** (preferred): tRPC's errorFormatter augments the
12
+ * error shape with `data.capRouteReason` when the server throws a
13
+ * CapRouteError. Read it from `err.data?.capRouteReason` to avoid
14
+ * brittle string matching.
15
+ *
16
+ * 2. **Substring fallback** (transitional safety): older error paths
17
+ * that don't carry a typed reason still emit the human-readable
18
+ * message "provider not available". The fallback is ONLY engaged
19
+ * when `capRouteReason` is absent — future clean-up can drop it
20
+ * once every throw site has been migrated.
21
+ */
22
+ /**
23
+ * Returns `true` when `err` indicates that the requested capability has
24
+ * no provider bound for the device — i.e. the device legitimately does
25
+ * not expose this cap and the UI should stay hidden / show a friendly
26
+ * "not supported" message.
27
+ *
28
+ * Returns `false` for real dispatch errors (`transport-failed`) — those
29
+ * should be surfaced to the operator as unexpected failures.
30
+ *
31
+ * ## Absent-provider reasons
32
+ * - `'no-provider'` — no provider is registered for this cap/device pair.
33
+ * - `'node-offline'` — the node that hosts the cap is not reachable; the
34
+ * device is effectively unavailable so we treat it as absent.
35
+ *
36
+ * ## Not-absent reasons
37
+ * - `'transport-failed'` — a provider exists but the call failed in transit.
38
+ * - `'cap-unknown'` — the cap name isn't registered at all; treat as
39
+ * a real error (likely a programming mistake or version skew).
40
+ */
41
+ export declare function isAbsentProvider(err: unknown): boolean;
@@ -1,4 +1,5 @@
1
1
  export { cn } from './cn';
2
+ export { isAbsentProvider } from './cap-error';
2
3
  export * from './responsive';
3
4
  export { mirror } from './pipeline-mirror';
4
5
  export type { MirrorSource, MirrorInput, MirrorOutcome, MirrorResultEntry, } from './pipeline-mirror';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/ui-library",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -1,9 +0,0 @@
1
- import { MotionZoneOptions } from '@camstack/types';
2
- export interface MotionGridCanvasProps {
3
- /** Fixed lattice dimensions — from the cap's `getOptions`. */
4
- readonly options: MotionZoneOptions;
5
- /** Row-major active-cell grid, length === gridWidth*gridHeight. */
6
- readonly cells: readonly boolean[];
7
- readonly onCellsChange: (next: boolean[]) => void;
8
- }
9
- export declare function MotionGridCanvas({ options, cells, onCellsChange }: MotionGridCanvasProps): import("react/jsx-runtime").JSX.Element;