@camstack/ui-library 1.2.105 → 1.2.107
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.
- package/dist/composites/device-controls/primary-child.d.ts +17 -8
- package/dist/index.cjs +24 -44
- package/dist/index.js +25 -45
- package/package.json +1 -1
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* that should be rendered as the container's PRIMARY child.
|
|
2
|
+
* Which child a container is rendered AS — this surface's name for the shared
|
|
3
|
+
* rule.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* The list and the resolution used to live here, in a COPY that carried a
|
|
6
|
+
* comment asking the Home Assistant adoption mapping and the viewer's panel to
|
|
7
|
+
* stay in sync with it. Three lists and three comments is not one rule, it is
|
|
8
|
+
* three chances to drift. Both now come from `@camstack/types`, which all of
|
|
9
|
+
* them already depend on; what remains here is the adapter for this module's
|
|
10
|
+
* historical `ChildRef` shape.
|
|
11
11
|
*/
|
|
12
|
+
/** The shared precedence, under this module's historical name. */
|
|
12
13
|
export declare const PRIORITY: readonly string[];
|
|
13
14
|
export interface ChildRef {
|
|
14
15
|
readonly id: number;
|
|
15
16
|
readonly entityId: string;
|
|
16
17
|
readonly type: string;
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve a container's primary child: the operator's pick when it still
|
|
21
|
+
* matches a live child, else the highest-priority type.
|
|
22
|
+
*
|
|
23
|
+
* `entityId` here is `sourceInfo?.id ?? stableId` (see `containerChildToRef`).
|
|
24
|
+
* The shared resolver matches its canonical `stableId` key first and accepts
|
|
25
|
+
* that legacy value too, so a pick stored under either keeps resolving.
|
|
26
|
+
*/
|
|
18
27
|
export declare function resolvePrimaryChild(children: readonly ChildRef[], overrideEntityId: string | undefined): ChildRef | null;
|
package/dist/index.cjs
CHANGED
|
@@ -39628,53 +39628,33 @@ function OfflineBadge({ lastChangedAt, className }) {
|
|
|
39628
39628
|
//#endregion
|
|
39629
39629
|
//#region src/composites/device-controls/primary-child.ts
|
|
39630
39630
|
/**
|
|
39631
|
-
*
|
|
39632
|
-
*
|
|
39633
|
-
* that should be rendered as the container's PRIMARY child.
|
|
39631
|
+
* Which child a container is rendered AS — this surface's name for the shared
|
|
39632
|
+
* rule.
|
|
39634
39633
|
*
|
|
39635
|
-
*
|
|
39636
|
-
*
|
|
39637
|
-
*
|
|
39638
|
-
*
|
|
39639
|
-
*
|
|
39634
|
+
* The list and the resolution used to live here, in a COPY that carried a
|
|
39635
|
+
* comment asking the Home Assistant adoption mapping and the viewer's panel to
|
|
39636
|
+
* stay in sync with it. Three lists and three comments is not one rule, it is
|
|
39637
|
+
* three chances to drift. Both now come from `@camstack/types`, which all of
|
|
39638
|
+
* them already depend on; what remains here is the adapter for this module's
|
|
39639
|
+
* historical `ChildRef` shape.
|
|
39640
|
+
*/
|
|
39641
|
+
/** The shared precedence, under this module's historical name. */
|
|
39642
|
+
var PRIORITY = _camstack_types.CONTAINER_CHILD_PRIORITY;
|
|
39643
|
+
/**
|
|
39644
|
+
* Resolve a container's primary child: the operator's pick when it still
|
|
39645
|
+
* matches a live child, else the highest-priority type.
|
|
39646
|
+
*
|
|
39647
|
+
* `entityId` here is `sourceInfo?.id ?? stableId` (see `containerChildToRef`).
|
|
39648
|
+
* The shared resolver matches its canonical `stableId` key first and accepts
|
|
39649
|
+
* that legacy value too, so a pick stored under either keeps resolving.
|
|
39640
39650
|
*/
|
|
39641
|
-
var PRIORITY = [
|
|
39642
|
-
"media-player",
|
|
39643
|
-
"alarm-panel",
|
|
39644
|
-
"thermostat",
|
|
39645
|
-
"climate",
|
|
39646
|
-
"humidifier",
|
|
39647
|
-
"water-heater",
|
|
39648
|
-
"lock",
|
|
39649
|
-
"cover",
|
|
39650
|
-
"valve",
|
|
39651
|
-
"fan",
|
|
39652
|
-
"vacuum",
|
|
39653
|
-
"lawn-mower",
|
|
39654
|
-
"light",
|
|
39655
|
-
"switch",
|
|
39656
|
-
"siren",
|
|
39657
|
-
"button",
|
|
39658
|
-
"control",
|
|
39659
|
-
"notifier",
|
|
39660
|
-
"script",
|
|
39661
|
-
"automation",
|
|
39662
|
-
"update",
|
|
39663
|
-
"presence",
|
|
39664
|
-
"weather",
|
|
39665
|
-
"image",
|
|
39666
|
-
"sensor"
|
|
39667
|
-
];
|
|
39668
39651
|
function resolvePrimaryChild(children, overrideEntityId) {
|
|
39669
|
-
|
|
39670
|
-
|
|
39671
|
-
|
|
39672
|
-
|
|
39673
|
-
|
|
39674
|
-
|
|
39675
|
-
function rank(type) {
|
|
39676
|
-
const i = PRIORITY.indexOf(type);
|
|
39677
|
-
return i === -1 ? PRIORITY.length : i;
|
|
39652
|
+
const picked = (0, _camstack_types.resolveContainerPrimaryChild)(children.map((c) => ({
|
|
39653
|
+
id: c.id,
|
|
39654
|
+
stableId: c.entityId,
|
|
39655
|
+
type: c.type
|
|
39656
|
+
})), overrideEntityId);
|
|
39657
|
+
return picked === null ? null : children.find((c) => c.id === picked.id) ?? null;
|
|
39678
39658
|
}
|
|
39679
39659
|
//#endregion
|
|
39680
39660
|
//#region src/composites/device-controls/container-primary.ts
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import * as __mfHostReactDOMClient from "react-dom/client";
|
|
|
13
13
|
import { createRoot } from "react-dom/client";
|
|
14
14
|
import * as __mfHostTrpcClient from "@trpc/client";
|
|
15
15
|
import { createTRPCClient, createWSClient, httpLink, splitLink, wsLink } from "@trpc/client";
|
|
16
|
-
import { ALL_CAPABILITY_DEFINITIONS, CAM_PROFILE_ORDER, DEFAULT_EVENTS_BAND_BUFFER_SEC, DEFAULT_EVENT_COLOR, DEVICE_TYPE_CONTROL_KIND, DeviceExportStatusSchema, DeviceFeature, DeviceRole, DeviceType, EVENT_TAXONOMY, EventCategory, ExposedDeviceSchema, KNOWN_CAP_NAMES, MODEL_PROVIDER_IDS, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, RecordingConfigSchema, RecordingStatusSchema, TIMEZONES, buildModelVariantGroups, canConvertUnit, clusterStepSettingFieldsFor, createDeviceProxy, createLazyTrpcSource, createSliceHandle, deriveRecordingMode, describeModelVariant, findTimezone, resolveDeviceControlKind, resolveRecordingProfiles, resolveVariantModelId, resolveViewableDeviceIds, selectAssignedProfileSlots, tryConvertUnit } from "@camstack/types";
|
|
16
|
+
import { ALL_CAPABILITY_DEFINITIONS, CAM_PROFILE_ORDER, CONTAINER_CHILD_PRIORITY, DEFAULT_EVENTS_BAND_BUFFER_SEC, DEFAULT_EVENT_COLOR, DEVICE_TYPE_CONTROL_KIND, DeviceExportStatusSchema, DeviceFeature, DeviceRole, DeviceType, EVENT_TAXONOMY, EventCategory, ExposedDeviceSchema, KNOWN_CAP_NAMES, MODEL_PROVIDER_IDS, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, RecordingConfigSchema, RecordingStatusSchema, TIMEZONES, buildModelVariantGroups, canConvertUnit, clusterStepSettingFieldsFor, createDeviceProxy, createLazyTrpcSource, createSliceHandle, deriveRecordingMode, describeModelVariant, findTimezone, resolveContainerPrimaryChild, resolveDeviceControlKind, resolveRecordingProfiles, resolveVariantModelId, resolveViewableDeviceIds, selectAssignedProfileSlots, tryConvertUnit } from "@camstack/types";
|
|
17
17
|
import { createSystem } from "@camstack/sdk";
|
|
18
18
|
import { z } from "zod";
|
|
19
19
|
//#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
|
@@ -39604,53 +39604,33 @@ function OfflineBadge({ lastChangedAt, className }) {
|
|
|
39604
39604
|
//#endregion
|
|
39605
39605
|
//#region src/composites/device-controls/primary-child.ts
|
|
39606
39606
|
/**
|
|
39607
|
-
*
|
|
39608
|
-
*
|
|
39609
|
-
* that should be rendered as the container's PRIMARY child.
|
|
39607
|
+
* Which child a container is rendered AS — this surface's name for the shared
|
|
39608
|
+
* rule.
|
|
39610
39609
|
*
|
|
39611
|
-
*
|
|
39612
|
-
*
|
|
39613
|
-
*
|
|
39614
|
-
*
|
|
39615
|
-
*
|
|
39610
|
+
* The list and the resolution used to live here, in a COPY that carried a
|
|
39611
|
+
* comment asking the Home Assistant adoption mapping and the viewer's panel to
|
|
39612
|
+
* stay in sync with it. Three lists and three comments is not one rule, it is
|
|
39613
|
+
* three chances to drift. Both now come from `@camstack/types`, which all of
|
|
39614
|
+
* them already depend on; what remains here is the adapter for this module's
|
|
39615
|
+
* historical `ChildRef` shape.
|
|
39616
|
+
*/
|
|
39617
|
+
/** The shared precedence, under this module's historical name. */
|
|
39618
|
+
var PRIORITY = CONTAINER_CHILD_PRIORITY;
|
|
39619
|
+
/**
|
|
39620
|
+
* Resolve a container's primary child: the operator's pick when it still
|
|
39621
|
+
* matches a live child, else the highest-priority type.
|
|
39622
|
+
*
|
|
39623
|
+
* `entityId` here is `sourceInfo?.id ?? stableId` (see `containerChildToRef`).
|
|
39624
|
+
* The shared resolver matches its canonical `stableId` key first and accepts
|
|
39625
|
+
* that legacy value too, so a pick stored under either keeps resolving.
|
|
39616
39626
|
*/
|
|
39617
|
-
var PRIORITY = [
|
|
39618
|
-
"media-player",
|
|
39619
|
-
"alarm-panel",
|
|
39620
|
-
"thermostat",
|
|
39621
|
-
"climate",
|
|
39622
|
-
"humidifier",
|
|
39623
|
-
"water-heater",
|
|
39624
|
-
"lock",
|
|
39625
|
-
"cover",
|
|
39626
|
-
"valve",
|
|
39627
|
-
"fan",
|
|
39628
|
-
"vacuum",
|
|
39629
|
-
"lawn-mower",
|
|
39630
|
-
"light",
|
|
39631
|
-
"switch",
|
|
39632
|
-
"siren",
|
|
39633
|
-
"button",
|
|
39634
|
-
"control",
|
|
39635
|
-
"notifier",
|
|
39636
|
-
"script",
|
|
39637
|
-
"automation",
|
|
39638
|
-
"update",
|
|
39639
|
-
"presence",
|
|
39640
|
-
"weather",
|
|
39641
|
-
"image",
|
|
39642
|
-
"sensor"
|
|
39643
|
-
];
|
|
39644
39627
|
function resolvePrimaryChild(children, overrideEntityId) {
|
|
39645
|
-
|
|
39646
|
-
|
|
39647
|
-
|
|
39648
|
-
|
|
39649
|
-
|
|
39650
|
-
|
|
39651
|
-
function rank(type) {
|
|
39652
|
-
const i = PRIORITY.indexOf(type);
|
|
39653
|
-
return i === -1 ? PRIORITY.length : i;
|
|
39628
|
+
const picked = resolveContainerPrimaryChild(children.map((c) => ({
|
|
39629
|
+
id: c.id,
|
|
39630
|
+
stableId: c.entityId,
|
|
39631
|
+
type: c.type
|
|
39632
|
+
})), overrideEntityId);
|
|
39633
|
+
return picked === null ? null : children.find((c) => c.id === picked.id) ?? null;
|
|
39654
39634
|
}
|
|
39655
39635
|
//#endregion
|
|
39656
39636
|
//#region src/composites/device-controls/container-primary.ts
|