@momo2555/koppeliajs 0.0.162 → 0.0.163

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.
@@ -1,2 +1,15 @@
1
+ /**
2
+ * A reactive Svelte store that holds the active route context of the application.
3
+ * Developers can subscribe to this store to adapt UI or logic based on the current view.
4
+ * * Possible values:
5
+ * - `"controller"`: If the user is on a controller interface.
6
+ * - `"monitor"`: If the user is on a monitor interface.
7
+ * - `""` (empty string): If the current route matches neither.
8
+ */
1
9
  export declare const routeType: import("svelte/store").Writable<string>;
10
+ /**
11
+ * Evaluates the current SvelteKit page URL and updates the `routeType` store accordingly.
12
+ * This function should typically be called during layout initialization or whenever
13
+ * a route change is detected to ensure the store stays synchronized with the actual URL.
14
+ */
2
15
  export declare function updateRoute(): void;
@@ -1,22 +1,32 @@
1
- // src/lib/routeStore.js (dans la librairie)
2
- import { writable, get } from 'svelte/store';
3
- import { page } from '$app/stores';
4
- import { logger } from '../scripts/logger.js';
5
- // Crée un store pour la route active
6
- export const routeType = writable('');
7
- // Cette fonction met à jour le store en fonction de la route
1
+ import { get, writable } from "svelte/store";
2
+ import { page } from "$app/stores";
3
+ import { logger } from "../scripts/logger.js";
4
+ /**
5
+ * A reactive Svelte store that holds the active route context of the application.
6
+ * Developers can subscribe to this store to adapt UI or logic based on the current view.
7
+ * * Possible values:
8
+ * - `"controller"`: If the user is on a controller interface.
9
+ * - `"monitor"`: If the user is on a monitor interface.
10
+ * - `""` (empty string): If the current route matches neither.
11
+ */
12
+ export const routeType = writable("");
13
+ /**
14
+ * Evaluates the current SvelteKit page URL and updates the `routeType` store accordingly.
15
+ * This function should typically be called during layout initialization or whenever
16
+ * a route change is detected to ensure the store stays synchronized with the actual URL.
17
+ */
8
18
  export function updateRoute() {
9
19
  const path = get(page).url.pathname;
10
- logger.log("updateRoue with path = ", path);
11
- if (path.includes('controller')) {
12
- routeType.set('controller');
20
+ logger.log("updateRoute with path = ", path);
21
+ if (path.includes("controller")) {
22
+ routeType.set("controller");
13
23
  logger.log(path, "CONTROLLER");
14
24
  }
15
- else if (path.includes('monitor')) {
16
- routeType.set('monitor');
25
+ else if (path.includes("monitor")) {
26
+ routeType.set("monitor");
17
27
  logger.log(path, "MONITOR");
18
28
  }
19
29
  else {
20
- routeType.set('');
30
+ routeType.set("");
21
31
  }
22
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo2555/koppeliajs",
3
- "version": "0.0.162",
3
+ "version": "0.0.163",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",