@camstack/ui-library 0.1.56 → 0.1.58

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.
Files changed (126) hide show
  1. package/dist/composites/battery-badge.d.ts +3 -0
  2. package/dist/composites/camera-stream-player.d.ts +101 -1
  3. package/dist/composites/cap-settings/ConsumablesPanel.d.ts +2 -0
  4. package/dist/composites/cap-settings/CoverageTrack.d.ts +12 -0
  5. package/dist/composites/cap-settings/EventBucketStrip.d.ts +25 -0
  6. package/dist/composites/cap-settings/EventHeatmap.d.ts +10 -0
  7. package/dist/composites/cap-settings/MaskShapeCanvas.d.ts +48 -0
  8. package/dist/composites/cap-settings/MotionZonesSettings.d.ts +1 -1
  9. package/dist/composites/cap-settings/PrivacyMaskSettings.d.ts +2 -0
  10. package/dist/composites/cap-settings/RecordingPanel.d.ts +2 -0
  11. package/dist/composites/cap-settings/RecordingRulesEditor.d.ts +7 -0
  12. package/dist/composites/cap-settings/RecordingSettings.d.ts +8 -0
  13. package/dist/composites/cap-settings/RecordingTimeline.d.ts +5 -0
  14. package/dist/composites/cap-settings/TimelineControls.d.ts +21 -0
  15. package/dist/composites/cap-settings/event-thumb.d.ts +11 -0
  16. package/dist/composites/cap-settings/index.d.ts +7 -0
  17. package/dist/composites/cap-settings/recording-config-form.d.ts +5 -0
  18. package/dist/composites/cap-settings/recording-spans.d.ts +22 -0
  19. package/dist/composites/cap-settings/recording-timeline-model.d.ts +84 -0
  20. package/dist/composites/device-activity-panel.d.ts +5 -1
  21. package/dist/composites/device-controls/alarm-hero-card.d.ts +24 -0
  22. package/dist/composites/device-controls/atoms.d.ts +81 -0
  23. package/dist/composites/device-controls/brightness-panel.d.ts +3 -0
  24. package/dist/composites/device-controls/button-control.d.ts +18 -0
  25. package/dist/composites/device-controls/climate-panel.d.ts +16 -0
  26. package/dist/composites/device-controls/container-primary-hero.d.ts +24 -0
  27. package/dist/composites/device-controls/container-primary.d.ts +46 -0
  28. package/dist/composites/device-controls/control-panel.d.ts +10 -0
  29. package/dist/composites/device-controls/control-registry.d.ts +74 -0
  30. package/dist/composites/device-controls/cover-hero-card.d.ts +27 -0
  31. package/dist/composites/device-controls/cover-inline.d.ts +27 -0
  32. package/dist/composites/device-controls/cover-panel.d.ts +3 -0
  33. package/dist/composites/device-controls/dummy-hero-card.d.ts +6 -0
  34. package/dist/composites/device-controls/fan-hero-card.d.ts +21 -0
  35. package/dist/composites/device-controls/fan-panel.d.ts +3 -0
  36. package/dist/composites/device-controls/humidifier-control.d.ts +37 -0
  37. package/dist/composites/device-controls/image-control.d.ts +24 -0
  38. package/dist/composites/device-controls/index.d.ts +33 -0
  39. package/dist/composites/device-controls/lawn-mower-control.d.ts +24 -0
  40. package/dist/composites/device-controls/light-hero-card.d.ts +16 -0
  41. package/dist/composites/device-controls/lock-hero-card.d.ts +15 -0
  42. package/dist/composites/device-controls/lock-panel.d.ts +3 -0
  43. package/dist/composites/device-controls/media-player-hero-card.d.ts +17 -0
  44. package/dist/composites/device-controls/media-player-panel.d.ts +9 -0
  45. package/dist/composites/device-controls/offline-badge.d.ts +11 -0
  46. package/dist/composites/device-controls/panel-controls.d.ts +17 -0
  47. package/dist/composites/device-controls/popover-row-action.d.ts +9 -0
  48. package/dist/composites/device-controls/primary-child.d.ts +18 -0
  49. package/dist/composites/device-controls/radial-gauge.d.ts +20 -0
  50. package/dist/composites/device-controls/sensor-hero-card.d.ts +10 -0
  51. package/dist/composites/device-controls/sensor-inline-control.d.ts +11 -0
  52. package/dist/composites/device-controls/sensor-value-atom.d.ts +106 -0
  53. package/dist/composites/device-controls/switch-hero-card.d.ts +13 -0
  54. package/dist/composites/device-controls/switch-panel.d.ts +3 -0
  55. package/dist/composites/device-controls/tap-toggle.d.ts +17 -0
  56. package/dist/composites/device-controls/thermostat-hero-card.d.ts +17 -0
  57. package/dist/composites/device-controls/types.d.ts +17 -0
  58. package/dist/composites/device-controls/update-control.d.ts +11 -0
  59. package/dist/composites/device-controls/vacuum-control.d.ts +36 -0
  60. package/dist/composites/device-controls/valve-control.d.ts +46 -0
  61. package/dist/composites/device-controls/water-heater-control.d.ts +41 -0
  62. package/dist/composites/device-controls/weather-control.d.ts +41 -0
  63. package/dist/composites/device-export-panel.d.ts +8 -1
  64. package/dist/composites/device-item/actions.d.ts +12 -1
  65. package/dist/composites/device-item/child-layout.d.ts +32 -0
  66. package/dist/composites/device-item/child-section-accordion.d.ts +9 -0
  67. package/dist/composites/device-item/container-children-context.d.ts +15 -0
  68. package/dist/composites/device-item/device-delete-action.d.ts +8 -0
  69. package/dist/composites/device-item/header.d.ts +8 -1
  70. package/dist/composites/device-item/helpers.d.ts +117 -2
  71. package/dist/composites/device-item/index.d.ts +4 -0
  72. package/dist/composites/device-item/preview.d.ts +3 -3
  73. package/dist/composites/device-item/reboot-quick-action.d.ts +9 -0
  74. package/dist/composites/device-item/status-dot.d.ts +4 -1
  75. package/dist/composites/device-list/batch-actions-bar.d.ts +15 -0
  76. package/dist/composites/device-list/batch-toolbar.d.ts +15 -0
  77. package/dist/composites/device-list/cards-layout.d.ts +18 -0
  78. package/dist/composites/device-list/columns.d.ts +68 -0
  79. package/dist/composites/device-list/device-mode.d.ts +115 -0
  80. package/dist/composites/device-list/filter-chips.d.ts +24 -13
  81. package/dist/composites/device-list/fuzzy-match.d.ts +27 -0
  82. package/dist/composites/device-list/generic-mode.d.ts +81 -0
  83. package/dist/composites/device-list/group.d.ts +19 -0
  84. package/dist/composites/device-list/hardware-cell.d.ts +7 -0
  85. package/dist/composites/device-list/hardware.d.ts +26 -0
  86. package/dist/composites/device-list/icon-action.d.ts +17 -0
  87. package/dist/composites/device-list/index.d.ts +23 -30
  88. package/dist/composites/device-list/multi-select.d.ts +22 -0
  89. package/dist/composites/device-list/sort.d.ts +18 -0
  90. package/dist/composites/device-list/sortable-header.d.ts +10 -0
  91. package/dist/composites/device-list/table-layout.d.ts +25 -0
  92. package/dist/composites/device-list/type-filter.d.ts +19 -0
  93. package/dist/composites/device-list/url-state.d.ts +14 -4
  94. package/dist/composites/device-meta.d.ts +38 -0
  95. package/dist/composites/discovery-panel.d.ts +3 -3
  96. package/dist/composites/hls-quality.d.ts +35 -0
  97. package/dist/composites/hls-video.d.ts +26 -0
  98. package/dist/composites/hover-zoom-image.d.ts +18 -0
  99. package/dist/composites/index.d.ts +13 -2
  100. package/dist/composites/log-stream-scroll.d.ts +32 -0
  101. package/dist/composites/log-stream.d.ts +8 -1
  102. package/dist/composites/stream-panel.d.ts +60 -9
  103. package/dist/composites/timezone-selector.d.ts +18 -0
  104. package/dist/composites/widget-panel.d.ts +28 -0
  105. package/dist/contexts/vod-playback.d.ts +17 -0
  106. package/dist/generated/system-hooks.d.ts +358 -56
  107. package/dist/hooks/index.d.ts +6 -0
  108. package/dist/hooks/use-device-cap-slice.d.ts +19 -0
  109. package/dist/hooks/use-device-capability.d.ts +12 -0
  110. package/dist/hooks/use-device-list-page-size.d.ts +14 -0
  111. package/dist/hooks/use-device-webrtc.d.ts +101 -4
  112. package/dist/hooks/use-optimistic-slice.d.ts +11 -0
  113. package/dist/index.cjs +53123 -9819
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.d.ts +1 -0
  116. package/dist/index.js +52791 -9767
  117. package/dist/index.js.map +1 -1
  118. package/dist/lib/cap-error.d.ts +41 -0
  119. package/dist/lib/format-control-datetime.d.ts +18 -0
  120. package/dist/lib/format-last-seen.d.ts +12 -0
  121. package/dist/lib/format-numeric.d.ts +9 -0
  122. package/dist/lib/index.d.ts +4 -0
  123. package/dist/primitives/dialog.d.ts +13 -0
  124. package/dist/primitives/tooltip.d.ts +9 -3
  125. package/package.json +3 -1
  126. package/dist/composites/cap-settings/MotionGridCanvas.d.ts +0 -9
