@camstack/types 1.2.558 → 1.2.559

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,136 @@
1
+ /**
2
+ * device-icon — THE icon of a device, from what it IS: its {@link DeviceType},
3
+ * refined by its {@link DeviceRole}. One table for every surface: the admin's
4
+ * rows, cards, page header, lists and pickers draw it through ui-library's
5
+ * glyph table, the viewer through its catalog nodes. The value is a key of the
6
+ * icon catalog (D854), never a glyph.
7
+ *
8
+ * Exhaustive over both enums (`satisfies Record<…>`): a new type or role fails
9
+ * the build until it has an icon. Nothing here reads a name, a provider or a
10
+ * capability — an icon picked from those would be invented.
11
+ *
12
+ * Precedence: a known role → its icon; otherwise the type's icon; a type this
13
+ * build does not know → the generic type's icon. An operator's per-device or
14
+ * per-role display override is the caller's level above this one.
15
+ */
16
+ import { DeviceRole, DeviceType } from './device-type.js';
17
+ /** The icon of each device type. */
18
+ export declare const DEVICE_TYPE_ICON: {
19
+ readonly camera: 'camera';
20
+ readonly hub: 'network';
21
+ readonly light: 'lightbulb';
22
+ readonly siren: 'siren';
23
+ readonly switch: 'toggle-left';
24
+ readonly sensor: 'activity';
25
+ readonly climate: 'thermometer';
26
+ readonly "heat-pump": 'flame';
27
+ readonly button: 'circle-dot';
28
+ readonly "event-emitter": 'zap';
29
+ readonly update: 'refresh-cw';
30
+ readonly generic: 'box';
31
+ readonly notifier: 'bell';
32
+ readonly script: 'scroll-text';
33
+ readonly automation: 'workflow';
34
+ readonly lock: 'lock';
35
+ readonly cover: 'blinds';
36
+ readonly valve: 'pipette';
37
+ readonly humidifier: 'waves';
38
+ readonly "water-heater": 'bath';
39
+ readonly fan: 'fan';
40
+ readonly "media-player": 'monitor-play';
41
+ readonly "alarm-panel": 'shield-alert';
42
+ readonly control: 'sliders-horizontal';
43
+ readonly presence: 'map-pin';
44
+ readonly weather: 'cloud-sun';
45
+ readonly vacuum: 'bot';
46
+ readonly "lawn-mower": 'tractor';
47
+ readonly container: 'box';
48
+ readonly image: 'image';
49
+ readonly "pet-feeder": 'bone';
50
+ readonly "pet-fountain": 'droplets';
51
+ readonly dishwasher: 'waves';
52
+ readonly washer: 'washing-machine';
53
+ readonly dryer: 'wind';
54
+ readonly gateway: 'router';
55
+ };
56
+ /** The icon of each role: what the device is FOR, which reads better than its type. */
57
+ export declare const DEVICE_ROLE_ICON: {
58
+ readonly siren: 'siren';
59
+ readonly floodlight: 'lightbulb';
60
+ readonly spotlight: 'flashlight';
61
+ readonly "pir-sensor": 'radar';
62
+ readonly chime: 'bell';
63
+ readonly autotrack: 'crosshair';
64
+ readonly nightvision: 'moon';
65
+ readonly "privacy-mask": 'eye-off';
66
+ readonly doorbell: 'door-closed';
67
+ readonly "cover-blind": 'blinds';
68
+ readonly "cover-shutter": 'blinds';
69
+ readonly "cover-awning": 'blinds';
70
+ readonly "cover-curtain": 'blinds';
71
+ readonly "cover-garage": 'door-closed';
72
+ readonly "cover-gate": 'door-closed';
73
+ readonly "cover-door": 'door-open';
74
+ readonly "cover-window": 'blinds';
75
+ readonly "binary-helper": 'toggle-left';
76
+ readonly outlet: 'plug';
77
+ readonly "switch-heater": 'flame';
78
+ readonly "switch-fan": 'fan';
79
+ readonly "switch-light": 'lightbulb';
80
+ readonly "climate-ac": 'air-vent';
81
+ readonly "climate-thermostat": 'thermometer';
82
+ readonly "climate-floor": 'waves';
83
+ readonly "climate-radiator": 'heater';
84
+ readonly "climate-heater": 'flame';
85
+ readonly "climate-heat-pump-circuit": 'refresh-cw';
86
+ readonly "motion-sensor": 'footprints';
87
+ readonly "contact-sensor": 'door-open';
88
+ readonly "leak-sensor": 'droplet';
89
+ readonly "smoke-sensor": 'alarm-smoke';
90
+ readonly "co-sensor": 'wind';
91
+ readonly "gas-sensor": 'flame';
92
+ readonly "tamper-sensor": 'shield-alert';
93
+ readonly "vibration-sensor": 'vibrate';
94
+ readonly "connectivity-sensor": 'wifi';
95
+ readonly "sound-sensor": 'volume-2';
96
+ readonly "binary-sensor": 'toggle-left';
97
+ readonly "temperature-sensor": 'thermometer';
98
+ readonly "humidity-sensor": 'droplets';
99
+ readonly "ambient-light-sensor": 'sun';
100
+ readonly "pressure-sensor": 'gauge';
101
+ readonly "wind-sensor": 'wind';
102
+ readonly "rain-sensor": 'cloud-rain';
103
+ readonly "uv-sensor": 'sun-medium';
104
+ readonly "solar-radiation-sensor": 'sunrise';
105
+ readonly "soil-moisture-sensor": 'sprout';
106
+ readonly "power-sensor": 'zap';
107
+ readonly "energy-sensor": 'zap';
108
+ readonly "voltage-sensor": 'zap';
109
+ readonly "current-sensor": 'zap';
110
+ readonly "air-quality-sensor": 'wind';
111
+ readonly "battery-sensor": 'gauge';
112
+ readonly "numeric-sensor": 'hash';
113
+ readonly "enum-sensor": 'list';
114
+ readonly "datetime-sensor": 'clock';
115
+ readonly "generic-sensor": 'gauge';
116
+ readonly "numeric-control": 'sliders-horizontal';
117
+ readonly "select-control": 'list-checks';
118
+ readonly "text-control": 'type';
119
+ readonly "datetime-control": 'clock';
120
+ readonly "mobile-push-notifier": 'smartphone';
121
+ readonly "messaging-notifier": 'message-square';
122
+ readonly "email-notifier": 'mail';
123
+ readonly "generic-notifier": 'bell';
124
+ readonly "ir-transmitter": 'radio-tower';
125
+ };
126
+ /** Every icon a device can be drawn with — a subset of the catalog the glyph tables must cover. */
127
+ export type DeviceIconKey = (typeof DEVICE_TYPE_ICON)[DeviceType] | (typeof DEVICE_ROLE_ICON)[DeviceRole];
128
+ /** The icon of a device type alone; a type this build does not know draws the generic one. */
129
+ export declare function deviceTypeIconKey(type: string): DeviceIconKey;
130
+ /** The icon of a role alone, or `null` for a role this build does not know. */
131
+ export declare function deviceRoleIconKey(role: string): DeviceIconKey | null;
132
+ /**
133
+ * The icon of a device: its role's when the role is known, else its type's.
134
+ * An unknown role never borrows another role's icon — it is drawn as its type.
135
+ */
136
+ export declare function deviceIconKey(type: string, role?: string | null): DeviceIconKey;
@@ -72,5 +72,12 @@ export declare function humidityMeasurement(percent: number, since: number | nul
72
72
  export declare function powerMeasurement(watts: number, since: number | null): HeroMeasurement;
73
73
  export declare function contactMeasurement(open: boolean, since: number | null): HeroMeasurement;
74
74
  export declare function textMeasurement(text: string, since: number | null): HeroMeasurement;
75
+ /**
76
+ * The measurement of a sensor that has not reported yet: its normal card with
77
+ * an empty "—" value and its unit — never a placeholder, never a 0 (D393). The
78
+ * reading is `null` (nothing to format), the scene does not move, and nothing
79
+ * claims a moment.
80
+ */
81
+ export declare function emptyMeasurement(quantity: HeroMeasurementQuantity): HeroMeasurement;
75
82
  /** Whether `m` is the reading a device of `role` shows. */
76
83
  export declare function measurementFitsRole(m: HeroMeasurement, role: string | null): boolean;
@@ -6,3 +6,11 @@ export declare const HeroTextSchema: z.ZodObject<{
6
6
  it: z.ZodString;
7
7
  }, z.core.$strip>;
8
8
  export type HeroText = z.infer<typeof HeroTextSchema>;
9
+ /**
10
+ * What a device that has not reported says in place of its value: an empty "—",
11
+ * never a word like "Unknown" and never a 0 (D393). The card stays its normal
12
+ * self; only the value is empty.
13
+ */
14
+ export declare const NOT_REPORTED: HeroText;
15
+ /** Whether `text` is {@link NOT_REPORTED}: a client may leave such a slot out instead of painting a dash twice. */
16
+ export declare function isNotReported(text: HeroText): boolean;
@@ -9,7 +9,7 @@ export { HERO_ROW_IDS, HERO_ROW_LABELS, heroArgsWithValue, type HeroAction, type
9
9
  export { HERO_ANIMATIONS, HERO_BACKGROUNDS, HERO_STATES, HERO_TONES, type HeroAnimation, type HeroBackgroundToken, type HeroLook, type HeroState, type HeroTone, type StateLook, } from './hero-state.js';
10
10
  export { HERO_SCENE_BY_ROLE, HERO_SCENE_BY_TYPE, HERO_SCENES, HERO_SCENE_MODES, resolveHeroSceneId, type HeroScene, type HeroSceneId, type HeroSceneMode, } from './hero-scene.js';
11
11
  export { HeroRowModelSchema, projectDeviceRow, type HeroRowModel, } from './hero-row.js';
12
- export { HERO_MEASUREMENT_BANDS, HERO_MEASUREMENT_QUANTITIES, HERO_MEASUREMENT_SINCE_KINDS, HeroMeasurementReadingSchema, HeroMeasurementSchema, contactMeasurement, measurementFitsRole, humidityMeasurement, powerMeasurement, temperatureBand, temperatureMeasurement, textMeasurement, type HeroMeasurement, type HeroMeasurementBand, type HeroMeasurementQuantity, type HeroMeasurementReading, type HeroMeasurementSinceKind, } from './hero-measurement.js';
13
- export { heroText, type HeroText } from './hero-text.js';
12
+ export { HERO_MEASUREMENT_BANDS, HERO_MEASUREMENT_QUANTITIES, HERO_MEASUREMENT_SINCE_KINDS, HeroMeasurementReadingSchema, HeroMeasurementSchema, contactMeasurement, emptyMeasurement, measurementFitsRole, humidityMeasurement, powerMeasurement, temperatureBand, temperatureMeasurement, textMeasurement, type HeroMeasurement, type HeroMeasurementBand, type HeroMeasurementQuantity, type HeroMeasurementReading, type HeroMeasurementSinceKind, } from './hero-measurement.js';
13
+ export { NOT_REPORTED, heroText, isNotReported, type HeroText } from './hero-text.js';
14
14
  export * from './media-player-view.js';
15
15
  export { resolveOwnPower } from './own-power.js';
@@ -20,6 +20,8 @@ export type { IDeviceRuntimeState, Snapshot as RuntimeStateSnapshot, } from './d
20
20
  export { ChargingStatus, DeviceFeature, DeviceRole, DeviceType, featuresOfBoundCaps, } from './device-type.js';
21
21
  export { capAppliesToDeviceKind, canonicalStoredDeviceType, CLIMATE_ROLES, StoredDeviceTypeSchema, climateRoleOf, isAirConditioner, isOutlet, isSwitchFan, isSwitchHeater, isSwitchLight, type ClimateRole, type DeviceKindGate, } from './device-kind.js';
22
22
  export type { IBatteryOperated, IDoorbellButton, INativeSnapshot, IPanTiltZoom, IRebootable, ITwoWayAudio, } from './features.js';
23
+ export { DEVICE_ROLE_ICON, DEVICE_TYPE_ICON, deviceIconKey, deviceRoleIconKey, deviceTypeIconKey, } from './device-icon.js';
24
+ export type { DeviceIconKey } from './device-icon.js';
23
25
  export type { IconCategoryId, IconEntry, IconHit, IconKey, } from './icon-catalog.js';
24
26
  export { ICON_CATALOG_SOURCE, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, canonicalIconKey, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, resolveIconKey, searchIcons, } from './icon-catalog.js';
25
27
  export type { LocationDescriptionAssignment, LocationIconAssignment, } from './location-icon.js';
package/dist/index.d.ts CHANGED
@@ -280,6 +280,8 @@ export { DEVICE_FEATURE_REQUIREMENTS, deriveFeatureProvenance, isKernelDerivedFe
280
280
  export { implementedMethodsOf } from './device/implemented-methods.js';
281
281
  export { APPLIANCE_EXPORT, type ApplianceExportDecision, type ApplianceExportEcosystem, type ApplianceExported, type ApplianceNotExported, type PlugApplianceType, PLUG_APPLIANCE_TYPES, applianceExport, isPlugApplianceType, } from './device/appliance-export.js';
282
282
  export type { IBatteryOperated, IDoorbellButton, INativeSnapshot, IPanTiltZoom, IRebootable, ITwoWayAudio, } from './device/features.js';
283
+ export { DEVICE_ROLE_ICON, DEVICE_TYPE_ICON, deviceIconKey, deviceRoleIconKey, deviceTypeIconKey, } from './device/device-icon.js';
284
+ export type { DeviceIconKey } from './device/device-icon.js';
283
285
  export type { IconCategoryId, IconEntry, IconHit, IconKey, } from './device/icon-catalog.js';
284
286
  export { ICON_CATALOG_SOURCE, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, canonicalIconKey, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, resolveIconKey, searchIcons, } from './device/icon-catalog.js';
285
287
  export type { LocationDescriptionAssignment, LocationIconAssignment, } from './device/location-icon.js';