vue-router-query-sync 0.0.13 → 1.0.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/README.md CHANGED
@@ -16,14 +16,22 @@
16
16
 
17
17
  - Changes in your store update the URL query.
18
18
  - Changes in the URL query update your store.
19
- - Batched updates to avoid excessive router.replace calls.
19
+ - Batched updates prevent excessive `router.replace` calls.
20
20
 
21
21
  ---
22
22
 
23
+ ## 💡 Why use this plugin?
24
+
25
+ - 🔄 Keeps your app state and URL perfectly in sync — no more manual watchers or `router.replace` logic.
26
+ - 🧠 Works with **Pinia**, **local refs**, or any reactive source.
27
+ - 🧩 Handles multiple query keys and isolated contexts safely.
28
+ - ⚙️ Fully typed with TypeScript and designed for Vue 3’s Composition API.
29
+ - 🚀 Tiny footprint — optimized for production.
30
+
23
31
  ## ✅ Requirements
24
32
 
25
- - Vue 3 (`vue@^3.3.13`)
26
- - Vue Router 4 (`vue-router@^4.0.3`)
33
+ - Vue 3
34
+ - Vue Router 4
27
35
 
28
36
  ---
29
37
 
@@ -63,7 +71,8 @@ createApp(App)
63
71
 
64
72
  ## 🧩 Basic Usage
65
73
 
66
- Sync a value with a query param named `tab`:
74
+ - You can use `useQuerySync` several times in one component.
75
+ - Sync a value with a query param named `tab`:
67
76
 
68
77
  ```ts
69
78
  import { useQuerySync } from 'vue-router-query-sync'
@@ -1,17 +1,17 @@
1
1
  import { QuerySyncOptions } from '../types';
2
2
  /**
3
- * Синхронизирует значение из стора с query-параметром в адресной строке
3
+ * Synchronizes a store value with a query parameter in the URL.
4
4
  *
5
- * @param key - имя параметра в query, например "tab"
6
- * @param get - функция, возвращающая текущее значение из стора
7
- * @param set - функция, устанавливающая значение в стор
8
- * @param options.deps - список зависимостей, чтобы синхронизировать только после их изменения
9
- * @param options.context - конекст использования query-параметра, обязателен, если на странице нессколько одинаковых query-параметра
5
+ * @param key - The name of the query parameter, e.g. "tab".
6
+ * @param get - A function that returns the current value from the store.
7
+ * @param set - A function that updates the value in the store.
8
+ * @param options.deps - A list of reactive dependencies that must change before synchronization occurs.
9
+ * @param options.context - A unique context identifier, required when multiple instances use the same query key on the same page.
10
10
  *
11
- * ⚠️ Важно:
12
- * Если на одной странице может быть несколько компонентов с одинаковыми query-ключами
13
- * обязательно передавайте уникальный `context`, чтобы не было конфликтов.
14
- * Или всегда использовать уникальные ключи (например вместо "page" - "usersPage").
11
+ * ⚠️ Important:
12
+ * If multiple components on the same page use the same query key,
13
+ * you must provide a unique `context` to prevent conflicts.
14
+ * Alternatively, always use unique query keys (for example, instead of "page", use "usersPage").
15
15
  */
16
16
  export declare function useQuerySync<T extends string | number>(key: string, get: () => T | null, set: (val: T) => void, options?: QuerySyncOptions): void;
17
17
  //# sourceMappingURL=useQuerySync.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-router-query-sync",
3
- "version": "0.0.13",
3
+ "version": "1.0.0",
4
4
  "description": "Vue composable for syncing router query params with store",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,12 +20,16 @@
20
20
  ],
21
21
  "keywords": [
22
22
  "vue",
23
+ "vue3",
24
+ "vue plugin",
23
25
  "router",
24
26
  "query",
25
27
  "sync",
26
28
  "pinia",
27
29
  "store",
28
- "composable"
30
+ "composable",
31
+ "router query",
32
+ "query sync"
29
33
  ],
30
34
  "author": "Ivan Chikachev <ivan-chikachev@mail.ru>",
31
35
  "license": "MIT",