@@ -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;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Format an HA-native datetime control value in the user's locale.
3
+ *
4
+ * The `control` cap keeps the value verbatim in one of three HA-native shapes:
5
+ * - date → 'YYYY-MM-DD'
6
+ * - time → 'HH:MM' or 'HH:MM:SS'
7
+ * - datetime → full ISO timestamp ('YYYY-MM-DDTHH:MM[:SS]' or space-separated)
8
+ *
9
+ * This helper renders that value for the READ-ONLY (at-a-glance) context:
10
+ * - 'date' → locale date (e.g. en-US '6/7/2026')
11
+ * - 'time' → locale time (e.g. en-US '07:30 AM')
12
+ * - 'datetime' → locale date+time (medium date + short time)
13
+ *
14
+ * It NEVER throws: any value it cannot parse is returned unchanged (graceful
15
+ * fallback). `locale` is optional and defaults to the runtime/browser locale.
16
+ */
17
+ export type ControlDateTimeFormat = 'date' | 'time' | 'datetime';
18
+ export declare function formatControlDateTime(value: string, format: ControlDateTimeFormat, locale?: string): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Relative "last seen" formatter for the offline affordance.
3
+ *
4
+ * Renders a short relative-time label from a millisecond epoch:
5
+ * "just now", "5m ago", "3h ago", "2d ago". Returns `null` for
6
+ * missing/non-positive inputs so callers can render nothing rather
7
+ * than a misleading "—" or "NaN ago".
8
+ *
9
+ * Future timestamps (clock skew between the device and the browser)
10
+ * collapse to "just now" instead of a negative duration.
11
+ */
12
+ export declare function formatLastSeen(timestampMs: number | null | undefined): string | null;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Format a numeric sensor / control value with optional display precision.
3
+ *
4
+ * When `precision` is provided, delegates to `value.toFixed(precision)` which
5
+ * matches the HA `suggested_display_precision` contract.
6
+ * When absent, falls back to auto-formatting: integers render without a
7
+ * decimal point; non-integers use one decimal place.
8
+ */
9
+ export declare function formatNumeric(value: number, precision: number | undefined): string;
@@ -1,4 +1,8 @@
1
1
  export { cn } from './cn';
