vue-router-query-sync 0.0.1 → 0.0.3

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.
@@ -0,0 +1,17 @@
1
+ import { Options } from '../types/index';
2
+ /**
3
+ * Синхронизирует значение из стора с query-параметром в адресной строке
4
+ *
5
+ * @param key - имя параметра в query, например "tab"
6
+ * @param get - функция, возвращающая текущее значение из стора
7
+ * @param set - функция, устанавливающая значение в стор
8
+ * @param options.deps - список зависимостей, чтобы синхронизировать только после их изменения
9
+ * @param options.context - конекст использования query-параметра, обязателен, если на странице нессколько одинаковых query-параметра
10
+ *
11
+ * ⚠️ Важно:
12
+ * Если на одной странице может быть несколько компонентов с одинаковыми query-ключами —
13
+ * обязательно передавайте уникальный `context`, чтобы не было конфликтов.
14
+ * Или всегда использовать уникальные ключи (например вместо "page" - "usersPage").
15
+ */
16
+ export declare function useQuerySync<T extends string | number>(key: string, get: () => T | null, set: (val: T) => void, options?: Options): void;
17
+ //# sourceMappingURL=useQuerySync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQuerySync.d.ts","sourceRoot":"","sources":["../../src/composables/useQuerySync.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACpD,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,EACnB,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,EACrB,OAAO,GAAE,OAAY,QAwDtB"}
@@ -0,0 +1,4 @@
1
+ export * from './composables/useQuerySync';
2
+ export * from './utils/replaceRouterQueue';
3
+ export * from './types/index';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,eAAe,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Ref } from 'vue';
2
+ export type Options = {
3
+ deps?: Ref<unknown>[];
4
+ context?: string;
5
+ };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export default function replaceRouterQueue(key: string, value: string | number | null): void;
2
+ //# sourceMappingURL=replaceRouterQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replaceRouterQueue.d.ts","sourceRoot":"","sources":["../../src/utils/replaceRouterQueue.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,QAiCpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-router-query-sync",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Vue composable for syncing router query params with store",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,8 +15,18 @@
15
15
  "require": "./dist/index.js"
16
16
  }
17
17
  },
18
- "files": ["dist"],
19
- "keywords": ["vue", "router", "query", "sync", "pinia", "store", "composable"],
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "keywords": [
22
+ "vue",
23
+ "router",
24
+ "query",
25
+ "sync",
26
+ "pinia",
27
+ "store",
28
+ "composable"
29
+ ],
20
30
  "author": "Ivan Chikachev <ivan-chikachev@mail.ru>",
21
31
  "license": "MIT",
22
32
  "repository": {
@@ -24,13 +34,14 @@
24
34
  "url": "https://github.com/Ivan-Chikachev/vue-router-query-sync"
25
35
  },
26
36
  "peerDependencies": {
27
- "vue": "^3.0.0",
28
- "vue-router": "^4.0.0"
37
+ "vue": "^3.2.0",
38
+ "vue-router": "^4.0.3"
29
39
  },
30
40
  "devDependencies": {
31
- "@vitejs/plugin-vue": "^5.2.3",
41
+ "vite-plugin-dts": "^4.5.4",
32
42
  "@types/node": "^20.1.0",
33
43
  "@typescript-eslint/eslint-plugin": "^8.4.0",
44
+ "@vitejs/plugin-vue": "^5.2.3",
34
45
  "@vue/eslint-config-typescript": "^12.0.0",
35
46
  "eslint": "^8.57.0",
36
47
  "eslint-config-prettier": "^9.1.0",
@@ -40,4 +51,4 @@
40
51
  "typescript": "^5.2.0",
41
52
  "vite": "^6.3.6"
42
53
  }
43
- }
54
+ }