From 0e9a025d956a08a2cb4e79e6bec246c5ffa9552c Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Mon, 12 Jan 2026 12:04:13 +0000 Subject: [PATCH] feat(eco-view-peripherals): encapsulate networkRanges as internal @state and add public getter/setter methods --- changelog.md | 8 ++++++++ ts_web/00_commitinfo_data.ts | 2 +- .../eco-view-peripherals/eco-view-peripherals.ts | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 8ccf882..20257c3 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 2026-01-12 - 3.36.0 - feat(eco-view-peripherals) +encapsulate networkRanges as internal @state and add public getter/setter methods + +- Replaced @property({ type: Array }) with @state() for networkRanges to treat it as internal reactive state. +- Added setNetworkRanges(ranges: INetworkRange[]) and getNetworkRanges(): INetworkRange[] to provide a controlled public API for updating and reading network ranges. +- Methods use array spread to return/copy arrays, preventing external mutation of internal state. +- Added JSDoc comments for the new methods. + ## 2026-01-12 - 3.35.0 - feat(peripherals) Add peripherals settings panel with network range management, network scanning, and manual device probe; update peripheral types and adjust UI/styling; overhaul README with expanded docs, quick start, and updated company/contact information diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index 5f9beb7..3844835 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@ecobridge.xyz/catalog', - version: '3.35.0', + version: '3.36.0', description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.' } diff --git a/ts_web/views/eco-view-peripherals/eco-view-peripherals.ts b/ts_web/views/eco-view-peripherals/eco-view-peripherals.ts index 2c2785a..8497257 100644 --- a/ts_web/views/eco-view-peripherals/eco-view-peripherals.ts +++ b/ts_web/views/eco-view-peripherals/eco-view-peripherals.ts @@ -527,12 +527,26 @@ export class EcoViewPeripherals extends DeesElement { @property({ type: String }) accessor activeCategory: TPeripheralCategory = 'all'; - @property({ type: Array }) + @state() accessor networkRanges: INetworkRange[] = []; @state() accessor isScanning = false; + /** + * Set the initial network ranges (e.g., loaded from backend) + */ + public setNetworkRanges(ranges: INetworkRange[]): void { + this.networkRanges = [...ranges]; + } + + /** + * Get the current network ranges + */ + public getNetworkRanges(): INetworkRange[] { + return [...this.networkRanges]; + } + @state() accessor newNetworkInput = '';