@camstack/ui-library 1.1.21 → 1.1.23

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.
@@ -31,6 +31,10 @@ export declare function deviceRoleMeta(role: DeviceRole): DeviceRoleMeta;
31
31
  * Runtime-string-safe lookup: device data crosses process / network boundaries
32
32
  * as plain strings, so an unrecognised value falls back to the `Generic` meta
33
33
  * instead of throwing.
34
+ *
35
+ * This also guards mixed-version module-federation loads where the host
36
+ * `@camstack/types` enum has a new member before the loaded ui-library bundle
37
+ * has the matching `DEVICE_TYPE_META` entry.
34
38
  */
35
39
  export declare function deviceTypeMetaOf(type: string): DeviceTypeMeta;
36
40
  /** Runtime-string-safe role lookup; unknown roles fall back to `GenericSensor`. */
package/dist/index.cjs CHANGED
@@ -26012,17 +26012,25 @@ function deviceTypeMeta(type) {
26012
26012
  function deviceRoleMeta(role) {
26013
26013
  return DEVICE_ROLE_META[role];
26014
26014
  }
26015
+ var FALLBACK_DEVICE_TYPE_META = DEVICE_TYPE_META[_camstack_types.DeviceType.Generic];
26016
+ var FALLBACK_DEVICE_ROLE_META = DEVICE_ROLE_META[_camstack_types.DeviceRole.GenericSensor];
26015
26017
  /**
26016
26018
  * Runtime-string-safe lookup: device data crosses process / network boundaries
26017
26019
  * as plain strings, so an unrecognised value falls back to the `Generic` meta
26018
26020
  * instead of throwing.
26021
+ *
26022
+ * This also guards mixed-version module-federation loads where the host
26023
+ * `@camstack/types` enum has a new member before the loaded ui-library bundle
26024
+ * has the matching `DEVICE_TYPE_META` entry.
26019
26025
  */
26020
26026
  function deviceTypeMetaOf(type) {
26021
- return isDeviceType(type) ? DEVICE_TYPE_META[type] : DEVICE_TYPE_META[_camstack_types.DeviceType.Generic];
26027
+ if (!isDeviceType(type)) return FALLBACK_DEVICE_TYPE_META;
26028
+ return DEVICE_TYPE_META[type] ?? FALLBACK_DEVICE_TYPE_META;
26022
26029
  }
26023
26030
  /** Runtime-string-safe role lookup; unknown roles fall back to `GenericSensor`. */
26024
26031
  function deviceRoleMetaOf(role) {
26025
- return isDeviceRole(role) ? DEVICE_ROLE_META[role] : DEVICE_ROLE_META[_camstack_types.DeviceRole.GenericSensor];
26032
+ if (!isDeviceRole(role)) return FALLBACK_DEVICE_ROLE_META;
26033
+ return DEVICE_ROLE_META[role] ?? FALLBACK_DEVICE_ROLE_META;
26026
26034
  }
26027
26035
  /**
26028
26036
  * Icons an operator may pick for a per-device `display.icon` override, keyed by
@@ -26086,11 +26094,14 @@ function resolveDisplayIcon(name) {
26086
26094
  * compares against `device.type`); `label` + `icon` come from the meta map.
26087
26095
  * Ordered by `DeviceType` declaration order for a stable, intentional layout.
26088
26096
  */
26089
- var ALL_DEVICE_TYPE_FILTER_OPTIONS = Object.values(_camstack_types.DeviceType).map((type) => ({
26090
- id: type,
26091
- label: DEVICE_TYPE_META[type].label,
26092
- icon: DEVICE_TYPE_META[type].icon
26093
- }));
26097
+ var ALL_DEVICE_TYPE_FILTER_OPTIONS = Object.values(_camstack_types.DeviceType).map((type) => {
26098
+ const meta = deviceTypeMetaOf(type);
26099
+ return {
26100
+ id: type,
26101
+ label: meta.label,
26102
+ icon: meta.icon
26103
+ };
26104
+ });
26094
26105
  function allDeviceTypeFilterOptions() {
26095
26106
  return ALL_DEVICE_TYPE_FILTER_OPTIONS;
26096
26107
  }
package/dist/index.js CHANGED
@@ -25988,17 +25988,25 @@ function deviceTypeMeta(type) {
25988
25988
  function deviceRoleMeta(role) {
25989
25989
  return DEVICE_ROLE_META[role];
25990
25990
  }
25991
+ var FALLBACK_DEVICE_TYPE_META = DEVICE_TYPE_META[DeviceType.Generic];
25992
+ var FALLBACK_DEVICE_ROLE_META = DEVICE_ROLE_META[DeviceRole.GenericSensor];
25991
25993
  /**
25992
25994
  * Runtime-string-safe lookup: device data crosses process / network boundaries
25993
25995
  * as plain strings, so an unrecognised value falls back to the `Generic` meta
25994
25996
  * instead of throwing.
25997
+ *
25998
+ * This also guards mixed-version module-federation loads where the host
25999
+ * `@camstack/types` enum has a new member before the loaded ui-library bundle
26000
+ * has the matching `DEVICE_TYPE_META` entry.
25995
26001
  */
25996
26002
  function deviceTypeMetaOf(type) {
25997
- return isDeviceType(type) ? DEVICE_TYPE_META[type] : DEVICE_TYPE_META[DeviceType.Generic];
26003
+ if (!isDeviceType(type)) return FALLBACK_DEVICE_TYPE_META;
26004
+ return DEVICE_TYPE_META[type] ?? FALLBACK_DEVICE_TYPE_META;
25998
26005
  }
25999
26006
  /** Runtime-string-safe role lookup; unknown roles fall back to `GenericSensor`. */
26000
26007
  function deviceRoleMetaOf(role) {
26001
- return isDeviceRole(role) ? DEVICE_ROLE_META[role] : DEVICE_ROLE_META[DeviceRole.GenericSensor];
26008
+ if (!isDeviceRole(role)) return FALLBACK_DEVICE_ROLE_META;
26009
+ return DEVICE_ROLE_META[role] ?? FALLBACK_DEVICE_ROLE_META;
26002
26010
  }
26003
26011
  /**
26004
26012
  * Icons an operator may pick for a per-device `display.icon` override, keyed by
@@ -26062,11 +26070,14 @@ function resolveDisplayIcon(name) {
26062
26070
  * compares against `device.type`); `label` + `icon` come from the meta map.
26063
26071
  * Ordered by `DeviceType` declaration order for a stable, intentional layout.
26064
26072
  */
26065
- var ALL_DEVICE_TYPE_FILTER_OPTIONS = Object.values(DeviceType).map((type) => ({
26066
- id: type,
26067
- label: DEVICE_TYPE_META[type].label,
26068
- icon: DEVICE_TYPE_META[type].icon
26069
- }));
26073
+ var ALL_DEVICE_TYPE_FILTER_OPTIONS = Object.values(DeviceType).map((type) => {
26074
+ const meta = deviceTypeMetaOf(type);
26075
+ return {
26076
+ id: type,
26077
+ label: meta.label,
26078
+ icon: meta.icon
26079
+ };
26080
+ });
26070
26081
  function allDeviceTypeFilterOptions() {
26071
26082
  return ALL_DEVICE_TYPE_FILTER_OPTIONS;
26072
26083
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/ui-library",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",