vue-router-query-sync 2.0.0-alpha.0 → 2.0.0-alpha.2

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
@@ -20,40 +20,43 @@ npm install vue-router-query-sync
20
20
 
21
21
  ## `useQueryFilters(schema)`
22
22
 
23
- Returns a reactive object; access fields without `.value`. The type is inferred from the schema.
23
+ Returns `{ filters, patch, reset }`. `filters` is a reactive object of schema fields only
24
+ (no methods on it); access fields without `.value`. The type is inferred from the schema.
24
25
 
25
26
  ```ts
26
27
  import { useQueryFilters, param } from 'vue-router-query-sync'
27
28
 
28
29
  enum SortType { Popular = 'popular', New = 'new' }
29
30
 
30
- const filters = useQueryFilters({
31
+ const { filters, patch, reset } = useQueryFilters({
31
32
  sort: param.enum(SortType, { default: SortType.Popular, history: 'push' }),
32
33
  brands: param.stringArray(), // default: []
33
34
  page: param.number({ default: 1 }),
34
35
  from: param.custom(dateCodec), // default: null
35
36
  })
36
37
 
37
- filters.sort = SortType.New // write -> router navigation
38
- filters.brands // read -> parses route.query
39
- filters.patch({ brands: ['lg'], page: 1 }) // several fields, ONE navigation
40
- filters.reset() // all fields back to defaults (keys removed)
38
+ filters.sort = SortType.New // write -> router navigation
39
+ filters.brands // read -> parses route.query (or pending write)
40
+ patch({ brands: ['lg'], page: 2 }) // several fields, ONE navigation
41
+ reset() // all fields back to defaults (keys removed)
41
42
  ```
42
43
 
43
- - **Read**: `route.query[key]` → `deserialize` → on `undefined`/throw → `default`.
44
+ - **Read**: pending write (same tick) → else `route.query[key]` → `deserialize` → on
45
+ `undefined`/throw → `default`. Reading a field right after writing it returns the new value.
44
46
  - **Write**: `serialize` → if `null` or equal to `serialize(default)` → the key is removed.
45
47
  - Query keys not described in the schema are left untouched.
46
- - `patch` / `reset` are reserved names; using them as param keys throws at creation.
47
- - Destructuring loses reactivity — use Vue's `toRefs(filters)`.
48
+ - Destructuring `filters` loses reactivity use Vue's `toRefs(filters)`.
48
49
 
49
- ## `useQueryParam(key, param)`
50
+ ### Single parameter
50
51
 
51
- Single-parameter wrapper over the same logic. Returns a `WritableComputedRef`.
52
+ There is no separate single-param helper: use a one-key schema and `toRef`.
52
53
 
53
54
  ```ts
54
- import { useQueryParam, param } from 'vue-router-query-sync'
55
+ import { toRef } from 'vue'
56
+ import { useQueryFilters, param } from 'vue-router-query-sync'
55
57
 
56
- const tab = useQueryParam('tab', param.enum(['all', 'favorite'] as const))
58
+ const { filters } = useQueryFilters({ tab: param.enum(['all', 'favorite'] as const) })
59
+ const tab = toRef(filters, 'tab') // WritableComputedRef<'all' | 'favorite' | null>
57
60
  tab.value = 'favorite'
58
61
  ```
59
62
 
