@mxtommy/kip 3.10.0-beta.8 → 3.10.0
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/CHANGELOG.md +5 -0
- package/README.md +11 -0
- package/images/KipGaugeSample3-1024x508.png +0 -0
- package/package.json +2 -1
- package/plugin/index.js +238 -31
- package/plugin/openApi.json +367 -0
- package/public/3rdpartylicenses.txt +52 -52
- package/public/assets/help-docs/kiosk.md +192 -0
- package/public/assets/help-docs/menu.json +1 -0
- package/public/assets/help-docs/welcome.md +27 -2
- package/public/assets/svg/icons.svg +5 -1
- package/public/chunk-2XB2ZNXV.js +1 -0
- package/public/{chunk-J3WNXGAQ.js → chunk-4N6AW5Y5.js} +1 -1
- package/public/chunk-5NKFZDV5.js +5 -0
- package/public/chunk-AREYGJLO.js +3 -0
- package/public/chunk-B6IRZFL5.js +3 -0
- package/public/chunk-CCEKSCJH.js +8 -0
- package/public/chunk-DSBAZLLN.js +5 -0
- package/public/chunk-DSWRNQDG.js +15 -0
- package/public/{chunk-LRX3XYXK.js → chunk-EOXCM3IV.js} +1 -1
- package/public/chunk-G5U7W6LL.js +1 -0
- package/public/{chunk-7OMETTVK.js → chunk-JHI7SSDT.js} +1 -1
- package/public/{chunk-GJ33QBJ6.js → chunk-KABAIECE.js} +1 -1
- package/public/chunk-LYPFRDZT.js +1 -0
- package/public/chunk-O2GGGUBC.js +2 -0
- package/public/chunk-QZO4362R.js +4 -0
- package/public/chunk-RJDZKEUA.js +1 -0
- package/public/{chunk-TDHAZ7DS.js → chunk-SVI34QP4.js} +1 -1
- package/public/chunk-TSNRNW3D.js +2 -0
- package/public/{chunk-6VFNB64Z.js → chunk-TTNX7JB6.js} +10 -10
- package/public/chunk-WUFURHSA.js +5 -0
- package/public/chunk-X45MUE6N.js +2 -0
- package/public/chunk-YPVFGYWU.js +1 -0
- package/public/chunk-ZGO25KK6.js +2 -0
- package/public/chunk-ZOYXBB55.js +2 -0
- package/public/index.html +1 -1
- package/public/{main-4QLKDUA3.js → main-JN6ENHFX.js} +12 -14
- package/COPILOT.md +0 -362
- package/eslint.config.js +0 -45
- package/kip-plugin/src/index.ts +0 -53
- package/kip-plugin/tsconfig.plugin.json +0 -13
- package/public/chunk-5UDAYYUA.js +0 -1
- package/public/chunk-BZF6OYAF.js +0 -7
- package/public/chunk-FW2LAMAA.js +0 -16
- package/public/chunk-HKUJILH7.js +0 -6
- package/public/chunk-JFDPDIG2.js +0 -2
- package/public/chunk-MXKB5Z6M.js +0 -5
- package/public/chunk-NL52VRFS.js +0 -1
- package/public/chunk-PTADMSJZ.js +0 -1
- package/public/chunk-RL2DBZFR.js +0 -11
- package/public/chunk-T5GXSVMN.js +0 -1
- package/public/chunk-WQP3T7F5.js +0 -1
- package/public/chunk-XCVMMK2G.js +0 -2
package/COPILOT.md
DELETED
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
# COPILOT.md
|
|
2
|
-
|
|
3
|
-
## 1. Project Overview
|
|
4
|
-
KIP Instrument MFD is an advanced and versatile marine instrumentation package designed to display Signal K data in a modern, customizable dashboard, on boats. It provides real-time visualization of navigation, wind, engine, and other marine data streams offered by Signal K, supporting a wide range of widgets and configuration options. The project aims to deliver a user-friendly, extensible, and visually appealing interface for both professional and recreational marine users.
|
|
5
|
-
|
|
6
|
-
- **Key technologies:** Angular (v20+), Angular Material, Signal K, TypeScript, SCSS.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 2. Architecture & Structure
|
|
11
|
-
- **Main folders:**
|
|
12
|
-
- `src/app/`: Main application code.
|
|
13
|
-
- `src/app/widgets/`: Widget components (e.g., wind, autopilot).
|
|
14
|
-
- `src/app/widget-config/`: Widget configuration components and logic.
|
|
15
|
-
- `src/app/core/`: Core services, interfaces, and utilities.
|
|
16
|
-
- **Component structure:**
|
|
17
|
-
- Each widget has its own component, template, and theme SCSS in `src/app/widgets/`.
|
|
18
|
-
- All widget configuration logic and UI is centralized and handled independently by components in `src/app/widget-config/`.
|
|
19
|
-
- Creating a new widget does not require changes to `src/app/widget-config/` unless your widget introduces new configuration properties or needs a custom config UI.
|
|
20
|
-
- The main configuration form logic is in `src/app/widget-config/modal-widget-config/`. For unique widget config needs, you may add a new config component (e.g., `modal-widget-<name>-config`).
|
|
21
|
-
- Widget logic/UI and widget configuration are separate concepts that work together.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 4. Conventions & Patterns
|
|
26
|
-
- **Naming:**
|
|
27
|
-
- Use descriptive, camelCase names for variables and controls.
|
|
28
|
-
- Widget config properties match the widget’s function (e.g., `trueWindAngle`, `drift`).
|
|
29
|
-
- **Forms:**
|
|
30
|
-
- Use Angular Reactive Forms for all configuration UIs.
|
|
31
|
-
- Group related controls in form groups.
|
|
32
|
-
- **Theming:**
|
|
33
|
-
- Use SCSS mixins for light/dark themes.
|
|
34
|
-
- Theme mixins must be included in global or component styles.
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## 5. Development Workflow
|
|
39
|
-
- **Linting:**
|
|
40
|
-
- Run `npm run lint` before every commit (enforced with Husky pre-commit hook).
|
|
41
|
-
- **Testing:**
|
|
42
|
-
- _To be defined._
|
|
43
|
-
- **Build & Serve:**
|
|
44
|
-
- `npm run dev` for development server.
|
|
45
|
-
- `npm run build-dev` for development build.
|
|
46
|
-
- `npm run build-prod` for production build.
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## 6. Documentation & Comments
|
|
51
|
-
- **Document all custom validators and business rules.**
|
|
52
|
-
- **Update this file and the README with any major changes or new patterns.**
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## 8. Core Service Summaries
|
|
58
|
-
All major services in `src/app/core/services/` are summarized below for Copilot and developer context. Each entry includes purpose, key methods/responsibilities, dependencies, and usage notes.
|
|
59
|
-
|
|
60
|
-
- **AppNetworkInitService (`app-initNetwork.service.ts`)**
|
|
61
|
-
- Purpose: Loads network services (Signal K connection, authentication, Storage Service) and retrieves configurations from the Signal K server and loaded it before app startup using Angular's `APP_INITIALIZER`.
|
|
62
|
-
- Key methods: `initNetworkServices()`, config loading, login management.
|
|
63
|
-
- Dependencies: SignalKConnectionService, AuthenticationService, StorageService, DataService, SignalKDeltaService.
|
|
64
|
-
- Usage: Ensures network, authentication, Storage Service and configuration are ready before app bootstraps.
|
|
65
|
-
|
|
66
|
-
- **AuthenticationService (`authentication.service.ts`)**
|
|
67
|
-
- Purpose: Handles user/device authentication with the Signal K server.
|
|
68
|
-
- Key methods: `login()`, `logout()`, token management, exposes `isLoggedIn$` observable.
|
|
69
|
-
- Dependencies: SignalKConnectionService, HttpClient.
|
|
70
|
-
|
|
71
|
-
- Purpose: Centralizes all app dialogs using Angular Material.
|
|
72
|
-
- Dependencies: MatDialog, Dialog components.
|
|
73
|
-
- Usage: Used throughout the app to open modals and dialogs for user interaction.
|
|
74
|
-
|
|
75
|
-
- **SignalKConnectionService (`signalk-connection.service.ts`)**
|
|
76
|
-
- Purpose: Manages the WebSocket connection to the Signal K server, including reconnect logic and status tracking.
|
|
77
|
-
- Key methods: `connect()`, `disconnect()`, status observables.
|
|
78
|
-
- Dependencies: WebSocket, AuthenticationService.
|
|
79
|
-
|
|
80
|
-
- **SignalKDeltaService (`signalk-delta.service.ts`)**
|
|
81
|
-
- Purpose: Handles real-time delta updates from Signal K, distributing data to widgets and services.
|
|
82
|
-
- Key methods: Delta subscription, data distribution.
|
|
83
|
-
- Dependencies: SignalKConnectionService, DataService.
|
|
84
|
-
|
|
85
|
-
- **DataService (`data.service.ts`)**
|
|
86
|
-
- Purpose: Central data provider for Signal K and other sources; handles subscriptions, value updates, and metadata management.
|
|
87
|
-
- Key methods: `subscribeToPath()`, `getValue()`, `getMetadata()`, data and metadata update distribution.
|
|
88
|
-
- Dependencies: SignalKDeltaService, StorageService.
|
|
89
|
-
|
|
90
|
-
- **AppService (`app-service.ts`)**
|
|
91
|
-
- Purpose: Centralizes app-wide utilities, notifications, and theme management.
|
|
92
|
-
- Key methods: Notification helpers, theme switching, app-level utilities.
|
|
93
|
-
- Dependencies: Angular core, theme and notification services.
|
|
94
|
-
|
|
95
|
-
- **UIEventService (`uiEvent.service.ts`)**
|
|
96
|
-
- Purpose: Manages UI events such as drag, fullscreen, wake lock, and hotkeys.
|
|
97
|
-
- Key methods: Event emitters, hotkey handlers.
|
|
98
|
-
- Dependencies: Angular core, browser APIs.
|
|
99
|
-
|
|
100
|
-
- **AppSettingsService (`app-settings.service.ts`)**
|
|
101
|
-
- Purpose: Manages persistent app settings, user preferences, and configuration storage.
|
|
102
|
-
- Key methods: `getSetting()`, `setSetting()`, config file management.
|
|
103
|
-
- Dependencies: StorageService.
|
|
104
|
-
|
|
105
|
-
- **StorageService (`storage.service.ts`)**
|
|
106
|
-
- Purpose: Provides persistent storage for app data, settings, and user preferences.
|
|
107
|
-
- Key methods: `getItem()`, `setItem()`, config file management.
|
|
108
|
-
- Dependencies: LocalStorage, IndexedDB, or similar.
|
|
109
|
-
|
|
110
|
-
- **NotificationsService (`notifications.service.ts`)**
|
|
111
|
-
- Key methods: Notification state management, audio/visual alerts, muting.
|
|
112
|
-
- Dependencies: AppSettingsService, DataService, SignalkRequestsService, Howler.
|
|
113
|
-
|
|
114
|
-
- **CanvasService (`canvas.service.ts`)**
|
|
115
|
-
- Purpose: Provides drawing and rendering utilities for widgets and dashboard components.
|
|
116
|
-
- Key methods: Canvas context helpers, drawing utilities.
|
|
117
|
-
- Dependencies: None (core Angular).
|
|
118
|
-
|
|
119
|
-
- **DashboardService (`dashboard.service.ts`)**
|
|
120
|
-
- Purpose: Handles dashboard layout, widget arrangement, and dashboard state.
|
|
121
|
-
- Key methods: Layout management, widget arrangement, dashboard state.
|
|
122
|
-
- Dependencies: StorageService, WidgetService.
|
|
123
|
-
|
|
124
|
-
- **DataSetService (`data-set.service.ts`)**
|
|
125
|
-
- Purpose: Manages data sets, including loading, saving, and updating widget data sources.
|
|
126
|
-
- Key methods: Data set CRUD, data source updates.
|
|
127
|
-
- Dependencies: DataService, StorageService.
|
|
128
|
-
|
|
129
|
-
- **SignalKPluginsService (`signalk-plugins.service.ts`)**
|
|
130
|
-
- Purpose: Manages Signal K plugin discovery, configuration, and state.
|
|
131
|
-
- Key methods: Plugin list management, config updates.
|
|
132
|
-
- Dependencies: SignalKConnectionService, DataService.
|
|
133
|
-
- Usage: Used to manage plugins and their configuration.
|
|
134
|
-
|
|
135
|
-
- **SignalKRequestsService (`signalk-requests.service.ts`)**
|
|
136
|
-
- Purpose: Handles requests to the Signal K server, such as PUT/POST operations and custom actions.
|
|
137
|
-
- Key methods: `sendRequest()`, custom action handlers.
|
|
138
|
-
- Dependencies: SignalKConnectionService, DataService.
|
|
139
|
-
|
|
140
|
-
- **TimersService (`timers.service.ts`)**
|
|
141
|
-
- Purpose: Centralized timer utility for app and widgets, supporting intervals, timeouts, and scheduling.
|
|
142
|
-
- Key methods: Timer creation, interval management.
|
|
143
|
-
- Dependencies: Angular core.
|
|
144
|
-
|
|
145
|
-
- **UnitsService (`units.service.ts`)**
|
|
146
|
-
- Purpose: Handles unit conversion and formatting for all displayed data.
|
|
147
|
-
- Key methods: `convert()`, `format()`, unit preference management.
|
|
148
|
-
- Dependencies: AppSettingsService.
|
|
149
|
-
|
|
150
|
-
- **WidgetService (`widget.service.ts`)**
|
|
151
|
-
- Purpose: Manages widget registration, configuration, and lifecycle.
|
|
152
|
-
- Key methods: Widget registration, config helpers, lifecycle management.
|
|
153
|
-
- Dependencies: DashboardService, DataService.
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## 9. Widget Structure, BaseWidgetComponent, and Signal K Zones
|
|
158
|
-
- All widgets must extend `BaseWidgetComponent` to inherit core data, config, and lifecycle logic.
|
|
159
|
-
- Handles:
|
|
160
|
-
- Data subscriptions via `DataService` (values and metadata).
|
|
161
|
-
- Unit conversion via `UnitsService`.
|
|
162
|
-
- Theme and app-wide utilities via `AppService`.
|
|
163
|
-
- Config validation and merging with defaults.
|
|
164
|
-
- Utility for formatting numbers with min/max and decimals.
|
|
165
|
-
- Abstract methods: `startWidget()` and `updateConfig(config)` must be implemented by each widget.
|
|
166
|
-
- Provides:
|
|
167
|
-
- `observeDataStream()` for subscribing to live data.
|
|
168
|
-
- `unsubscribeDataStream()` and `unsubscribeMetaStream()` for cleanup (call in `ngOnDestroy`).
|
|
169
|
-
- `formatWidgetNumberValue()` for consistent value formatting.
|
|
170
|
-
- `validateConfig()` to merge user config with defaults and prevent breaking changes.
|
|
171
|
-
- `zones$` observable for zone metadata (e.g., to highlight elements in widgets based on data state ie. zone state).
|
|
172
|
-
|
|
173
|
-
- Zones are a Signal K metadata concept that define value ranges for states like nominal, warning, alarm, and emergency.
|
|
174
|
-
- The `observeMetaStream()` method in `BaseWidgetComponent` subscribes to zones metadata for a widget's data path, making it available via the `zones$` observable.
|
|
175
|
-
|
|
176
|
-
- **Widget Path Configuration:**
|
|
177
|
-
- `isPathConfigurable` and `pathRequired` in `IWidgetPath` control UI and validation.
|
|
178
|
-
- If `pathRequired` is `true` or undefined, path is required and must be valid.
|
|
179
|
-
- If `pathRequired` is `false`, path is optional (can be empty or valid).
|
|
180
|
-
- Non-configurable paths are excluded from config UI and validation.
|
|
181
|
-
- **Custom Validators:**
|
|
182
|
-
- Path controls use a custom validator to enforce the above rules.
|
|
183
|
-
- No `Validators.required` is used for path controls; only the custom validator.
|
|
184
|
-
- **UI Feedback:**
|
|
185
|
-
- The UI uses Angular’s `@if` syntax to show “(optional)” and hints when appropriate.
|
|
186
|
-
- Error messages are shown for required and invalid paths.
|
|
187
|
-
**Signal K Metadata, Units & Value Conversion:**
|
|
188
|
-
- Signal K defines a schema with base SI units for all standard paths (e.g., meters, Celsius, Pascals). Plugins can add custom paths, but these are not in the schema and must provide their own metadata (especially units) or the path will be treated as unitless.
|
|
189
|
-
- Each data path may provide metadata such as units, display names, min/max, etc. This metadata is essential for context-aware UI, validation, and display hints.
|
|
190
|
-
- KIP uses the base SI units from metadata to map each path to a conversion group in the UnitsService. This enables conversion from the base SI unit to any supported display unit (e.g., meters to feet, Celsius to Fahrenheit) according to user preferences.
|
|
191
|
-
- The "Format" setting in KIP determines what display format or unit to apply to a value. If no metadata units are present, the value is treated as unitless and any format (or none) can be applied.
|
|
192
|
-
- The DataService provides access to both values and metadata for each path, supporting both value display and context-aware logic.
|
|
193
|
-
|
|
194
|
-
- **Widget Structure:**
|
|
195
|
-
- Each widget is an Angular component in `src/app/widgets/`, extending `BaseWidgetComponent`.
|
|
196
|
-
- Widget configuration is defined in `widgetProperties` (implements `IWidget`), with all config stored in `widgetProperties.config`.
|
|
197
|
-
- Widget config includes paths, display options, min/max, decimals, and more.
|
|
198
|
-
- All widget configuration logic/UI is handled in `src/app/widget-config/`.
|
|
199
|
-
|
|
200
|
-
- **Widget Creation Best Practices:**
|
|
201
|
-
- Always extend `BaseWidgetComponent` for new widgets.
|
|
202
|
-
- Implement `startWidget()` to initialize widget-specific logic.
|
|
203
|
-
- Implement `updateConfig(config)` to handle config changes.
|
|
204
|
-
- Use `observeDataStream()` to subscribe to data, and `observeMetaStream()` for zones/metadata.
|
|
205
|
-
- Use `UnitsService` for all value conversions and formatting.
|
|
206
|
-
- Store all widget state/config in `widgetProperties.config`.
|
|
207
|
-
- Clean up all subscriptions in `ngOnDestroy` using provided methods.
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## 10. KIP Colors, Theming, and Widget Best Practices
|
|
211
|
-
|
|
212
|
-
- **KIP Color & Theming Concepts:**
|
|
213
|
-
- KIP uses a centralized theme system with color roles defined in SCSS and exposed to TypeScript via CSS variables and the `AppService`.
|
|
214
|
-
- Theme colors (e.g., `contrast`, `blue`, `zoneAlarm`, `background`, etc.) are defined in SCSS files (`styles.scss`, theme partials) and mapped to CSS variables (e.g., `--kip-blue-color`).
|
|
215
|
-
- The `AppService` provides a `cssThemeColorRoles$` observable and a `theme()` signal for accessing current theme colors in TypeScript.
|
|
216
|
-
- Theme switching (light, dark, night) is handled by toggling classes on `<body>` and updating CSS variables.
|
|
217
|
-
- All widgets should use theme colors for UI consistency and accessibility.
|
|
218
|
-
|
|
219
|
-
- **Best Practices for Using Colors & Theming in Widgets:**
|
|
220
|
-
- **TypeScript:**
|
|
221
|
-
- Access theme colors via `this.theme().<colorRole>` (e.g., `this.theme().zoneAlarm`, `this.theme().contrast`).
|
|
222
|
-
- Never hardcode color hex values in widget TypeScript; always use theme roles.
|
|
223
|
-
- For dynamic coloring (e.g., based on state/zones), use the correct theme role for each state (see `zoneAlarm`, `zoneWarn`, etc.).
|
|
224
|
-
- Use the color mapping pattern as in `getColors()` for supporting multiple color roles and dim/dimmer variants.
|
|
225
|
-
- When updating widget visuals (e.g., gauge, highlights), always update with theme colors to support live theme switching.
|
|
226
|
-
- **SCSS:**
|
|
227
|
-
- Use CSS variables (e.g., `var(--kip-blue-color)`) for all color assignments in widget/component styles.
|
|
228
|
-
- Do not use static hex codes; always reference a theme variable.
|
|
229
|
-
- For custom widget styles, define new CSS variables in the theme partials if needed, and use them in your SCSS.
|
|
230
|
-
- Use the `.light-theme`, `.night-theme`, and default (dark) selectors to override variables for each theme as needed.
|
|
231
|
-
- Use SCSS mixins for reusable style patterns and to support theme switching.
|
|
232
|
-
- **General:**
|
|
233
|
-
- Always test widgets in all themes (light, dark, night) to ensure colors are accessible and visually correct.
|
|
234
|
-
- Use theme roles for all UI elements, including backgrounds, borders, text, and highlights.
|
|
235
|
-
- For state-based coloring (e.g., alarms, warnings), use the corresponding zone color from the theme.
|
|
236
|
-
- Avoid inline styles for colors; prefer class-based or variable-based styling.
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
## 11. Additional Instructions & Cross-References
|
|
240
|
-
|
|
241
|
-
### **Related Instruction Files:**
|
|
242
|
-
- **README.md**: Project overview, setup instructions, and development guidelines
|
|
243
|
-
- **`.github/instructions/angular.instructions.md`**: Detailed Angular v20+ coding standards, component patterns, and framework-specific best practices
|
|
244
|
-
|
|
245
|
-
### **Instruction Hierarchy:**
|
|
246
|
-
1. **Primary**: This `COPILOT.md` file (KIP-specific project guidelines and architecture)
|
|
247
|
-
2. **Secondary**: `.github/instructions/angular.instructions.md` (Angular framework standards and modern patterns)
|
|
248
|
-
3. **Tertiary**: `README.md` (General project information and setup)
|
|
249
|
-
|
|
250
|
-
### **Usage Notes:**
|
|
251
|
-
- All Angular development should follow both this COPILOT.md file AND the angular.instructions.md guidelines
|
|
252
|
-
- When conflicts arise, KIP-specific guidelines in this file take precedence over general Angular patterns
|
|
253
|
-
- For widget development, prioritize the BaseWidgetComponent patterns described in this file
|
|
254
|
-
- For general Angular coding (components, services, forms, component), follow the modern Angular v20+ patterns in angular.instructions.md
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
## 12. SVG Animation Utilities (requestAnimationFrame Helpers)
|
|
259
|
-
|
|
260
|
-
High-performance SVG animations in KIP (e.g., wind steering dial laylines, sector bands, rotating indicators) use a small set of utilities found in `src/app/widgets/utils/svg-animate.util.ts` to ensure:
|
|
261
|
-
|
|
262
|
-
- No unnecessary Angular change detection on every animation frame
|
|
263
|
-
- Consistent easing and shortest‑path angle interpolation
|
|
264
|
-
- Centralized cancellation logic (preventing overlapping animations per element/concern)
|
|
265
|
-
- Readable, minimal widget component code
|
|
266
|
-
|
|
267
|
-
### 12.1 Design Principles
|
|
268
|
-
1. Run frame loops outside Angular's `NgZone` to avoid triggering change detection ~60 times/sec.
|
|
269
|
-
2. Only re-enter the zone once per animation (on completion callback) if UI state needs Angular binding updates.
|
|
270
|
-
3. Gate “tiny” animations (angle deltas below a threshold) to avoid visual jitter and wasted work.
|
|
271
|
-
4. Always animate the shortest angular path (wrap via ±180 logic) for rotational continuity.
|
|
272
|
-
5. Provide generic primitives (angle + sector interpolation) so components don’t duplicate interpolation math.
|
|
273
|
-
|
|
274
|
-
### 12.2 Provided Functions
|
|
275
|
-
| Function | Purpose | Key Inputs | Notes |
|
|
276
|
-
|----------|---------|-----------|-------|
|
|
277
|
-
| `animateRotation(el, fromDeg, toDeg, durationMs, onDone?, ngZone?)` | Smoothly rotates an SVG element (`transform: rotate(...)`) | Element, start+end angles, duration | Tracks per-element frame id internally (WeakMap) so a new call cancels the prior rotation for that element. |
|
|
278
|
-
| `animateRudderWidth(rectEl, fromWidth, toWidth, durationMs, onDone?, ngZone?)` | Interpolates a `<rect>` width | SVGRectElement, numeric widths | Same outside-zone strategy; width set via `setAttribute`. |
|
|
279
|
-
| `animateAngleTransition(fromDeg, toDeg, durationMs, applyFn, onDone?, ngZone?)` | Generic angle interpolation (no DOM assumptions) | Angles, duration, callback(angle) | Use for derived geometry (e.g., computing a path string). |
|
|
280
|
-
| `animateSectorTransition(from: SectorAngles, to: SectorAngles, durationMs, applyFn, onDone?, ngZone?)` | Interpolates a structured group of three related angles (`min, mid, max`) | Objects with `{min, mid, max}` | Uses same angle normalization per field + easing. |
|
|
281
|
-
|
|
282
|
-
`SectorAngles` interface:
|
|
283
|
-
```
|
|
284
|
-
interface SectorAngles { min: number; mid: number; max: number; }
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### 12.3 NgZone Strategy
|
|
288
|
-
All helpers accept an optional `NgZone`. When provided they:
|
|
289
|
-
1. Call `ngZone.runOutsideAngular()` wrapping the frame loop.
|
|
290
|
-
2. Use `requestAnimationFrame` until elapsed >= duration.
|
|
291
|
-
3. Apply easing (cubic in/out) and normalized shortest-path interpolation.
|
|
292
|
-
4. On final frame, invoke `onDone` inside Angular (`ngZone.run(...)`) so any bound template values update once.
|
|
293
|
-
|
|
294
|
-
If `ngZone` is omitted they still function (pure browser environment) — suitable for non-Angular contexts or tests.
|
|
295
|
-
|
|
296
|
-
### 12.4 Cancellation Rules
|
|
297
|
-
- `animateRotation` & `animateRudderWidth` internally keep a WeakMap<Element, frameId>; a new call replaces the old.
|
|
298
|
-
- Callers of `animateAngleTransition` / `animateSectorTransition` receive the raw `frameId` and MUST store & cancel it if a new animation is started for the same conceptual target (e.g., a layline or sector band) before completion.
|
|
299
|
-
- Always cancel outstanding frame ids in `ngOnDestroy` to avoid orphan rAF callbacks if the component is torn down mid-animation.
|
|
300
|
-
|
|
301
|
-
### 12.5 Angle Handling Details
|
|
302
|
-
- Input angles are normalized to [0, 360).
|
|
303
|
-
- Delta uses wrapped signed difference: `((to - from + 540) % 360) - 180` for shortest path.
|
|
304
|
-
- Interpolated angle = `from + easedT * delta`; final angle normalized again.
|
|
305
|
-
- A small epsilon (e.g., ~0.25°) can be used by callers to skip tiny animations; component sets `EPS_ANGLE` constant.
|
|
306
|
-
|
|
307
|
-
### 12.6 Easing
|
|
308
|
-
Currently a fixed cubic ease-in-out: `t < 0.5 ? 4t^3 : 1 - pow(-2t + 2, 3)/2`. Chosen for smooth acceleration/deceleration without overshoot. If future needs arise, expose an optional easing parameter (keep backward compatibility by defaulting to cubic in/out).
|
|
309
|
-
|
|
310
|
-
### 12.7 Usage Patterns
|
|
311
|
-
|
|
312
|
-
Rotate an indicator:
|
|
313
|
-
```
|
|
314
|
-
this.animationFrameIds.set(
|
|
315
|
-
el,
|
|
316
|
-
animateRotation(el, currentAngle, targetAngle, 300, () => { /* one-time post animation logic */ }, this.ngZone)
|
|
317
|
-
);
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
Animate a layline path angle:
|
|
321
|
-
```
|
|
322
|
-
if (this.portLaylineAnimId) cancelAnimationFrame(this.portLaylineAnimId);
|
|
323
|
-
this.portLaylineAnimId = animateAngleTransition(
|
|
324
|
-
prevAngle,
|
|
325
|
-
nextAngle,
|
|
326
|
-
300,
|
|
327
|
-
angle => this.updateLaylinePath(angle, /* isPort= */ true),
|
|
328
|
-
() => { this.portLaylineAnimId = null; },
|
|
329
|
-
this.ngZone
|
|
330
|
-
);
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
Animate a wind sector (three angles):
|
|
334
|
-
```
|
|
335
|
-
if (this.portSectorAnimId) cancelAnimationFrame(this.portSectorAnimId);
|
|
336
|
-
this.portSectorAnimId = animateSectorTransition(
|
|
337
|
-
previousSector,
|
|
338
|
-
newSector,
|
|
339
|
-
300,
|
|
340
|
-
sector => this.updateSectorPath(sector, true),
|
|
341
|
-
() => { this.portSectorAnimId = null; },
|
|
342
|
-
this.ngZone
|
|
343
|
-
);
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
### 12.8 When NOT to Animate
|
|
347
|
-
- First render / initialization where the user has no prior visual expectation — just set final state.
|
|
348
|
-
- Discontinuous jumps (e.g., compass wrap after data gap) that would produce a long spin — snap instead.
|
|
349
|
-
- Extremely small (< epsilon) changes — update instantly.
|
|
350
|
-
|
|
351
|
-
### 12.9 Testing Tips
|
|
352
|
-
- For deterministic unit tests, inject a mock `performance.now()` / substitute a manual time advance, or abstract the timestamp acquisition behind a seam if greater test coverage is required.
|
|
353
|
-
- Validate shortest-path logic with cases like `from=350 → to=10` (should rotate +20°, not -340°).
|
|
354
|
-
- Confirm cancellation by firing a second animation mid-way; the first should not apply further frames.
|
|
355
|
-
|
|
356
|
-
### 12.10 Future Extensions (Backlog Ideas)
|
|
357
|
-
- Optional custom easing function parameter.
|
|
358
|
-
- Support for group animations (batch multiple angle transitions under one rAF loop for micro-optimizations).
|
|
359
|
-
- Auto-prefetch “snap if > threshold degrees” heuristic inside helpers (today caller decides).
|
|
360
|
-
|
|
361
|
-
---
|
|
362
|
-
|
package/eslint.config.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const eslint = require("@eslint/js");
|
|
3
|
-
const tseslint = require("typescript-eslint");
|
|
4
|
-
const angular = require("angular-eslint");
|
|
5
|
-
|
|
6
|
-
module.exports = tseslint.config(
|
|
7
|
-
{
|
|
8
|
-
files: ["**/*.ts"],
|
|
9
|
-
extends: [
|
|
10
|
-
eslint.configs.recommended,
|
|
11
|
-
...tseslint.configs.recommended,
|
|
12
|
-
...tseslint.configs.stylistic,
|
|
13
|
-
...angular.configs.tsRecommended,
|
|
14
|
-
],
|
|
15
|
-
processor: angular.processInlineTemplates,
|
|
16
|
-
rules: {
|
|
17
|
-
"@typescript-eslint/no-empty-function": ["off"],
|
|
18
|
-
"@angular-eslint/directive-selector": [
|
|
19
|
-
"off",
|
|
20
|
-
{
|
|
21
|
-
type: "attribute",
|
|
22
|
-
prefix: "app",
|
|
23
|
-
style: "camelCase",
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
"@angular-eslint/component-selector": [
|
|
27
|
-
"off",
|
|
28
|
-
{
|
|
29
|
-
type: "element",
|
|
30
|
-
prefix: "app",
|
|
31
|
-
style: "kebab-case",
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
'@typescript-eslint/no-explicit-any': 'error', // Forbid usage of 'any'
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
files: ["**/*.html"],
|
|
39
|
-
extends: [
|
|
40
|
-
...angular.configs.templateRecommended,
|
|
41
|
-
...angular.configs.templateAccessibility,
|
|
42
|
-
],
|
|
43
|
-
rules: {},
|
|
44
|
-
}
|
|
45
|
-
);
|
package/kip-plugin/src/index.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Delta, Path, Plugin, ServerAPI, Value } from '@signalk/server-api'
|
|
2
|
-
|
|
3
|
-
export default (app: ServerAPI): Plugin => {
|
|
4
|
-
const displaysPath = 'displays';
|
|
5
|
-
const context = 'vessels.self';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
-
function displayPutHandler(context: string, path: string, value: Value, callback?: unknown): { state: 'COMPLETED'; statusCode: number; message?: string } {
|
|
9
|
-
app.debug(`PUT handler called for context ${context}, path ${path}, value ${value}`);
|
|
10
|
-
try {
|
|
11
|
-
const delta: Delta = {
|
|
12
|
-
updates: [
|
|
13
|
-
{
|
|
14
|
-
values: [
|
|
15
|
-
{
|
|
16
|
-
path: path as Path,
|
|
17
|
-
value: value
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
};
|
|
23
|
-
app.debug(`Sending message: `, JSON.stringify(delta));
|
|
24
|
-
app.handleMessage(plugin.id, delta);
|
|
25
|
-
return { state: "COMPLETED" as const, statusCode: 200 };
|
|
26
|
-
|
|
27
|
-
} catch (error) {
|
|
28
|
-
app.error(`Error in PUT handler: ${error}`);
|
|
29
|
-
return { state: "COMPLETED" as const, statusCode: 400, message: (error as Error).message };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const plugin: Plugin = {
|
|
34
|
-
id: 'kip',
|
|
35
|
-
name: 'KIP',
|
|
36
|
-
description: 'KIP server plugin',
|
|
37
|
-
start: (settings) => {
|
|
38
|
-
app.debug(`Starting plugin with settings: ${JSON.stringify(settings)}`);
|
|
39
|
-
app.registerPutHandler(context, displaysPath, displayPutHandler);
|
|
40
|
-
},
|
|
41
|
-
stop: () => {
|
|
42
|
-
app.debug(`Stopping plugin`);
|
|
43
|
-
},
|
|
44
|
-
schema: () => {
|
|
45
|
-
return {
|
|
46
|
-
type: "object",
|
|
47
|
-
properties: {}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
return plugin;
|
|
53
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../plugin",
|
|
6
|
-
"types": [],
|
|
7
|
-
"resolveJsonModule": true,
|
|
8
|
-
"sourceMap": false,
|
|
9
|
-
"module": "commonjs",
|
|
10
|
-
"moduleResolution": "node"
|
|
11
|
-
},
|
|
12
|
-
"include": ["./src/*.*"]
|
|
13
|
-
}
|
package/public/chunk-5UDAYYUA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-T5GXSVMN.js";import{a as g}from"./chunk-WQP3T7F5.js";import"./chunk-GJ33QBJ6.js";import{g as a,i as r,w as l}from"./chunk-HKUJILH7.js";import{eb as s,ra as t}from"./chunk-FW2LAMAA.js";var v=(()=>{class o{dialog=t(l);auth=t(a);appService=t(g);appSettingsService=t(r);connectionConfig=null;ngOnInit(){this.connectionConfig=this.appSettingsService.getConnectionConfig(),this.openUserCredentialModal("Sign in failed: Incorrect user/password. Enter valide credentials or access the Confifuration/Settings menu, validate the server URL or/and disable the user Sign in option")}openUserCredentialModal(e){this.dialog.open(c,{disableClose:!0,data:{user:this.connectionConfig.loginName,password:this.connectionConfig.loginPassword,error:e}}).afterClosed().subscribe(i=>{i===void 0||!i||(this.connectionConfig.loginName=i.user,this.connectionConfig.loginPassword=i.password,this.appSettingsService.setConnectionConfig(this.connectionConfig),this.serverLogin())})}serverLogin(e){this.auth.login({usr:this.connectionConfig.loginName,pwd:this.connectionConfig.loginPassword,newUrl:e}).then(()=>{this.appSettingsService.reloadApp()}).catch(n=>{n.status==401?(this.openUserCredentialModal("Sign in failed: Invalide user/password. Enter valide credentials"),console.log("[Setting-SignalK Component] Sign in failed: "+n.error.message)):n.status==404?(this.appService.sendSnackbarNotification("Sign in failed: Login API not found at URL. See connection detail status in Configuration/Settings",5e3,!1),console.log("[Setting-SignalK Component] Sign in failed: "+n.error.message)):n.status==0?(this.appService.sendSnackbarNotification("Sign in failed: Cannot reach server at Signal K URL. See connection detail status in Configuration/Settings",5e3,!1),console.log("[Setting-SignalK Component] Sign in failed: Cannot reach server at Signal K URL:"+n.message)):(this.appService.sendSnackbarNotification("Unknown authentication failure: "+JSON.stringify(n),5e3,!1),console.log("[Setting-SignalK Component] Unknown login error response: "+JSON.stringify(n)))})}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=s({type:o,selectors:[["app-widget-login"]],decls:0,vars:0,template:function(n,i){},encapsulation:2})}return o})();export{v as WidgetLoginComponent};
|