@camstack/addon-osd-manager 0.1.160 → 0.1.161

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 (17) hide show
  1. package/dist/{MotionZonesSettings-gJgHYJJc.mjs → MotionZonesSettings-CSheC3_V.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-HmUc5RFn.mjs → PrivacyMaskSettings-I6eE4GFM.mjs} +4 -4
  3. package/dist/{SceneMonitorEditor-Dqc4eAZT.mjs → SceneMonitorEditor-mNJ89n0T.mjs} +3 -3
  4. package/dist/_stub.js +155 -167
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BX8u4O5k.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BYQUZdGL.mjs} +2 -2
  6. package/dist/{_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BzuGVFNp.mjs → _virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-B2mEdhqd.mjs} +1 -1
  7. package/dist/{hostInit-o9ggbWOT.mjs → hostInit-DFyjx8Xk.mjs} +1 -1
  8. package/dist/index.js +115 -36
  9. package/dist/index.mjs +108 -37
  10. package/dist/{player-overlays-BgDqoYs3.mjs → player-overlays-DFXmMB9Y.mjs} +1 -1
  11. package/dist/remoteEntry.js +1 -1
  12. package/dist/{responsive-B7zCyVCX.mjs → responsive-DLFs-5i_.mjs} +1 -1
  13. package/dist/{scene-monitor-copy-DWIcj1X6.mjs → scene-monitor-copy-DVNcikwa.mjs} +1 -1
  14. package/dist/{square-D0YQUHMC.mjs → square-Co3Eglp3.mjs} +1 -1
  15. package/dist/{trash-2-C_1H5SIl.mjs → trash-2-DnKldIWK.mjs} +1 -1
  16. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-BAuPDG6y.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-C3yC0JaQ.mjs} +1 -1
  17. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -39327,21 +39327,12 @@ setOverlay: method(object({
39327
39327
  }
39328
39328
  }] }
39329
39329
  };