@@ -98,9 +101,12 @@ const dateCodec = defineCodec<Date | null>({
98
101
 
99
102
  ## Batching & history
100
103
 
101
- Writes made in the same tick are merged into a single navigation via `queueMicrotask`.
102
- If any changed param in the batch has `history: 'push'`, `router.push` is used; otherwise
103
- `router.replace`. Query keys are sorted for a deterministic URL.
104
+ All writes in the same tick field assignments, `patch`, `reset` accumulate into one
105
+ pending batch (kept per router instance) and are applied as a **single** navigation via
106
+ `queueMicrotask`. The batch is layered over the last *scheduled* state, so reads within the
107
+ same tick see pending writes. If any changed param in the batch has `history: 'push'`, the
108
+ whole batch uses `router.push`; otherwise `router.replace`. Query keys are sorted for a
109
+ deterministic URL.
104
110
 
105
111
  ## Playground
106
112
 
@@ -108,8 +114,9 @@ If any changed param in the batch has `history: 'push'`, `router.push` is used;
108
114
  npm run dev
109
115
  ```
110
116
 
111
- A catalog page exercises every param type plus `reset`/`patch`, and a second route uses
112
- `useQueryParam`. The current `route.query` is rendered on screen.
117
+ A catalog page exercises every param type plus `reset`/`patch`, and a second route shows the
118
+ single-parameter pattern (`toRef` over a one-key schema). The current `route.query` is
119
+ rendered on screen.
113
120
 
114
121
  ## License
115
122
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { useQueryFilters } from './useQueryFilters';
2
- export { useQueryParam } from './useQueryParam';
3
2
  export { param } from './param';
4
3
  export { defineCodec } from './defineCodec';
5
- export type { QueryCodec, ParamOptions, Param, FilterSchema, InferFilters, QueryFilters } from './types';
4
+ export type { QueryCodec, ParamOptions, Param, FilterSchema, InferFilters, UseQueryFiltersReturn } from './types';
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,YAAY,EACV,UAAU,EACV,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACb,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,YAAY,EACV,UAAU,EACV,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS,CAAA"}
package/dist/index.mjs CHANGED
@@ -1,96 +1,117 @@
1
- import { computed as h, reactive as b } from "vue";
2
- import { useRoute as o, useRouter as A } from "vue-router";
3
- function N(e) {
1
+ import { reactive as A, computed as N } from "vue";
2
+ import { useRoute as v, useRouter as S } from "vue-router";
3
+ function g(e) {
4
4
  if (e != null)
5
5
  return Array.isArray(e) ? e.filter((r) => r !== null) : e;
6
6
  }
7
- function S(e, r) {
7
+ function o(e, r) {
8
8
  return e === r ? !0 : Array.isArray(e) && Array.isArray(r) ? e.length !== r.length ? !1 : e.every((t, u) => t === r[u]) : !1;
9
9
  }
10
- const f = /* @__PURE__ */ new WeakMap();
11
- function q(e) {
12
- let r = f.get(e);
13
- return r || (r = { sets: /* @__PURE__ */ new Map(), deletes: /* @__PURE__ */ new Set(), usePush: !1, scheduled: !1 }, f.set(e, r)), r;
10
+ const h = /* @__PURE__ */ new WeakMap();
11
+ function m(e) {
12
+ let r = h.get(e);
13
+ return r || (r = {
14
+ patch: A(/* @__PURE__ */ new Map()),
15
+ usePush: !1,
16
+ scheduled: !1
17
+ }, h.set(e, r)), r;
14
18
  }
15
- function y(e, r, t, u) {
16
- const n = q(e);
17
- t === null ? (n.sets.delete(r), n.deletes.add(r)) : (n.deletes.delete(r), n.sets.set(r, t)), u === "push" && (n.usePush = !0), n.scheduled || (n.scheduled = !0, queueMicrotask(() => j(e)));
19
+ function P(e, r) {
20
+ const t = m(e);
21
+ return t.patch.has(r) ? { pending: !0, value: t.patch.get(r) ?? null } : { pending: !1, value: null };
22
+ }
23
+ function z(e, r, t, u) {
24
+ const l = m(e);
25
+ l.patch.set(r, t), u === "push" && (l.usePush = !0), l.scheduled || (l.scheduled = !0, queueMicrotask(() => q(e)));
18
26
  }
19
- function v(e, r) {
27
+ function j(e, r) {
20
28
  const t = Object.keys(e), u = Object.keys(r);
21
29
  if (t.length !== u.length)
22
30
  return !1;
23
- const n = (s, c) => {
24
- if (Array.isArray(s) || Array.isArray(c)) {
25
- const l = Array.isArray(s) ? s : [s], a = Array.isArray(c) ? c : [c];
26
- return l.length === a.length && l.every((z, m) => String(z) === String(a[m]));
31
+ const l = (n, c) => {
32
+ if (Array.isArray(n) || Array.isArray(c)) {
33
+ const a = Array.isArray(n) ? n : [n], s = Array.isArray(c) ? c : [c];
34
+ return a.length === s.length && a.every((i, f) => String(i) === String(s[f]));
27
35
  }
28
- return String(s) === String(c);
36
+ return String(n) === String(c);
29
37
  };
30
- return t.every((s) => s in r && n(e[s], r[s]));
38
+ return t.every((n) => n in r && l(e[n], r[n]));
31
39
  }
32
- function j(e) {
33
- const r = f.get(e);
40
+ function q(e) {
41
+ const r = h.get(e);
34
42
  if (!r)
35
43
  return;
36
- f.delete(e);
37
- const t = e.currentRoute.value.query, u = {};
38
- for (const [c, l] of Object.entries(t))
39
- l !== null && (u[c] = Array.isArray(l) ? l.filter((a) => a !== null) : l);
40
- r.deletes.forEach((c) => delete u[c]), r.sets.forEach((c, l) => {
41
- u[l] = c;
42
- });
43
- const n = {};
44
- for (const c of Object.keys(u).sort())
45
- n[c] = u[c];
46
- if (v(t, n))
44
+ if (r.scheduled = !1, r.patch.size === 0) {
45
+ r.usePush = !1;
47
46
  return;
48
- (r.usePush ? e.push({ query: n }) : e.replace({ query: n })).catch(() => {
47
+ }
48
+ const t = r.usePush;
49
+ r.usePush = !1;
50
+ const u = e.currentRoute.value.query, l = {};
51
+ for (const [i, f] of Object.entries(u))
52
+ f !== null && (l[i] = Array.isArray(f) ? f.filter((b) => b !== null) : f);
53
+ const n = new Map(r.patch);
54
+ n.forEach((i, f) => {
55
+ i === null ? delete l[f] : l[f] = i;
49
56
  });
50
- }
51
- function g(e, r, t) {
52
- const u = N(e[r]);
53
- if (u === void 0)
54
- return t.default;
57
+ const c = {};
58
+ for (const i of Object.keys(l).sort())
59
+ c[i] = l[i];
60
+ const a = () => {
61
+ n.forEach((i, f) => {
62
+ r.patch.get(f) === i && r.patch.delete(f);
63
+ });
64
+ };
65
+ if (j(u, c)) {
66
+ a();
67
+ return;
68
+ }
69
+ (t ? e.push({ query: c }) : e.replace({ query: c })).then(a, a);
70
+ }
71
+ function O(e, r, t, u) {
72
+ const l = P(r, t);
73
+ let n;
74
+ if (l.pending) {
75
+ if (l.value === null)
76
+ return u.default;
77
+ n = g(l.value);
78
+ } else
79
+ n = g(e.query[t]);
80
+ if (n === void 0)
81
+ return u.default;
55
82
  try {
56
- const n = t.codec.deserialize(u);
57
- return n === void 0 ? t.default : n;
83
+ const c = u.codec.deserialize(n);
84
+ return c === void 0 ? u.default : c;
58
85
  } catch {
59
- return t.default;
86
+ return u.default;
60
87
  }
61
88
  }
62
- function i(e, r, t, u) {
63
- const n = t.codec.serialize(u), s = t.codec.serialize(t.default);
64
- n === null || S(n, s) ? y(e, r, null, t.history) : y(e, r, n, t.history);
65
- }
66
- const k = ["patch", "reset"];
67
- function V(e) {
68
- for (const l of k)
69
- if (l in e)
70
- throw new Error(
71
- `[vue-router-query-sync] "${l}" is a reserved method name and cannot be used as a param key.`
72
- );
73
- const r = o(), t = A(), u = Object.keys(e), n = {};
74
- for (const l of u)
75
- n[l] = h({
76
- get: () => g(r.query, l, e[l]),
77
- set: (a) => i(t, l, e[l], a)
78
- });
79
- return b({ ...n, patch: (l) => {
80
- for (const a of Object.keys(l))
81
- a in e && i(t, a, e[a], l[a]);
82
- }, reset: () => {
83
- for (const l of u)
84
- i(t, l, e[l], e[l].default);
85
- } });
86
- }
87
- function C(e, r) {
88
- const t = o(), u = A();
89
- return h({
90
- get: () => g(t.query, e, r),
91
- set: (n) => i(u, e, r, n)
89
+ function y(e, r, t, u) {
90
+ const l = t.codec.serialize(u), n = t.codec.serialize(t.default);
91
+ l === null || o(l, n) ? z(e, r, null, t.history) : z(e, r, l, t.history);
92
+ }
93
+ function k(e, r, t, u) {
94
+ let l = !1, n, c;
95
+ return N({
96
+ get: () => {
97
+ const a = O(e, r, t, u), s = u.codec.serialize(a);
98
+ return l && o(s, c) ? n : (l = !0, n = a, c = s, a);
99
+ },
100
+ set: (a) => y(r, t, u, a)
92
101
  });
93
102
  }
103
+ function W(e) {
104
+ const r = v(), t = S(), u = Object.keys(e), l = {};
105
+ for (const s of u)
106
+ l[s] = k(r, t, s, e[s]);
107
+ return { filters: A(l), patch: (s) => {
108
+ for (const i of Object.keys(s))
109
+ i in e && y(t, i, e[i], s[i]);
110
+ }, reset: () => {
111
+ for (const s of u)
112
+ y(t, s, e[s], e[s].default);
113
+ } };
114
+ }
94
115
  function d(e) {
95
116
  return Array.isArray(e) ? e[0] ?? "" : e;
96
117
  }
@@ -100,16 +121,16 @@ function w(e) {
100
121
  deserialize: (t) => d(t)
101
122
  }, default: (e == null ? void 0 : e.default) ?? null, history: (e == null ? void 0 : e.history) ?? "replace" };
102
123
  }
103
- function E(e) {
124
+ function F(e) {
104
125
  return { codec: {
105
126
  serialize: (t) => t === null ? null : String(t),
106
127
  deserialize: (t) => {
107
- const u = d(t), n = Number(u);
108
- return u === "" || Number.isNaN(n) ? void 0 : n;
128
+ const u = d(t), l = Number(u);
129
+ return u === "" || Number.isNaN(l) ? void 0 : l;
109
130
  }
110
131
  }, default: (e == null ? void 0 : e.default) ?? null, history: (e == null ? void 0 : e.history) ?? "replace" };
111
132
  }
112
- function O(e) {
133
+ function M(e) {
113
134
  return { codec: {
114
135
  serialize: (t) => t === null ? null : t ? "true" : "false",
115
136
  deserialize: (t) => {
@@ -127,24 +148,24 @@ function R(e) {
127
148
  deserialize: (t) => Array.isArray(t) ? [...t] : [t]
128
149
  }, default: (e == null ? void 0 : e.default) ?? [], history: (e == null ? void 0 : e.history) ?? "replace" };
129
150
  }
130
- function P(e) {
151
+ function E(e) {
131
152
  return Object.entries(e).filter(([r]) => Number.isNaN(Number(r))).map(([, r]) => r);
132
153
  }
133
- function Q(e, r) {
134
- const t = Array.isArray(e) ? [...e] : P(e), u = new Set(t);
154
+ function C(e, r) {
155
+ const t = Array.isArray(e) ? [...e] : E(e), u = new Set(t);
135
156
  return { codec: {
136
- serialize: (s) => s === null ? null : String(s),
137
- deserialize: (s) => {
138
- const c = d(s);
157
+ serialize: (n) => n === null ? null : String(n),
158
+ deserialize: (n) => {
159
+ const c = d(n);
139
160
  if (u.has(c))
140
161
  return c;
141
- const l = Number(c);
142
- if (c !== "" && !Number.isNaN(l) && u.has(l))
143
- return l;
162
+ const a = Number(c);
163
+ if (c !== "" && !Number.isNaN(a) && u.has(a))
164
+ return a;
144
165
  }
145
166
  }, default: (r == null ? void 0 : r.default) ?? null, history: (r == null ? void 0 : r.history) ?? "replace" };
146
167
  }
147
- function F(e, r) {
168
+ function K(e, r) {
148
169
  return {
149
170
  codec: {
150
171
  serialize: (u) => u === null ? null : e.serialize(u),
@@ -154,20 +175,19 @@ function F(e, r) {
154
175
  history: (r == null ? void 0 : r.history) ?? "replace"
155
176
  };
156
177
  }
157
- const D = {
178
+ const B = {
158
179
  string: w,
159
- number: E,
160
- boolean: O,
180
+ number: F,
181
+ boolean: M,
161
182
  stringArray: R,
162
- enum: Q,
163
- custom: F
183
+ enum: C,
184
+ custom: K
164
185
  };
165
- function W(e) {
186
+ function D(e) {
166
187
  return e;
167
188
  }
168
189
  export {
169
- W as defineCodec,
170
- D as param,
171
- V as useQueryFilters,
172
- C as useQueryParam
190
+ D as defineCodec,
191
+ B as param,
192
+ W as useQueryFilters
173
193
  };
@@ -0,0 +1,10 @@
1
+ import { Router } from 'vue-router';
2
+ type Serialized = string | string[];
3
+ export interface PendingRead {
4
+ pending: boolean;
5
+ value: Serialized | null;
6
+ }
7
+ export declare function readPending(router: Router, key: string): PendingRead;
8
+ export declare function scheduleWrite(router: Router, key: string, value: Serialized | null, history: 'push' | 'replace'): void;
9
+ export {};
10
+ //# sourceMappingURL=batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/internal/batch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmC,MAAM,EAAE,MAAM,YAAY,CAAA;AAEzE,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AA2BnC,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;CACzB;AAGD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAMpE;AAGD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,UAAU,GAAG,IAAI,EACxB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAUN"}
@@ -1,5 +1,5 @@
1
- import { LocationQuery, Router } from 'vue-router';
1
+ import { RouteLocationNormalizedLoaded, Router } from 'vue-router';
2
2
  import { Param } from '../types';
3
- export declare function readField<Out>(query: LocationQuery, key: string, p: Param<Out>): Out;
3
+ export declare function readField<Out>(route: RouteLocationNormalizedLoaded, router: Router, key: string, p: Param<Out>): Out;
4
4
  export declare function writeField<Out>(router: Router, key: string, p: Param<Out>, value: Out): void;
5
5
  //# sourceMappingURL=field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/internal/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAMrC,wBAAgB,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAWpF;AAGD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAQ5F"}
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/internal/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAOrC,wBAAgB,SAAS,CAAC,GAAG,EAC3B,KAAK,EAAE,6BAA6B,EACpC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GACZ,GAAG,CAoBL;AAGD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAQ5F"}
package/dist/types.d.ts CHANGED
@@ -15,8 +15,9 @@ export type FilterSchema = Record<string, Param<unknown>>;
15
15
  export type InferFilters<S extends FilterSchema> = {
16
16
  [K in keyof S]: S[K] extends Param<infer O> ? O : never;
17
17
  };
18
- export type QueryFilters<S extends FilterSchema> = InferFilters<S> & {
18
+ export interface UseQueryFiltersReturn<S extends FilterSchema> {
19
+ filters: InferFilters<S>;
19
20
  patch(partial: Partial<InferFilters<S>>): void;
20
21
  reset(): void;
21
- };
22
+ }
22
23
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,UAAU,CAAC,CAAC;IAE3B,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;IAE7C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAA;CACnD;AAGD,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,OAAO,CAAC,EAAE,CAAC,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,CAAA;AAGD,MAAM,WAAW,KAAK,CAAC,GAAG;IACxB,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAA;IACtB,OAAO,EAAE,GAAG,CAAA;IACZ,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAGD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;AAGzD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,YAAY,IAAI;KAChD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CACxD,CAAA;AAGD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,YAAY,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG;IACnE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IAC9C,KAAK,IAAI,IAAI,CAAA;CACd,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,UAAU,CAAC,CAAC;IAE3B,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;IAE7C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAA;CACnD;AAGD,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,OAAO,CAAC,EAAE,CAAC,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,CAAA;AAGD,MAAM,WAAW,KAAK,CAAC,GAAG;IACxB,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAA;IACtB,OAAO,EAAE,GAAG,CAAA;IACZ,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAGD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;AAGzD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,YAAY,IAAI;KAChD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CACxD,CAAA;AAGD,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,YAAY;IAC3D,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IACxB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IAC9C,KAAK,IAAI,IAAI,CAAA;CACd"}
@@ -1,3 +1,3 @@
1
- import { FilterSchema, QueryFilters } from './types';
2
- export declare function useQueryFilters<S extends FilterSchema>(schema: S): QueryFilters<S>;
1
+ import { FilterSchema, UseQueryFiltersReturn } from './types';
2
+ export declare function useQueryFilters<S extends FilterSchema>(schema: S): UseQueryFiltersReturn<S>;
3
3
  //# sourceMappingURL=useQueryFilters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useQueryFilters.d.ts","sourceRoot":"","sources":["../src/useQueryFilters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAMzD,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAoClF"}
1
+ {"version":3,"file":"useQueryFilters.d.ts","sourceRoot":"","sources":["../src/useQueryFilters.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAuB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAiCvF,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CA0B3F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-router-query-sync",
3
- "version": "2.0.0-alpha.0",
3
+ "version": "2.0.0-alpha.2",
4
4
  "description": "Reactive, typed view of Vue Router query params with codecs and defaults",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",
@@ -1,3 +0,0 @@
1
- import { Router } from 'vue-router';
2
- export declare function scheduleQuery(router: Router, key: string, value: string | string[] | null, history: 'push' | 'replace'): void;
3
- //# sourceMappingURL=queryQueue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryQueue.d.ts","sourceRoot":"","sources":["../../src/internal/queryQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmC,MAAM,EAAE,MAAM,YAAY,CAAA;AAsBzE,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAC/B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAiBN"}
@@ -1,4 +0,0 @@
1
- import { WritableComputedRef } from 'vue';
2
- import { Param } from './types';
3
- export declare function useQueryParam<Out>(key: string, p: Param<Out>): WritableComputedRef<Out>;
4
- //# sourceMappingURL=useQueryParam.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useQueryParam.d.ts","sourceRoot":"","sources":["../src/useQueryParam.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,KAAK,CAAA;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAOvF"}