2
+ export { formatLastSeen } from './format-last-seen';
3
+ export { formatControlDateTime } from './format-control-datetime';
4
+ export type { ControlDateTimeFormat } from './format-control-datetime';
5
+ export { isAbsentProvider } from './cap-error';
2
6
  export * from './responsive';
3
7
  export { mirror } from './pipeline-mirror';
4
8
  export type { MirrorSource, MirrorInput, MirrorOutcome, MirrorResultEntry, } from './pipeline-mirror';
@@ -7,6 +7,19 @@ interface DialogProps {
7
7
  }
8
8
  export declare function Dialog({ children, open: controlledOpen, onOpenChange }: DialogProps): import("react/jsx-runtime").JSX.Element;
9
9
  export declare function DialogTrigger({ children, ...props }: HTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
10
+ /**
11
+ * A native <dialog> opened with showModal() is promoted to the top layer, so
12
+ * ancestor transform/overflow can't clip it — but it relies on the UA
13
+ * stylesheet's `dialog { margin: auto }` for modal centering. Tailwind's
14
+ * preflight resets `margin: 0` on every element, which defeats that centering
15
+ * and pins the modal to the top-left. We therefore center deterministically:
16
+ * a top-layer dialog with `position: fixed` is viewport-relative, and a
17
+ * self-transform is fine, so `fixed left-1/2 top-1/2 -translate-x-1/2
18
+ * -translate-y-1/2 m-0` always centers regardless of any margin reset. Width
19
+ * is capped to the viewport (`w-[calc(100vw-2rem)]`) rather than a bare
20
+ * `w-full` (which would overflow/clip a centered dialog); the per-variant
21
+ * `max-w-*` keeps small dialogs small while the cap prevents overflow.
22
+ */
10
23
  declare const contentVariants: (props?: ({
11
24
  width?: "sm" | "md" | "lg" | null | undefined;
12
25
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -1,6 +1,12 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- export declare function Tooltip({ children }: {
3
- children: ReactNode;
4
- }): import("react/jsx-runtime").JSX.Element;
2
+ interface TooltipProps {
3
+ readonly children: ReactNode;
4
+ /** Extra classes for the positioning wrapper. Defaults to `inline-block`
5
+ * (shrink-to-fit). Pass `block w-full min-w-0` when the trigger must fill a
6
+ * width-constrained parent so its inner content can truncate cleanly. */
7
+ readonly className?: string;
8
+ }
9
+ export declare function Tooltip({ children, className }: TooltipProps): import("react/jsx-runtime").JSX.Element;
5
10
  export declare function TooltipTrigger({ children, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
6
11
  export declare function TooltipContent({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
12
+ export {};
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.58",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -31,6 +31,7 @@
31
31
  "scripts": {
32
32
  "build": "vite build",
33
33
  "typecheck": "tsc --noEmit",
34
+ "test": "vitest run",
34
35
  "publish": "npm publish --access public"
35
36
  },
36
37
  "peerDependencies": {
@@ -80,6 +81,7 @@
80
81
  "@module-federation/runtime": "^2.4.0",
81
82
  "class-variance-authority": "^0.7",
82
83
  "clsx": "^2.1",
84
+ "hls.js": "^1.6.16",
83
85
  "lucide-react": "^0.576",
84
86
  "qrcode.react": "^4.2.0",
85
87
  "tailwind-merge": "^3.0"
@@ -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;