39330
- /**
39331
- * `osd-manager` — the ORCHESTRATOR over the device-scope `osd` cap.
39332
- *
39333
- * The `osd` cap is the firmware contract: it probes a camera's overlay
39334
- * SLOTS and writes literal text into one. It has no idea WHERE that text
39335
- * comes from, and it must not — a driver that grew a "show the temperature
39336
- * here" feature would grow it once per vendor.
39337
- *
39338
- * This cap owns the other half: a per-(camera, slot) BINDING that says
39339
- * which value feeds the slot, how it is formatted, and under which
39340
- * conditions it is shown at all. Named TEMPLATES combine many device
39341
- * fields into one overlay string (Scrypted OSD Manager parity).
39342
- */
39343
- /** What `{alias}` expands to for one template binding. Exactly one choice. */
39344
- var OsdTemplateFormatSchema = _enum([
39330
+ _enum([
39331
+ "value",
39332
+ "unit",
39333
+ "full"
39334
+ ]);
39335
+ _enum([
39345
39336
  "value+unit",
39346
39337
  "value",
39347
39338
  "unit"
@@ -39356,29 +39347,30 @@ var OsdTemplatePickSchema = object({
39356
39347
  deviceId: number().int()
39357
39348
  });
39358
39349
  /**
39359
- * One named binding inside a multi-device template. The parser only
39360
- * sees `{alias}`; format / unit / decimals live here structurally.
39350
+ * One named binding inside a multi-device template: device path + unit
39351
+ * selection + precision. The parser expands `{alias}`, `{alias.value}`,
39352
+ * `{alias.unit}`, or `{alias.full}` from the same binding — there is no
39353
+ * per-binding format lock.
39361
39354
  */
39362
39355
  var OsdTemplateBindingSchema = object({
39363
- /** Token in the parser, e.g. `t` → `{t}`. Unique within the template. */
39356
+ /** Token stem in the parser, e.g. `t` → `{t}` / `{t.value}`. Unique within the template. */
39364
39357
  alias: string().min(1).max(32).regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "alias must start with a letter"),
39365
39358
  pick: OsdTemplatePickSchema,
39366
39359
  capName: string().min(1).max(64),
39367
39360
  valuePath: string().min(1).max(64),
39368
- format: OsdTemplateFormatSchema.default("value+unit"),
39369
39361
  /** Convert TO this unit at render (`tryConvertUnit`). Absent = source unit. */
39370
39362
  displayUnit: string().max(16).optional(),
39371
39363
  maxDecimals: number().int().min(0).max(4).default(1)
39372
39364
  });
39373
39365
  /**
39374
- * A named template: bindings (alias → leaf field) + a parser that only
39375
- * references `{alias}` tokens.
39366
+ * A named template: bindings (alias → leaf field) + a parser that
39367
+ * references `{alias}` / `{alias.value}` / `{alias.unit}` / `{alias.full}`.
39376
39368
  */
39377
39369
  var OsdNamedTemplateSchema = object({
39378
39370
  id: string().min(1).max(64),
39379
39371
  name: string().min(1).max(64),
39380
39372
  bindings: array(OsdTemplateBindingSchema).max(32).default([]),
39381
- /** Parser with alias placeholders, e.g. `{t} / {h}`. */
39373
+ /** Parser with alias placeholders, e.g. `{t.value} {t.unit} / {h}`. */
39382
39374
  parser: string().max(256).default("")
39383
39375
  });
39384
39376
  /** Where a slot's value comes from. */
@@ -45584,6 +45576,10 @@ var UNIT_TABLE = {
45584
45576
  function specFor(unit) {
45585
45577
  return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
45586
45578
  }
45579
+ /** The dimension a unit belongs to, or `undefined` for an unknown unit. */
45580
+ function unitDimension(unit) {
45581
+ return specFor(unit)?.dimension;
45582
+ }
45587
45583
  /** Value in `spec`'s unit → its dimension's canonical unit. */
45588
45584
  function toCanonical(value, spec) {
45589
45585
  return value * spec.factor + spec.offset;
@@ -58385,24 +58381,73 @@ function readStatePath(slice, path) {
58385
58381
  }
58386
58382
  //#endregion
58387
58383
  //#region src/template-tokens.ts
58388
- /** Build the placeholder token for one binding alias. */
58389
- function aliasToken(alias) {
58390
- return `{${alias}}`;
58384
+ /** Build a placeholder token for one binding alias + expand kind. */
58385
+ function aliasToken(alias, kind = "full") {
58386
+ if (kind === "full") return `{${alias}}`;
58387
+ return `{${alias}.${kind}}`;
58388
+ }
58389
+ /** Explicit `{alias.full}` form (chips prefer this over bare `{alias}`). */
58390
+ function aliasFullToken(alias) {
58391
+ return `{${alias}.full}`;
58392
+ }
58393
+ /** Chip / parser insert options for one binding (value, unit, value+unit). */
58394
+ function bindingInsertChips(binding) {
58395
+ const alias = binding.alias;
58396
+ return [
58397
+ {
58398
+ id: `${alias}.value`,
58399
+ label: `${alias} · value`,
58400
+ token: aliasToken(alias, "value"),
58401
+ kind: "value"
58402
+ },
58403
+ {
58404
+ id: `${alias}.unit`,
58405
+ label: `${alias} · unit`,
58406
+ token: aliasToken(alias, "unit"),
58407
+ kind: "unit"
58408
+ },
58409
+ {
58410
+ id: `${alias}.full`,
58411
+ label: `${alias} · value+unit`,
58412
+ token: aliasFullToken(alias),
58413
+ kind: "full"
58414
+ }
58415
+ ];
58391
58416
  }
58392
- /** Chip / parser token for a binding. */
58417
+ /** @deprecated Prefer `bindingInsertChips` — bare `{alias}` only. */
58393
58418
  function bindingToken(binding) {
58394
- return aliasToken(binding.alias);
58419
+ return aliasToken(binding.alias, "full");
58395
58420
  }
58396
- /** Parse `{alias}` tokens from a parser string (letters, digits, `_`, `-`). */
58421
+ /**
58422
+ * Parse `{alias}`, `{alias.value}`, `{alias.unit}`, `{alias.full}` from a
58423
+ * parser string. Bare `{alias}` and `{alias.full}` both mean `full`.
58424
+ */
58397
58425
  function parseAliasTokens(parser) {
58398
58426
  const out = [];
58399
- for (const match of parser.matchAll(/\{([A-Za-z][A-Za-z0-9_-]*)\}/g)) {
58427
+ const seen = /* @__PURE__ */ new Set();
58428
+ for (const match of parser.matchAll(/\{([A-Za-z][A-Za-z0-9_-]*)(?:\.(value|unit|full))?\}/g)) {
58400
58429
  const alias = match[1];
58401
58430
  if (alias === void 0 || alias === "") continue;
58402
- if (!out.includes(alias)) out.push(alias);
58431
+ const suffix = match[2];
58432
+ const kind = suffix === "value" || suffix === "unit" ? suffix : "full";
58433
+ const token = match[0] ?? "";
58434
+ const key = `${alias}:${kind}:${token}`;
58435
+ if (seen.has(key)) continue;
58436
+ seen.add(key);
58437
+ out.push({
58438
+ alias,
58439
+ kind,
58440
+ token
58441
+ });
58403
58442
  }
58404
58443
  return out;
58405
58444
  }
58445
+ /** Unique alias stems referenced by a parser (any token kind). */
58446
+ function parseAliasStems(parser) {
58447
+ const stems = [];
58448
+ for (const entry of parseAliasTokens(parser)) if (!stems.includes(entry.alias)) stems.push(entry.alias);
58449
+ return stems;
58450
+ }
58406
58451
  /** Replace every occurrence of `token` in `parser` with `value`. */
58407
58452
  function replaceToken(parser, token, value) {
58408
58453
  return parser.replaceAll(token, value);
@@ -58428,6 +58473,16 @@ function suggestAlias(seed, taken, fallbackPrefix = "b") {
58428
58473
  * UNIT_TABLE / tryConvertUnit (same set as D699).
58429
58474
  */
58430
58475
  /**
58476
+ * Dimension for a UnitPicker from a raw source unit (may be bare `C`).
58477
+ * Normalize before `unitDimension` — the table only knows canonical spellings.
58478
+ */
58479
+ function dimensionFromSourceUnit(sourceUnit) {
58480
+ if (sourceUnit === void 0) return void 0;
58481
+ const normalized = normalizeUnit(sourceUnit);
58482
+ if (normalized === void 0) return void 0;
58483
+ return unitDimension(normalized);
58484
+ }
58485
+ /**
58431
58486
  * Convert `raw` from `sourceUnit` to `displayUnit` when both are known and
58432
58487
  * same-dimension. On refusal, keep the raw value and the source unit so the
58433
58488
  * label never lies about the number.
@@ -58476,16 +58531,23 @@ function inferSourceUnit(slice, valuePath) {
58476
58531
  }
58477
58532
  //#endregion
58478
58533
  //#region src/named-template-render.ts
58479
- /** Combine value/unit according to the binding's single format choice. */
58480
- function applyTemplateFormat(value, unit, format) {
58481
- if (format === "value") return value;
58482
- if (format === "unit") return unit;
58534
+ /** Combine value/unit for a token kind. */
58535
+ function applyTemplateTokenKind(value, unit, kind) {
58536
+ if (kind === "value") return value;
58537
+ if (kind === "unit") return unit;
58483
58538
  const v = value.trim();
58484
58539
  const u = unit.trim();
58485
58540
  if (v === "") return u;
58486
58541
  if (u === "") return v;
58487
58542
  return `${v} ${u}`;
58488
58543
  }
58544
+ /**
58545
+ * @deprecated Prefer `applyTemplateTokenKind`. Maps legacy format enum to
58546
+ * the same join rules (`value+unit` → `full`).
58547
+ */
58548
+ function applyTemplateFormat(value, unit, format) {
58549
+ return applyTemplateTokenKind(value, unit, format === "value" ? "value" : format === "unit" ? "unit" : "full");
58550
+ }
58489
58551
  /** Resolve one binding to live value/unit/formatted parts (or a reason). */
58490
58552
  function resolveBindingLive(binding, facts) {
58491
58553
  const deviceId = binding.pick.deviceId;
@@ -58507,9 +58569,18 @@ function resolveBindingLive(binding, facts) {
58507
58569
  return {
58508
58570
  value,
58509
58571
  unit,
58510
- formatted: applyTemplateFormat(value, unit, binding.format)
58572
+ formatted: applyTemplateTokenKind(value, unit, "full")
58511
58573
  };
58512
58574
  }
58575
+ /** Substitute every token form for one alias from live parts. Longest first. */
58576
+ function expandBindingTokens(parser, alias, live) {
58577
+ let text = parser;
58578
+ text = replaceToken(text, aliasFullToken(alias), live.formatted);
58579
+ text = replaceToken(text, aliasToken(alias, "value"), live.value);
58580
+ text = replaceToken(text, aliasToken(alias, "unit"), live.unit);
58581
+ text = replaceToken(text, aliasToken(alias, "full"), live.formatted);
58582
+ return text;
58583
+ }
58513
58584
  /** Render one named template's parser from live states. */
58514
58585
  function renderNamedTemplate(template, facts) {
58515
58586
  let text = template.parser;
@@ -58517,7 +58588,7 @@ function renderNamedTemplate(template, facts) {
58517
58588
  for (const binding of template.bindings) {
58518
58589
  const live = resolveBindingLive(binding, facts);
58519
58590
  if ("reason" in live) return live;
58520
- text = replaceToken(text, aliasToken(binding.alias), live.formatted);
58591
+ text = expandBindingTokens(text, binding.alias, live);
58521
58592
  }
58522
58593
  return { text };
58523
58594
  }
@@ -59557,4 +59628,4 @@ function templateIdFromName(name) {
59557
59628
  return `${slug.length > 0 ? slug : "template"}-${Date.now().toString(36)}`;
59558
59629
  }
59559
59630
  //#endregion
59560
- export { DEFAULT_TICK_MS, EMPTY_BINDINGS, OSD_BINDINGS_KEY, OSD_NON_LEAF_TYPES, OSD_PICKER_EXCLUDED_TYPES, OSD_SOURCE_CAP_NAMES, OSD_SUPPORTED_CONDITIONS, OsdBindingsStore, OsdDeviceBindingsSchema, OsdManager, OsdManagerAddon, OsdManagerAddon as default, aliasToken, applyTemplate, applyTemplateFormat, assertSupportedConditions, bindingToken, deviceById, displayValue, evaluateGate, formatClock, formatSlotText, generateTemplateId, humanizeCapName, isContainerDeviceType, isOsdLeafDeviceType, isOsdPickerDeviceType, isOsdSourceCap, limitText, osdStateLeavesOf, osdSupportedChildrenOf, parseAliasTokens, readStatePath, renderNamedTemplate, renderSlot, replaceToken, resolveBindingLive, resolveSource, sourceOptionsFor, stateLeavesOf, suggestAlias, templateIdFromName, toOsdPickerDevices, truncateDecimals, unsupportedConditionKeys, withBinding, withoutBinding };
59631
+ export { DEFAULT_TICK_MS, EMPTY_BINDINGS, OSD_BINDINGS_KEY, OSD_NON_LEAF_TYPES, OSD_PICKER_EXCLUDED_TYPES, OSD_SOURCE_CAP_NAMES, OSD_SUPPORTED_CONDITIONS, OsdBindingsStore, OsdDeviceBindingsSchema, OsdManager, OsdManagerAddon, OsdManagerAddon as default, aliasFullToken, aliasToken, applyTemplate, applyTemplateFormat, applyTemplateTokenKind, assertSupportedConditions, bindingInsertChips, bindingToken, convertForDisplay, deviceById, dimensionFromSourceUnit, displayValue, evaluateGate, expandBindingTokens, formatClock, formatSlotText, generateTemplateId, humanizeCapName, inferSourceUnit, isContainerDeviceType, isOsdLeafDeviceType, isOsdPickerDeviceType, isOsdSourceCap, limitText, osdStateLeavesOf, osdSupportedChildrenOf, parseAliasStems, parseAliasTokens, readStatePath, renderNamedTemplate, renderSlot, replaceToken, resolveBindingLive, resolveSource, sourceOptionsFor, stateLeavesOf, suggestAlias, templateIdFromName, toOsdPickerDevices, truncateDecimals, unsupportedConditionKeys, withBinding, withoutBinding };
@@ -1,5 +1,5 @@
1
1
  import { b as e, g as t, l as n, u as r } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-C5jUMd7X.mjs";
2
- import { c as i, s as a } from "./responsive-B7zCyVCX.mjs";
2
+ import { c as i, s as a } from "./responsive-DLFs-5i_.mjs";
3
3
  import { n as o, r as s, t as c } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DalfdIDw.mjs";
4
4
  var l = i("chevron-down", [["path", {
5
5
  d: "m6 9 6 6 6-6",
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-BAuPDG6y.mjs";
1
+ import { n as e, t } from "./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-C3yC0JaQ.mjs";
2
2
  export { t as get, e as init };
@@ -1,6 +1,6 @@
1
1
  import { _ as e, b as t, c as n, g as r, l as i, m as a, n as o, r as s, t as c, u as l } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-C5jUMd7X.mjs";
2
2
  import "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DalfdIDw.mjs";
3
- import { i as u } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BzuGVFNp.mjs";
3
+ import { i as u } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-B2mEdhqd.mjs";
4
4
  //#region ../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
5
5
  t();
6
6
  var d = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), f = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), p = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), m = (e) => {
@@ -1,5 +1,5 @@
1
1
  import { b as e, c as t, g as n, m as r } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-C5jUMd7X.mjs";
2
- import { c as i } from "./responsive-B7zCyVCX.mjs";
2
+ import { c as i } from "./responsive-DLFs-5i_.mjs";
3
3
  var a = i("camera", [["path", {
4
4
  d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
5
5
  key: "18u6gg"
@@ -1,4 +1,4 @@
1
- import { c as e } from "./responsive-B7zCyVCX.mjs";
1
+ import { c as e } from "./responsive-DLFs-5i_.mjs";
2
2
  var t = e("eye-off", [
3
3
  ["path", {
4
4
  d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
@@ -1,4 +1,4 @@
1
- import { c as e } from "./responsive-B7zCyVCX.mjs";
1
+ import { c as e } from "./responsive-DLFs-5i_.mjs";
2
2
  var t = e("trash-2", [
3
3
  ["path", {
4
4
  d: "M10 11v6",
@@ -2753,7 +2753,7 @@ async function rr(e) {
2753
2753
  }
2754
2754
  }
2755
2755
  async function ir() {
2756
- return tr ||= rr(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BX8u4O5k.mjs")).catch((e) => {
2756
+ return tr ||= rr(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BYQUZdGL.mjs")).catch((e) => {
2757
2757
  throw tr = void 0, e;
2758
2758
  }), tr;
2759
2759
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-osd-manager",
3
- "version": "0.1.160",
3
+ "version": "0.1.161",
4
4
  "description": "Binds camera on-screen-display slots to live state and recognitions",
5
5
  "keywords": [
6
6
  "camstack",