@camstack/types 1.2.604 → 1.2.606

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_runtime_capabilities = require("./runtime-capabilities-D9KsXMv7.js");
2
+ const require_runtime_capabilities = require("./runtime-capabilities-DCRxheYq.js");
3
3
  const require_event_category = require("./event-category-CMA0-jGW.js");
4
4
  const require_composed_stable_id = require("./composed-stable-id-DkF5-kuf.js");
5
- const require_implemented_methods = require("./implemented-methods-I_l2ENnf.js");
5
+ const require_implemented_methods = require("./implemented-methods-BHN-Utsb.js");
6
6
  const require_node_color = require("./node-color.js");
7
7
  const require_convert = require("./convert-BI8iTXn6.js");
8
8
  const require_device_template_catalogue = require("./device-template-catalogue.js");
@@ -43583,6 +43583,31 @@ var BatteryStatusSchema = zod.z.object({
43583
43583
  */
43584
43584
  voltage: zod.z.number().nullable().optional().meta(require_runtime_capabilities.readingMeta("voltage", { label: "Voltage" })),
43585
43585
  /**
43586
+ * What the CELL is doing, as opposed to {@link charging} (what it is powered
43587
+ * from). `'charging'` takes current, `'full'` is connected and topped up,
43588
+ * `'idle'` is a stopped cell the firmware reported as such (running on the
43589
+ * battery, or an adapter that is not feeding it).
43590
+ *
43591
+ * Absent or `'unknown'` is NOT an answer: the provider has not read the
43592
+ * charge fields. It must never be coerced to `'idle'` (D315) — a camera
43593
+ * nobody reached would be drawn "not charging". Consumers SKIP it.
43594
+ */
43595
+ chargeState: zod.z.enum([
43596
+ "charging",
43597
+ "full",
43598
+ "idle",
43599
+ "unknown"
43600
+ ]).optional().meta({ label: "Charge state" }),
43601
+ /**
43602
+ * Battery current in milliamperes, as the firmware reports it (sign is the
43603
+ * firmware's). `null`/absent = not reported. Stored in mA, not the quantity
43604
+ * base (A), so it carries no reading quantity: a quantity would make the UI
43605
+ * convert and print it as amperes.
43606
+ */
43607
+ currentMa: zod.z.number().nullable().optional().meta(require_runtime_capabilities.readingMeta("none", { label: "Current (mA)" })),
43608
+ /** Battery temperature in °C. `null`/absent = not reported. */
43609
+ temperatureC: zod.z.number().nullable().optional().meta(require_runtime_capabilities.readingMeta("temperature", { label: "Temperature" })),
43610
+ /**
43586
43611
  * Ms epoch of the last time the device PROVED it was reachable — a
43587
43612
  * completed firmware round-trip, an observed wake, or an inbound push
43588
43613
  * (firmware event, email). `0`/absent = never since this slice was born.
@@ -43742,6 +43767,10 @@ onStatusChanged: {
43742
43767
  voltage: {
43743
43768
  kind: "gauge",
43744
43769
  unit: "V"
43770
+ },
43771
+ temperatureC: {
43772
+ kind: "gauge",
43773
+ unit: "°C"
43745
43774
  }
43746
43775
  } },
43747
43776
  customize: batteryCustomize,
@@ -43794,6 +43823,30 @@ onStatusChanged: {
43794
43823
  }
43795
43824
  ],
43796
43825
  icon: "battery-charging"
43826
+ },
43827
+ {
43828
+ kind: "enum",
43829
+ field: "chargeState",
43830
+ label: require_runtime_capabilities.t("Charge state", "Stato di carica"),
43831
+ values: [
43832
+ {
43833
+ value: "charging",
43834
+ label: require_runtime_capabilities.t("Charging", "In carica")
43835
+ },
43836
+ {
43837
+ value: "full",
43838
+ label: require_runtime_capabilities.t("Full", "Carica completa")
43839
+ },
43840
+ {
43841
+ value: "idle",
43842
+ label: require_runtime_capabilities.t("Not charging", "Non in carica")
43843
+ },
43844
+ {
43845
+ value: "unknown",
43846
+ label: require_runtime_capabilities.t("Unknown", "Sconosciuto")
43847
+ }
43848
+ ],
43849
+ icon: "battery-charging"
43797
43850
  }
43798
43851
  ],
43799
43852
  extraEvents: [{
@@ -50611,7 +50664,8 @@ var CAP_RUNTIME_FIELD_UNITS = {
50611
50664
  "ambient-light-sensor": { illuminance: "lx" },
50612
50665
  "battery": {
50613
50666
  level: "%",
50614
- voltage: "V"
50667
+ voltage: "V",
50668
+ temperatureC: "°C"
50615
50669
  },
50616
50670
  "humidity-sensor": { humidity: "%" },
50617
50671
  "power-meter": {
@@ -51662,7 +51716,7 @@ function groupTemplate(id) {
51662
51716
  //#region src/generated/history-catalog.ts
51663
51717
  /**
51664
51718
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
51665
- * 47 caps with series (131 series), 40 caps answered `'none'`.
51719
+ * 47 caps with series (132 series), 40 caps answered `'none'`.
51666
51720
  * Field keys are `runtimeState` paths (`a.b` into fixed objects only).
51667
51721
  */
51668
51722
  var HISTORY_CATALOG = {
@@ -51724,6 +51778,10 @@ var HISTORY_CATALOG = {
51724
51778
  "voltage": {
51725
51779
  kind: "gauge",
51726
51780
  unit: "V"
51781
+ },
51782
+ "temperatureC": {
51783
+ kind: "gauge",
51784
+ unit: "°C"
51727
51785
  }
51728
51786
  },
51729
51787
  "binary": { "on": { kind: "boolean" } },
@@ -53215,6 +53273,7 @@ function compileHelper(spec, retention = require_implemented_methods.DEFAULT_HIS
53215
53273
  case "arithmetic": return compileMath(arithmeticDraft(spec));
53216
53274
  case "expression": return compileMath(expressionDraft(spec));
53217
53275
  case "grid":
53276
+ case "crop":
53218
53277
  case "terminal": return parseDraft(engineHostedDraft(spec));
53219
53278
  }
53220
53279
  }
@@ -110308,7 +110367,7 @@ function proposeRunningThreshold(series) {
110308
110367
  const notes = [];
110309
110368
  const longestPause = pauses.length === 0 ? 0 : Math.max(...pauses);
110310
110369
  const stopFloor = series.deviceType === void 0 ? STOP_MIN_MS : STOP_FLOOR_BY_KIND[series.deviceType] ?? STOP_MIN_MS;
110311
- let stop = clamp(Math.max(stopFloor, roundUp(STOP_FACTOR * longestPause, STOP_STEP_MS)), STOP_MIN_MS, STOP_MAX_MS);
110370
+ let stop = clamp$1(Math.max(stopFloor, roundUp(STOP_FACTOR * longestPause, STOP_STEP_MS)), STOP_MIN_MS, STOP_MAX_MS);
110312
110371
  const shortestGap = betweenGaps.length === 0 ? null : Math.min(...betweenGaps);
110313
110372
  if (shortestGap !== null && stop >= shortestGap) notes.push("stop-dwell-exceeds-shortest-gap");
110314
110373
  const blips = excursionsOutside(segments, threshold, runs);
@@ -110388,7 +110447,7 @@ function durationOf(spans) {
110388
110447
  function maxOf(values) {
110389
110448
  return values.length === 0 ? 0 : Math.max(...values);
110390
110449
  }
110391
- function clamp(value, min, max) {
110450
+ function clamp$1(value, min, max) {
110392
110451
  return Math.min(max, Math.max(min, value));
110393
110452
  }
110394
110453
  function roundUp(value, step) {
@@ -110777,6 +110836,96 @@ function createDeviceExtensionProvider(options) {
110777
110836
  };
110778
110837
  }
110779
110838
  //#endregion
110839
+ //#region src/composition/helpers/crop-geometry.ts
110840
+ /** The smallest side a crop may shrink to, as a fraction of the source. */
110841
+ var CROP_MIN_SIDE = .05;
110842
+ /** A seeded crop covers this fraction of the largest rectangle that fits, so it is a visible crop. */
110843
+ var CROP_SEED_SCALE = .6;
110844
+ /** The pixel aspect (width / height) a preset locks to; `null` for `free`. */
110845
+ function cropAspectRatio(aspect) {
110846
+ switch (aspect) {
110847
+ case "16:9": return 16 / 9;
110848
+ case "4:3": return 4 / 3;
110849
+ case "1:1": return 1;
110850
+ case "free": return null;
110851
+ }
110852
+ }
110853
+ /** The pixel aspect of the canvas a crop produces: crop aspect times source aspect. */
110854
+ function cropCanvasAspect(rect, sourceAspect) {
110855
+ return rect.width / rect.height * sourceAspect;
110856
+ }
110857
+ function clamp(value, min, max) {
110858
+ return Math.min(Math.max(value, min), max);
110859
+ }
110860
+ /**
110861
+ * The rectangle a new crop starts from: centred, the preset's pixel aspect on
110862
+ * a source of `sourceAspect`. `free` starts as the middle quarter.
110863
+ */
110864
+ function seedCropRect(aspect, sourceAspect) {
110865
+ const ratio = cropAspectRatio(aspect);
110866
+ if (ratio === null) return {
110867
+ x: .25,
110868
+ y: .25,
110869
+ width: .5,
110870
+ height: .5
110871
+ };
110872
+ const heightPerWidth = sourceAspect / ratio;
110873
+ const width = (heightPerWidth <= 1 ? 1 : 1 / heightPerWidth) * CROP_SEED_SCALE;
110874
+ const height = width * heightPerWidth;
110875
+ return {
110876
+ x: (1 - width) / 2,
110877
+ y: (1 - height) / 2,
110878
+ width,
110879
+ height
110880
+ };
110881
+ }
110882
+ /** The same rectangle moved by (dx, dy), held inside the source. Its size never changes. */
110883
+ function moveCropRect(rect, dx, dy) {
110884
+ return {
110885
+ ...rect,
110886
+ x: clamp(rect.x + dx, 0, 1 - rect.width),
110887
+ y: clamp(rect.y + dy, 0, 1 - rect.height)
110888
+ };
110889
+ }
110890
+ /**
110891
+ * Drag one corner. The opposite corner is the anchor. A preset keeps the pixel
110892
+ * aspect exactly (the larger of the two pointer distances leads), `free` follows
110893
+ * the pointer on both axes. Either way the result stays inside the source and
110894
+ * never shrinks below `CROP_MIN_SIDE`.
110895
+ */
110896
+ function resizeCropRect(input) {
110897
+ const { rect, handle, point, aspect, sourceAspect } = input;
110898
+ const west = handle === "nw" || handle === "sw";
110899
+ const north = handle === "nw" || handle === "ne";
110900
+ const anchorX = west ? rect.x + rect.width : rect.x;
110901
+ const anchorY = north ? rect.y + rect.height : rect.y;
110902
+ const signX = west ? -1 : 1;
110903
+ const signY = north ? -1 : 1;
110904
+ const roomX = signX > 0 ? 1 - anchorX : anchorX;
110905
+ const roomY = signY > 0 ? 1 - anchorY : anchorY;
110906
+ const wantX = (point.x - anchorX) * signX;
110907
+ const wantY = (point.y - anchorY) * signY;
110908
+ const ratio = cropAspectRatio(aspect);
110909
+ let width;
110910
+ let height;
110911
+ if (ratio === null) {
110912
+ width = clamp(wantX, Math.min(CROP_MIN_SIDE, roomX), roomX);
110913
+ height = clamp(wantY, Math.min(CROP_MIN_SIDE, roomY), roomY);
110914
+ } else {
110915
+ const k = ratio / sourceAspect;
110916
+ const maxWidth = Math.min(roomX, roomY * k);
110917
+ const minWidth = Math.min(Math.max(CROP_MIN_SIDE, CROP_MIN_SIDE * k), maxWidth);
110918
+ width = clamp(Math.max(wantX, wantY * k), minWidth, maxWidth);
110919
+ height = width / k;
110920
+ }
110921
+ return {
110922
+ x: signX > 0 ? anchorX : anchorX - width,
110923
+ y: signY > 0 ? anchorY : anchorY - height,
110924
+ width,
110925
+ height
110926
+ };
110927
+ }
110928
+ //#endregion
110780
110929
  //#region src/composition/helpers/actuator-methods.ts
110781
110930
  /**
110782
110931
  * One method table per actuator type (D944). A group offers a method only
@@ -151707,7 +151856,10 @@ exports.CORE_ULTRA_265K_IGPU_CLOCK_MHZ = CORE_ULTRA_265K_IGPU_CLOCK_MHZ;
151707
151856
  exports.CORE_ULTRA_265K_IGPU_EU = CORE_ULTRA_265K_IGPU_EU;
151708
151857
  exports.CREDENTIAL_TOKEN_AUDIENCE = CREDENTIAL_TOKEN_AUDIENCE;
151709
151858
  exports.CREDENTIAL_TOKEN_KIND = CREDENTIAL_TOKEN_KIND;
151859
+ exports.CROP_ASPECTS = require_implemented_methods.CROP_ASPECTS;
151710
151860
  exports.CROP_CLASS_FLOORS = CROP_CLASS_FLOORS;
151861
+ exports.CROP_MIN_SIDE = CROP_MIN_SIDE;
151862
+ exports.CROP_SEED_SCALE = CROP_SEED_SCALE;
151711
151863
  exports.CROP_SUPPLY_SOURCES = CROP_SUPPLY_SOURCES;
151712
151864
  exports.CROP_SUPPLY_STEP_IDS = CROP_SUPPLY_STEP_IDS;
151713
151865
  exports.CUSTOMIZATION_BLOCK_NAME_PREFIX = require_implemented_methods.CUSTOMIZATION_BLOCK_NAME_PREFIX;
@@ -151909,6 +152061,7 @@ exports.CoverStatusSchema = CoverStatusSchema;
151909
152061
  exports.CreateUserInputSchema = CreateUserInputSchema;
151910
152062
  exports.CredentialScopeSchema = CredentialScopeSchema;
151911
152063
  exports.CredentialTokenClaimsSchema = CredentialTokenClaimsSchema;
152064
+ exports.CropHelperSpecSchema = require_implemented_methods.CropHelperSpecSchema;
151912
152065
  exports.CurrentAutomationRecipeSchema = CurrentAutomationRecipeSchema;
151913
152066
  exports.CustomActionInputSchema = CustomActionInputSchema;
151914
152067
  exports.CustomModelDescriptorSchema = CustomModelDescriptorSchema;
@@ -151936,6 +152089,7 @@ exports.DEFAULT_CLUSTER_STEP_MODELS = DEFAULT_CLUSTER_STEP_MODELS;
151936
152089
  exports.DEFAULT_CLUSTER_STEP_SETTINGS = DEFAULT_CLUSTER_STEP_SETTINGS;
151937
152090
  exports.DEFAULT_COMMAND_HOLD_MS = DEFAULT_COMMAND_HOLD_MS;
151938
152091
  exports.DEFAULT_CORE_BLOCK_ENTRY = DEFAULT_CORE_BLOCK_ENTRY;
152092
+ exports.DEFAULT_CROP_ASPECT = require_implemented_methods.DEFAULT_CROP_ASPECT;
151939
152093
  exports.DEFAULT_DECODER_HWACCEL_CONFIG = DEFAULT_DECODER_HWACCEL_CONFIG;
151940
152094
  exports.DEFAULT_DETAIL_CROP_CONVENTION = DEFAULT_DETAIL_CROP_CONVENTION;
151941
152095
  exports.DEFAULT_DISPLAY_PREFERENCE = require_runtime_capabilities.DEFAULT_DISPLAY_PREFERENCE;
@@ -154463,6 +154617,8 @@ exports.createSecretsAccess = require_runtime_capabilities.createSecretsAccess;
154463
154617
  exports.createSliceHandle = require_runtime_capabilities.createSliceHandle;
154464
154618
  exports.createStatefulExpressionMemory = require_implemented_methods.createStatefulExpressionMemory;
154465
154619
  exports.createSystemProxy = createSystemProxy;
154620
+ exports.cropAspectRatio = cropAspectRatio;
154621
+ exports.cropCanvasAspect = cropCanvasAspect;
154466
154622
  exports.customAction = require_runtime_capabilities.customAction;
154467
154623
  exports.customKeyOfRole = customKeyOfRole;
154468
154624
  exports.customModelRegistryCapability = customModelRegistryCapability;
@@ -155055,6 +155211,7 @@ exports.motionZonesCapability = motionZonesCapability;
155055
155211
  exports.moveBodySwitchToRegistry = require_runtime_capabilities.moveBodySwitchToRegistry;
155056
155212
  exports.moveBrokerLinksToConnections = moveBrokerLinksToConnections;
155057
155213
  exports.moveCalendarIdsToRecords = moveCalendarIdsToRecords;
155214
+ exports.moveCropRect = moveCropRect;
155058
155215
  exports.moveGroup = moveGroup;
155059
155216
  exports.moveIntegrationRowsToRecords = moveIntegrationRowsToRecords;
155060
155217
  exports.moveRegistrySwitchToBody = require_runtime_capabilities.moveRegistrySwitchToBody;
@@ -155070,6 +155227,7 @@ exports.netPowerOf = netPowerOf;
155070
155227
  exports.networkAccessCapability = networkAccessCapability;
155071
155228
  exports.networkLinkCapability = networkLinkCapability;
155072
155229
  exports.networkQualityCapability = networkQualityCapability;
155230
+ exports.newCropHelperSpec = require_implemented_methods.newCropHelperSpec;
155073
155231
  exports.newGridHelperSpec = require_implemented_methods.newGridHelperSpec;
155074
155232
  exports.nextLocalMidnight = require_implemented_methods.nextLocalMidnight;
155075
155233
  exports.nextOccurrence = nextOccurrence;
@@ -155333,6 +155491,7 @@ exports.requiredTopLevelKeys = requiredTopLevelKeys;
155333
155491
  exports.requiresPython = require_runtime_capabilities.requiresPython;
155334
155492
  exports.reservedSourceOwner = reservedSourceOwner;
155335
155493
  exports.resetPoolBaseline = resetPoolBaseline;
155494
+ exports.resizeCropRect = resizeCropRect;
155336
155495
  exports.resolveActionVariables = resolveActionVariables;
155337
155496
  exports.resolveAddonExecution = resolveAddonExecution;
155338
155497
  exports.resolveAddonGroup = resolveAddonGroup;
@@ -155475,6 +155634,7 @@ exports.secretTreeFromSchema = require_runtime_capabilities.secretTreeFromSchema
155475
155634
  exports.secretViewsOf = require_runtime_capabilities.secretViewsOf;
155476
155635
  exports.secretsOverMigrationApi = require_runtime_capabilities.secretsOverMigrationApi;
155477
155636
  exports.secureActuationFor = secureActuationFor;
155637
+ exports.seedCropRect = seedCropRect;
155478
155638
  exports.seedInstanceOnce = seedInstanceOnce;
155479
155639
  exports.seedLeaf = seedLeaf;
155480
155640
  exports.seekPatch = seekPatch;